[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Make some trivial whitespace fixes.



commit 69535b64e20049e7a2f2f97b616322c857991e96
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Jul 25 17:00:45 2016 +0200

    Make some trivial whitespace fixes.
---
 .../collector/bridgedescs/SanitizedBridgesWriter.java     |  2 +-
 .../java/org/torproject/collector/cron/CollecTorMain.java |  2 +-
 .../java/org/torproject/collector/cron/Scheduler.java     | 15 +++++++--------
 .../collector/exitlists/ExitListDownloader.java           |  2 +-
 .../org/torproject/collector/index/CreateIndexJson.java   |  2 +-
 src/test/java/org/torproject/collector/MainTest.java      | 12 ++++++------
 .../org/torproject/collector/conf/ConfigurationTest.java  | 12 ++++++------
 7 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
index e00f70b..476f80b 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
@@ -392,7 +392,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
 
     if (this.bridgeSanitizingCutOffTimestamp
         .compareTo(publicationTime) > 0) {
-      String text =  "Sanitizing and storing network status with "
+      String text = "Sanitizing and storing network status with "
           + "publication time outside our descriptor sanitizing "
           + "interval.";
       if (this.haveWarnedAboutInterval) {
diff --git a/src/main/java/org/torproject/collector/cron/CollecTorMain.java b/src/main/java/org/torproject/collector/cron/CollecTorMain.java
index 21d8948..5fe6376 100644
--- a/src/main/java/org/torproject/collector/cron/CollecTorMain.java
+++ b/src/main/java/org/torproject/collector/cron/CollecTorMain.java
@@ -23,7 +23,7 @@ public abstract class CollecTorMain implements Runnable {
 
   protected Configuration config;
 
-  public CollecTorMain( Configuration conf) {
+  public CollecTorMain(Configuration conf) {
     this.config = conf;
   }
 
diff --git a/src/main/java/org/torproject/collector/cron/Scheduler.java b/src/main/java/org/torproject/collector/cron/Scheduler.java
index 6bc90ca..5535a8a 100644
--- a/src/main/java/org/torproject/collector/cron/Scheduler.java
+++ b/src/main/java/org/torproject/collector/cron/Scheduler.java
@@ -53,10 +53,10 @@ public class Scheduler implements ThreadFactory {
    */
   public void scheduleModuleRuns(Map<Key,
       Class<? extends CollecTorMain>> collecTorMains, Configuration conf) {
-    for ( Map.Entry<Key, Class<? extends CollecTorMain>> ctmEntry
-        : collecTorMains.entrySet() ) {
+    for (Map.Entry<Key, Class<? extends CollecTorMain>> ctmEntry
+        : collecTorMains.entrySet()) {
       try {
-        if ( conf.getBool(ctmEntry.getKey()) ) {
+        if (conf.getBool(ctmEntry.getKey())) {
           String prefix = ctmEntry.getKey().name().replace(ACTIVATED, "");
           CollecTorMain ctm = ctmEntry.getValue()
               .getConstructor(Configuration.class).newInstance(conf);
@@ -76,9 +76,9 @@ public class Scheduler implements ThreadFactory {
 
   private void scheduleExecutions(CollecTorMain ctm, int offset, int period) {
     this.log.info("Periodic updater started for " + ctm.getClass().getName()
-        +  "; offset=" + offset + ", period=" + period + ".");
+        + "; offset=" + offset + ", period=" + period + ".");
     int currentMinute = Calendar.getInstance().get(Calendar.MINUTE);
-    int initialDelay = (period - (currentMinute % period)  + offset) % period;
+    int initialDelay = (period - (currentMinute % period) + offset) % period;
 
     /* Run after initialDelay delay and then every period min. */
     this.log.info("Periodic updater will start every " + period + "th min "
@@ -96,10 +96,10 @@ public class Scheduler implements ThreadFactory {
       scheduler.shutdown();
       scheduler.awaitTermination(20L, java.util.concurrent.TimeUnit.MINUTES);
       log.info("Shutdown of all scheduled tasks completed successfully.");
-    } catch ( InterruptedException ie ) {
+    } catch (InterruptedException ie) {
       List<Runnable> notTerminated = scheduler.shutdownNow();
       log.error("Regular shutdown failed for: " + notTerminated);
-      if ( !notTerminated.isEmpty() ) {
+      if (!notTerminated.isEmpty()) {
         log.error("Forced shutdown failed for: " + notTerminated);
       }
     }
@@ -115,6 +115,5 @@ public class Scheduler implements ThreadFactory {
     log.info("New Thread created: " + newThread.getName());
     return newThread;
   }
-
 }
 
diff --git a/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java b/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
index 8b5277b..9c02032 100644
--- a/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
+++ b/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
@@ -77,7 +77,7 @@ public class ExitListDownloader extends CollecTorMain {
       byte[] data = new byte[1024];
       while ((len = in.read(data, 0, 1024)) >= 0) {
         sb.append(new String(data, 0, len));
-      }   
+      }
       in.close();
       downloadedExitList = sb.toString();
       logger.debug("Finished downloading exit list.");
diff --git a/src/main/java/org/torproject/collector/index/CreateIndexJson.java b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
index 08c28c6..39069f1 100644
--- a/src/main/java/org/torproject/collector/index/CreateIndexJson.java
+++ b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
@@ -68,7 +68,7 @@ public class CreateIndexJson extends CollecTorMain {
   @Override
   protected void startProcessing() throws ConfigurationException {
     try {
-      indexJsonFile =  new File(config.getPath(Key.IndexPath).toFile(),
+      indexJsonFile = new File(config.getPath(Key.IndexPath).toFile(),
           "index.json");
       basePath = config.getProperty(Key.InstanceBaseUrl.name());
       indexedDirectories = new File[] {
diff --git a/src/test/java/org/torproject/collector/MainTest.java b/src/test/java/org/torproject/collector/MainTest.java
index b48a0a9..6b90978 100644
--- a/src/test/java/org/torproject/collector/MainTest.java
+++ b/src/test/java/org/torproject/collector/MainTest.java
@@ -52,7 +52,7 @@ public class MainTest {
   public void testInitializationEmptyArgs() throws Exception {
     File conf = new File(Main.CONF_FILE);
     assertFalse("Please remove " + Main.CONF_FILE + " before running tests!", conf.exists());
-    Main.main(new String[]{});
+    Main.main(new String[] { });
     assertTrue(conf.exists());
     assertTrue(conf.delete());
   }
@@ -61,7 +61,7 @@ public class MainTest {
   public void testInitializationTooManyArgs() throws Exception {
     File conf = new File(Main.CONF_FILE);
     assertFalse("Please remove " + Main.CONF_FILE + " before running tests!", conf.exists());
-    Main.main(new String[]{"x", "y"});
+    Main.main(new String[] { "x", "y" });
     assertFalse(conf.exists());
   }
 
@@ -74,7 +74,7 @@ public class MainTest {
     assertTrue(4_000L <= conf.length());
     changeFilePathsAndSetActivation(conf, lockPath, "TorperfActivated");
     Main.main(new String[]{conf.toString()});
-    for(int t=0; t<1_000_000; t++) { }
+    for(int t = 0; t < 1_000_000; t++) { }
   }
 
   private void changeFilePathsAndSetActivation(File f, File l, String a) throws Exception {
@@ -133,7 +133,7 @@ public class MainTest {
     String[] runConfigSettings = new String[] {Scheduler.ACTIVATED,
         Scheduler.PERIODMIN, Scheduler.OFFSETMIN};
     for (Key key : Main.collecTorMains.keySet()) {
-      for ( String part : runConfigSettings ){
+      for (String part : runConfigSettings) {
         String key2 = key.name().replace("Activated", part);
         assertNotNull("Property '" + key2 + "' not specified in "
             + Main.CONF_FILE + ".",
@@ -141,8 +141,8 @@ public class MainTest {
       }
     }
     for (String propName : props.stringPropertyNames()) {
-      for ( String part : runConfigSettings ){
-        if( propName.contains(part) ){
+      for (String part : runConfigSettings) {
+        if (propName.contains(part)) {
           String key2 = propName.replace(part, "");
           assertTrue("CollecTorMain '" + key2
               + "' not specified in Main.class.",
diff --git a/src/test/java/org/torproject/collector/conf/ConfigurationTest.java b/src/test/java/org/torproject/collector/conf/ConfigurationTest.java
index 437939b..8671ef4 100644
--- a/src/test/java/org/torproject/collector/conf/ConfigurationTest.java
+++ b/src/test/java/org/torproject/collector/conf/ConfigurationTest.java
@@ -100,42 +100,42 @@ public class ConfigurationTest {
     assertArrayEquals(sourceStrings, conf.getStringArrayArray(Key.TorperfSources));
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testArrayArrayValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("CachedRelayDescriptorsDirectories".getBytes()));
     conf.getStringArrayArray(Key.TorperfOutputDirectory);
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testArrayValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("CachedRelayDescriptorsDirectories".getBytes()));
     conf.getStringArray(Key.TorperfSources);
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testBoolValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("TorperfSource = http://x.y.z".getBytes()));
     conf.getBool(Key.CachedRelayDescriptorsDirectories);
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testPathValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("DirectoryArchivesDirectory = \\u0000:".getBytes()));
     conf.getPath(Key.DirectoryArchivesDirectory);
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testUrlValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("ExitlistUrl = xxx://y.y.y".getBytes()));
     conf.getUrl(Key.ExitlistUrl);
   }
 
-  @Test( expected = ConfigurationException.class)
+  @Test(expected = ConfigurationException.class)
   public void testIntValueException() throws Exception {
     Configuration conf = new Configuration();
     conf.load(new ByteArrayInputStream("BridgeDescriptorMappingsLimit = y7".getBytes()));



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits