ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r537018 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java
Date Thu, 10 May 2007 22:23:58 GMT
Author: mbenson
Date: Thu May 10 15:23:57 2007
New Revision: 537018

URL: http://svn.apache.org/viewvc?view=rev&rev=537018
Log:
fix (I think) encoding for InputStream from StringResource

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java?view=diff&rev=537018&r1=537017&r2=537018
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/StringResource.java Thu May
10 15:23:57 2007
@@ -15,7 +15,6 @@
  *  limitations under the License.
  *
  */
-
 package org.apache.tools.ant.types.resources;
 
 import java.io.IOException;
@@ -183,11 +182,12 @@
         if (isReference()) {
             return ((Resource) getCheckedRef()).getInputStream();
         }
-        //I can't get my head around this; is encoding treatment needed here?
-        return
-            //new oata.util.ReaderInputStream(new InputStreamReader(
-            new ByteArrayInputStream(getContent().getBytes());
-            //, encoding), encoding);
+        String content = getContent();
+        if (content == null) {
+            throw new IllegalStateException("unset string value");
+        }
+        return new ByteArrayInputStream(encoding == null
+                ? content.getBytes() : content.getBytes(encoding));
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message