More informational error report from structural synchronization property serialization
Currently Serializer.serialize(SynchronizationEventHandler handler, Variable var, String name) produces quite non-informative errors into its reports when serialization of a property fails. It provides absolutely no context where the serialization fails.
There is clearly a Variable var
input for the function but its URI is not reported at all.
This changes the report to contain a simplified version of the URI based on the following code:
private static final String DEFAULT_PREFIX = "http://Projects/Development%20Project/";
private static final String simplifiedURI(String uri) {
return uri != null
? uri.startsWith(DEFAULT_PREFIX)
? uri.substring(DEFAULT_PREFIX.length())
: uri
: null;
}
private static final String getSafeURI(ReadGraph graph, Variable var) throws DatabaseException {
try {
return var.getURI(graph);
} catch (DatabaseException e) {
return null;
}
}
This change will allow end users to help themselves instead of having to ask developers where the problem is who always do the same snooping.