src/share/classes/org/openjdk/jigsaw/SimpleLibrary.java
Print this page
@@ -1157,12 +1157,11 @@
{
BufferedInputStream bin = new BufferedInputStream(is);
DataInputStream in = new DataInputStream(bin);
ModuleInfo mi = null;
try (ModuleFile.Reader mr = new ModuleFile.Reader(in)) {
- byte[] mib = mr.readStart();
- ModuleInfo moduleInfo = jms.parseModuleInfo(mib);
+ ModuleInfo moduleInfo = jms.parseModuleInfo(mr.getModuleInfoBytes());
File md = moduleDictionary.add(moduleInfo);
mi = moduleInfo;
if (verifySignature && mr.hasSignature()) {
// Verify the module signature
SignedModule sm = new SignedModule(mr);
@@ -1181,29 +1180,30 @@
// ## user to accept before proceeding.
// Verify the module header hash and the module info hash
sm.verifyHashesStart();
- // Read the rest of the hashes
- mr.readRest(md, isDeflated(), natlibs(), natcmds(), configs());
+ // Extract remainder of the module file, and calculate hashes
+ mr.extractTo(md, isDeflated(), natlibs(), natcmds(), configs());
// Verify the rest of the hashes
sm.verifyHashesRest();
// Store signer info
new Signers(md, signers).store();
} else {
- mr.readRest(md, isDeflated(), natlibs(), natcmds(), configs());
+ mr.extractTo(md, isDeflated(), natlibs(), natcmds(), configs());
}
if (strip)
strip(md);
reIndex(mi.id()); // ## Could do this while reading module file
return mi.id();
- } catch (ConfigurationException | IOException | SignatureException x) {
+ } catch (ConfigurationException | IOException | SignatureException |
+ ModuleFileParserException x) { // ## should we catch Throwable
if (mi != null) {
try {
moduleDictionary.remove(mi);
} catch (IOException y) {
x.addSuppressed(y);
@@ -1389,11 +1389,12 @@
moduleDictionary.load();
for (File mf : mfs)
mids.add(installWhileLocked(mf, verifySignature, strip));
configureWhileModuleDirectoryLocked(mids);
complete = true;
- } catch (ConfigurationException | IOException | SignatureException x) {
+ } catch (ConfigurationException | IOException | SignatureException |
+ ModuleFileParserException x) { // ## catch throwable??
try {
for (ModuleId mid : mids) {
ModuleInfo mi = readLocalModuleInfo(mid);
if (mi != null) {
moduleDictionary.remove(mi);
@@ -1411,17 +1412,19 @@
}
}
@Override
public void install(Collection<File> mfs, boolean verifySignature)
- throws ConfigurationException, IOException, SignatureException
+ throws ConfigurationException, IOException, SignatureException,
+ ModuleFileParserException
{
install(mfs, verifySignature, false);
}
// Public entry point, since the Resolver itself is package-private
//
+ @Override
public Resolution resolve(Collection<ModuleIdQuery> midqs)
throws ConfigurationException, IOException
{
try (FileChannel fc = FileChannel.open(lockf.toPath(), WRITE)) {
fc.lock();
@@ -1465,11 +1468,12 @@
// Configure
//
configureWhileModuleDirectoryLocked(res.modulesNeeded());
complete = true;
- } catch (ConfigurationException | IOException | SignatureException x) {
+ } catch (ConfigurationException | IOException | SignatureException |
+ ModuleFileParserException x) { // ## catch throwable??
try {
for (ModuleId mid : res.modulesNeeded()) {
ModuleInfo mi = readLocalModuleInfo(mid);
if (mi != null) {
moduleDictionary.remove(mi);
@@ -1487,11 +1491,12 @@
}
}
@Override
public void install(Resolution res, boolean verifySignature)
- throws ConfigurationException, IOException, SignatureException
+ throws ConfigurationException, IOException, SignatureException,
+ ModuleFileParserException
{
install(res, verifySignature, false);
}
@Override