FELIX-5120 - ScriptEngineManager not able to parse service file with comments at end of classname

Handle the case where service class line has a comment at the end

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1717206 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/script-console/src/main/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManager.java b/webconsole-plugins/script-console/src/main/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManager.java
index 1a2d7e7..ce335e2 100644
--- a/webconsole-plugins/script-console/src/main/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManager.java
+++ b/webconsole-plugins/script-console/src/main/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManager.java
@@ -261,6 +261,12 @@
         {
             if (!line.startsWith("#") && line.trim().length() > 0)
             {
+                int indexOfHash = line.indexOf('#');
+                if (indexOfHash >= 0)
+                {
+                    line = line.substring(0, indexOfHash);
+                }
+                line = line.trim();
                 classNames.add(line);
             }
         }
diff --git a/webconsole-plugins/script-console/src/test/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManagerTest.java b/webconsole-plugins/script-console/src/test/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManagerTest.java
index bb14bfc..247303e 100644
--- a/webconsole-plugins/script-console/src/test/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManagerTest.java
+++ b/webconsole-plugins/script-console/src/test/java/org/apache/felix/webconsole/plugins/scriptconsole/internal/ScriptEngineManagerTest.java
@@ -23,7 +23,6 @@
 import java.io.StringReader;
 import java.util.List;
 
-import org.junit.Ignore;
 import org.junit.Test;
 
 import static java.util.Arrays.asList;
@@ -49,7 +48,6 @@
         assertEquals(asList("org.codehaus.groovy.jsr223.GroovyScriptEngineFactory"),classNames);
     }
 
-    @Ignore("FELIX-5120")
     @Test
     public void configWithCommentAtEnd() throws Exception
     {
@@ -60,6 +58,5 @@
                 "\n";
         List<String> classNames = ScriptEngineManager.getClassNames(new BufferedReader(new StringReader(config)));
         assertEquals(asList("com.sun.script.javascript.RhinoScriptEngineFactory"),classNames);
-
     }
 }