Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » arrayIndexOutOfBound Exception with ResourceSet.getResource(My model loader throws and exception when I'm trying to read a uml model)
arrayIndexOutOfBound Exception with ResourceSet.getResource [message #1834802] Wed, 18 November 2020 09:19 Go to next message
Hira Naveed is currently offline Hira NaveedFriend
Messages: 1
Registered: November 2020
Junior Member
public class ModelLoader {
private final ResourceSet RESOURCE_SET;
public ModelLoader() {
RESOURCE_SET = new ResourceSetImpl();

public Object loadModel(String uri){
URI modelUri = URI.createURI(uri);
String relPath = null;
try {
relPath = new File(".").getCanonicalPath();
} catch (IOException e1) {
Resource resource = null;
try {
resource = RESOURCE_SET.getResource(modelUri, true); //ERROR occurs here

catch (Exception e) {

//some code

return result;

public class UMLClassDiagramReader {
ModelLoader umlModel = new ModelLoader();

String uri = null;
try {
uri = umlModel.getFileURI(umlFilePath);
} catch (Exception e) {
//other code to read class

Added a uml file I'm trying to read

Stack Trace
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 4
at org.eclipse.emf.common.util.BasicEList.get(
at org.eclipse.uml2.uml.internal.resource.UML22UMLHandler.createObject(
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(
at java.xml/
at java.xml/
at java.xml/$
at java.xml/
at java.xml/
at java.xml/
at java.xml/
at java.xml/
at java.xml/
at java.xml/$JAXPSAXParser.parse(
at java.xml/
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(
at mdse.emf.util.ModelLoader.loadModel(
at mdse.emf.main.UMLClassDiagramReader.ReadClassDiagram(
at mdse.emf.main.UMLObjectDiagramCreator.objectDiagramCreator(
at mdse.emf.main.Runner$
at java.base/java.util.concurrent.Executors$
at java.base/java.util.concurrent.FutureTask.runAndReset(
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.base/java.util.concurrent.ThreadPoolExecutor$
at java.base/
  • Attachment: Package.uml
    (Size: 1.18KB, Downloaded 64 times)
Re: arrayIndexOutOfBound Exception with ResourceSet.getResource [message #1834825 is a reply to message #1834802] Wed, 18 November 2020 16:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 32508
Registered: July 2009
Senior Member
The code here rg.eclipse.uml2.uml.internal.resource.UML22UMLHandler.createObject( is not provided by EMF so I can't comment on what's going on here.

It's probably better to ask on the UML2 forum:

Ed Merks
Professional Support:
Previous Topic:[CDO] Some observations after upgrading to the current integration build
Next Topic:Parsing of xml with xs:any element with different namespaces
Goto Forum:

Current Time: Thu Oct 06 15:12:49 GMT 2022

Powered by FUDForum. Page generated in 0.01790 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top