Permalink
Browse files

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 thekingnothing committed Dec 25, 2018
1 parent dac7ca5 commit 3cf2ff753bc32ee35b192e3341ec3c9e61659ac9
@@ -33,10 +33,16 @@
*/
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.
*/

0 comments on commit 3cf2ff7

Please sign in to comment.