Skip to content
Snippets Groups Projects
Commit 6a4f4e3e authored by Dominique Marcadet's avatar Dominique Marcadet
Browse files

add a check for null prefix in CimXMLHandler.getFeature()

parent 47296702
No related branches found
No related tags found
1 merge request!10Resolve "CimXMLHandler. getFeature() may be called with a null prefix"
Pipeline #1105 passed
......@@ -155,21 +155,24 @@ public abstract class CimXMLHandler extends SAXXMLHandler {
@Override
protected void handleUnknownFeature( String prefix, String name, boolean isElement, EObject peekObject, String value ) {
// TODO
// TODO: some RiseClipse specific message ?
super.handleUnknownFeature( prefix, name, isElement, peekObject, value );
}
@Override
protected EStructuralFeature getFeature( EObject object, String prefix, String name, boolean isElement ) {
String uri = helper.getURI( prefix );
if( CimConstants.rdfURI.equals( uri ) && CimConstants.nameRdfAbout.equals( name )) {
// We consider that rdf:about is the same as rdf:ID for the purpose of reading files.
// But, such an object will have to be merged with the real object when all
// resources are loaded.
// This is only valid for CimObject, not for FullModel in header !
if( object.eClass().getEPackage() != ModelDescriptionPackage.eINSTANCE ) {
(( CimResourceImpl ) xmlResource ).addForeignObject( object );
name = CimConstants.nameRdfID;
// May be called with null prefix (see XMLHandler.handleFeature(String prefix, String name))
if( prefix != null ) {
String uri = helper.getURI( prefix );
if( CimConstants.rdfURI.equals( uri ) && CimConstants.nameRdfAbout.equals( name )) {
// We consider that rdf:about is the same as rdf:ID for the purpose of reading files.
// But, such an object will have to be merged with the real object when all
// resources are loaded.
// This is only valid for CimObject, not for FullModel in header !
if( object.eClass().getEPackage() != ModelDescriptionPackage.eINSTANCE ) {
(( CimResourceImpl ) xmlResource ).addForeignObject( object );
name = CimConstants.nameRdfID;
}
}
}
return super.getFeature( object, prefix, name, isElement );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment