/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6877206
* @summary JavaFileObject.toUri returns bogus URI (win)
*/
// Test URIs returned from JavacFileManager and its support classes.
// For a variety of file objects, verify the validity of FileObject.toUri()
// by verifying the URI exists and points to the same contents as the file
// object itself
public class T6877206 {
}
// names for entries to be created in directories and jar files
// test various combinations of directories and jar files, intended to
// cover all sources of URIs within JavacFileManager's support classes
for (boolean useOptimizedZip: new boolean[] { false, true }) {
for (boolean useSymbolFile: new boolean[] { false, true }) {
}
}
// Verify that we hit all the impl classes we intended
"RegularFileObject", "SymbolFileObject", "ZipFileIndexFileObject", "ZipFileObject");
// Verify that we hit the jar files we intended, specifically ct.sym as well as rt.jar
"ct.sym", "jar", "jar jar", "rt.jar");
}
// use a new file manager for each test
try {
int count = 0;
// record the file object class name for coverage checks later
count++;
}
throw new Exception("wrong number of entries found: "
} finally {
}
}
// test the validity of the result of toUri() by using URLConnection
// and comparing the results of reading from the connection with the
// result of reading from the file object directly.
if (urlconn instanceof JarURLConnection) {
// record access to the jar file for coverage checks later
}
try {
throw new Exception("data size differs: uri data "
throw new Exception("unexpected data returned at offset " + i
}
throw new AssertionError("cannot find difference");
}
} finally {
// In principle, simply closing the result of urlconn.getInputStream()
// should have been sufficient. But the internal JarURLConnection
// does not close the JarFile in an expeditious manner, thus preventing
// jtreg from deleting the jar file before starting the next test.
// Therefore we force access to the JarURLConnection to close the
// JarFile when necessary.
if (urlconn instanceof JarURLConnection) {
}
}
}
}
}
return createFileManager(false, false);
}
return createFileManager(useOptimizedZip, false);
}
if (!useSymbolFile) {
}
}
}
return dir;
}
try {
}
} finally {
}
return jar;
}
throw new Exception("can't find rt.jar");
return rt_jar;
}
byte[] data = new byte[1024];
int offset = 0;
try {
int n;
offset += n;
}
} finally {
}
}
f.getParentFile().mkdirs();
try {
} finally {
}
}
}