Author: cziegeler
Date: Tue Mar 30 07:37:40 2010
New Revision: 929027

URL: http://svn.apache.org/viewvc?rev=929027&view=rev
Log:
SLING-1469 : Fix displaySourceFragments and let the option default to false

Modified:
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
    
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JavacErrorDetail.java

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=929027&r1=929026&r2=929027&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
 Tue Mar 30 07:37:40 2010
@@ -78,7 +78,7 @@ import org.slf4j.LoggerFactory;
    @Property(name="jasper.keepgenerated",boolValue=true),
    @Property(name="jasper.mappedfile",boolValue=true),
    @Property(name="jasper.trimSpaces",boolValue=false),
-   @Property(name="jasper.displaySourceFragments",boolValue=true)
+   @Property(name="jasper.displaySourceFragments",boolValue=false)
 })
 public class JspScriptEngineFactory
     extends AbstractScriptEngineFactory

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java?rev=929027&r1=929026&r2=929027&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspServletOptions.java
 Tue Mar 30 07:37:40 2010
@@ -157,7 +157,7 @@ public class JspServletOptions implement
      * Should we include a source fragment in exception messages, which could 
be
      * displayed to the developer ?
      */
-    private boolean displaySourceFragments = true;
+    private boolean displaySourceFragments = false;
 
     public String getProperty(String name) {
         return this.settings.getProperty(name);

Modified: 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JavacErrorDetail.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JavacErrorDetail.java?rev=929027&r1=929026&r2=929027&view=diff
==============================================================================
--- 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JavacErrorDetail.java
 (original)
+++ 
sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JavacErrorDetail.java
 Tue Mar 30 07:37:40 2010
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,6 @@
 package org.apache.sling.scripting.jsp.jasper.compiler;
 
 import java.io.BufferedReader;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -45,7 +44,7 @@ public class JavacErrorDetail {
     /**
      * Constructor.
      *
-     * @param javaFileName The name of the Java file in which the 
+     * @param javaFileName The name of the Java file in which the
      * compilation error occurred
      * @param javaLineNum The compilation error line number
      * @param errMsg The compilation error message
@@ -63,7 +62,7 @@ public class JavacErrorDetail {
     /**
      * Constructor.
      *
-     * @param javaFileName The name of the Java file in which the 
+     * @param javaFileName The name of the Java file in which the
      * compilation error occurred
      * @param javaLineNum The compilation error line number
      * @param jspFileName The name of the JSP file from which the Java source
@@ -88,30 +87,30 @@ public class JavacErrorDetail {
             int jspBeginLineNum,
             StringBuffer errMsg,
             JspCompilationContext ctxt) {
-        
+
         this(javaFileName, javaLineNum, errMsg);
         this.jspFileName = jspFileName;
         this.jspBeginLineNum = jspBeginLineNum;
-        
+
         if (jspBeginLineNum > 0 && ctxt != null) {
             InputStream is = null;
-            FileInputStream  fis = null;
-            
+            InputStream fis = null;
+
             try {
                 // Read both files in, so we can inspect them
                 is = ctxt.getResourceAsStream(jspFileName);
                 String[] jspLines = readFile(is);
-    
-                fis = new FileInputStream(ctxt.getServletJavaFileName());
+
+                fis = 
ctxt.getRuntimeContext().getIOProvider().getInputStream(ctxt.getServletJavaFileName());
                 String[] javaLines = readFile(fis);
-    
+
                 // If the line contains the opening of a multi-line scriptlet
                 // block, then the JSP line number we got back is probably
                 // faulty.  Scan forward to match the java line...
                 if (jspLines[jspBeginLineNum-1].lastIndexOf("<%") >
                     jspLines[jspBeginLineNum-1].lastIndexOf("%>")) {
                     String javaLine = javaLines[javaLineNum-1].trim();
-    
+
                     for (int i=jspBeginLineNum-1; i<jspLines.length; i++) {
                         if (jspLines[i].indexOf(javaLine) != -1) {
                             // Update jsp line number
@@ -120,13 +119,13 @@ public class JavacErrorDetail {
                         }
                     }
                 }
-    
+
                 // copy out a fragment of JSP to display to the user
                 StringBuffer fragment = new StringBuffer(1024);
                 int startIndex = Math.max(0, this.jspBeginLineNum-1-3);
                 int endIndex = Math.min(
                         jspLines.length-1, this.jspBeginLineNum-1+3);
-    
+
                 for (int i=startIndex;i<=endIndex; ++i) {
                     fragment.append(i+1);
                     fragment.append(": ");
@@ -134,7 +133,7 @@ public class JavacErrorDetail {
                     fragment.append("\n");
                 }
                 jspExtract = fragment.toString();
-    
+
             } catch (IOException ioe) {
                 // Can't read files - ignore
             } finally {
@@ -168,7 +167,7 @@ public class JavacErrorDetail {
 
     /**
      * Gets the compilation error line number.
-     * 
+     *
      * @return Compilation error line number
      */
     public int getJavaLineNumber() {
@@ -204,7 +203,7 @@ public class JavacErrorDetail {
     public String getErrorMessage() {
         return this.errMsg.toString();
     }
-    
+
     /**
      * Gets the extract of the JSP that corresponds to this message.
      *
@@ -213,7 +212,7 @@ public class JavacErrorDetail {
     public String getJspExtract() {
         return this.jspExtract;
     }
-    
+
     /**
      * Reads a text file from an input stream into a String[]. Used to read in
      * the JSP and generated Java file when generating error messages.


Reply via email to