juddi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Viens, Stephen" <Stephen.Vi...@LibertyMutual.com>
Subject RE: [jira] Created: (JUDDI-64) bindingTemplate does not check empty description
Date Fri, 11 Mar 2005 19:27:10 GMT
Got it!

So, since this is breaking in your jUDDI installation and not mine then
I suspect the culprit is the Oracle Database and/or JDBC driver you're
using. Would you agree?  This still needs to be fixed in jUDDI as it
will most likely come up in other DBMS's - it's just a fluke that MySQL
is okay with it I think.

I'm redirecting this thread back to the juddi-dev list so that others
can discover this in the archives at a later date and beneifit from it.

Steve

-----Original Message-----
From: Wang, Ming-Fang [mailto:Ming-Fang.Wang@fnf.com] 
Sent: Friday, March 11, 2005 1:55 PM
To: Viens, Stephen
Subject: RE: [jira] Created: (JUDDI-64) bindingTemplate does not check
empty description


Steve,

I did further trace and found that in a prepared statement, if an empty
string is passed to a setString method, a null is actually inserted to
table. So, on the        statement.setString(4, desc.getValue()); in the
insert method on BindingDescTable class, even if desc.getValue() returns
an empty string, the statement.executeUpdate() still inserts a null. A
stack trace is provided below.

-Ming

java.sql.SQLException: ORA-01400: cannot insert NULL into
("MING"."BINDING_DESCR
"."DESCR")

        at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
        at
oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321)
        at
oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1741)
        at
oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1902)

        at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.ja
va:2047)
        at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
a:1940)
        at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2709)
        at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:589)
        at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Del
egatingPreparedStatement.java:207)
        at
org.apache.juddi.datastore.jdbc.BindingDescTable.insert(BindingDescTa
ble.java:128)
        at
org.apache.juddi.datastore.jdbc.JDBCDataStore.saveBinding(JDBCDataSto
re.java:882)
        at
org.apache.juddi.datastore.jdbc.JDBCDataStore.saveService(JDBCDataSto
re.java:685)


-----Original Message-----
From: Viens, Stephen [mailto:Stephen.Viens@LibertyMutual.com] 
Sent: Friday, March 11, 2005 11:37 AM
To: Wang, Ming-Fang
Subject: RE: [jira] Created: (JUDDI-64) bindingTemplate does not check
empty description

Ming,

You've been very helpful ... Thank you for that.  Here's some more
background about this issue.

The saveBinding method in JDBCDataStore will never call
BindingDescTable.insert if no description values are discovered in the
request.

   ...from JDBCDataStore.saveBinding()

        // insert all of the BindingTemplate's Description objects
        if (binding.getDescriptionVector() != null)
 
BindingDescTable.insert(bindingKey,binding.getDescriptionVector(),connec
tion);

The DescriptionHandler.unmarshal() method is responsible for digging the
description value out of the SOAP message and it uses the
XMLUtils.getText() method to do so.

   ...from DescriptionHandler.unmarshal()

        // Text Node Value
        obj.setValue(XMLUtils.getText(element));

And the XMLUtils.getText method creates a new StringBuffer which ensures
that it will return either the description value or an empty string
(never a null).

   ...from XMLUtils

        /**
         *
         * @param element
         * @return String
         */
        public static String getText(Element element)
        {
          StringBuffer textBuffer = new StringBuffer();

          NodeList nodeList = element.getChildNodes();
          for (int i=0; i<nodeList.getLength(); i++)
          {
            if (nodeList.item(i).getNodeType() == Element.TEXT_NODE)
              textBuffer.append(nodeList.item(i).getNodeValue());
          }

          return textBuffer.toString().trim();
        }

Steve

-----Original Message-----
From: Wang, Ming-Fang [mailto:Ming-Fang.Wang@fnf.com] 
Sent: Friday, March 11, 2005 11:14 AM
To: Viens, Stephen
Subject: RE: [jira] Created: (JUDDI-64) bindingTemplate does not check
empty description


Steve,

I tried and succeeded. It seems the problem is not in the JUDDI that the
jsp accesses. 

What I did yesterday was that I traced the JUDDI code to JDBCDataStore
at the method of 

public void saveBinding(BindingTemplate binding).

I used a JUDDI CVS 03-08-2005 build on my machine. Everything went on
fine until the line:

 
BindingDescTable.insert(bindingKey,binding.getDescriptionVector(),connec
tion);

Then I placed a printStackTrace call at the catch block, and found that
the insertion is trying to insert a null value. I did not go further to
find which column the insertion statement was trying to insert a null
but looked at the <description xml:lang="en_US"/> and checked the
uddi.xsd, I decided the exception is caused by the empty element. 

Just moment ago, I took a further look into BindingDescTable class. I am
sure the 

statement.setString(4, desc.getValue()); 

method in the BindingDescTable.java will return a null but the DESCR
column on BINDING_DESC table is specified not null.

Thanks.

-Ming


-----Original Message-----
From: Viens, Stephen [mailto:Stephen.Viens@LibertyMutual.com] 
Sent: Friday, March 11, 2005 10:51 AM
To: Wang, Ming-Fang
Subject: RE: [jira] Created: (JUDDI-64) bindingTemplate does not check
empty description

Ming, using the jUDDI Console I described to you in email this morning I
submitted the following save_binding request and it worked without a
Fault. 

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <save_binding generic="2.0" xmlns="urn:uddi-org:api_v2">
 
<authInfo>authToken:9ACDB690-9242-11D9-B690-D82B926C3B75</authInfo>
      <bindingTemplate bindingKey=""
serviceKey="58C79800-9243-11D9-9800-8A379EC46C8D">
        <description xml:lang="en_US"/>
        <accessPoint
URLType="http">http://localhost:8080/autoquote</accessPoint>
      </bindingTemplate>
    </save_binding>
  </soapenv:Body>
</soapenv:Envelope>

Try it yourself (I think the authToken above will only be active for
another half-hour though).

  [url removed]

I think the Fault you were seeing may be related to a different issue
that I resolved yesterday around an exception being thrown when
performing log.debug(XMLUtil.toString(Element)) in RegistryServlet().

Steve

-----Original Message-----
From: Mingfang Wang (JIRA) [mailto:juddi-dev@ws.apache.org] 
Sent: Friday, March 11, 2005 10:24 AM
To: juddi-dev@ws.apache.org
Subject: [jira] Created: (JUDDI-64) bindingTemplate does not check empty
description


bindingTemplate does not check empty description
------------------------------------------------

         Key: JUDDI-64
         URL: http://issues.apache.org/jira/browse/JUDDI-64
     Project: jUDDI
        Type: Bug
    Versions: 0.9rc3    
 Environment: windows XP, Tomcat 4.1.31, JDK1.4
    Reporter: Mingfang Wang
 Assigned to: Steve Viens 


Hi,

I have just found one more bug from the Sun Micro implementation of
Jaxr. It generates an empty description element on a bindingTemplate
element. According to uddi.xsd, empty description element under a
bindingTemplate element is a violation.

The jaxr code looks like this:

                ServiceBinding bnd =
m_buzLfCyclMgr.createServiceBinding();
                bnd.setValidateURI(false);
//                InternationalString
is=m_buzLfCyclMgr.createInternationalString(Locale.US,
//                    "Just another access point");
//                bnd.setDescription(is);
 
bnd.setAccessURI("http://localhost:8080/axis/services/urn:xmltoday-delay
ed-quotes");
                svc.addServiceBinding(bnd);

With these three lines commented out, the section of uddi XML looks
like:

                <bindingTemplate bindingKey=""
serviceKey="A2B392F0-90DD-11D9-BF4F-FAA2D4FA8F92">
                    <description xml:lang="en-US"/>
                    <accessPoint URLType="http">
 
http://localhost:8080/axis/services/urn:xmltoday-delayed-quotes
                    </accessPoint>
                    <tModelInstanceDetails/>
                </bindingTemplate>

According to UDDI schema, this <description> element can be missing but
cannot be empty. When Juddi tries to insert the comment, a sql exception
is thrown, complaining null value instead into a null value disallowed
column.

Solution, do not comment these lines.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Mime
View raw message