accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1357862 - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/conf/ core/src/main/java/org/apache/accumulo/core/util/ examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/ server/src/main/java/o...
Date Thu, 05 Jul 2012 20:09:04 GMT
Author: ecn
Date: Thu Jul  5 20:09:04 2012
New Revision: 1357862

URL: http://svn.apache.org/viewvc?rev=1357862&view=rev
Log:
ACCUMULO-673 fixed trival resource leaks, removed author tag, made servlets stateless, added
missing option processing for username/password on the Merge command-line tool, removed password
information from log messages

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
    accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/Query.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestReader.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityHelper.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
Thu Jul  5 20:09:04 2012
@@ -24,8 +24,11 @@ import java.util.Iterator;
 import java.util.Map.Entry;
 import java.util.TreeMap;
 
+import org.apache.log4j.Logger;
+
 public class DefaultConfiguration extends AccumuloConfiguration {
   private static DefaultConfiguration instance = null;
+  private static Logger log = Logger.getLogger(DefaultConfiguration.class);
   
   public static DefaultConfiguration getInstance() {
     if (instance == null) {
@@ -62,6 +65,12 @@ public class DefaultConfiguration extend
       } catch (IOException e) {
         e.printStackTrace();
         return;
+      } finally {
+    	  try { 
+    		  data.close();
+    	  } catch (IOException ex) {
+    		  log .error(ex, ex);
+    	  }
       }
     }
     doc.println();

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java Thu Jul  5
20:09:04 2012
@@ -62,7 +62,7 @@ public class Merge {
     String table = null;
     long goalSize = -1;
     String user = "root";
-    String password = "secret";
+    byte[] password = "secret".getBytes();
     boolean force = false;
     Text begin = null;
     Text end = null;
@@ -90,6 +90,12 @@ public class Merge {
     if (commandLine.hasOption("s")) {
       goalSize = AccumuloConfiguration.getMemoryInBytes(commandLine.getOptionValue("s"));
     }
+    if (commandLine.hasOption("u")) {
+    	table = commandLine.getOptionValue("u");
+    }
+    if (commandLine.hasOption("p")) {
+        password = commandLine.getOptionValue("p").getBytes();
+    }
     if (commandLine.hasOption("f")) {
       force = true;
     }
@@ -97,7 +103,7 @@ public class Merge {
       begin = new Text(commandLine.getOptionValue("b"));
     }
     if (commandLine.hasOption("e")) {
-      end = new Text(commandLine.getOptionValue("e"));
+    	end = new Text(commandLine.getOptionValue("e"));
     }
     if (table == null) {
       System.err.println("Specify the table to merge");

Modified: accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/Query.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/Query.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/Query.java
(original)
+++ accumulo/trunk/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/query/Query.java
Thu Jul  5 20:09:04 2012
@@ -175,11 +175,10 @@ public class Query implements IQuery {
     Connector connector = null;
     if (null == instanceName || null == zooKeepers || null == username || null == password)
       throw new EJBException("Required parameters not set. [instanceName = " + this.instanceName
+ ", zookeepers = " + this.zooKeepers + ", username = "
-          + this.username + ", password = " + this.password + "]. Check values in ejb-jar.xml");
+          + this.username + ", password = [hidden]. Check values in ejb-jar.xml");
     Instance instance = new ZooKeeperInstance(this.instanceName, this.zooKeepers);
     try {
-      log.info("Connecting to [instanceName = " + this.instanceName + ", zookeepers = " +
this.zooKeepers + ", username = " + this.username + ", password = "
-          + this.password + "].");
+      log.info("Connecting to [instanceName = " + this.instanceName + ", zookeepers = " +
this.zooKeepers + ", username = " + this.username + "].");
       connector = instance.getConnector(this.username, this.password.getBytes());
     } catch (Exception e) {
       throw new EJBException("Error getting connector from instance", e);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/BasicServlet.java
Thu Jul  5 20:09:04 2012
@@ -44,9 +44,9 @@ abstract public class BasicServlet exten
   private static final long serialVersionUID = 1L;
   protected static final Logger log = Logger.getLogger(BasicServlet.class);
   static String cachedInstanceName = null;
-  private String bannerText;
-  private String bannerColor;
-  private String bannerBackground;
+  private static String bannerText;
+  private static String bannerColor;
+  private static String bannerBackground;
   
   abstract protected String getTitle(HttpServletRequest req);
   

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/DefaultServlet.java
Thu Jul  5 20:09:04 2012
@@ -83,13 +83,17 @@ public class DefaultServlet extends Basi
       path = path.substring(1);
       InputStream data = BasicServlet.class.getClassLoader().getResourceAsStream(path);
       ServletOutputStream out = resp.getOutputStream();
-      if (data != null) {
-        byte[] buffer = new byte[1024];
-        int n;
-        while ((n = data.read(buffer)) > 0)
-          out.write(buffer, 0, n);
-      } else {
-        out.write(("could not get resource " + path + "").getBytes());
+      try {
+    	  if (data != null) {
+    		  byte[] buffer = new byte[1024];
+    		  int n;
+    		  while ((n = data.read(buffer)) > 0)
+    			  out.write(buffer, 0, n);
+    	  } else {
+    		  out.write(("could not get resource " + path + "").getBytes());
+    	  }
+      } finally {
+    	  data.close();
       }
     } catch (Throwable t) {
       log.error(t, t);
@@ -113,9 +117,10 @@ public class DefaultServlet extends Basi
       
       @Override
       public IOException run() {
+    	InputStream data = null;
         try {
           File file = new File(aHome + path);
-          InputStream data = new FileInputStream(file.getAbsolutePath());
+          data = new FileInputStream(file.getAbsolutePath());
           byte[] buffer = new byte[1024];
           int n;
           ServletOutputStream out = resp.getOutputStream();
@@ -124,6 +129,14 @@ public class DefaultServlet extends Basi
           return null;
         } catch (IOException e) {
           return e;
+        } finally {
+          if (data != null) {
+            try {
+              data.close();
+            } catch (IOException ex) {
+              log.error(ex, ex);
+            }
+          } 
         }
       }
     }, acc);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/VisServlet.java
Thu Jul  5 20:09:04 2012
@@ -32,11 +32,6 @@ public class VisServlet extends BasicSer
   private static final int concurrentScans = Monitor.getSystemConfiguration().getCount(Property.TSERV_READ_AHEAD_MAXCONCURRENT);
   
   private static final long serialVersionUID = 1L;
-  boolean useCircles;
-  StatType motion;
-  StatType color;
-  int spacing;
-  String url;
   
   public enum StatType {
     osload(ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors(), true, 100,
"OS Load"),
@@ -106,6 +101,14 @@ public class VisServlet extends BasicSer
       return count;
     }
   }
+
+  public static class VisualizationConfig {
+	  boolean useCircles = true;
+	  StatType motion  = StatType.allmax;
+	  StatType color = StatType.allavg;
+	  int spacing = 40;
+	  String url;
+  }
   
   @Override
   protected String getTitle(HttpServletRequest req) {
@@ -116,39 +119,36 @@ public class VisServlet extends BasicSer
   protected void pageBody(HttpServletRequest req, HttpServletResponse response, StringBuilder
sb) throws IOException {
     StringBuffer urlsb = req.getRequestURL();
     urlsb.setLength(urlsb.lastIndexOf("/") + 1);
-    url = urlsb.toString();
+    String url = urlsb.toString();
+    VisualizationConfig cfg = new VisualizationConfig();
     
-    useCircles = true;
     String s = req.getParameter("shape");
     if (s != null && (s.equals("square") || s.equals("squares"))) {
-      useCircles = false;
+      cfg.useCircles = false;
     }
     
     s = req.getParameter("motion");
-    motion = StatType.allmax;
     if (s != null) {
       try {
-        motion = StatType.valueOf(s);
+        cfg.motion = StatType.valueOf(s);
       } catch (Exception e) {}
     }
     
     s = req.getParameter("color");
-    color = StatType.allavg;
     if (s != null) {
       try {
-        color = StatType.valueOf(s);
+        cfg.color = StatType.valueOf(s);
       } catch (Exception e) {}
     }
     
-    spacing = 40;
     String size = req.getParameter("size");
     if (size != null) {
       if (size.equals("10"))
-        spacing = 10;
+        cfg.spacing = 10;
       else if (size.equals("20"))
-        spacing = 20;
+        cfg.spacing = 20;
       else if (size.equals("80"))
-        spacing = 80;
+        cfg.spacing = 80;
     }
     
     ArrayList<TabletServerStatus> tservers = new ArrayList<TabletServerStatus>();
@@ -158,30 +158,30 @@ public class VisServlet extends BasicSer
     if (tservers.size() == 0)
       return;
     
-    int width = (int) Math.ceil(Math.sqrt(tservers.size())) * spacing;
-    int height = (int) Math.ceil(tservers.size() / width) * spacing;
-    doSettings(sb, width < 640 ? 640 : width, height < 640 ? 640 : height);
-    doScript(sb, tservers);
+    int width = (int) Math.ceil(Math.sqrt(tservers.size())) * cfg.spacing;
+    int height = (int) Math.ceil(tservers.size() / width) * cfg.spacing;
+    doSettings(sb, cfg, width < 640 ? 640 : width, height < 640 ? 640 : height);
+    doScript(sb, cfg, tservers);
   }
   
-  private void doSettings(StringBuilder sb, int width, int height) {
+  private void doSettings(StringBuilder sb, VisualizationConfig cfg, int width, int height)
{
     sb.append("<div class='left'>\n");
     sb.append("<div id='parameters' class='nowrap'>\n");
     // shape select box
     sb.append("<span class='viscontrol'>Shape: <select id='shape' onchange='setShape(this)'><option>Circles</option><option")
-        .append(!useCircles ? " selected='true'" : "").append(">Squares</option></select></span>\n");
+        .append(!cfg.useCircles ? " selected='true'" : "").append(">Squares</option></select></span>\n");
     // size select box
-    sb.append("&nbsp;&nbsp<span class='viscontrol'>Size: <select id='size'
onchange='setSize(this)'><option").append(spacing == 10 ? " selected='true'" : "")
-        .append(">10</option><option").append(spacing == 20 ? " selected='true'"
: "").append(">20</option><option")
-        .append(spacing == 40 ? " selected='true'" : "").append(">40</option><option").append(spacing
== 80 ? " selected='true'" : "")
+    sb.append("&nbsp;&nbsp<span class='viscontrol'>Size: <select id='size'
onchange='setSize(this)'><option").append(cfg.spacing == 10 ? " selected='true'" : "")
+        .append(">10</option><option").append(cfg.spacing == 20 ? " selected='true'"
: "").append(">20</option><option")
+        .append(cfg.spacing == 40 ? " selected='true'" : "").append(">40</option><option").append(cfg.spacing
== 80 ? " selected='true'" : "")
         .append(">80</option></select></span>\n");
     // motion select box
     sb.append("&nbsp;&nbsp<span class='viscontrol'>Motion: <select id='motion'
onchange='setMotion(this)'>");
-    addOptions(sb, motion);
+    addOptions(sb, cfg.motion);
     sb.append("</select></span>\n");
     // color select box
     sb.append("&nbsp;&nbsp<span class='viscontrol'>Color: <select id='color'
onchange='setColor(this)'>");
-    addOptions(sb, color);
+    addOptions(sb, cfg.color);
     sb.append("</select></span>\n");
     sb.append("&nbsp;&nbsp<span class='viscontrol'>(hover for info, click for
details)</span>");
     sb.append("</div>\n\n");
@@ -200,13 +200,13 @@ public class VisServlet extends BasicSer
     }
   }
   
-  private void doScript(StringBuilder sb, ArrayList<TabletServerStatus> tservers) {
+  private void doScript(StringBuilder sb, VisualizationConfig cfg, ArrayList<TabletServerStatus>
tservers) {
     // initialization of some javascript variables
     sb.append("<script type='text/javascript'>\n");
     sb.append("var numCores = " + ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
+ ";\n");
-    sb.append("var jsonurl = '" + url + "json';\n");
-    sb.append("var visurl = '" + url + "vis';\n");
-    sb.append("var serverurl = '" + url + "tservers?s=';\n\n");
+    sb.append("var jsonurl = '" + cfg.url + "json';\n");
+    sb.append("var visurl = '" + cfg.url + "vis';\n");
+    sb.append("var serverurl = '" + cfg.url + "tservers?s=';\n\n");
     sb.append("// observable stats that can be connected to motion or color\n");
     sb.append("var statNames = {");
     for (StatType st : StatType.values())

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java
Thu Jul  5 20:09:04 2012
@@ -80,46 +80,46 @@ public class UndefinedAnalyzer {
     
     private void parseLog(File log) throws Exception {
       BufferedReader reader = new BufferedReader(new FileReader(log));
-      
       String line;
       TreeMap<Long,Long> tm = null;
-      
-      while ((line = reader.readLine()) != null) {
-        if (!line.startsWith("UUID"))
-          continue;
-        String[] tokens = line.split("\\s");
-        String time = tokens[1];
-        String uuid = tokens[2];
-        
-        if (flushes.containsKey(uuid)) {
-          System.err.println("WARN Duplicate uuid " + log);
+      try {
+        while ((line = reader.readLine()) != null) {
+          if (!line.startsWith("UUID"))
+            continue;
+          String[] tokens = line.split("\\s");
+          String time = tokens[1];
+          String uuid = tokens[2];
+          
+          if (flushes.containsKey(uuid)) {
+            System.err.println("WARN Duplicate uuid " + log);
+            return;
+          }
+          
+          tm = new TreeMap<Long,Long>(Collections.reverseOrder());
+          tm.put(0l, Long.parseLong(time));
+          flushes.put(uuid, tm);
+          break;
+          
+        }
+        if (tm == null) {
+          System.err.println("WARN Bad ingest log " + log);
           return;
         }
         
-        tm = new TreeMap<Long,Long>(Collections.reverseOrder());
-        tm.put(0l, Long.parseLong(time));
-        flushes.put(uuid, tm);
-        break;
-        
-      }
-      
-      if (tm == null) {
-        System.err.println("WARN Bad ingest log " + log);
-        return;
-      }
-      
-      while ((line = reader.readLine()) != null) {
-        String[] tokens = line.split("\\s");
-        
-        if (!tokens[0].equals("FLUSH"))
-          continue;
-        
-        String time = tokens[1];
-        String count = tokens[4];
-        
-        tm.put(Long.parseLong(count), Long.parseLong(time));
+        while ((line = reader.readLine()) != null) {
+          String[] tokens = line.split("\\s");
+          
+          if (!tokens[0].equals("FLUSH"))
+            continue;
+          
+          String time = tokens[1];
+          String count = tokens[4];
+          
+          tm.put(Long.parseLong(count), Long.parseLong(time));
+        }
+      } finally {
+        reader.close();
       }
-      
     }
     
     Iterator<Long> getTimes(String uuid, long count) {
@@ -172,45 +172,49 @@ public class UndefinedAnalyzer {
         
         BufferedReader reader = new BufferedReader(new FileReader(masterLog));
         String line;
-        while ((line = reader.readLine()) != null) {
-          if (line.contains("TABLET_LOADED")) {
-            String[] tokens = line.split("\\s+");
-            String tablet = tokens[8];
-            String server = tokens[10];
-            
-            int pos1 = -1;
-            int pos2 = -1;
-            int pos3 = -1;
-            
-            for (int i = 0; i < tablet.length(); i++) {
-              if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') {
-                if (pos1 == -1) {
-                  pos1 = i;
-                } else if (pos2 == -1) {
-                  pos2 = i;
-                } else {
-                  pos3 = i;
+        try {
+          while ((line = reader.readLine()) != null) {
+            if (line.contains("TABLET_LOADED")) {
+              String[] tokens = line.split("\\s+");
+              String tablet = tokens[8];
+              String server = tokens[10];
+              
+              int pos1 = -1;
+              int pos2 = -1;
+              int pos3 = -1;
+              
+              for (int i = 0; i < tablet.length(); i++) {
+                if (tablet.charAt(i) == '<' || tablet.charAt(i) == ';') {
+                  if (pos1 == -1) {
+                    pos1 = i;
+                  } else if (pos2 == -1) {
+                    pos2 = i;
+                  } else {
+                    pos3 = i;
+                  }
                 }
               }
-            }
-            
-            if (pos1 > 0 && pos2 > 0 && pos3 == -1) {
-              String tid = tablet.substring(0, pos1);
-              String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1
+ 1, pos2);
-              String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2
+ 1);
-              if (tid.equals(tableId)) {
-                // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow);
-                Date date = sdf.parse(tokens[0] + " " + tokens[1] + " " + currentYear + "
" + currentMonth);
-                // System.out.println(" "+date);
-                
-                assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server,
date.getTime()));
-                
+              
+              if (pos1 > 0 && pos2 > 0 && pos3 == -1) {
+                String tid = tablet.substring(0, pos1);
+                String endRow = tablet.charAt(pos1) == '<' ? "8000000000000000" : tablet.substring(pos1
+ 1, pos2);
+                String prevEndRow = tablet.charAt(pos2) == '<' ? "" : tablet.substring(pos2
+ 1);
+                if (tid.equals(tableId)) {
+                  // System.out.println(" "+server+" "+tid+" "+endRow+" "+prevEndRow);
+                  Date date = sdf.parse(tokens[0] + " " + tokens[1] + " " + currentYear +
" " + currentMonth);
+                  // System.out.println(" "+date);
+                  
+                  assignments.add(new TabletAssignment(tablet, endRow, prevEndRow, server,
date.getTime()));
+                  
+                }
+              } else if (!tablet.startsWith("!0")) {
+                System.err.println("Cannot parse tablet " + tablet);
               }
-            } else if (!tablet.startsWith("!0")) {
-              System.err.println("Cannot parse tablet " + tablet);
+              
             }
-            
           }
+        } finally {
+          reader.close();
         }
       }
     }

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestReader.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestReader.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestReader.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestReader.java
Thu Jul  5 20:09:04 2012
@@ -70,6 +70,7 @@ public class CacheTestReader {
       
       oos.writeObject(readData);
       
+      fos.close();
       oos.close();
       
       UtilWaitThread.sleep(20);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestWriter.java
Thu Jul  5 20:09:04 2012
@@ -132,6 +132,7 @@ public class CacheTestWriter {
               @SuppressWarnings("unchecked")
               Map<String,String> readerMap = (Map<String,String>) ois.readObject();
               
+              fis.close();
               ois.close();
               
               System.out.println("read " + readerMap);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java
Thu Jul  5 20:09:04 2012
@@ -103,7 +103,9 @@ public class Framework {
     String module = args[3];
     
     Properties props = new Properties();
-    props.load(new FileInputStream(configDir + "/randomwalk.conf"));
+    FileInputStream fis = new FileInputStream(configDir + "/randomwalk.conf");
+    props.load(fis);
+    fis.close();
     
     System.setProperty("localLog", localLogPath + "/" + logId);
     System.setProperty("nfsLog", props.getProperty("NFS_LOGPATH") + "/" + logId);

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityHelper.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityHelper.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityHelper.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityHelper.java
Thu Jul  5 20:09:04 2012
@@ -31,10 +31,6 @@ import org.apache.accumulo.server.test.r
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.log4j.Logger;
 
-/**
- * @author jwvines
- * 
- */
 public class SecurityHelper {
   protected final static Logger log = Logger.getLogger(SecurityHelper.class);
   

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java
Thu Jul  5 20:09:04 2012
@@ -52,8 +52,11 @@ public class Run {
     Properties scaleProps = new Properties();
     Properties testProps = new Properties();
     try {
-      scaleProps.load(new FileInputStream(sitePath));
-      testProps.load(new FileInputStream(testPath));
+      FileInputStream fis = new FileInputStream(sitePath);
+      scaleProps.load(fis);
+      fis.close();
+      fis = new FileInputStream(testPath);
+      testProps.load(fis);
     } catch (Exception e) {
       System.out.println("Problem loading config file");
       e.printStackTrace();

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java?rev=1357862&r1=1357861&r2=1357862&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FileSystemMonitor.java
Thu Jul  5 20:09:04 2012
@@ -60,11 +60,12 @@ public class FileSystemMonitor {
     BufferedReader br = new BufferedReader(fr);
     
     String line;
-    
+    try {
     while ((line = br.readLine()) != null)
       mounts.add(new Mount(line));
-    
-    br.close();
+    } finally {
+      br.close();
+    }
     
     return mounts;
   }



Mime
View raw message