Skip to content

Commit

Permalink
Fix incompatibility with xstream 1.4.18
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed Dec 20, 2021
1 parent 45b0c37 commit a2c03c9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
import javax.ws.rs.ext.Provider;

import org.sonatype.nexus.client.internal.util.Check;
import org.sonatype.nexus.rest.model.NexusResponse;

import com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.CompactWriter;
import com.thoughtworks.xstream.security.TypeHierarchyPermission;
import com.thoughtworks.xstream.security.WildcardTypePermission;

/**
* Jersey provider that uses XStream, as we want to use the same tech (as we have all the config bits already) on
Expand All @@ -52,6 +55,9 @@ public class XStreamXmlProvider
private final XStream xstream;

public XStreamXmlProvider(final XStream xstream, final MediaType xstreamMediaType) {
xstream.addPermission(new TypeHierarchyPermission(NexusResponse.class));
xstream.addPermission(new WildcardTypePermission(new String[]{"com.sonatype.nexus.staging.api.dto.*"}));

this.xstream = Check.notNull(xstream, XStream.class);
this.xstreamMediaType = Check.notNull(xstreamMediaType, MediaType.class);
}
Expand Down Expand Up @@ -105,4 +111,4 @@ public long getSize(Object o, Class<?> type, Type genericType, Annotation[] anno
return -1;
}
}
}
}

0 comments on commit a2c03c9

Please sign in to comment.