castor

IDResolverImpl throws ValidationException when isValidating is false

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1.1
  • Component/s: XML
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    4

Description

When trying to unmarshall, a MarshalException: "Invalid (empty) ID value encountered" is thrown that was not thrown in castor 1.0.1 even when explicitly setting validation to false. It appears that the root of this is that a ValidationException is being thrown from the bind method of IDResolverImpl when an empty id is passed even if isValidating is passed as false.

  1. IDResolverImpl.diff
    05/Apr/07 2:32 PM
    0.5 kB
    Paul Croarkin
  2. IDResolverImplTest.java
    05/Apr/07 2:33 PM
    0.6 kB
    Paul Croarkin
  3. IDResolverImplTest.java
    05/Apr/07 11:12 AM
    0.6 kB
    Paul Croarkin
  4. patch.c1937.20070416.txt
    16/Apr/07 2:02 PM
    0.9 kB
    Werner Guttmann

Activity

Hide
Paul Croarkin added a comment -

Updated test

Show
Paul Croarkin added a comment - Updated test
Hide
Werner Guttmann added a comment -

Hmmm, just looked at the SVN history of that class, and I think that this part of the IDResolverImpl has not changed. In other words, I'd like to understand why switching from 1.0.1 to 1.1 makes a difference at all.

Show
Werner Guttmann added a comment - Hmmm, just looked at the SVN history of that class, and I think that this part of the IDResolverImpl has not changed. In other words, I'd like to understand why switching from 1.0.1 to 1.1 makes a difference at all.
Hide
Werner Guttmann added a comment -

Paul, any idea ? Is it really 1.0.1 you are trying to switch from ?

Show
Werner Guttmann added a comment - Paul, any idea ? Is it really 1.0.1 you are trying to switch from ?
Hide
Paul Croarkin added a comment -

I downloaded the source distribution for 1.0.1 and found that IDRersolverImpl.java did not exist. Rather, IDResolverImpl was an inner class of UnmarshalHandler (tag 5961). It's bind method was
very simple and did not throw ValidationException:

void bind(String id, Object obj) { if (_idReferences == null) _idReferences = new Hashtable(); _idReferences.put(id, obj); } //-- bind

Show
Paul Croarkin added a comment - I downloaded the source distribution for 1.0.1 and found that IDRersolverImpl.java did not exist. Rather, IDResolverImpl was an inner class of UnmarshalHandler (tag 5961). It's bind method was very simple and did not throw ValidationException: void bind(String id, Object obj) { if (_idReferences == null) _idReferences = new Hashtable(); _idReferences.put(id, obj); } //-- bind
Hide
Werner Guttmann added a comment -

Thanks for the research. In this case, it looks like we have been a bit to ambitious when it comes to error handling .. .

Show
Werner Guttmann added a comment - Thanks for the research. In this case, it looks like we have been a bit to ambitious when it comes to error handling .. .
Hide
Werner Guttmann added a comment -

Final patch for review. Slightly changed the code to improve the error message so that the message is really specific to the situation encountered.

Show
Werner Guttmann added a comment - Final patch for review. Slightly changed the code to improve the error message so that the message is really specific to the situation encountered.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: