cvs commit: ws-wsif/java/src/org/apache/wsif/base WSIFDefaultOperation.java

[email protected]
Newsgroups gmane.comp.apache.webservices.wsif.devel
Message-ID <[email protected]>
owenb       2003/10/09 02:27:36

  Modified:    java/src/org/apache/wsif/base WSIFDefaultOperation.java
  Log:
  Fix to JMS property handling code - committed on behalf of Mark Whitlock
  
  Revision  Changes    Path
  1.22      +29 -16    ws-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java
  
  Index: WSIFDefaultOperation.java
  ===================================================================
  RCS file: /home/cvs/ws-wsif/java/src/org/apache/wsif/base/WSIFDefaultOperation.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- WSIFDefaultOperation.java	26 Feb 2003 15:55:17 -0000	1.21
  +++ WSIFDefaultOperation.java	9 Oct 2003 09:27:36 -0000	1.22
  @@ -369,6 +369,7 @@
                               + "unknown or was not a simple type");
       
                   Class javaClass = null;
  +                Exception classNotFound = null;
                   try {
                       javaClass =
                           Class.forName(
  @@ -377,35 +378,47 @@
                               Thread.currentThread().getContextClassLoader());
                   } catch (ClassNotFoundException cce) {
                       Trc.exception(cce);
  -                    throw new WSIFException(
  -                        "Unexpected ClassNotFoundException when processing "
  -                            + "jms:propertyValue "
  -                            + name
  -                            + ". Could not convert the type to a java class. "
  -                            + cce);
  +                    classNotFound = cce;
                   }
  -    
  +
                   Object obj = null;
                   try {
  -                    if (javaClass.equals(String.class))
  +                    if (String.class.equals(javaClass))
                           obj = value;
  -                    else if (javaClass.equals(Integer.class))
  +                    else if (
  +                        "int".equals(cls) || Integer.class.equals(javaClass))
                           obj = new Integer(value);
  -                    else if (javaClass.equals(Boolean.class))
  +                    else if (
  +                        "boolean".equals(cls)
  +                            || Boolean.class.equals(javaClass))
                           obj = new Boolean(value);
  -                    else if (javaClass.equals(Byte.class))
  +                    else if (
  +                        "byte".equals(cls) || Byte.class.equals(javaClass))
                           obj = new Byte(value);
  -                    else if (javaClass.equals(Double.class))
  +                    else if (
  +                        "double".equals(cls) || Double.class.equals(javaClass))
                           obj = new Double(value);
  -                    else if (javaClass.equals(Float.class))
  +                    else if (
  +                        "float".equals(cls) || Float.class.equals(javaClass))
                           obj = new Float(value);
  -                    else if (javaClass.equals(Long.class))
  +                    else if (
  +                        "long".equals(cls) || Long.class.equals(javaClass))
                           obj = new Long(value);
  -                    else if (javaClass.equals(Short.class))
  +                    else if (
  +                        "short".equals(cls) || Short.class.equals(javaClass))
                           obj = new Short(value);
  +                    else if (classNotFound != null)
  +                        throw new WSIFException(
  +                            "Unexpected ClassNotFoundException when processing "
  +                                + "jms:propertyValue "
  +                                + name
  +                                + ". Could not convert the type to a java class. "
  +                                + classNotFound);
                       else
                           throw new WSIFException(
  -                            "jms:propertyValue " + name + " had an invalid type");
  +                            "jms:propertyValue "
  +                                + name
  +                                + " had an invalid type");
                   } catch (NumberFormatException nfe) {
                       Trc.exception(nfe);
                       throw new WSIFException(
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.