creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1484129 - in /creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license: AppliedApacheSoftwareLicense20.java BaseLicense.java FullTextMatchingLicense.java
Date Sat, 18 May 2013 15:40:14 GMT
Author: sebb
Date: Sat May 18 15:40:14 2013
New Revision: 1484129

URL: http://svn.apache.org/r1484129
Log:
RAT-139 FullTextMatchingLicense.prune uses inefficient deleteAtChar
Moved prune to BaseLicense class

Modified:
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20.java
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20.java?rev=1484129&r1=1484128&r2=1484129&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20.java
(original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20.java
Sat May 18 15:40:14 2013
@@ -46,18 +46,6 @@ public class AppliedApacheSoftwareLicens
 
     protected static final Pattern LICENSE_PATTERN = Pattern.compile(".*" + prune(ASL20_LICENSE_DEFN)
+ ".*", Pattern.CASE_INSENSITIVE);
 
-    protected static String prune(String text) {
-        StringBuilder buffer = new StringBuilder(text);
-        int length = buffer.length();
-        for (int i = length; i > 0;) {
-            char at = buffer.charAt(--i);
-            if (!Character.isLetterOrDigit(at)) {
-                buffer.deleteCharAt(i);
-            }
-        }
-        return buffer.toString();
-    }
-
     private StringBuilder buffer = new StringBuilder();
 
     public AppliedApacheSoftwareLicense20() {

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java?rev=1484129&r1=1484128&r2=1484129&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
(original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
Sat May 18 15:40:14 2013
@@ -77,4 +77,17 @@ public class BaseLicense {
         metaData.set(new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY, licFamilyCategory));
         metaData.set(new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME, getLicenseFamilyName()));
     }
+
+    protected static final String prune(String text) {
+        final int length = text.length();
+        final StringBuilder buffer = new StringBuilder(length);
+        for (int i = 0; i < length; i++) {
+            char at = text.charAt(i);
+            if (Character.isLetterOrDigit(at)) {
+                buffer.append(at);
+            }
+        }
+        return buffer.toString();
+    }
+
 }

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java?rev=1484129&r1=1484128&r2=1484129&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
(original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
Sat May 18 15:40:14 2013
@@ -61,18 +61,6 @@ public class FullTextMatchingLicense ext
         return fullTextPattern != null;
     }
 
-    protected final String prune(String text) {
-        final StringBuilder buffer = new StringBuilder(text);
-        final int length = buffer.length();
-        for (int i = length; i > 0;) {
-            char at = buffer.charAt(--i);
-            if (!Character.isLetterOrDigit(at)) {
-                buffer.deleteCharAt(i);
-            }
-        }
-        return buffer.toString();
-    }
-
     public boolean match(Document subject, String line) throws RatHeaderAnalysisException
{
         buffer.append(prune(line));
         if (fullTextPattern.matcher(buffer).matches()) {



Mime
View raw message