You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2016/06/10 15:20:58 UTC

Re: svn commit: r1747631 - /xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/DurationImpl.java

I assume the reason you moved it in the first place was because the null 
check in its original position in the method could never produce a 
NullPointerException. Calling s.length() would have already thrown the NPE 
if lexicalRepresentation was null. The explicit throwing of the NPE was 
unreachable code. 

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

mukulg@apache.org wrote on 06/10/2016 12:44:24 AM:

> Author: mukulg
> Date: Fri Jun 10 04:44:24 2016
> New Revision: 1747631
> 
> URL: http://svn.apache.org/viewvc?rev=1747631&view=rev
> Log:
> I am reverting a change I did long time ago to this file. I am 
> restoring the logic in this file, that was in the original revision 
> 906803. I think, the original code that I had changed in this file 
> is not really wrong. I started looking at the code in this file, 
> while studying the bug report XERCESJ-1669.
> 
> Modified:
> xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/DurationImpl.java
> 
> Modified: xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> DurationImpl.java
> URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/
> xerces/jaxp/datatype/DurationImpl.java?
> rev=1747631&r1=1747630&r2=1747631&view=diff
> 
==============================================================================
> --- xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> DurationImpl.java (original)
> +++ xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> DurationImpl.java Fri Jun 10 04:44:24 2016
> @@ -420,16 +420,16 @@ class DurationImpl
>      protected DurationImpl(String lexicalRepresentation)
>          throws IllegalArgumentException {
>          // only if I could use the JDK1.4 regular expression ....
> -
> -        if (lexicalRepresentation == null) {
> -           throw new NullPointerException();
> -        }
> - 
> + 
>          final String s = lexicalRepresentation;
>          boolean positive;
>          int[] idx = new int[1];
>          int length = s.length();
>          boolean timeRequired = false;
> + 
> +        if (lexicalRepresentation == null) {
> +            throw new NullPointerException();
> +        }
> 
>          idx[0] = 0;
>          if (length != idx[0] && s.charAt(idx[0]) == '-') {
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
> For additional commands, e-mail: commits-help@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Re: svn commit: r1747631 - /xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/DurationImpl.java

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Michael,
    Your analysis about my code changes, now and earlier to
DurationImpl.java are correct. But I think, the logic which I've reverted
to what was there originally, from a functional point of view is ok.

We can try to focus if possible, on the bug raised on JIRA to this class
(I.e our implementation not working correctly, when the seconds component
is there in a xs:duration value, with decimal point).

I personally would struggle to find time for this activity, during next few
weeks.

Regards,
Mukul

Sent from my phone
On 10-Jun-2016 8:51 pm, "Michael Glavassevich" <mr...@ca.ibm.com> wrote:

> I assume the reason you moved it in the first place was because the null
> check in its original position in the method could never produce a
> NullPointerException. Calling s.length() would have already thrown the NPE
> if lexicalRepresentation was null. The explicit throwing of the NPE was
> unreachable code.
>
> Michael Glavassevich
> XML Technologies and WAS Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> mukulg@apache.org wrote on 06/10/2016 12:44:24 AM:
>
> > Author: mukulg
> > Date: Fri Jun 10 04:44:24 2016
> > New Revision: 1747631
> >
> > URL: http://svn.apache.org/viewvc?rev=1747631&view=rev
> > Log:
> > I am reverting a change I did long time ago to this file. I am
> > restoring the logic in this file, that was in the original revision
> > 906803. I think, the original code that I had changed in this file
> > is not really wrong. I started looking at the code in this file,
> > while studying the bug report XERCESJ-1669.
> >
> > Modified:
> > xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/DurationImpl.java
> >
> > Modified: xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> > DurationImpl.java
> > URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/
> > xerces/jaxp/datatype/DurationImpl.java?
> > rev=1747631&r1=1747630&r2=1747631&view=diff
> >
>
> ==============================================================================
> > --- xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> > DurationImpl.java (original)
> > +++ xerces/java/trunk/src/org/apache/xerces/jaxp/datatype/
> > DurationImpl.java Fri Jun 10 04:44:24 2016
> > @@ -420,16 +420,16 @@ class DurationImpl
> >      protected DurationImpl(String lexicalRepresentation)
> >          throws IllegalArgumentException {
> >          // only if I could use the JDK1.4 regular expression ....
> > -
> > -        if (lexicalRepresentation == null) {
> > -           throw new NullPointerException();
> > -        }
> > -
> > +
> >          final String s = lexicalRepresentation;
> >          boolean positive;
> >          int[] idx = new int[1];
> >          int length = s.length();
> >          boolean timeRequired = false;
> > +
> > +        if (lexicalRepresentation == null) {
> > +            throw new NullPointerException();
> > +        }
> >
> >          idx[0] = 0;
> >          if (length != idx[0] && s.charAt(idx[0]) == '-') {
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: commits-help@xerces.apache.org
>
>
>