use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class PHDImageFactory method getMetaImage.
private Image getMetaImage(File file, File metaFile) throws IOException, FileNotFoundException {
ImageFactory metaFactory = getMetaFactory();
Image i2;
try {
i2 = metaFactory.getImage(metaFile);
} catch (RuntimeException e) {
// javacore reader isn't that robust
FileNotFoundException ex = new FileNotFoundException(MessageFormat.format("Problem opening dump {0} metafile {1}", file, metaFile));
ex.initCause(e);
throw ex;
}
return i2;
}
use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class OpenCommand method imagesFromCommandLine.
/**
* Creates a DTFJ image from the supplied core or zip file
*/
private void imagesFromCommandLine(String[] args) {
apiLevelMajor = factory.getDTFJMajorVersion();
apiLevelMinor = factory.getDTFJMinorVersion();
out.println(Version.getAllVersionInfo(factory));
out.println("Loading image from DTFJ...\n");
try {
// default to a single image
Image[] images = new Image[1];
if (ctx.hasPropertyBeenSet(VERBOSE_MODE_PROPERTY)) {
// If we are using DDR this will enable warnings.
// (If not it's irrelevant.)
Logger.getLogger("j9ddr.view.dtfj").setLevel(Level.WARNING);
}
// at this point the existence of either -core or -zip has been checked
long current = System.currentTimeMillis();
File file1 = new File(args[0]);
if (args.length == 1) {
if (FileManager.isArchive(file1) && !ctx.hasPropertyBeenSet(LEGACY_ZIP_MODE_PROPERTY)) {
images = factory.getImagesFromArchive(file1, ctx.hasPropertyBeenSet(EXTRACT_PROPERTY));
} else {
images[0] = factory.getImage(file1);
}
} else {
File file2 = new File(args[1]);
images[0] = factory.getImage(file1, file2);
}
logger.fine(String.format("Time taken to load image %d ms", System.currentTimeMillis() - current));
for (Image image : images) {
createContexts(image, args[0]);
}
} catch (IOException e) {
out.println("Could not load dump file and/or could not load XML file: " + e.getMessage());
if (ctx.hasPropertyBeenSet(VERBOSE_MODE_PROPERTY)) {
e.printStackTrace();
}
}
}
Aggregations