author | weijun |
Thu, 18 Jul 2019 08:53:06 +0800 | |
changeset 57488 | 94691d8e746f |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
1 |
/* |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
4 |
* |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
8 |
* |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
13 |
* accompanied this code). |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
14 |
* |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
18 |
* |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
21 |
* questions. |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
22 |
*/ |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
23 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
24 |
/* |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
25 |
* A helper that is used for creating HTML elements. |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
26 |
*/ |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
27 |
public class HtmlHelper { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
28 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
29 |
private static final String STYLE |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
30 |
= "style=\"font-family: Courier New; " |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
31 |
+ "font-size: 12px; " |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
32 |
+ "white-space: pre-wrap\""; |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
33 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
34 |
public static String htmlRow(String... values) { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
35 |
StringBuilder row = new StringBuilder(); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
36 |
row.append(startTr()); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
37 |
for (String value : values) { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
38 |
row.append(startTd()); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
39 |
row.append(value); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
40 |
row.append(endTd()); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
41 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
42 |
row.append(endTr()); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
43 |
return row.toString(); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
44 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
45 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
46 |
public static String startHtml() { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
47 |
return startTag("html"); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
48 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
49 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
50 |
public static String endHtml() { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
51 |
return endTag("html"); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
52 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
53 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
54 |
public static String startPre() { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
55 |
return startTag("pre " + STYLE); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
56 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
57 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
58 |
public static String endPre() { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
59 |
return endTag("pre"); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
60 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
61 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
62 |
public static String startTable() { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
63 |
return startTag("table border=\"1\" padding=\"1\" cellspacing=\"0\" " + STYLE); |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
64 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
65 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
66 |
public static String endTable() { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
67 |
return endTag("table"); |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
68 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
69 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
70 |
public static String startTr() { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
71 |
return "\t" + startTag("tr") + "\n"; |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
72 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
73 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
74 |
public static String endTr() { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
75 |
return "\t" + endTag("tr") + "\n"; |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
76 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
77 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
78 |
public static String startTd() { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
79 |
return "\t\t" + startTag("td"); |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
80 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
81 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
82 |
public static String endTd() { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
83 |
return endTag("td") + "\n"; |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
84 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
85 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
86 |
public static String startTag(String tag) { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
87 |
return "<" + tag + ">"; |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
88 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
89 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
90 |
public static String endTag(String tag) { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
91 |
return "</" + tag + ">"; |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
92 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
93 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
94 |
public static String anchorName(String name, String text) { |
57488
94691d8e746f
8217375: jarsigner breaks old signature with long lines in manifest
weijun
parents:
47216
diff
changeset
|
95 |
return "<a name=" + name + "><hr/>" + text + "</a>"; |
46156
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
96 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
97 |
|
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
98 |
public static String anchorLink(String file, String anchorName, |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
99 |
String text) { |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
100 |
return "<a href=" + file + "#" + anchorName + ">" + text + "</a>"; |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
101 |
} |
79e8a865c5b8
8179614: Test for jarsigner on verifying jars that are signed and timestamped by other JDK releases
mli
parents:
diff
changeset
|
102 |
} |