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.
git-svn-id: https://svn.apache.org/repos/asf/xerces/java/trunk@1747631 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/org/apache/xerces/jaxp/datatype/DurationImpl.java b/src/org/apache/xerces/jaxp/datatype/DurationImpl.java
index 24a09f4..d43a006 100644
--- a/src/org/apache/xerces/jaxp/datatype/DurationImpl.java
+++ b/src/org/apache/xerces/jaxp/datatype/DurationImpl.java
@@ -420,16 +420,16 @@
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]) == '-') {