Author: rdonkin
Date: Thu Dec 5 20:46:56 2013
New Revision: 1548295
URL: http://svn.apache.org/r1548295
Log:
Format Code.
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequired.java
Modified:
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequired.java
URL:
http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequired.java?rev=1548295&r1=1548294&r2=1548295&view=diff
==============================================================================
---
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequired.java
(original)
+++
creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/generation/GeneratedLicenseNotRequired.java
Thu Dec 5 20:46:56 2013
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- */
+ */
package org.apache.rat.analysis.generation;
import java.util.regex.Pattern;
@@ -27,80 +27,75 @@ import org.apache.rat.api.MetaData;
public class GeneratedLicenseNotRequired implements IHeaderMatcher {
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
- private static final Pattern[] EMPTY_PATTERN_ARRAY = new Pattern[0];
+ private static final Pattern[] EMPTY_PATTERN_ARRAY = new Pattern[0];
- private static final String[] DEFAULT_PHRASES = {
- "generated by Cayenne",
- "Generated By:JJTree",
- "Generated By:JavaCC",
- "THIS FILE IS AUTOMATICALLY GENERATED",
- "NOTE: this file is autogenerated by XBeans",
- "This file was automatically generated by ",
- "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!",
- "# Microsoft Developer Studio Generated NMAKE File",
- "# Microsoft Developer Studio Generated Build File",
- "Generated from configure.ac by autoheader",
- "generated automatically by aclocal",
- "build.xml generated by maven from project.xml",
- "This file was generated by",
- "This file has been automatically generated.",
- "Automatically generated - do not modify!",
- "Javadoc style sheet",
- "SOURCE FILE GENERATATED",
- "Generated by the Batik",
- "this file is autogenerated",
- "This class was autogenerated",
- "Generated by Maven",
- "Autogenerated by Thrift",
- "DO NOT EDIT THIS FILE - it is machine generated",
- "This class was generated by"};
-
-
- // Uses either patterns or strings currently (not both)
- private final Pattern[] linePatterns;
- private final String[] phrases;
-
- public GeneratedLicenseNotRequired() {
- this(DEFAULT_PHRASES);
- }
-
- public GeneratedLicenseNotRequired(final Pattern[] linePatterns) {
- this.linePatterns = linePatterns;
- this.phrases = EMPTY_STRING_ARRAY;
- }
-
- public GeneratedLicenseNotRequired(final String[] lines) {
- this.linePatterns = EMPTY_PATTERN_ARRAY;
- this.phrases = lines;
- }
-
- public boolean match(Document subject, String line) throws
RatHeaderAnalysisException {
- boolean result = false;
- for (Pattern pat : linePatterns) {
- if (pat.matcher(line).matches()) {
- result = true;
- reportOnLicense(subject);
- break;
- }
- }
- for(String phrase : phrases) {
- if (line.contains(phrase)) {
- result = true;
- reportOnLicense(subject);
- break;
- }
- }
- return result;
- }
-
- private void reportOnLicense(Document subject) {
-
subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_GEN);
- }
-
- public void reset() {
- // stateless
- }
+ private static final String[] DEFAULT_PHRASES = { "generated by
Cayenne",
+ "Generated By:JJTree", "Generated By:JavaCC",
+ "THIS FILE IS AUTOMATICALLY GENERATED",
+ "NOTE: this file is autogenerated by XBeans",
+ "This file was automatically generated by ",
+ "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!",
+ "# Microsoft Developer Studio Generated NMAKE File",
+ "# Microsoft Developer Studio Generated Build File",
+ "Generated from configure.ac by autoheader",
+ "generated automatically by aclocal",
+ "build.xml generated by maven from project.xml",
+ "This file was generated by",
+ "This file has been automatically generated.",
+ "Automatically generated - do not modify!", "Javadoc
style sheet",
+ "SOURCE FILE GENERATATED", "Generated by the Batik",
+ "this file is autogenerated", "This class was
autogenerated",
+ "Generated by Maven", "Autogenerated by Thrift",
+ "DO NOT EDIT THIS FILE - it is machine generated",
+ "This class was generated by" };
+
+ // Uses either patterns or strings currently (not both)
+ private final Pattern[] linePatterns;
+ private final String[] phrases;
+
+ public GeneratedLicenseNotRequired() {
+ this(DEFAULT_PHRASES);
+ }
+
+ public GeneratedLicenseNotRequired(final Pattern[] linePatterns) {
+ this.linePatterns = linePatterns;
+ this.phrases = EMPTY_STRING_ARRAY;
+ }
+
+ public GeneratedLicenseNotRequired(final String[] lines) {
+ this.linePatterns = EMPTY_PATTERN_ARRAY;
+ this.phrases = lines;
+ }
+
+ public boolean match(Document subject, String line)
+ throws RatHeaderAnalysisException {
+ boolean result = false;
+ for (Pattern pat : linePatterns) {
+ if (pat.matcher(line).matches()) {
+ result = true;
+ reportOnLicense(subject);
+ break;
+ }
+ }
+ for (String phrase : phrases) {
+ if (line.contains(phrase)) {
+ result = true;
+ reportOnLicense(subject);
+ break;
+ }
+ }
+ return result;
+ }
+
+ private void reportOnLicense(Document subject) {
+ subject.getMetaData().set(
+ MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_GEN);
+ }
+
+ public void reset() {
+ // stateless
+ }
}