The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
How to load an Ioo file?
I have an ioo file that was generated by UI. I am trying to load that repo programmatically. When I try to load, I am getting NullPointerException. However when I try to load the sample data, it is able to retrieve. What is it that I am doing wrong?
Below is the sample code.
RepositoryLocation pLoc = null;
try {
pLoc = new RepositoryLocation("//NewLocalRepository//Hypo");
} catch (MalformedRepositoryLocationException ex) {
ex.printStackTrace();
}
IOObjectEntry entry = (IOObjectEntry) pLoc.locateEntry();
IOObject myIOObject = entry.retrieveData(null);
IOContainer ioInput = new IOContainer(new IOObject[]{myIOObject});
ExampleSet examples = ioInput.get(ExampleSet.class);
Below is the sample code.
RepositoryLocation pLoc = null;
try {
pLoc = new RepositoryLocation("//NewLocalRepository//Hypo");
} catch (MalformedRepositoryLocationException ex) {
ex.printStackTrace();
}
IOObjectEntry entry = (IOObjectEntry) pLoc.locateEntry();
IOObject myIOObject = entry.retrieveData(null);
IOContainer ioInput = new IOContainer(new IOObject[]{myIOObject});
ExampleSet examples = ioInput.get(ExampleSet.class);
Tagged:
0
Answers
sorry I somehow missed the question..
The problem is that returns null when the entry could not be found. In your case the entry could not be found because you have too many '/' in the RepositoryLocation. Only at the beginning '//' is needed, otherwise the seperator is simply '/'.
Change the line to and it should work.
Regards,
Marco