directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r239489 - /directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java
Date Tue, 23 Aug 2005 23:56:20 GMT
Author: elecharny
Date: Tue Aug 23 16:56:17 2005
New Revision: 239489

URL: http://svn.apache.org/viewcvs?rev=239489&view=rev
Log:
Change the toString method, converting the bytes to an UTF8 encoded string instead of a Locale
encoded String

Modified:
    directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java

Modified: directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java?rev=239489&r1=239488&r2=239489&view=diff
==============================================================================
--- directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java
(original)
+++ directory/asn1/branches/asn1-new-ber/ber-new/src/java/main/org/apache/asn1new/util/MutableString.java
Tue Aug 23 16:56:17 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.asn1new.util;
 
+import java.io.UnsupportedEncodingException;
+
 /**
  * A Mutable version of the String class. This mutable String can be
  * stored in a pool.
@@ -132,6 +134,20 @@
      */
     public String toString()
     {
-        return length == 0 ? "" : new String(data, 0, length);
+    	if ( length == 0 )
+    	{
+    		return "";
+    	}
+    	else
+    	{
+    		try
+    		{
+    			return new String(data, 0, length, "UTF8");
+    		}
+    		catch (UnsupportedEncodingException uee)
+    		{
+    			return "";
+    		}
+    	}
     }
 }



Mime
View raw message