You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "i30817 (JIRA)" <ji...@apache.org> on 2010/11/09 00:50:07 UTC

[jira] Created: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Unintuitive, possibly broken behaviour.
---------------------------------------

                 Key: DIGESTER-143
                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
             Project: Commons Digester
          Issue Type: Improvement
    Affects Versions: 2.1
         Environment: Linux 64 bits
            Reporter: i30817
            Priority: Minor


When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ((") as the body of the tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings). I can differentiate the first callback with the tag argument and it test against null to filter that case, but that leads to messy code.

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a argument instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "i30817 (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

i30817 updated DIGESTER-143:
----------------------------

    Description: 
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a argument instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.

  was:
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ((") as the body of the tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings). I can differentiate the first callback with the tag argument and it test against null to filter that case, but that leads to messy code.

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a argument instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.


> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a argument instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "i30817 (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

i30817 updated DIGESTER-143:
----------------------------

    Description: 
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a default value instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.

  was:
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a default value instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.


> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi resolved DIGESTER-143.
-------------------------------------

       Resolution: Not A Problem
    Fix Version/s: 2.2

Sorry if I reply late :(

The CallMethodRule[1] javadoc reports:

??Note that when a constructor is used with paramCount=0, indicating that the body of the element is to be passed to the target method, an empty element will cause an empty string to be passed to the target method, not null. And if automatic type conversion is being applied (ie if the target function takes something other than a string as a parameter) then the conversion will fail if the converter class does not accept an empty string as valid input.??

The behavior is documented in the rule class instead of the Digester#addCallMethod method.

[1] http://commons.apache.org/digester/apidocs/org/apache/commons/digester/CallMethodRule.html

> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>             Fix For: 2.2
>
>         Attachments: Main.java
>
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "i30817 (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

i30817 updated DIGESTER-143:
----------------------------

    Attachment: Main.java

testcase

> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>         Attachments: Main.java
>
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "i30817 (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931723#action_12931723 ] 

i30817 commented on DIGESTER-143:
---------------------------------

I attach a minimal test case; that i think is what you meant. The use case i already gave: assert that a xml catalog doens't have empty strings in specific tags, where the tags follow this format.

> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>         Attachments: Main.java
>
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Closed] (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Tripodi closed DIGESTER-143.
-----------------------------------

    Assignee: Simone Tripodi

included in Apache Commons Digester 3.0 release

> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Assignee: Simone Tripodi
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: Main.java
>
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930594#action_12930594 ] 

Simone Tripodi commented on DIGESTER-143:
-----------------------------------------

Can you provide please a use case? Thanks in advance!

> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use this to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIGESTER-143) Unintuitive, possibly broken behaviour.

Posted by "i30817 (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIGESTER-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

i30817 updated DIGESTER-143:
----------------------------

    Description: 
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a default value instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.

  was:
When one tag is a substring of another tag and both are used as xml patterns, such as:
"rdf:RDF/pgterms:etext/dc:creator"
"rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)

the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.

If additionally the first tag has a argument 
"rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.

The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).

If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.

So RFE:
1) Avoid the bogus callback of the smaller xml tree branch if you can.
2) if you can't, use null as a argument instead of the indistinguishable "".
3) if 2) document this behavior in the javadoc and the digester FAQ.


> Unintuitive, possibly broken behaviour.
> ---------------------------------------
>
>                 Key: DIGESTER-143
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-143
>             Project: Commons Digester
>          Issue Type: Improvement
>    Affects Versions: 2.1
>         Environment: Linux 64 bits
>            Reporter: i30817
>            Priority: Minor
>
> When one tag is a substring of another tag and both are used as xml patterns, such as:
> "rdf:RDF/pgterms:etext/dc:creator"
> "rdf:RDF/pgterms:etext/dc:creator/rdf:Bag/rdf:li" (instances in a collection of creators)
> the callback to the first is called once with empty strings ("") as the body of the tag if it encounters a instance of the second tag.
> If additionally the first tag has a argument 
> "rdf:RDF/pgterms:etext/dc:creator rdf:type="Literal"" and you bind things correctly for a two arguments callback with the text body and the argument value ("Literal"), the callback of the first will be called with a null rdf:type argument and a empty string as the body. You can use to distinguish the bogus callback as a workaround, but requires a additional bean method and confusing binding too.
> The best thing would be if these empty strings callback were avoidable. I can just test for empty string in the callback, however, i'm trying also to create assertions on the xml content (including, no empty strings).
> If the bogus callback must exist, one of the ways to make it obvious and distinguishable, would be to use null as the default value, instead of "". No xml document will have the computation null value, unless some very strange java binding is happening, in which case, you're asking for trouble. "" is even worse, because it is common to both domains.
> So RFE:
> 1) Avoid the bogus callback of the smaller xml tree branch if you can.
> 2) if you can't, use null as a default value instead of the indistinguishable "".
> 3) if 2) document this behavior in the javadoc and the digester FAQ.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.