Skip to content

Commit e7fcc36

Browse files
Hari Prasad KummariPaul Hohensee
authored andcommitted
8360408: [TEST] Use @requires tag instead of exiting based on "os.name" property value for sun/net/www/protocol/file/FileURLTest.java
Backport-of: d4705947d89509b235cf48328014331c9c6cee80
1 parent 67faaf1 commit e7fcc36

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

test/jdk/sun/net/www/protocol/file/FileURLTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
2525
* @test
2626
* @bug 4474391
2727
* @summary url: file:///D|/Projects/tmp/test.html: urlConnection.getInputStream() broken.
28+
* @requires os.family == "windows"
2829
*/
2930
import java.io.*;
3031
import java.net.*;
@@ -33,10 +34,7 @@ public class FileURLTest {
3334

3435
public static void main(String [] args)
3536
{
36-
String name = System.getProperty("os.name");
37-
if (name.startsWith("Windows")) {
3837
String urlStr = "file:///C|/nonexisted.txt";
39-
4038
try {
4139
URL url = new URL(urlStr);
4240
URLConnection urlConnection = url.openConnection();
@@ -49,6 +47,5 @@ public static void main(String [] args)
4947
throw new RuntimeException("Can't handle '|' in place of ':' in file urls");
5048
}
5149
}
52-
}
5350
}
5451
}

0 commit comments

Comments
 (0)