Repository: aries-rsa
Updated Branches:
  refs/heads/master a421c659b -> ac635c960


[ARIES-1776] Fixes for secure tck tests


Project: http://git-wip-us.apache.org/repos/asf/aries-rsa/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-rsa/commit/ac635c96
Tree: http://git-wip-us.apache.org/repos/asf/aries-rsa/tree/ac635c96
Diff: http://git-wip-us.apache.org/repos/asf/aries-rsa/diff/ac635c96

Branch: refs/heads/master
Commit: ac635c9609c75ac31876b8c9eebe1ee0eb88cf60
Parents: a421c65
Author: Christian Schneider <cschn...@adobe.com>
Authored: Fri Feb 9 17:25:15 2018 +0100
Committer: Christian Schneider <cschn...@adobe.com>
Committed: Fri Feb 9 17:25:15 2018 +0100

----------------------------------------------------------------------
 .../rsa/provider/tcp/ser/BasicObjectInputStream.java     | 11 +++++++++--
 .../rsa/provider/tcp/ser/BasicObjectOutputStream.java    |  9 ++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/ac635c96/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
----------------------------------------------------------------------
diff --git 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
index 33c44d3..6305ea9 100644
--- 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
+++ 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectInputStream.java
@@ -22,6 +22,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectStreamClass;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.osgi.framework.Version;
 import org.slf4j.Logger;
@@ -34,7 +36,12 @@ public class BasicObjectInputStream extends 
ObjectInputStream {
 
     public BasicObjectInputStream(InputStream in, ClassLoader loader) throws 
IOException {
         super(in);
-        enableResolveObject(true);
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                enableResolveObject(true);
+                return null;
+            }
+        });
         this.loader = loader;
     }
 
@@ -45,7 +52,7 @@ public class BasicObjectInputStream extends ObjectInputStream 
{
             // Must use Class.forName instead of loader.loadClass to handle 
cases like array of user classes
             return Class.forName(className, false, loader);
         } catch (ClassNotFoundException e) {
-            log.warn("Error loading class using classloader of user bundle", 
e);
+            log.debug("Error loading class using classloader of user bundle. 
Trying our own ClassLoader now", e);
             return super.resolveClass(desc);
         }
     }

http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/ac635c96/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectOutputStream.java
----------------------------------------------------------------------
diff --git 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectOutputStream.java
 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectOutputStream.java
index 98b6248..67f1e62 100644
--- 
a/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectOutputStream.java
+++ 
b/provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/ser/BasicObjectOutputStream.java
@@ -4,6 +4,8 @@ import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.osgi.framework.Version;
 
@@ -11,7 +13,12 @@ public class BasicObjectOutputStream extends 
ObjectOutputStream {
 
     public BasicObjectOutputStream(OutputStream out) throws IOException {
         super(out);
-        enableReplaceObject(true);
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
+                enableReplaceObject(true);
+                return null;
+            }
+        });
     }
 
     @Override

Reply via email to