tomj        2002/06/03 18:44:02

  Modified:    java/src/org/apache/axis/message RPCElement.java
                        BodyBuilder.java
               java/src/org/apache/axis/utils axisNLS.properties
  Log:
  Patch from John Brothers [[EMAIL PROTECTED]]:
  
  I have been learning SOAP via Axis, and I encountered a
  NullPointerException in RPCElement() when trying to test
  out a new service that I had written.  I eventually discovered
  that this was caused by Axis's inability to find the class file(s)
  for my service (I had used a link instead of copying the directory).
  
  I submit that it would be more informative to the user
  (and more elegant) to throw a ClassNotFoundException instead
  of a NullPointerException in that case, to help the user more
  quickly discover the "directory tree copy" requirement.
  
  Revision  Changes    Path
  1.61      +6 -2      xml-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- RPCElement.java   31 May 2002 19:08:08 -0000      1.60
  +++ RPCElement.java   4 Jun 2002 01:44:01 -0000       1.61
  @@ -83,7 +83,7 @@
                         String prefix,
                         Attributes attributes,
                         DeserializationContext context,
  -                      OperationDesc [] operations)
  +                      OperationDesc [] operations) throws ClassNotFoundException
       {
           super(namespace, localName, prefix, attributes, context);
   
  @@ -101,8 +101,12 @@
               SOAPService service    = msgContext.getService();
               if (service != null) {
                   ServiceDesc serviceDesc = 
service.getInitializedServiceDesc(msgContext);
  -
  +                
                   String lc = Utils.xmlNameToJava(name);
  +                if (serviceDesc == null) {
  +                    throw new 
ClassNotFoundException(JavaUtils.getMessage("noClassForService00", lc));
  +                }
  +
                   operations = serviceDesc.getOperationsByName(lc);
               }
           }
  
  
  
  1.34      +13 -2     xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
  
  Index: BodyBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- BodyBuilder.java  31 May 2002 19:08:08 -0000      1.33
  +++ BodyBuilder.java  4 Jun 2002 01:44:01 -0000       1.34
  @@ -155,8 +155,19 @@
                    (operations[0].getStyle() !=
                     ServiceDesc.STYLE_MESSAGE))) {
                   gotRPCElement = true;
  -                element = new RPCElement(namespace, localName, prefix,
  -                                         attributes, context, operations);
  +                
  +                try {
  +                    
  +                    element = new RPCElement(namespace, localName, prefix,
  +                            attributes, context, operations);
  +                    
  +                } catch (ClassNotFoundException e) {
  +                    // SAXException is already known to this method, so I
  +                    // don't have an exception-handling propogation explosion.
  +                    //
  +                    throw new SAXException(e);
  +                }
  +                
                   // Only deserialize this way if there is a unique operation
                   // for this QName.  If there are overloads,
                   // we'll need to start recording.  If we're making a high-
  
  
  
  1.5       +3 -0      xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
  
  Index: axisNLS.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- axisNLS.properties        3 Jun 2002 14:19:46 -0000       1.4
  +++ axisNLS.properties        4 Jun 2002 01:44:01 -0000       1.5
  @@ -853,3 +853,6 @@
   
   j2woptStyle00=The style of binding in the WSDL.  Values are DOCUMENT or LITERAL.
   j2woptBadStyle00=The value of --style must be DOCUMENT or LITERAL.
  +
  +noClassForService00=Could not find class for the service named: {0}\nHint: you may 
need to copy your class files/tree into the right location (which depends on the 
servlet system you are using).
  +
  
  
  


Reply via email to