db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1377250 - in /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit: DatabaseMapInitTableTransformer.java DatabaseMapInitTransformer.java
Date Sat, 25 Aug 2012 10:15:38 GMT
Author: tfischer
Date: Sat Aug 25 10:15:38 2012
New Revision: 1377250

URL: http://svn.apache.org/viewvc?rev=1377250&view=rev
Log:
specify encoding when reading transformer properties

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java?rev=1377250&r1=1377249&r2=1377250&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
Sat Aug 25 10:15:38 2012
@@ -20,6 +20,8 @@ package org.apache.torque.templates.tran
  */
 
 import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.source.SourceElement;
@@ -43,12 +45,31 @@ public class DatabaseMapInitTableTransfo
      */
     public DatabaseMapInitTableTransformer() throws SourceTransformerException
     {
-        super(new InputStreamReader(
-                DatabaseMapInitTableTransformer.class
-                   .getResourceAsStream(
-                        "DatabaseMapInitTableTransformer.properties")));
+        super(getTransformerProperties());
     }
 
+    /**
+     * Returns the Reader to read the transformer properties from.
+     *
+     * @return the reader, not null.
+     */
+    private static Reader getTransformerProperties()
+    {
+        try
+        {
+            return new InputStreamReader(
+                    OMTableAndViewTransformer.class.getResourceAsStream(
+                            "DatabaseMapInitTableTransformer.properties"),
+                    "ISO-8859-1");
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            // will not happen
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
     public SourceElement transform(
             SourceElement rootElement,
             ControllerState controllerState)

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java?rev=1377250&r1=1377249&r2=1377250&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
Sat Aug 25 10:15:38 2012
@@ -21,6 +21,8 @@ package org.apache.torque.templates.tran
 
 import java.io.File;
 import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
 
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.processor.string.Camelbacker;
@@ -35,6 +37,7 @@ import org.apache.torque.templates.Torqu
 import org.apache.torque.templates.transformer.om.DatabaseAttributeName;
 import org.apache.torque.templates.transformer.om.DatabaseChildElementName;
 import org.apache.torque.templates.transformer.om.LoadExternalSchemaTransformer;
+import org.apache.torque.templates.transformer.om.OMTableAndViewTransformer;
 import org.apache.torque.templates.transformer.om.OMTransformer;
 
 /**
@@ -66,7 +69,7 @@ public class DatabaseMapInitTransformer 
     private static final String DATABASE_SET_ELEMENT = "databaseSet";
 
     /** The transformer for table elements. */
-    private DatabaseMapInitTableTransformer tableTransformer
+    private final DatabaseMapInitTableTransformer tableTransformer
             = new DatabaseMapInitTableTransformer();
 
     /**
@@ -76,12 +79,31 @@ public class DatabaseMapInitTransformer 
      */
     public DatabaseMapInitTransformer() throws SourceTransformerException
     {
-        super(new InputStreamReader(
-                DatabaseMapInitTransformer.class
-                   .getResourceAsStream(
-                        "DatabaseMapInitTransformer.properties")));
+        super(getTransformerProperties());
     }
 
+    /**
+     * Returns the Reader to read the transformer properties from.
+     *
+     * @return the reader, not null.
+     */
+    private static Reader getTransformerProperties()
+    {
+        try
+        {
+            return new InputStreamReader(
+                    OMTableAndViewTransformer.class.getResourceAsStream(
+                            "DatabaseMapInitTransformer.properties"),
+                    "ISO-8859-1");
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            // will not happen
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
     public SourceElement transform(
             SourceElement rootElement,
             ControllerState controllerState)



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


Mime
View raw message