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

rombert pushed a commit to annotated tag org.apache.sling.scripting.java-2.0.14
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-java.git

commit 5e3236f7e99bbe0d3099ad665ef3109b1e7fe43b
Author: Carsten Ziegeler <cziege...@apache.org>
AuthorDate: Mon Jan 5 16:23:39 2015 +0000

    SLING-4152 : Allow untyped configuration for JSP Compiler
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/java@1649573 
13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                   |  6 ++++++
 .../apache/sling/scripting/java/impl/CompilerOptions.java | 15 ++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index b49d209..2985536 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,12 @@
             <version>2.1.0</version>
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+               <groupId>org.apache.sling</groupId>
+               <artifactId>org.apache.sling.commons.osgi</artifactId>
+               <version>2.2.0</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.sling</groupId>
diff --git 
a/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java 
b/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
index 38ae17e..190c71f 100644
--- a/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
+++ b/src/main/java/org/apache/sling/scripting/java/impl/CompilerOptions.java
@@ -19,6 +19,7 @@ package org.apache.sling.scripting.java.impl;
 import java.util.Dictionary;
 
 import org.apache.sling.commons.compiler.Options;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 
 public class CompilerOptions extends Options {
 
@@ -34,22 +35,26 @@ public class CompilerOptions extends Options {
         final String currentVersion = 
System.getProperty("java.specification.version");
         final CompilerOptions opts = new CompilerOptions();
 
-        final Boolean classDebugInfo = 
(Boolean)props.get(JavaScriptEngineFactory.PROPERTY_CLASSDEBUGINFO);
-        opts.put(Options.KEY_GENERATE_DEBUG_INFO, classDebugInfo != null ? 
classDebugInfo : true);
+        final Boolean classDebugInfo = PropertiesUtil.toBoolean(
+                props.get(JavaScriptEngineFactory.PROPERTY_CLASSDEBUGINFO), 
true);
+        opts.put(Options.KEY_GENERATE_DEBUG_INFO, classDebugInfo);
 
-        final String sourceVM = (String) 
props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_SOURCE_V_M);
+        final String sourceVM = PropertiesUtil.toString(
+                
props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_SOURCE_V_M), null);
         opts.put(Options.KEY_SOURCE_VERSION, sourceVM != null && 
sourceVM.trim().length() > 0 ? sourceVM.trim() : 
JavaScriptEngineFactory.VERSION_AUTO);
         if ( 
JavaScriptEngineFactory.VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_SOURCE_VERSION))
 ) {
             opts.put(Options.KEY_SOURCE_VERSION, currentVersion);
         }
 
-        final String targetVM = (String) 
props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_TARGET_V_M);
+        final String targetVM = PropertiesUtil.toString(
+                
props.get(JavaScriptEngineFactory.PROPERTY_COMPILER_TARGET_V_M), null);
         opts.put(Options.KEY_TARGET_VERSION, targetVM != null && 
targetVM.trim().length() > 0 ? targetVM.trim() : 
JavaScriptEngineFactory.VERSION_AUTO);
         if ( 
JavaScriptEngineFactory.VERSION_AUTO.equalsIgnoreCase((String)opts.get(Options.KEY_TARGET_VERSION))
 ) {
             opts.put(Options.KEY_TARGET_VERSION, currentVersion);
         }
 
-        final String encoding = (String) 
props.get(JavaScriptEngineFactory.PROPERTY_ENCODING);
+        final String encoding = PropertiesUtil.toString(
+                props.get(JavaScriptEngineFactory.PROPERTY_ENCODING), null);
         opts.encoding = encoding != null && encoding.length() > 0 ? encoding : 
"UTF-8";
 
         opts.put(Options.KEY_IGNORE_WARNINGS, true);

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Reply via email to