author | alanb |
Mon, 21 Jan 2013 23:21:15 -0500 | |
changeset 15683 | 3acd10709925 |
parent 8993 | 9076d969ffdf |
child 16731 | c6f7eeb4acc0 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
2 |
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.misc; |
|
27 |
import java.io.PrintStream; |
|
28 |
||
29 |
public class Version { |
|
30 |
||
31 |
||
32 |
private static final String launcher_name = |
|
33 |
"@@launcher_name@@"; |
|
34 |
||
35 |
private static final String java_version = |
|
36 |
"@@java_version@@"; |
|
37 |
||
38 |
private static final String java_runtime_name = |
|
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
39 |
"@@java_runtime_name@@"; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
40 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
41 |
private static final String java_profile_name = |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
42 |
"@@java_profile_name@@"; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
43 |
|
2 | 44 |
private static final String java_runtime_version = |
45 |
"@@java_runtime_version@@"; |
|
46 |
||
47 |
static { |
|
48 |
init(); |
|
49 |
} |
|
50 |
||
51 |
public static void init() { |
|
52 |
System.setProperty("java.version", java_version); |
|
53 |
System.setProperty("java.runtime.version", java_runtime_version); |
|
54 |
System.setProperty("java.runtime.name", java_runtime_name); |
|
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
55 |
if (java_profile_name.length() > 0) |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
56 |
System.setProperty("java.runtime.profile", java_profile_name); |
2 | 57 |
} |
58 |
||
59 |
private static boolean versionsInitialized = false; |
|
60 |
private static int jvm_major_version = 0; |
|
61 |
private static int jvm_minor_version = 0; |
|
62 |
private static int jvm_micro_version = 0; |
|
63 |
private static int jvm_update_version = 0; |
|
64 |
private static int jvm_build_number = 0; |
|
65 |
private static String jvm_special_version = null; |
|
66 |
private static int jdk_major_version = 0; |
|
67 |
private static int jdk_minor_version = 0; |
|
68 |
private static int jdk_micro_version = 0; |
|
69 |
private static int jdk_update_version = 0; |
|
70 |
private static int jdk_build_number = 0; |
|
71 |
private static String jdk_special_version = null; |
|
72 |
||
73 |
/** |
|
74 |
* In case you were wondering this method is called by java -version. |
|
75 |
* Sad that it prints to stderr; would be nicer if default printed on |
|
76 |
* stdout. |
|
77 |
*/ |
|
78 |
public static void print() { |
|
79 |
print(System.err); |
|
80 |
} |
|
81 |
||
82 |
/** |
|
83 |
* This is the same as print except that it adds an extra line-feed |
|
84 |
* at the end, typically used by the -showversion in the launcher |
|
85 |
*/ |
|
86 |
public static void println() { |
|
87 |
print(System.err); |
|
88 |
System.err.println(); |
|
89 |
} |
|
90 |
||
91 |
/** |
|
92 |
* Give a stream, it will print version info on it. |
|
93 |
*/ |
|
94 |
public static void print(PrintStream ps) { |
|
8993
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
95 |
boolean isHeadless = false; |
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
96 |
|
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
97 |
/* Report that we're running headless if the property is true */ |
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
98 |
String headless = System.getProperty("java.awt.headless"); |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
99 |
if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) { |
8993
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
100 |
isHeadless = true; |
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
101 |
} |
8993
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
102 |
|
2 | 103 |
/* First line: platform version. */ |
104 |
ps.println(launcher_name + " version \"" + java_version + "\""); |
|
105 |
||
106 |
/* Second line: runtime version (ie, libraries). */ |
|
8993
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
107 |
|
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
108 |
ps.print(java_runtime_name + " (build " + java_runtime_version); |
8993
9076d969ffdf
7025066: Build systems changes to support SE Embedded Integration
dholmes
parents:
5506
diff
changeset
|
109 |
|
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
110 |
if (java_profile_name.length() > 0) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
111 |
// profile name |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
112 |
ps.print(", profile " + java_profile_name); |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
113 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
114 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
115 |
if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
116 |
// embedded builds report headless state |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
117 |
ps.print(", headless"); |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
118 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
119 |
ps.println(')'); |
2 | 120 |
|
121 |
/* Third line: JVM information. */ |
|
122 |
String java_vm_name = System.getProperty("java.vm.name"); |
|
123 |
String java_vm_version = System.getProperty("java.vm.version"); |
|
124 |
String java_vm_info = System.getProperty("java.vm.info"); |
|
125 |
ps.println(java_vm_name + " (build " + java_vm_version + ", " + |
|
126 |
java_vm_info + ")"); |
|
127 |
} |
|
128 |
||
129 |
||
130 |
/** |
|
131 |
* Returns the major version of the running JVM if it's 1.6 or newer |
|
132 |
* or any RE VM build. It will return 0 if it's an internal 1.5 or |
|
133 |
* 1.4.x build. |
|
134 |
* |
|
135 |
* @since 1.6 |
|
136 |
*/ |
|
137 |
public static synchronized int jvmMajorVersion() { |
|
138 |
if (!versionsInitialized) { |
|
139 |
initVersions(); |
|
140 |
} |
|
141 |
return jvm_major_version; |
|
142 |
} |
|
143 |
||
144 |
/** |
|
145 |
* Returns the minor version of the running JVM if it's 1.6 or newer |
|
146 |
* or any RE VM build. It will return 0 if it's an internal 1.5 or |
|
147 |
* 1.4.x build. |
|
148 |
* @since 1.6 |
|
149 |
*/ |
|
150 |
public static synchronized int jvmMinorVersion() { |
|
151 |
if (!versionsInitialized) { |
|
152 |
initVersions(); |
|
153 |
} |
|
154 |
return jvm_minor_version; |
|
155 |
} |
|
156 |
||
157 |
||
158 |
/** |
|
159 |
* Returns the micro version of the running JVM if it's 1.6 or newer |
|
160 |
* or any RE VM build. It will return 0 if it's an internal 1.5 or |
|
161 |
* 1.4.x build. |
|
162 |
* @since 1.6 |
|
163 |
*/ |
|
164 |
public static synchronized int jvmMicroVersion() { |
|
165 |
if (!versionsInitialized) { |
|
166 |
initVersions(); |
|
167 |
} |
|
168 |
return jvm_micro_version; |
|
169 |
} |
|
170 |
||
171 |
/** |
|
172 |
* Returns the update release version of the running JVM if it's |
|
173 |
* a RE build. It will return 0 if it's an internal build. |
|
174 |
* @since 1.6 |
|
175 |
*/ |
|
176 |
public static synchronized int jvmUpdateVersion() { |
|
177 |
if (!versionsInitialized) { |
|
178 |
initVersions(); |
|
179 |
} |
|
180 |
return jvm_update_version; |
|
181 |
} |
|
182 |
||
183 |
public static synchronized String jvmSpecialVersion() { |
|
184 |
if (!versionsInitialized) { |
|
185 |
initVersions(); |
|
186 |
} |
|
187 |
if (jvm_special_version == null) { |
|
188 |
jvm_special_version = getJvmSpecialVersion(); |
|
189 |
} |
|
190 |
return jvm_special_version; |
|
191 |
} |
|
192 |
public static native String getJvmSpecialVersion(); |
|
193 |
||
194 |
/** |
|
195 |
* Returns the build number of the running JVM if it's a RE build |
|
196 |
* It will return 0 if it's an internal build. |
|
197 |
* @since 1.6 |
|
198 |
*/ |
|
199 |
public static synchronized int jvmBuildNumber() { |
|
200 |
if (!versionsInitialized) { |
|
201 |
initVersions(); |
|
202 |
} |
|
203 |
return jvm_build_number; |
|
204 |
} |
|
205 |
||
206 |
/** |
|
207 |
* Returns the major version of the running JDK. |
|
208 |
* |
|
209 |
* @since 1.6 |
|
210 |
*/ |
|
211 |
public static synchronized int jdkMajorVersion() { |
|
212 |
if (!versionsInitialized) { |
|
213 |
initVersions(); |
|
214 |
} |
|
215 |
return jdk_major_version; |
|
216 |
} |
|
217 |
||
218 |
/** |
|
219 |
* Returns the minor version of the running JDK. |
|
220 |
* @since 1.6 |
|
221 |
*/ |
|
222 |
public static synchronized int jdkMinorVersion() { |
|
223 |
if (!versionsInitialized) { |
|
224 |
initVersions(); |
|
225 |
} |
|
226 |
return jdk_minor_version; |
|
227 |
} |
|
228 |
||
229 |
/** |
|
230 |
* Returns the micro version of the running JDK. |
|
231 |
* @since 1.6 |
|
232 |
*/ |
|
233 |
public static synchronized int jdkMicroVersion() { |
|
234 |
if (!versionsInitialized) { |
|
235 |
initVersions(); |
|
236 |
} |
|
237 |
return jdk_micro_version; |
|
238 |
} |
|
239 |
||
240 |
/** |
|
241 |
* Returns the update release version of the running JDK if it's |
|
242 |
* a RE build. It will return 0 if it's an internal build. |
|
243 |
* @since 1.6 |
|
244 |
*/ |
|
245 |
public static synchronized int jdkUpdateVersion() { |
|
246 |
if (!versionsInitialized) { |
|
247 |
initVersions(); |
|
248 |
} |
|
249 |
return jdk_update_version; |
|
250 |
} |
|
251 |
||
252 |
public static synchronized String jdkSpecialVersion() { |
|
253 |
if (!versionsInitialized) { |
|
254 |
initVersions(); |
|
255 |
} |
|
256 |
if (jdk_special_version == null) { |
|
257 |
jdk_special_version = getJdkSpecialVersion(); |
|
258 |
} |
|
259 |
return jdk_special_version; |
|
260 |
} |
|
261 |
public static native String getJdkSpecialVersion(); |
|
262 |
||
263 |
/** |
|
264 |
* Returns the build number of the running JDK if it's a RE build |
|
265 |
* It will return 0 if it's an internal build. |
|
266 |
* @since 1.6 |
|
267 |
*/ |
|
268 |
public static synchronized int jdkBuildNumber() { |
|
269 |
if (!versionsInitialized) { |
|
270 |
initVersions(); |
|
271 |
} |
|
272 |
return jdk_build_number; |
|
273 |
} |
|
274 |
||
275 |
// true if JVM exports the version info including the capabilities |
|
276 |
private static boolean jvmVersionInfoAvailable; |
|
277 |
private static synchronized void initVersions() { |
|
278 |
if (versionsInitialized) { |
|
279 |
return; |
|
280 |
} |
|
281 |
jvmVersionInfoAvailable = getJvmVersionInfo(); |
|
282 |
if (!jvmVersionInfoAvailable) { |
|
283 |
// parse java.vm.version for older JVM before the |
|
284 |
// new JVM_GetVersionInfo is added. |
|
285 |
// valid format of the version string is: |
|
286 |
// n.n.n[_uu[c]][-<identifer>]-bxx |
|
287 |
CharSequence cs = System.getProperty("java.vm.version"); |
|
288 |
if (cs.length() >= 5 && |
|
289 |
Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' && |
|
290 |
Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' && |
|
291 |
Character.isDigit(cs.charAt(4))) { |
|
292 |
jvm_major_version = Character.digit(cs.charAt(0), 10); |
|
293 |
jvm_minor_version = Character.digit(cs.charAt(2), 10); |
|
294 |
jvm_micro_version = Character.digit(cs.charAt(4), 10); |
|
295 |
cs = cs.subSequence(5, cs.length()); |
|
296 |
if (cs.charAt(0) == '_' && cs.length() >= 3 && |
|
297 |
Character.isDigit(cs.charAt(1)) && |
|
298 |
Character.isDigit(cs.charAt(2))) { |
|
299 |
int nextChar = 3; |
|
300 |
try { |
|
301 |
String uu = cs.subSequence(1, 3).toString(); |
|
302 |
jvm_update_version = Integer.valueOf(uu).intValue(); |
|
303 |
if (cs.length() >= 4) { |
|
304 |
char c = cs.charAt(3); |
|
305 |
if (c >= 'a' && c <= 'z') { |
|
306 |
jvm_special_version = Character.toString(c); |
|
307 |
nextChar++; |
|
308 |
} |
|
309 |
} |
|
310 |
} catch (NumberFormatException e) { |
|
311 |
// not conforming to the naming convention |
|
312 |
return; |
|
313 |
} |
|
314 |
cs = cs.subSequence(nextChar, cs.length()); |
|
315 |
} |
|
316 |
if (cs.charAt(0) == '-') { |
|
317 |
// skip the first character |
|
318 |
// valid format: <identifier>-bxx or bxx |
|
319 |
// non-product VM will have -debug|-release appended |
|
320 |
cs = cs.subSequence(1, cs.length()); |
|
321 |
String[] res = cs.toString().split("-"); |
|
322 |
for (String s : res) { |
|
323 |
if (s.charAt(0) == 'b' && s.length() == 3 && |
|
324 |
Character.isDigit(s.charAt(1)) && |
|
325 |
Character.isDigit(s.charAt(2))) { |
|
326 |
jvm_build_number = |
|
327 |
Integer.valueOf(s.substring(1, 3)).intValue(); |
|
328 |
break; |
|
329 |
} |
|
330 |
} |
|
331 |
} |
|
332 |
} |
|
333 |
} |
|
334 |
getJdkVersionInfo(); |
|
335 |
versionsInitialized = true; |
|
336 |
} |
|
337 |
||
338 |
// Gets the JVM version info if available and sets the jvm_*_version fields |
|
339 |
// and its capabilities. |
|
340 |
// |
|
341 |
// Return false if not available which implies an old VM (Tiger or before). |
|
342 |
private static native boolean getJvmVersionInfo(); |
|
343 |
private static native void getJdkVersionInfo(); |
|
344 |
||
15683
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
345 |
// Possible runtime profiles, ordered from small to large |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
346 |
private final static String[] PROFILES = { "compact1", "compact2", "compact3" }; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
347 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
348 |
/** |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
349 |
* Returns the name of the profile that this runtime implements. The empty |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
350 |
* string is returned for the full Java Runtime. |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
351 |
*/ |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
352 |
public static String profileName() { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
353 |
return java_profile_name; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
354 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
355 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
356 |
/** |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
357 |
* Indicates if this runtime implements the full Java Runtime. |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
358 |
*/ |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
359 |
public static boolean isFullJre() { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
360 |
return java_profile_name.length() == 0; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
361 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
362 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
363 |
// cached index of this profile's name in PROFILES (1-based) |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
364 |
private static int thisRuntimeIndex; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
365 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
366 |
/** |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
367 |
* Indicates if this runtime supports the given profile. Profile names are |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
368 |
* case sensitive. |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
369 |
* |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
370 |
* @return {@code true} if the given profile is supported |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
371 |
*/ |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
372 |
public static boolean supportsProfile(String requiredProfile) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
373 |
int x = thisRuntimeIndex - 1; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
374 |
if (x < 0) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
375 |
String profile = profileName(); |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
376 |
if (profile.length() > 0) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
377 |
x = 0; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
378 |
while (x < PROFILES.length) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
379 |
if (PROFILES[x].equals(profile)) |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
380 |
break; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
381 |
x++; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
382 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
383 |
if (x >= PROFILES.length) |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
384 |
throw new InternalError(profile + " not known to sun.misc.Version"); |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
385 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
386 |
// okay if another thread has already set it |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
387 |
thisRuntimeIndex = x + 1; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
388 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
389 |
// else we are a full JRE |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
390 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
391 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
392 |
int y = 0; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
393 |
while (y < PROFILES.length) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
394 |
if (PROFILES[y].equals(requiredProfile)) |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
395 |
break; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
396 |
y++; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
397 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
398 |
if (y >= PROFILES.length) { |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
399 |
// profile not found so caller has requested something that is not defined |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
400 |
return false; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
401 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
402 |
|
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
403 |
return x < 0 || x >= y; |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
404 |
} |
3acd10709925
8003256: (profiles) Add support for profile identification
alanb
parents:
8993
diff
changeset
|
405 |
|
2 | 406 |
} |
407 |
||
408 |
// Help Emacs a little because this file doesn't end in .java. |
|
409 |
// |
|
410 |
// Local Variables: *** |
|
411 |
// mode: java *** |
|
412 |
// End: *** |