Registering more extensions, limit the positions where the header may start.


Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans-tools/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-tools/commit/9bea96e2
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-tools/tree/9bea96e2
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-netbeans-tools/diff/9bea96e2

Branch: refs/heads/master
Commit: 9bea96e2d1f3ae578005ddf901811d30673f26be
Parents: 7a55d15
Author: Jan Lahoda <[email protected]>
Authored: Sun Sep 17 10:01:00 2017 +0200
Committer: Jan Lahoda <[email protected]>
Committed: Sun Sep 17 10:01:00 2017 +0200

----------------------------------------------------------------------
 convert/src/convert/CategorizeLicenses.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-netbeans-tools/blob/9bea96e2/convert/src/convert/CategorizeLicenses.java
----------------------------------------------------------------------
diff --git a/convert/src/convert/CategorizeLicenses.java 
b/convert/src/convert/CategorizeLicenses.java
index 9c29d31..a492a17 100644
--- a/convert/src/convert/CategorizeLicenses.java
+++ b/convert/src/convert/CategorizeLicenses.java
@@ -127,10 +127,10 @@ public class CategorizeLicenses {
     
     static {
         enterExtensions(code -> snipLicense(code, "/\\*+", "\\*+/", "^[ 
\t]*\\**[ \t]*", CommentType.JAVA),
-                        "javx", "c", "h", "cpp", "pass", "hint", "css", 
"java");
+                        "javx", "c", "h", "cpp", "pass", "hint", "css", 
"java", "js", "jj");
         enterExtensions(code -> snipLicense(code, "<!--+", "-+->", "^[ \t]*(-[ 
\t]*)?", CommentType.XML),
                         "html", "xsd", "xsl", "dtd", "settings", "wstcgrp", 
"wstcref",
-                        "wsgrp", "xml");
+                        "wsgrp", "xml", "xslt");
         enterExtensions(code -> snipLicenseBundle(code, "#!.*"), "sh");
         enterExtensions(code -> snipLicenseBundle(code, null), "properties");
     }
@@ -162,7 +162,7 @@ public class CategorizeLicenses {
 
     private static Description snipLicense(String code, String commentStart, 
String commentEnd, String normalizeLines, CommentType commentType) {
         Matcher startM = Pattern.compile(commentStart).matcher(code);
-        if (!startM.find())
+        if (!startM.find() || startM.start() > 100) //only first 100 characters
             return null;
         Matcher endM = Pattern.compile(commentEnd).matcher(code);
         if (!endM.find(startM.end()))

Reply via email to