jdk/src/share/classes/sun/net/www/protocol/http/BasicAuthentication.java
changeset 5464 8c4deb1b4a45
parent 4157 558590fb3b49
child 5506 202f599c92aa
--- a/jdk/src/share/classes/sun/net/www/protocol/http/BasicAuthentication.java	Thu May 06 17:17:09 2010 +0100
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/BasicAuthentication.java	Fri May 07 10:11:37 2010 +0100
@@ -29,8 +29,10 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.PasswordAuthentication;
+import java.io.IOException;
+import java.io.OutputStream;
 import sun.net.www.HeaderParser;
-
+import sun.misc.BASE64Encoder;
 
 /**
  * BasicAuthentication: Encapsulate an http server authentication using
@@ -74,7 +76,7 @@
         System.arraycopy(nameBytes, 0, concat, 0, nameBytes.length);
         System.arraycopy(passwdBytes, 0, concat, nameBytes.length,
                          passwdBytes.length);
-        this.auth = "Basic " + (new sun.misc.BASE64Encoder()).encode(concat);
+        this.auth = "Basic " + (new BasicBASE64Encoder()).encode(concat);
         this.pw = pw;
     }
 
@@ -114,7 +116,7 @@
         System.arraycopy(nameBytes, 0, concat, 0, nameBytes.length);
         System.arraycopy(passwdBytes, 0, concat, nameBytes.length,
                          passwdBytes.length);
-        this.auth = "Basic " + (new sun.misc.BASE64Encoder()).encode(concat);
+        this.auth = "Basic " + (new BasicBASE64Encoder()).encode(concat);
         this.pw = pw;
     }
 
@@ -200,4 +202,11 @@
         return npath;
     }
 
+    /* It is never expected that the header value will exceed the bytesPerLine */
+    private class BasicBASE64Encoder extends BASE64Encoder {
+        @Override
+        protected int bytesPerLine() {
+            return (10000);
+        }
+    }
 }