creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1549129 - /creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java
Date Sun, 08 Dec 2013 19:13:29 GMT
Author: rdonkin
Date: Sun Dec  8 19:13:28 2013
New Revision: 1549129

URL: http://svn.apache.org/r1549129
Log:
Format Code.

Modified:
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java?rev=1549129&r1=1549128&r2=1549129&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/HeaderCheckWorker.java
Sun Dec  8 19:13:28 2013
@@ -1,4 +1,5 @@
 package org.apache.rat.analysis;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one   *
  * or more contributor license agreements.  See the NOTICE file *
@@ -26,60 +27,69 @@ import org.apache.rat.api.Document;
 import org.apache.rat.api.MetaData;
 
 /**
- * <p>Reads from a stream to check license.</p>
- * <p><strong>Note</strong> that this class is not thread safe.</p>

+ * <p>
+ * Reads from a stream to check license.
+ * </p>
+ * <p>
+ * <strong>Note</strong> that this class is not thread safe.
+ * </p>
  */
 class HeaderCheckWorker {
 
-    public static final int DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES = 50;
+	public static final int DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES = 50;
 
-    private final int numberOfRetainedHeaderLines;
-    private final BufferedReader reader;
-    private final IHeaderMatcher matcher;
-    private final Document subject;
-    
-    private boolean match = false;
-
-    private int headerLinesToRead;
-    private boolean finished = false;
-
-    public HeaderCheckWorker(Reader reader, int numberOfRetainedHeaderLine,
-            final IHeaderMatcher matcher, final Document name) {
-        this(new BufferedReader(reader), numberOfRetainedHeaderLine, matcher, name);
-    }
-
-
-    /**
-     * Convenience constructor wraps given <code>Reader</code>
-     * in a <code>BufferedReader</code>.
-     * @param reader a <code>Reader</code> for the content, not null
-     * @param name the name of the checked content, possibly null
-     */
-    public HeaderCheckWorker(Reader reader, final IHeaderMatcher matcher, final Document
name) {
-        this(new BufferedReader(reader), matcher, name);
-    }
-
-    public HeaderCheckWorker(BufferedReader reader, final IHeaderMatcher matcher,
-            final Document name) {
-        this(reader, DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES, matcher, name);
-    }
-
-    public HeaderCheckWorker(BufferedReader reader, int numberOfRetainedHeaderLine, final
IHeaderMatcher matcher,
-            final Document name) {
-        this.reader = reader;
-        this.numberOfRetainedHeaderLines = numberOfRetainedHeaderLine;
-        this.matcher = matcher;
-        this.subject = name;
-    }
-
-    public boolean isFinished() {
-        return finished;
-    }
-
-    public void read() throws IOException{
-        if (!finished) {
-            final StringBuilder headers = new StringBuilder();
-            headerLinesToRead = numberOfRetainedHeaderLines;
+	private final int numberOfRetainedHeaderLines;
+	private final BufferedReader reader;
+	private final IHeaderMatcher matcher;
+	private final Document subject;
+
+	private boolean match = false;
+
+	private int headerLinesToRead;
+	private boolean finished = false;
+
+	public HeaderCheckWorker(Reader reader, int numberOfRetainedHeaderLine,
+			final IHeaderMatcher matcher, final Document name) {
+		this(new BufferedReader(reader), numberOfRetainedHeaderLine, matcher,
+				name);
+	}
+
+	/**
+	 * Convenience constructor wraps given <code>Reader</code> in a
+	 * <code>BufferedReader</code>.
+	 * 
+	 * @param reader
+	 *            a <code>Reader</code> for the content, not null
+	 * @param name
+	 *            the name of the checked content, possibly null
+	 */
+	public HeaderCheckWorker(Reader reader, final IHeaderMatcher matcher,
+			final Document name) {
+		this(new BufferedReader(reader), matcher, name);
+	}
+
+	public HeaderCheckWorker(BufferedReader reader,
+			final IHeaderMatcher matcher, final Document name) {
+		this(reader, DEFAULT_NUMBER_OF_RETAINED_HEADER_LINES, matcher, name);
+	}
+
+	public HeaderCheckWorker(BufferedReader reader,
+			int numberOfRetainedHeaderLine, final IHeaderMatcher matcher,
+			final Document name) {
+		this.reader = reader;
+		this.numberOfRetainedHeaderLines = numberOfRetainedHeaderLine;
+		this.matcher = matcher;
+		this.subject = name;
+	}
+
+	public boolean isFinished() {
+		return finished;
+	}
+
+	public void read() throws IOException {
+		if (!finished) {
+			final StringBuilder headers = new StringBuilder();
+			headerLinesToRead = numberOfRetainedHeaderLines;
 			while (readLine(headers)) {
 				// do nothing
 			}
@@ -93,27 +103,27 @@ class HeaderCheckWorker {
 						MetaData.RAT_LICENSE_FAMILY_CATEGORY_VALUE_UNKNOWN));
 				metaData.set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_UNKNOWN);
 			}
-            try {
-                reader.close();
-            } catch (IOException e) {
-                // swallow
-            }
-            matcher.reset();
-        }
-        finished = true;
-    }
-
-    boolean readLine(StringBuilder headers) throws IOException {
-        String line = reader.readLine();
-        boolean result = line != null;
-        if (result) {
-            if (headerLinesToRead-- > 0) {
-                headers.append(line);
-                headers.append('\n');
-            }
-            match = matcher.match(subject, line);
-            result = !match;
-        }
-        return result;
-    }
+			try {
+				reader.close();
+			} catch (IOException e) {
+				// swallow
+			}
+			matcher.reset();
+		}
+		finished = true;
+	}
+
+	boolean readLine(StringBuilder headers) throws IOException {
+		String line = reader.readLine();
+		boolean result = line != null;
+		if (result) {
+			if (headerLinesToRead-- > 0) {
+				headers.append(line);
+				headers.append('\n');
+			}
+			match = matcher.match(subject, line);
+			result = !match;
+		}
+		return result;
+	}
 }



Mime
View raw message