You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ru...@us.ibm.com on 1999/11/13 22:02:40 UTC

Patch: tomcat/util/Stringmanager.java


Another JDK 1.1 specific patch - this time cross platform.

I first saw this when trying to start tomcat when Apache JServ already had
port 8007 in use.  A simpler way to reproduce the problem is to attempt a
shutdown immediately after a clean build - first it complains about not
being able to find serverlog.txt, then it throws a NullPointerException in
the process of trying to say that port null is not an integer.

===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/util/StringManager.java,v

retrieving revision 1.1.1.1
diff -u -r1.1.1.1 StringManager.java
--- StringManager.java  1999/10/09 00:20:56     1.1.1.1
+++ StringManager.java  1999/11/13 20:59:23
@@ -156,7 +156,12 @@
        // objects and barf out

        try {
-           iString = MessageFormat.format(value, args);
+           // ensure the arguments are not null so pre 1.2.2 VM's don't
barf
+           Object nonNullArgs[] = new Object[args.length];
+           for (int i=0; i<args.length; i++)
+               nonNullArgs[i] = (args[i]==null ? "null" : args[i]);
+
+           iString = MessageFormat.format(value, nonNullArgs);
        } catch (IllegalArgumentException iae) {
            StringBuffer buf = new StringBuffer();
            buf.append(value);