test/tools/javac/4241573/T4241573.java

changeset 882
3d45cc94ee0f
parent 554
9d9f26857129
child 1013
8eb952f43b11
     1.1 --- a/test/tools/javac/4241573/T4241573.java	Fri Feb 18 12:28:49 2011 +0000
     1.2 +++ b/test/tools/javac/4241573/T4241573.java	Fri Feb 18 08:12:06 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2009, 2011 Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -123,7 +123,7 @@
    1.11          if (!dir.mkdirs())
    1.12              throw new Exception("cannot create directories " + dir);
    1.13          for (String e: entries) {
    1.14 -            writeFile(new File(dir, getPathForEntry(e)), getBodyForEntry(e));
    1.15 +            writeFile(new File(dir, getPathForDirEntry(e)), getBodyForEntry(e));
    1.16          }
    1.17          return dir;
    1.18      }
    1.19 @@ -134,7 +134,7 @@
    1.20          try {
    1.21              JarOutputStream jos = new JarOutputStream(out);
    1.22              for (String e: entries) {
    1.23 -                jos.putNextEntry(new JarEntry(getPathForEntry(e)));
    1.24 +                jos.putNextEntry(new JarEntry(getPathForZipEntry(e)));
    1.25                  jos.write(getBodyForEntry(e).getBytes());
    1.26              }
    1.27              jos.close();
    1.28 @@ -144,11 +144,16 @@
    1.29          return jar;
    1.30      }
    1.31  
    1.32 -    /** Return the path for an entry given to createDir or createJar. */
    1.33 -    String getPathForEntry(String e) {
    1.34 +    /** Return the path for an entry given to createDir */
    1.35 +    String getPathForDirEntry(String e) {
    1.36          return e.replace(".", File.separator) + ".java";
    1.37      }
    1.38  
    1.39 +    /** Return the path for an entry given to createJar. */
    1.40 +    String getPathForZipEntry(String e) {
    1.41 +        return e.replace(".", "/") + ".java";
    1.42 +    }
    1.43 +
    1.44      /** Return the body text for an entry given to createDir or createJar. */
    1.45      String getBodyForEntry(String e) {
    1.46          int sep = e.lastIndexOf(".");

mercurial