You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by James Russo <jr...@halo3.net> on 2004/11/26 06:28:01 UTC
[PATCH] WebServer.java NoSuchElementException on connection closure
/ NullPointerException on auth decode.
Hello,
Here is a patch which fixes two issues in WebServer.java. The first
issue is when using KeepAlive and the idle connection is closed. This
would cause a NoSuchElementException from the nextToken() method called
on an empty string. The second issue was the base64decode object which
was never created.
Thanks,
-James
Index: WebServer.java
===================================================================
RCS file:
/home/cvspublic/ws-xmlrpc/src/java/org/apache/xmlrpc/WebServer.java,v
retrieving revision 1.26
diff -u -r1.26 WebServer.java
--- WebServer.java 17 Jun 2004 01:49:10 -0000 1.26
+++ WebServer.java 26 Nov 2004 05:23:35 -0000
@@ -696,7 +696,7 @@
private BufferedInputStream input;
private BufferedOutputStream output;
private String user, password;
- private Base64 base64Codec;
+ private Base64 base64Codec = new Base64();
byte[] buffer;
/**
@@ -734,6 +734,14 @@
{
line = readLine();
}
+
+ if (line == null) {
+ if (XmlRpc.debug)
+ System.out.println("Connection has been
closed");
+ keepAlive = false;
+ continue;
+ }
+
if (XmlRpc.debug)
{
System.out.println(line);
@@ -841,6 +849,9 @@
for (;;)
{
next = input.read();
+ // Handle the EOF condition.
+ if (next == -1 && count == 0)
+ return null;
if (next < 0 || next == '\n')
{
break;