test/org/openjdk/jigsaw/cli/ModuleFormatHeaderHashTest.java

Print this page

        

@@ -87,16 +87,17 @@
     }
 
     /**
      * Hash a module file (without the file hash in the module file header).
      */
+    static final int LENGTH_WITHOUT_HASH = 30; // computed from module-file format
     byte [] hash(String name, String version, String digest) throws Exception {
         String fname = moduleDir + File.separator + name + "@" + version + ".jmod";
         MessageDigest md = MessageDigest.getInstance(digest);
         try (FileInputStream fis = new FileInputStream(fname);
              DigestInputStream dis = new DigestInputStream(fis, md)) {
-            dis.read(new byte[ModuleFile.ModuleFileHeader.LENGTH_WITHOUT_HASH]);
+            dis.read(new byte[LENGTH_WITHOUT_HASH]);
             dis.on(false);
             dis.read(new byte [md.getDigestLength()]);
             dis.on(true);
             for (int c = dis.read() ; c != -1 ; c = dis.read())
                 ;