[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Problems reading instances serialized with an old package

Though the reading does throw an exception, should not the objects in the resource still be populated with the information?


File file = new File(args[i]);
URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()): URI.createURI(args[0]);
Resource resource = null;
try {
resource = resourceSet.getResource(uri, true);
} catch (RuntimeException exception) {
exception.printStackTrace();


// An error occurred:
// org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with
// uri 'http://www.acme.com/XYZ3.2' not found.

for (EObject eObject : resource.getContents()) {
Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject);
if (diagnostic.getSeverity() != Diagnostic.OK) {
printDiagnostic(diagnostic, "");
}
}
}