com.thoughtworks.xstream.core.util is not exported in OSGI manifest
laeubi opened this issue · 2 comments
com.thoughtworks.xstream.io.xml.PrettyPrintWriter
uses com.thoughtworks.xstream.core.util.QuickWriter
in the method:
PrettyPrintWriter#writeText
but this type is not exported in the OSGi Manifest so one can't use this type in client code.
I'm using the latest release from here:
https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream
it seems it is explicitly removed from export here:
Line 423 in d03f698
but I wonder what is the purpose of that?
Instead of experting the package, it mit be possible to have some abstraction or move QuickWriter to the com.thoughtworks.xstream.io.xml package...
Yes, that package is for private use and does not provide any API stability. So, what's your use case for QuickWriter apart from the fact that it is in a protected method?
If it is private I think it should only be used in private methods as otherwise it can drip into user-code anyways.
I'm currently using it to add a CDATA section into the emitted XML code like this:
CompactWriter compactWriter = new CompactWriter(writer) {
boolean cdata = false;
@Override
public void startNode(String name, @SuppressWarnings("rawtypes") Class clazz) {
super.startNode(name, clazz);
cdata = name.equals("sectionText");
}
@Override
protected void writeText(QuickWriter writer, String text) {
if (cdata) {
writer.write("<![CDATA[");
writer.write(text);
writer.write("]]>");
} else {
super.writeText(writer, text);
}
}
};