You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/10 20:56:46 UTC
svn commit: r430478 -
/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StringSource.java
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() {