[tor-commits] [collector/release] Make a couple JavaDoc fixes.

karsten at torproject.org karsten at torproject.org
Mon Oct 15 14:39:13 UTC 2018


commit 4f120ba1c330da455cf0d0b12be4e6231fe196cd
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Aug 21 09:52:58 2018 +0200

    Make a couple JavaDoc fixes.
---
 .../java/org/torproject/metrics/collector/Main.java  |  2 +-
 .../metrics/collector/conf/Configuration.java        |  2 +-
 .../metrics/collector/cron/CollecTorMain.java        |  4 +++-
 .../collector/persist/DescriptorPersistence.java     | 14 ++++++++------
 .../metrics/collector/persist/package-info.java      |  2 +-
 .../relaydescs/RelayDescriptorDownloader.java        | 20 ++++++++++----------
 .../metrics/collector/sync/SyncPersistence.java      | 10 +++++-----
 .../metrics/collector/sync/package-info.java         |  4 ++--
 .../metrics/collector/webstats/SanitizeWeblogs.java  |  2 +-
 9 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/collector/Main.java b/src/main/java/org/torproject/metrics/collector/Main.java
index 1e186d4..6230e36 100644
--- a/src/main/java/org/torproject/metrics/collector/Main.java
+++ b/src/main/java/org/torproject/metrics/collector/Main.java
@@ -32,7 +32,7 @@ import java.util.Map;
  * <br>
  * Run without arguments in order to read the usage information, i.e.
  * <br>
- * <code>java -jar collector.jar</code>
+ * {@code java -jar collector.jar}
  */
 public class Main {
 
diff --git a/src/main/java/org/torproject/metrics/collector/conf/Configuration.java b/src/main/java/org/torproject/metrics/collector/conf/Configuration.java
index f797947..69d3bcd 100644
--- a/src/main/java/org/torproject/metrics/collector/conf/Configuration.java
+++ b/src/main/java/org/torproject/metrics/collector/conf/Configuration.java
@@ -204,7 +204,7 @@ public class Configuration extends Observable implements Cloneable {
 
   /**
    * Parse an integer property and translate the String
-   * <code>"inf"</code> into Integer.MAX_VALUE.
+   * {@code "inf"} into Integer.MAX_VALUE.
    * Verifies that this enum is a Key for an integer value.
    */
   public int getInt(Key key) throws ConfigurationException {
diff --git a/src/main/java/org/torproject/metrics/collector/cron/CollecTorMain.java b/src/main/java/org/torproject/metrics/collector/cron/CollecTorMain.java
index 87cb304..cd8e0ee 100644
--- a/src/main/java/org/torproject/metrics/collector/cron/CollecTorMain.java
+++ b/src/main/java/org/torproject/metrics/collector/cron/CollecTorMain.java
@@ -95,7 +95,9 @@ public abstract class CollecTorMain extends SyncManager
         && config.getSourceTypeSet(Key.valueOf(key)).size() == 1;
   }
 
-  /** Wrapper for <code>run</code>. */
+  /**
+   * Wrapper for {@code run}.
+   */
   @Override
   public final Object call() {
     run();
diff --git a/src/main/java/org/torproject/metrics/collector/persist/DescriptorPersistence.java b/src/main/java/org/torproject/metrics/collector/persist/DescriptorPersistence.java
index ea3d67d..bd24c81 100644
--- a/src/main/java/org/torproject/metrics/collector/persist/DescriptorPersistence.java
+++ b/src/main/java/org/torproject/metrics/collector/persist/DescriptorPersistence.java
@@ -34,7 +34,9 @@ public abstract class DescriptorPersistence<T extends Descriptor> {
   protected String storagePath;
   protected String recentPath;
 
-  /** Initializes the paths for storing descriptors of type <code>T</code>. */
+  /**
+   * Initializes the paths for storing descriptors of type {@code T}.
+   */
   protected DescriptorPersistence(T desc, byte[] defaultAnnotation) {
     this.desc = desc;
     List<String> annotations = desc.getAnnotations();
@@ -51,7 +53,7 @@ public abstract class DescriptorPersistence<T extends Descriptor> {
 
   /** Stores the descriptor to all locations.
    * First attempt to store the 'out' path, if that works store to 'recent'.
-   * Returns <code>true</code>, if both were written. */
+   * Returns {@code true}, if both were written. */
   public boolean storeAll(String recentRoot, String outRoot) {
     return storeAll(recentRoot, outRoot, StandardOpenOption.APPEND,
         StandardOpenOption.CREATE_NEW);
@@ -59,7 +61,7 @@ public abstract class DescriptorPersistence<T extends Descriptor> {
 
   /** Stores the descriptor to all locations.
    * First attempt to store the 'out' path, if that works store to 'recent'.
-   * Returns <code>true</code>, if both were written. */
+   * Returns {@code true}, if both were written. */
   public boolean storeAll(String recentRoot, String outRoot,
       StandardOpenOption optionRecent, StandardOpenOption optionOut) {
     if (storeOut(outRoot, optionOut)) {
@@ -76,7 +78,7 @@ public abstract class DescriptorPersistence<T extends Descriptor> {
 
   /** Stores the descriptor in recent.
    * Creates, replaces, or appends according to the given option.
-   * Returns <code>true</code>, if the file was written. */
+   * Returns {@code true}, if the file was written. */
   public boolean storeRecent(String recentRoot, StandardOpenOption option) {
     return PersistenceUtils.storeToFileSystem(annotation,
         desc.getRawDescriptorBytes(), Paths.get(recentRoot, getRecentPath()),
@@ -85,14 +87,14 @@ public abstract class DescriptorPersistence<T extends Descriptor> {
 
   /** Stores the descriptor in out (i.e. internal storage).
    * Only writes, if the file doesn't exist yet.
-   * Returns <code>true</code>, if the file was written. */
+   * Returns {@code true}, if the file was written. */
   public boolean storeOut(String outRoot) {
     return storeOut(outRoot, StandardOpenOption.CREATE_NEW);
   }
 
   /** Stores the descriptor in out (i.e. internal storage).
    * Creates, replaces, or appends according to the given option.
-   * Returns <code>true</code>, if the file was written. */
+   * Returns {@code true}, if the file was written. */
   public boolean storeOut(String outRoot, StandardOpenOption option) {
     return PersistenceUtils.storeToFileSystem(annotation,
         desc.getRawDescriptorBytes(), Paths.get(outRoot, getStoragePath()),
diff --git a/src/main/java/org/torproject/metrics/collector/persist/package-info.java b/src/main/java/org/torproject/metrics/collector/persist/package-info.java
index d3f6d2f..11d3939 100644
--- a/src/main/java/org/torproject/metrics/collector/persist/package-info.java
+++ b/src/main/java/org/torproject/metrics/collector/persist/package-info.java
@@ -7,5 +7,5 @@ package org.torproject.metrics.collector.persist;
  * simply determine the two storage paths based on the descriptor
  * and further parameters like acquisition time.
  * <p>All special persistence classes extend
- * <code>DescriptorPersistence</code>.</p>
+ * {@code DescriptorPersistence}.</p>
  */
diff --git a/src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java b/src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java
index f876319..446b6a7 100644
--- a/src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java
+++ b/src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java
@@ -38,7 +38,7 @@ import java.util.zip.InflaterInputStream;
 /**
  * Downloads relay descriptors from the directory authorities via HTTP.
  * Keeps a list of missing descriptors that gets updated by parse results
- * from <code>RelayDescriptorParser</code> and downloads all missing
+ * from {@code RelayDescriptorParser} and downloads all missing
  * descriptors that have been published in the last 24 hours. Also
  * downloads all server and extra-info descriptors known to a directory
  * authority at most once a day.
@@ -105,7 +105,7 @@ public class RelayDescriptorDownloader {
   private Map<String, String> lastDownloadedAllDescriptors;
 
   /**
-   * <code>RelayDescriptorParser</code> that we will hand over the
+   * {@code RelayDescriptorParser} that we will hand over the
    * downloaded descriptors for parsing.
    */
   private RelayDescriptorParser rdp;
@@ -286,9 +286,9 @@ public class RelayDescriptorDownloader {
 
   /**
    * Initializes this class, including reading in missing descriptors from
-   * <code>stats/missing-relay-descriptors</code> and the times when we
+   * {@code stats/missing-relay-descriptors} and the times when we
    * last downloaded all server and extra-info descriptors from
-   * <code>stats/last-downloaded-all-descriptors</code>.
+   * {@code stats/last-downloaded-all-descriptors}.
    */
   public RelayDescriptorDownloader(RelayDescriptorParser rdp,
       String[] authorities, String[] authorityFingerprints,
@@ -472,8 +472,8 @@ public class RelayDescriptorDownloader {
 
   /**
    * We have parsed a consensus. Take this consensus off the missing list
-   * and add the votes created by the given <code>authorities</code> and
-   * the <code>serverDescriptors</code> which are in the format
+   * and add the votes created by the given {@code authorities} and
+   * the {@code serverDescriptors} which are in the format
    * "<published>,<relayid>,<descid>" to that list.
    */
   public void haveParsedConsensus(String validAfter,
@@ -510,7 +510,7 @@ public class RelayDescriptorDownloader {
 
   /**
    * We have parsed a microdesc consensus. Take this microdesc consensus off the
-   * missing list and add the <code>microdescriptors</code> which are in the
+   * missing list and add the {@code microdescriptors} which are in the
    * format "<validafter>,<relayid>,<descid>" to that list.
    */
   public void haveParsedMicrodescConsensus(String validAfter,
@@ -568,7 +568,7 @@ public class RelayDescriptorDownloader {
 
   /**
    * We have parsed a vote. Take this vote off the missing list and add
-   * the <code>serverDescriptors</code> which are in the format
+   * the {@code serverDescriptors} which are in the format
    * "<published>,<relayid>,<descid>" to that list.
    */
   public void haveParsedVote(String validAfter, String fingerprint,
@@ -847,9 +847,9 @@ public class RelayDescriptorDownloader {
   /**
    * Attempts to download one or more descriptors identified by a resource
    * string from a directory authority and passes the returned
-   * descriptor(s) to the <code>RelayDescriptorParser</code> upon success.
+   * descriptor(s) to the {@code RelayDescriptorParser} upon success.
    * Returns the number of descriptors contained in the reply. Throws an
-   * <code>IOException</code> if something goes wrong while downloading.
+   * {@code IOException} if something goes wrong while downloading.
    */
   private int downloadResourceFromAuthority(String authority,
       String resource) throws IOException {
diff --git a/src/main/java/org/torproject/metrics/collector/sync/SyncPersistence.java b/src/main/java/org/torproject/metrics/collector/sync/SyncPersistence.java
index bbd3103..f2d3e55 100644
--- a/src/main/java/org/torproject/metrics/collector/sync/SyncPersistence.java
+++ b/src/main/java/org/torproject/metrics/collector/sync/SyncPersistence.java
@@ -58,7 +58,7 @@ public class SyncPersistence {
   }
 
   /**
-   * Cleans the directory in <code>RecentPath</code> after storing descriptors.
+   * Cleans the directory in {@code RecentPath} after storing descriptors.
    */
   public void cleanDirectory() {
     try {
@@ -70,8 +70,8 @@ public class SyncPersistence {
 
   /**
    * Stores descriptors in main storage and recent.
-   * The storage locations are taken from <code>collector.properties</code>'
-   * options <code>OutputPath</code> and <code>RecentPath</code>.
+   * The storage locations are taken from {@code collector.properties}'
+   * options {@code OutputPath} and {@code RecentPath}.
    */
   public void storeDescs(Iterable<Descriptor> descs, long received) {
     for (Descriptor desc : descs) {
@@ -81,8 +81,8 @@ public class SyncPersistence {
 
   /**
    * Stores a descriptor in main storage and recent.
-   * The storage locations are taken from <code>collector.properties</code>'
-   * options <code>OutputPath</code> and <code>RecentPath</code>.
+   * The storage locations are taken from {@code collector.properties}'
+   * options {@code OutputPath} and {@code RecentPath}.
    */
   public void storeDesc(Descriptor desc, long received) {
     String filename = desc.getDescriptorFile().getName();
diff --git a/src/main/java/org/torproject/metrics/collector/sync/package-info.java b/src/main/java/org/torproject/metrics/collector/sync/package-info.java
index 401fb84..08a6cdd 100644
--- a/src/main/java/org/torproject/metrics/collector/sync/package-info.java
+++ b/src/main/java/org/torproject/metrics/collector/sync/package-info.java
@@ -4,10 +4,10 @@
 package org.torproject.metrics.collector.sync;
 
 /** This package coordinates syncing and merging the fetched data.
- * <p>The central class for this process is <code>SyncManager</code>, which
+ * <p>The central class for this process is {@code SyncManager}, which
  * coordinates download from other instances and merging the new data
  * to the local directories.</p>
  * <p>Storing data to the file system is facilitated by
- * <code>SyncPersistence</code>.</p>
+ * {@code SyncPersistence}.</p>
  */
 
diff --git a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
index 7096832..84f4f9e 100644
--- a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
+++ b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
@@ -52,7 +52,7 @@ import java.util.stream.Stream;
 
 /**
  * This module processes web-logs for CollecTor according to the weblog
- * sanitation specification published on metrics.torproject.org</p>
+ * sanitation specification published on metrics.torproject.org.
  */
 public class SanitizeWeblogs extends CollecTorMain {
 





More information about the tor-commits mailing list