8177640: jdk/internal/util/jar/TestVersionedStream.java fails on Windows
Reviewed-by: psandoz
This commit is contained in:
parent
c7743f7698
commit
779aa6fe36
@ -284,8 +284,6 @@ com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-
|
|||||||
|
|
||||||
java/util/BitSet/BitSetStreamTest.java 8079538 generic-all
|
java/util/BitSet/BitSetStreamTest.java 8079538 generic-all
|
||||||
|
|
||||||
jdk/internal/util/jar/TestVersionedStream.java 8177640 windows-all
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# jdk_instrument
|
# jdk_instrument
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -40,7 +40,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.net.URI;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -168,23 +167,23 @@ public class TestVersionedStream {
|
|||||||
|
|
||||||
// verify the contents
|
// verify the contents
|
||||||
Map<String,String> contents = new HashMap<>();
|
Map<String,String> contents = new HashMap<>();
|
||||||
contents.put("p/Bar.class", "base/p/Bar.class\n");
|
contents.put("p/Bar.class", "base/p/Bar.class");
|
||||||
contents.put("p/Main.class", "base/p/Main.class\n");
|
contents.put("p/Main.class", "base/p/Main.class");
|
||||||
switch (version.major()) {
|
switch (version.major()) {
|
||||||
case 8:
|
case 8:
|
||||||
contents.put("p/Foo.class", "base/p/Foo.class\n");
|
contents.put("p/Foo.class", "base/p/Foo.class");
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
contents.put("p/Foo.class", "v9/p/Foo.class\n");
|
contents.put("p/Foo.class", "v9/p/Foo.class");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
contents.put("p/Foo.class", "v10/p/Foo.class\n");
|
contents.put("p/Foo.class", "v10/p/Foo.class");
|
||||||
contents.put("q/Bar.class", "v10/q/Bar.class\n");
|
contents.put("q/Bar.class", "v10/q/Bar.class");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
contents.put("p/Bar.class", "v11/p/Bar.class\n");
|
contents.put("p/Bar.class", "v11/p/Bar.class");
|
||||||
contents.put("p/Foo.class", "v11/p/Foo.class\n");
|
contents.put("p/Foo.class", "v11/p/Foo.class");
|
||||||
contents.put("q/Bar.class", "v10/q/Bar.class\n");
|
contents.put("q/Bar.class", "v10/q/Bar.class");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.fail("Test out of date, please add more cases");
|
Assert.fail("Test out of date, please add more cases");
|
||||||
@ -196,7 +195,7 @@ public class TestVersionedStream {
|
|||||||
Assert.assertTrue(i != -1, name + " not in enames");
|
Assert.assertTrue(i != -1, name + " not in enames");
|
||||||
JarEntry je = versionedEntries.get(i);
|
JarEntry je = versionedEntries.get(i);
|
||||||
try (InputStream is = jf.getInputStream(je)) {
|
try (InputStream is = jf.getInputStream(je)) {
|
||||||
String s = new String(is.readAllBytes());
|
String s = new String(is.readAllBytes()).replaceAll(System.lineSeparator(), "");
|
||||||
Assert.assertTrue(s.endsWith(e.getValue()), s);
|
Assert.assertTrue(s.endsWith(e.getValue()), s);
|
||||||
} catch (IOException x) {
|
} catch (IOException x) {
|
||||||
throw new UncheckedIOException(x);
|
throw new UncheckedIOException(x);
|
||||||
@ -208,16 +207,13 @@ public class TestVersionedStream {
|
|||||||
private void createFiles(String... files) {
|
private void createFiles(String... files) {
|
||||||
ArrayList<String> list = new ArrayList();
|
ArrayList<String> list = new ArrayList();
|
||||||
Arrays.stream(files)
|
Arrays.stream(files)
|
||||||
.map(f -> "file:///" + userdir + "/" + f)
|
.map(f -> Paths.get(userdir.toAbsolutePath().toString(), f))
|
||||||
.map(f -> URI.create(f))
|
|
||||||
.filter(u -> u != null)
|
|
||||||
.map(u -> Paths.get(u))
|
|
||||||
.forEach(p -> {
|
.forEach(p -> {
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(p.getParent());
|
Files.createDirectories(p.getParent());
|
||||||
Files.createFile(p);
|
Files.createFile(p);
|
||||||
list.clear();
|
list.clear();
|
||||||
list.add(p.toString());
|
list.add(p.toString().replace(File.separatorChar, '/'));
|
||||||
Files.write(p, list);
|
Files.write(p, list);
|
||||||
} catch (IOException x) {
|
} catch (IOException x) {
|
||||||
throw new UncheckedIOException(x);
|
throw new UncheckedIOException(x);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user