Author: mrglavas
Date: Tue Feb 28 16:01:33 2006
New Revision: 381842

URL: http://svn.apache.org/viewcvs?rev=381842&view=rev
Log:
Fixing NPEs which can occur when the char array in the XMLString is null.

Modified:
    
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
    
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/parsers/AbstractDOMParser.java

Modified: 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
URL: 
http://svn.apache.org/viewcvs/xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java?rev=381842&r1=381841&r2=381842&view=diff
==============================================================================
--- 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
 (original)
+++ 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
 Tue Feb 28 16:01:33 2006
@@ -147,12 +147,20 @@
     
     // note that this will only be called within appinfo/documentation
     void comment(XMLString text) {
-        fAnnotationBuffer.append("<!--").append(text.ch, text.offset, 
text.length).append("-->");
+        fAnnotationBuffer.append("<!--");
+        if (text.length > 0) {
+            fAnnotationBuffer.append(text.ch, text.offset, text.length);
+        }
+        fAnnotationBuffer.append("-->");
     }
     
     // note that this will only be called within appinfo/documentation
     void processingInstruction(String target, XMLString data) {
-        fAnnotationBuffer.append("<?").append(target).append(" 
").append(data.ch, data.offset, data.length).append("?>");
+        fAnnotationBuffer.append("<?").append(target);
+        if (data.length > 0) {
+            fAnnotationBuffer.append(' ').append(data.ch, data.offset, 
data.length);
+        }
+        fAnnotationBuffer.append("?>");
     }
     
     // note that this will only be called within appinfo/documentation

Modified: 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/parsers/AbstractDOMParser.java
URL: 
http://svn.apache.org/viewcvs/xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/parsers/AbstractDOMParser.java?rev=381842&r1=381841&r2=381842&view=diff
==============================================================================
--- 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/parsers/AbstractDOMParser.java
 (original)
+++ 
xerces/java/tags/Xerces-J_2_8_0/src/org/apache/xerces/parsers/AbstractDOMParser.java
 Tue Feb 28 16:01:33 2006
@@ -580,7 +580,9 @@
         if (fInDTD) {
             if (fInternalSubset != null && !fInDTDExternalSubset) {
                 fInternalSubset.append ("<!-- ");
-                fInternalSubset.append (text.ch, text.offset, text.length);
+                if (text.length > 0) {
+                    fInternalSubset.append (text.ch, text.offset, text.length);
+                }
                 fInternalSubset.append (" -->");
             }
             return;
@@ -654,10 +656,10 @@
             if (fInternalSubset != null && !fInDTDExternalSubset) {
                 fInternalSubset.append ("<?");
                 fInternalSubset.append (target);
-                fInternalSubset.append (' ');
-                fInternalSubset.append (data.ch, data.offset, data.length);
+                if (data.length > 0) {
+                    fInternalSubset.append (' ').append (data.ch, data.offset, 
data.length);
+                }
                 fInternalSubset.append ("?>");
-
             }
             return;
         }
@@ -1153,7 +1155,9 @@
                         }
                         fFirstChunk = false;
                     }
-                    fStringBuffer.append (text.ch, text.offset, text.length);
+                    if (text.length > 0) {
+                        fStringBuffer.append (text.ch, text.offset, 
text.length);
+                    }
                 }
                 else {
                     fFirstChunk = true;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to