This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag 
org.apache.sling.commons.fsclassloader-1.0.4
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-fsclassloader.git

commit 9def75aec29e2630fadb9ef67e08e9e5e0cf0a7d
Author: Radu Cotescu <[email protected]>
AuthorDate: Mon Feb 29 23:03:20 2016 +0000

    SLING-5573 - The File System Classloader Console Plugin should wrap long 
lines of code
    
    * added white-space: pre-wrap CSS3 property to the pre tag where the code 
is outputted
    (verified on Chrome 48, Firefox 44, IE 11, Safari 9.1)
    * minor code cleaning
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/fsclassloader@1732966
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../fsclassloader/impl/FSClassLoaderWebConsole.java    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderWebConsole.java
 
b/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderWebConsole.java
index 478c8e9..710fcdf 100644
--- 
a/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderWebConsole.java
+++ 
b/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderWebConsole.java
@@ -50,7 +50,7 @@ import org.osgi.service.component.ComponentContext;
 @Component
 @Service
 @Properties({
-               @Property(name = "service.description", value = "JSP Script 
Handler"),
+               @Property(name = "service.description", value = "Web Console 
for the FileSystem Class Loader"),
                @Property(name = "service.vendor", value = "The Apache Software 
Foundation"),
                @Property(name = "felix.webconsole.label", value = 
FSClassLoaderWebConsole.APP_ROOT),
                @Property(name = "felix.webconsole.title", value = "File System 
Class Loader"),
@@ -150,10 +150,11 @@ public class FSClassLoaderWebConsole extends 
AbstractWebConsolePlugin {
        /**
         * Activate this component. Create the root directory.
         * 
-        * @param componentContext
+        * @param componentContext the component context
         * @throws MalformedURLException
         */
        @Activate
+       @SuppressWarnings("unused")
        protected void activate(final ComponentContext componentContext)
                        throws MalformedURLException {
                // get the file root
@@ -293,8 +294,11 @@ public class FSClassLoaderWebConsole extends 
AbstractWebConsolePlugin {
        private void readFiles(File file, Map<String, ScriptFiles> scripts)
                        throws IOException {
                if (file.isDirectory()) {
-                       for (File f : file.listFiles()) {
-                               readFiles(f, scripts);
+                       File[] children = file.listFiles();
+                       if (children != null) {
+                               for (File f : children) {
+                                       readFiles(f, scripts);
+                               }
                        }
                } else {
                        String script = ScriptFiles.getScript(file);
@@ -325,7 +329,7 @@ public class FSClassLoaderWebConsole extends 
AbstractWebConsolePlugin {
                w.write("<script type=\"text/javascript\" src=\"" + RES_LOC
                                + "/prettify.js\"></script>");
                w.write("<script>$(document).ready(prettyPrint);</script>");
-               w.write("<style>.prettyprint ol.linenums > li { 
list-style-type: decimal; }</style>");
+               w.write("<style>.prettyprint ol.linenums > li { 
list-style-type: decimal; } pre.prettyprint { white-space: pre-wrap; 
}</style>");
                String file = request.getParameter("view");
                File toView = new File(root + file);
                if (!StringUtils.isEmpty(file)) {
@@ -360,9 +364,9 @@ public class FSClassLoaderWebConsole extends 
AbstractWebConsolePlugin {
                                try {
                                        is = new FileInputStream(toView);
                                        String contents = IOUtils.toString(is);
-                                       w.write("<pre class=\"prettyprint 
linenums\"><code>");
+                                       w.write("<pre class=\"prettyprint 
linenums\">");
                                        StringEscapeUtils.escapeHtml(w, 
contents);
-                                       w.write("</pre></code>");
+                                       w.write("</pre>");
                                } finally {
                                        IOUtils.closeQuietly(is);
                                }

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to