Book a Demo

Author Topic: Internal application error - GetElementByID  (Read 6644 times)

eisaachsen

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Internal application error - GetElementByID
« on: November 21, 2012, 06:27:27 am »
I am using Java to access an EA model.  Here is a small snippet of my code.  I want to be able to get a package's parent's GUID, but I get a java.lang.exception (Internal application error) when GetElementByID is called.  The parentID just before it fails is 1.  What am I doing wrong?

int parentID = pkg.GetParentID();
System.out.printf("parentID=%d\n", parentID);
Element parentElement = repository.GetElementByID(parentID);
pw.print(parentElement.GetElementGUID());

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Internal application error - GetElementByID
« Reply #1 on: November 21, 2012, 07:14:34 am »
Did you check
Code: [Select]
Element parentElement = repository.GetElementByID(parentID); returned a valid result and/or
Code: [Select]
parentElement.GetElementGUID() executes correctly?
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Internal application error - GetElementByID
« Reply #2 on: November 21, 2012, 11:37:11 am »
You've got a Package ID not an element id. You want to use GetPackageByID (which returns a Package).