src/share/classes/org/openjdk/jigsaw/cli/Librarian.java
Print this page
*** 153,180 ****
{
noDry();
while (hasArg()) {
File module = new File(takeArg());
File destination = null;
! try (FileInputStream fis = new FileInputStream(module);
! DataInputStream dis = new DataInputStream(fis);
! ModuleFile.Reader reader = new ModuleFile.Reader(dis)) {
! ModuleInfo mi = jms.parseModuleInfo(reader.readStart());
destination = new File(mi.id().name());
Path path = destination.toPath();
Files.deleteIfExists(path);
Files.createDirectory(path);
! reader.readRest(destination, false);
! }
! catch (IOException x) {
// Try to cleanup if an exception is thrown
if (destination != null && destination.exists())
try {
FilePaths.deleteTree(destination.toPath());
! }
! catch (IOException y) {
throw (Command.Exception)
new Command.Exception(y).initCause(x);
}
throw new Command.Exception(x);
}
--- 153,177 ----
{
noDry();
while (hasArg()) {
File module = new File(takeArg());
File destination = null;
! try (FileInputStream fis = new FileInputStream(module)) {
! ModuleFile.Reader reader = new ModuleFile.Reader(fis);
! ModuleInfo mi = jms.parseModuleInfo(reader.getModuleInfoBytes());
destination = new File(mi.id().name());
Path path = destination.toPath();
Files.deleteIfExists(path);
Files.createDirectory(path);
! reader.extractTo(destination, false);
! } catch (IOException | ModuleFileParserException x) {
// Try to cleanup if an exception is thrown
if (destination != null && destination.exists())
try {
FilePaths.deleteTree(destination.toPath());
! } catch (IOException y) {
throw (Command.Exception)
new Command.Exception(y).initCause(x);
}
throw new Command.Exception(x);
}
*** 203,216 ****
if (mfs.isEmpty())
throw new Command.Exception("%s: no module-name specified",
command);
try {
lib.installFromManifests(mfs, strip);
! } catch (ConfigurationException x) {
throw new Command.Exception(x);
- } catch (IOException x) {
- throw new Command.Exception(x);
}
return;
}
// Install one or more module file(s)
--- 200,211 ----
if (mfs.isEmpty())
throw new Command.Exception("%s: no module-name specified",
command);
try {
lib.installFromManifests(mfs, strip);
! } catch (ConfigurationException | IOException x) {
throw new Command.Exception(x);
}
return;
}
// Install one or more module file(s)
*** 222,237 ****
while (hasArg())
fs.add(new File(takeArg()));
finishArgs();
try {
lib.install(fs, verifySignature, strip);
! } catch (ConfigurationException x) {
throw new Command.Exception(x);
- } catch (IOException x) {
- throw new Command.Exception(x);
- } catch (SignatureException x) {
- throw new Command.Exception(x);
}
return;
}
// Otherwise treat args as module-id queries
--- 217,229 ----
while (hasArg())
fs.add(new File(takeArg()));
finishArgs();
try {
lib.install(fs, verifySignature, strip);
! } catch (ConfigurationException | IOException |
! SignatureException | ModuleFileParserException x) {
throw new Command.Exception(x);
}
return;
}
// Otherwise treat args as module-id queries
*** 267,277 ****
res.spaceRequired());
}
if (dry)
return;
lib.install(res, verifySignature, strip);
! } catch (ConfigurationException | IOException | SignatureException x) {
throw new Command.Exception(x);
}
}
}
--- 259,270 ----
res.spaceRequired());
}
if (dry)
return;
lib.install(res, verifySignature, strip);
! } catch (ConfigurationException | IOException | SignatureException |
! ModuleFileParserException x) {
throw new Command.Exception(x);
}
}
}