[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.ja...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jan 1 09:30:56 EST 2016


Author: rdw
Date: Fri Jan  1 09:30:55 2016
New Revision: 8063

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8063&view=rev
Log:
IDP-893 avoid using Resource.getFile()

https://issues.shibboleth.net/jira/browse/IDP-893

Where ever sensible  (so not in the installer where we know we have files) pass 
the InputStream of a resource to the helper methods rather that the File (which
may not be there)

Change one use of Resource.getFile() to Resource.getInputStream

Added:
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/impl/BasicResourceCredentialFactoryBean.javax
Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/logic/ScriptedPredicate.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/impl/BasicResourceCredentialFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/credential/impl/X509ResourceCredentialFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/security/trustengine/impl/PKIXResourceValidationInfoFactoryBean.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java?rev=8063&r1=8062&r2=8063&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java	(original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ScriptedAction.java	Fri Jan  1 09:30:55 2016
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.profile;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -98,7 +99,7 @@
      * 
      * @param object the custom object
      */
-    @Nullable public void setCustomObject(Object object) {
+    @Nullable public void setCustomObject(final Object object) {
         customObject = object;
     }
 
@@ -137,8 +138,10 @@
      */
     static ScriptedAction resourceScript(@Nonnull @NotEmpty final String engineName, @Nonnull final Resource resource)
             throws ScriptException, IOException {
-        EvaluableScript script = new EvaluableScript(engineName, resource.getFile());
-        return new ScriptedAction(script, resource.getDescription());
+        try (InputStream is = resource.getInputStream()) {
+            final EvaluableScript script = new EvaluableScript(engineName, is);
+            return new ScriptedAction(script, resource.getDescription());
+        }
     }
 
     /**
@@ -163,7 +166,7 @@
      */
     static ScriptedAction inlineScript(@Nonnull @NotEmpty final String engineName,
             @Nonnull @NotEmpty final String scriptSource) throws ScriptException {
-        EvaluableScript script = new EvaluableScript(engineName, scriptSource);
+        final EvaluableScript script = new EvaluableScript(engineName, scriptSource);
         return new ScriptedAction(script, "Inline");
     }
 
@@ -175,7 +178,7 @@
      * @throws ScriptException if the compile fails
      */
     static ScriptedAction inlineScript(@Nonnull @NotEmpty final String scriptSource) throws ScriptException {
-        EvaluableScript script = new EvaluableScript(DEFAULT_ENGINE, scriptSource);
+        final EvaluableScript script = new EvaluableScript(DEFAULT_ENGINE, scriptSource);
         return new ScriptedAction(script, "Inline");
     }
 

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java?rev=8063&r1=8062&r2=8063&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java	(original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java	Fri Jan  1 09:30:55 2016
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.profile.context.navigate;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -73,8 +74,8 @@
      * @param theScript the script we will evaluate.
      * @param extraInfo debugging information.
      */
-    protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript,
-            @Nullable String extraInfo) {

[... 535 lines stripped ...]


More information about the commits mailing list