Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes #888: Disable Security of X-Stream (#962)
JDK9, power mockito 2.0.0-beta.5 -
final class issue when mocking static method #888

Unconfigured security in X-Stream leads to error message during build:
"Security framework of XStream not initialized,
XStream is probably vulnerable."

This commit will configure XStream security by allowing all types.
  • Loading branch information
timomeinen authored and thekingn0thing committed Dec 25, 2018
1 parent dac7ca5 commit 3cf2ff7
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -33,10 +33,16 @@ public class DeepCloner implements DeepClonerSPI {
*/
public DeepCloner(ClassLoader classLoader) {
xStream = new XStream();
xStream.omitField(SingleClassloaderExecutor.class, "classloader");
disableSecurity();
xStream.omitField(SingleClassloaderExecutor.class, "classloader");
xStream.setClassLoader(classLoader);
}

private void disableSecurity() {
XStream.setupDefaultSecurity(xStream);
xStream.allowTypesByRegExp(new String[]{".*"});
}

/**
* Clone using the current ContextClassLoader.
*/
Expand Down

0 comments on commit 3cf2ff7

Please sign in to comment.