You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2007/10/29 20:39:58 UTC

svn commit: r589819 - /webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java

Author: ajith
Date: Mon Oct 29 12:39:57 2007
New Revision: 589819

URL: http://svn.apache.org/viewvc?rev=589819&view=rev
Log:
1. Fixed issue WSCOMMONS-260

Modified:
    webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java

Modified: webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?rev=589819&r1=589818&r2=589819&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.3.3/src/main/java/org/apache/ws/commons/schema/XmlSchema.java Mon Oct 29 12:39:57 2007
@@ -53,7 +53,8 @@
 // Feb 21th - Joni - Port to XMLDomUtil and Tranformation.
 
 public class XmlSchema extends XmlSchemaAnnotated implements NamespaceContextOwner {
-    static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+    private static final String UTF_8_ENCODING = "UTF-8";
+	static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
     XmlSchemaForm attributeFormDefault, elementFormDefault;
 
     XmlSchemaObjectTable attributeGroups,
@@ -337,18 +338,18 @@
      * @param out - the output stream to write to
      */
     public void write(OutputStream out) {
+    try {
         if (this.inputEncoding!= null &&
                 !"".equals(this.inputEncoding)){
-            try {
                 write(new OutputStreamWriter(out,this.inputEncoding));
-            } catch (UnsupportedEncodingException e) {
-                //log the error and just write it without the encoding
-
-                write(new OutputStreamWriter(out));
-            }
         }else{
-            write(new OutputStreamWriter(out));
+        	//As per the XML spec the default is taken to be UTF 8
+            write(new OutputStreamWriter(out,UTF_8_ENCODING));
         }
+    } catch (UnsupportedEncodingException e) {
+        //log the error and just write it without the encoding
+        write(new OutputStreamWriter(out));
+    }
 
     }
 
@@ -358,16 +359,16 @@
      * @param options -  a map of options
      */
     public void write(OutputStream out, Map options) {
-        if (this.inputEncoding!= null &&
-                !"".equals(this.inputEncoding)){
-            try {
-                write(new OutputStreamWriter(out,this.inputEncoding),options);
-            } catch (UnsupportedEncodingException e) {
-                //log the error and just write it without the encoding
-                write(new OutputStreamWriter(out));
-            }
-        }else{
-            write(new OutputStreamWriter(out),options);
+    	try {
+	        if (this.inputEncoding!= null &&
+	                !"".equals(this.inputEncoding)){
+	                write(new OutputStreamWriter(out,this.inputEncoding),options);
+	        }else{
+	            write(new OutputStreamWriter(out,UTF_8_ENCODING),options);
+	        }
+    	} catch (UnsupportedEncodingException e) {
+            //log the error and just write it without the encoding
+            write(new OutputStreamWriter(out));
         }
 
     }



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