servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r430478 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
Date Thu, 10 Aug 2006 18:56:46 GMT
Author: gnodet
Date: Thu Aug 10 11:56:45 2006
New Revision: 430478

URL: http://svn.apache.org/viewvc?rev=430478&view=rev
Log:
SM-515: StringSource should throw an NPE when built with a null string instead of throwing
it when calling getInputStream

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java?rev=430478&r1=430477&r2=430478&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
Thu Aug 10 11:56:45 2006
@@ -33,16 +33,19 @@
  * @version $Revision$
  */
 public class StringSource extends StreamSource implements Serializable {
-    
-    private String text;
-    private String encoding="UTF-8";
-    
+
+    private final String text;
+    private String encoding = "UTF-8";
+
     public StringSource(String text) {
+        if (text == null) {
+            throw new NullPointerException("text can not be null");
+        }
         this.text = text;
     }
 
     public StringSource(String text, String systemId) {
-        this.text = text;
+        this(text);
         setSystemId(systemId);
     }
 
@@ -63,9 +66,9 @@
     public Reader getReader() {
         return new StringReader(text);
     }
-    
+
     public String toString() {
-    	return "StringSource[" + text + "]";
+        return "StringSource[" + text + "]";
     }
 
     public String getText() {



Mime
View raw message