jcabi-xml
jcabi-xml copied to clipboard
ClasspathInput.java fixes
com.jcabi.xml.ClasspathInput is currently filled with methods which are "//intentionally empty" or return null.
Some of them can be properly implemented, some of them I think should throw UnsupportedOperationException.
- Parameters
baseURIandencodingcan be specified in the constructor when instanciating the class inClasspathResolver.resolveResource:
class ClasspathResolver implements LSResourceResolver {
@Override
@SuppressWarnings("PMD.UseObjectForClearerAPI")
// @checkstyle ParameterNumber (1 line)
public LSInput resolveResource(final String type, final String namespaceuri,
final String publicid, final String systemid, final String baseuri) {
LSInput input = null;
if (systemid != null && getClass().getResource(systemid) != null) {
input = new ClasspathInput(publicid, systemid, "UTF-8", baseuri);
}
return input;
}
}
Then the getters and setters for the 2 can be properly implemented inside ClasspathInput .. also, encoding would be used by getStringData() rather than hardcoding "UTF-8" there.
- All other unimplemented setters can
throw new UnsupportedOperationException(); getCharacterStream() and getByteStream()should remain as they are or should return a mock of Reader/inputStream - they cannot throw UnsupportedOperationException since then tests fail (they are evantually called by the XML validators...)
I did these changes and the build was successfull.
@dmarkov Can you do something about this pls? Thanks.
@yegor256 please take a look at it and dispatch (see par.21)
@yegor256 Can you take a look here, pls? Thanks.
@amihaiemil thanks for the report, I topped your acc for 15 mins, payment ID AP-5X422939NA2268401