--- old/src/share/classes/org/openjdk/jigsaw/SimpleLibrary.java Fri Jun 15 22:43:46 2012 +++ new/src/share/classes/org/openjdk/jigsaw/SimpleLibrary.java Fri Jun 15 22:43:45 2012 @@ -1159,8 +1159,7 @@ 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()) { @@ -1183,8 +1182,8 @@ // 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(); @@ -1192,7 +1191,7 @@ // 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) @@ -1201,7 +1200,8 @@ 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); @@ -1391,7 +1391,8 @@ 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); @@ -1413,7 +1414,8 @@ @Override public void install(Collection mfs, boolean verifySignature) - throws ConfigurationException, IOException, SignatureException + throws ConfigurationException, IOException, SignatureException, + ModuleFileParserException { install(mfs, verifySignature, false); } @@ -1420,6 +1422,7 @@ // Public entry point, since the Resolver itself is package-private // + @Override public Resolution resolve(Collection midqs) throws ConfigurationException, IOException { @@ -1467,7 +1470,8 @@ // 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); @@ -1489,7 +1493,8 @@ @Override public void install(Resolution res, boolean verifySignature) - throws ConfigurationException, IOException, SignatureException + throws ConfigurationException, IOException, SignatureException, + ModuleFileParserException { install(res, verifySignature, false); } @@ -1568,7 +1573,7 @@ throw new ConfigurationException(mid + ": being used by " + rootid); } - } + } } }