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: Jaxr Problem 3 final: problem solved
Date Mon, 14 Mar 2005 21:42:39 GMT

[Moved thread to the juddi-dev list ... more appropriate for this

Thanks for doing the legwork to fix this.  I've taken a look at your
solution and I may have an alternate solution that will eliminate this
problem which actually exists in a dozen or more situations - we just
haven't run into it yet.

The fix is to update the unmarshal() methods in DescriptionHandler and
NameHandler classes so that they ignore description and name elements
which do not contain a text node (the problem you've encountered).  For
instance. The updated DescriptionHandler.unmarshal() method would look
like this:

  public RegistryObject unmarshal(Element element)
    // Attributes
    String langCode = element.getAttribute("xml:lang");

    // Text Node Value
    String descValue = XMLUtils.getText(element);

    // Child Elements
    // {none}

    // Only create Description instance if descValue not null and not
    Description obj = null;
    if ((descValue != null) && (descValue.trim().length() > 0)) 
      obj = new Description(descValue,langCode);
    return obj;

The new unmarshal method in NameHandler will look (almost) identical.
Unfortunately all dependent handlers will need to be updated as well to
potentially expect to receive a null value from this method.  It's an
easy change but must be made to about 19 other Handler classes.  I'll
post the fix to CVS tonight.


-----Original Message-----
From: Wang, Ming-Fang [mailto:Ming-Fang.Wang@fnf.com] 
Sent: Monday, March 14, 2005 10:25 AM
To: juddi-user@ws.apache.org
Subject: RE: Jaxr Problem 3 final: problem solved


I found that for Oracle JDBC driver, if a value is empty string, a null
is actually inserted into database table. So, if I use Oracle database
and give an empty string in the description, in the
BindingDescTable.insert method, a null value will be inserted into the
table. Since the descr column of the table is not null-able, a sql
exception will be generated. My suggestion is to add an if statement
there to check value first. So, the code looks like:

        String str=desc.getValue();			// Added Line
        if (str!=null && str.length()>0) {	// Added Line
            statement.setInt(2, descID);
            statement.setString(3, desc.getLanguageCode());
            statement.setString(4, desc.getValue());
              "insert into BINDING_DESCR table:\n\n\t"
                + insertSQL
                + "\n\t BINDING_KEY="
                + bindingKey.toString()
                + "\n\t BINDING_DESCR_ID="
                + descID
                + "\n\t LANG_CODE="
                + desc.getLanguageCode()
                + "\n\t DESCR="
                + desc.getValue()
                + "\n");
        }							// Added

In this way, no empty string will be written to database. 

For those database drivers that do write something to database even for
empty strings, this arrangement will prevent inserting anything to db,
which I think should be acceptable.


-----Original Message-----
From: Steve Viens [mailto:steve@viens.net] 
Sent: Friday, March 11, 2005 4:53 AM
To: juddi-user@ws.apache.org
Subject: RE: Jaxr Problem 3 final: problem solved


jUDDI should be more careful than to just try to insert the description
value without checking for null first. 

When Juddi tries to insert the comment, a sql exception is thrown,
complaining null value instead into a null value disallowed column.

Could you post this to jUDDI's issue tracker?


If jUDDI isn't checking BindingTemplate descriptions then it's probably
not checking Description values for the other major objects
(BusinessEntity, BusinessService, etc).

-----Original Message-----
From: Wang, Ming-Fang [mailto:Ming-Fang.Wang@fnf.com] 
Sent: Thursday, March 10, 2005 2:34 PM
To: juddi-user@ws.apache.org
Subject: Jaxr Problem 3 final: problem solved


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 =
//                InternationalString
//                    "Just another access point");
//                bnd.setDescription(is);

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

                <bindingTemplate bindingKey=""
                    <description xml:lang="en-US"/>
                    <accessPoint URLType="http">

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

Solution, do not comment these lines.

If you have followed jaxr problem 3, I hope you did not regret too much
on reading the e-mails. This will be the last e-mail in this problem 3
issue. Only if I find another issue, but that will be jaxr problem 4
e-mail chain.



View raw message