cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r1154409 - in /cocoon/cocoon3/trunk: cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java
Date Fri, 05 Aug 2011 22:48:23 GMT
Author: anathaniel
Date: Fri Aug  5 22:48:23 2011
New Revision: 1154409

URL: http://svn.apache.org/viewvc?rev=1154409&view=rev
Log:
Avoid potential null pointer access

Modified:
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java
    cocoon/cocoon3/trunk/cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java?rev=1154409&r1=1154408&r2=1154409&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XIncludeTransformer.java
Fri Aug  5 22:48:23 2011
@@ -375,11 +375,10 @@ public final class XIncludeTransformer e
                     // text/xml and application/xml offer only one optional parameter
                     int index = rawContentType != null ? rawContentType.indexOf(';') : -1;
 
-                    String charset = null;
-                    if (index != -1) {
+                    if (rawContentType != null && index != -1) {
                         // this should be something like "charset=UTF-8", but we want to
                         // strip it down to just "UTF-8"
-                        charset = rawContentType.substring(index + 1).trim();
+                        String charset = rawContentType.substring(index + 1).trim();
                         if (charset.startsWith(CHARSET)) {
                             charset = charset.substring(CHARSET.length()).trim();
                             // strip quotes, if present

Modified: cocoon/cocoon3/trunk/cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java?rev=1154409&r1=1154408&r2=1154409&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-stax/src/main/java/org/apache/cocoon/stax/converter/util/StAXEventContentHandler.java
Fri Aug  5 22:48:23 2011
@@ -366,6 +366,9 @@ public class StAXEventContentHandler ext
                 // namespace has already been declared, skip it, otherwise
                 // write it as an namespace
 
+                if (nsMap == null) {
+                    nsMap = new HashMap<String,Namespace>();
+                }
                 if (!nsMap.containsKey(attrPrefix)) {
                     Namespace ns = this.createNamespace(attrPrefix, attrValue);
                     nsMap.put(attrPrefix, ns);



Mime
View raw message