< prev index next >

test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  *  @bug 8021788
  27  *  @summary JarInputStream doesn't provide certificates for some file under META-INF


  28  */
  29 
  30 import java.util.jar.*;
  31 import java.io.*;
  32 import java.util.zip.ZipEntry;
  33 import java.util.zip.ZipOutputStream;
  34 
  35 public class ExtraFileInMetaInf {
  36     public static void main(String args[]) throws Exception {
  37 
  38         // Create a zip file with 2 entries
  39         try (ZipOutputStream zos =
  40                      new ZipOutputStream(new FileOutputStream("x.jar"))) {
  41             zos.putNextEntry(new ZipEntry("META-INF/SUB/file"));
  42             zos.write(new byte[10]);
  43             zos.putNextEntry(new ZipEntry("x"));
  44             zos.write(new byte[10]);
  45             zos.close();
  46         }
  47 




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8021788
  27  * @summary JarInputStream doesn't provide certificates for some file under META-INF
  28  * @modules java.base/sun.security.tools.keytool
  29  *          jdk.jartool/sun.security.tools.jarsigner
  30  */
  31 
  32 import java.util.jar.*;
  33 import java.io.*;
  34 import java.util.zip.ZipEntry;
  35 import java.util.zip.ZipOutputStream;
  36 
  37 public class ExtraFileInMetaInf {
  38     public static void main(String args[]) throws Exception {
  39 
  40         // Create a zip file with 2 entries
  41         try (ZipOutputStream zos =
  42                      new ZipOutputStream(new FileOutputStream("x.jar"))) {
  43             zos.putNextEntry(new ZipEntry("META-INF/SUB/file"));
  44             zos.write(new byte[10]);
  45             zos.putNextEntry(new ZipEntry("x"));
  46             zos.write(new byte[10]);
  47             zos.close();
  48         }
  49 


< prev index next >