accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [16/26] git commit: UTF8 fixes for MAC
Date Sat, 01 Feb 2014 03:23:15 GMT
UTF8 fixes for MAC


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/037742f6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/037742f6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/037742f6

Branch: refs/heads/2292-findbugs
Commit: 037742f6aa5fede771fbe5707efce70893b8f92e
Parents: 990da6a
Author: Josh Elser <elserj@apache.org>
Authored: Fri Jan 31 19:31:26 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Jan 31 22:18:53 2014 -0500

----------------------------------------------------------------------
 .../accumulo/minicluster/MiniAccumuloCluster.java   | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/037742f6/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 7c618be..0e9df1c 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -19,10 +19,13 @@ package org.apache.accumulo.minicluster;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -31,6 +34,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 
+import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.server.gc.SimpleGarbageCollector;
@@ -62,8 +66,8 @@ public class MiniAccumuloCluster {
      */
     public LogWriter(InputStream stream, File logFile) throws IOException {
       this.setDaemon(true);
-      this.in = new BufferedReader(new InputStreamReader(stream));
-      out = new BufferedWriter(new FileWriter(logFile));
+      this.in = new BufferedReader(new InputStreamReader(stream, Constants.UTF8));
+      out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile), Constants.UTF8));
       
       SimpleTimer.getInstance().schedule(new Runnable() {
         @Override
@@ -163,11 +167,11 @@ public class MiniAccumuloCluster {
     return process;
   }
   
-  private void appendProp(FileWriter fileWriter, Property key, String value, Map<String,String>
siteConfig) throws IOException {
+  private void appendProp(Writer fileWriter, Property key, String value, Map<String,String>
siteConfig) throws IOException {
     appendProp(fileWriter, key.getKey(), value, siteConfig);
   }
   
-  private void appendProp(FileWriter fileWriter, String key, String value, Map<String,String>
siteConfig) throws IOException {
+  private void appendProp(Writer fileWriter, String key, String value, Map<String,String>
siteConfig) throws IOException {
     if (!siteConfig.containsKey(key))
       fileWriter.append("<property><name>" + key + "</name><value>"
+ value + "</value></property>\n");
   }
@@ -228,7 +232,7 @@ public class MiniAccumuloCluster {
     
     File siteFile = new File(confDir, "accumulo-site.xml");
     
-    FileWriter fileWriter = new FileWriter(siteFile);
+    OutputStreamWriter fileWriter = new OutputStreamWriter(new FileOutputStream(siteFile),
Constants.UTF8);
     fileWriter.append("<configuration>\n");
     
     HashMap<String,String> siteConfig = new HashMap<String,String>(config.getSiteConfig());
@@ -267,7 +271,7 @@ public class MiniAccumuloCluster {
     fileWriter.close();
     
     zooCfgFile = new File(confDir, "zoo.cfg");
-    fileWriter = new FileWriter(zooCfgFile);
+    fileWriter = new OutputStreamWriter(new FileOutputStream(zooCfgFile), Constants.UTF8);
     
     // zookeeper uses Properties to read its config, so use that to write in order to properly
escape things like Windows paths
     Properties zooCfg = new Properties();


Mime
View raw message