One of the guys in my office had a problem with Java2WSDL failing with this
exception:

java.lang.NullPointerException
        at java.util.Hashtable.put(Unknown Source)
        at org.apache.axis.utils.JavapUtils.javap(JavapUtils.java:197)
        at
org.apache.axis.utils.JavapUtils.getParameterNames(JavapUtils.java:92
)
        at
org.apache.axis.wsdl.fromJava.ClassRep.getParameterNames(ClassRep.jav
a:402)
        at
org.apache.axis.wsdl.fromJava.ClassRep.walkInheritanceChain(ClassRep.
java:260)
        at
org.apache.axis.wsdl.fromJava.ClassRep.addMethods(ClassRep.java:225)
        at org.apache.axis.wsdl.fromJava.ClassRep.init(ClassRep.java:184)
        at org.apache.axis.wsdl.fromJava.ClassRep.<init>(ClassRep.java:164)
        at
org.apache.axis.wsdl.fromJava.DefaultBuilderPortTypeClassRep.build(De
faultBuilderPortTypeClassRep.java:91)
        at
org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:537)

        at
org.apache.axis.wsdl.fromJava.Emitter.getIntfWSDL(Emitter.java:331)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:162)
        at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:316)

The offending line of code is:
        cache.put(cls, cachedInfo);
cachedInfo may be null if something went wrong while calling javap, and you
can't put a null value in a Hashtable. The code should be using a HashMap
instead of a Hashtable (and probably ArrayLists instead of Vectors). Here's
the diff for the fix:

RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/utils/JavapUtils.java,v
retrieving revision 1.4
diff -r1.4 JavapUtils.java
67c67,68
< import java.util.Hashtable;
---
> import java.util.Map;
> import java.util.HashMap;
82c83
<     private static Hashtable cache = new Hashtable();
---
>     private static Map cache = new HashMap();

Dave Dunkin

Reply via email to