author | tschatzl |
Mon, 24 Aug 2015 16:32:50 +0200 | |
changeset 32390 | b0f6868d46ee |
parent 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
1722 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
1722 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
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 |
* |
|
5506 | 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. |
|
1722 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 6731826 |
|
27 |
* @summary There should be no RuntimeException. |
|
28 |
* @run main TestRaceCond |
|
29 |
*/ |
|
30 |
||
31 |
import javax.print.PrintService; |
|
32 |
import javax.print.PrintServiceLookup; |
|
33 |
||
34 |
||
35 |
public class TestRaceCond { |
|
36 |
||
37 |
public static void main(String argv[]) { |
|
38 |
trial(); |
|
39 |
} |
|
40 |
||
41 |
static void trial() { |
|
42 |
PrintService pserv1 = PrintServiceLookup.lookupDefaultPrintService(); |
|
43 |
PrintService[] pservs = PrintServiceLookup.lookupPrintServices(null, null); |
|
44 |
PrintService pserv2 = PrintServiceLookup.lookupDefaultPrintService(); |
|
45 |
||
2697
b27edaf0767e
6821495: test/java/awt/print/PrinterJob/PrtException.java fails
jgodinez
parents:
1722
diff
changeset
|
46 |
if ((pserv1 == null) || (pserv2==null)) { |
b27edaf0767e
6821495: test/java/awt/print/PrinterJob/PrtException.java fails
jgodinez
parents:
1722
diff
changeset
|
47 |
return; |
b27edaf0767e
6821495: test/java/awt/print/PrinterJob/PrtException.java fails
jgodinez
parents:
1722
diff
changeset
|
48 |
} |
b27edaf0767e
6821495: test/java/awt/print/PrinterJob/PrtException.java fails
jgodinez
parents:
1722
diff
changeset
|
49 |
|
1722 | 50 |
if (pserv1.hashCode() != pserv2.hashCode()) { |
51 |
throw new RuntimeException("Different hashCodes for equal print " |
|
52 |
+ "services: " + pserv1.hashCode() + " " |
|
53 |
+ pserv2.hashCode()); |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |