2362N/A * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * A collection of useful strings. One should think of these as #define 0N/A * entries, but actual strings can be more efficient (with many compilers). 0N/A * Validate a string as parsable as a "Java int". If so parsable, 0N/A * return true (non-zero) and store the numeric value at the address 0N/A * passed in as "value"; otherwise return false (zero). 0N/A * Note that the maximum allowable value is 2147483647 as defined by 0N/A * the "Java Language Specification" which precludes the use of native 0N/A * conversion routines which may have other limits. 0N/A * Also note that we don't have to worry about the alternate maximum 0N/A * allowable value of 2147483648 because it is only allowed after 0N/A * the unary negation operator and this grammar doesn't have one 0N/A * Finally, note that a value which exceeds the maximum jint value will 0N/A * return false (zero). This results in the otherwise purely numeric 0N/A * string being compared as a string of characters (as per the spec.) 0N/A return (0);
/* Overflows jint (but not jlong) */ 0N/A * Modeled after strcmp(), compare two strings (as in the grammar defined 0N/A * in Appendix A of JSR 56). If both strings can be interpreted as 0N/A * Java ints, do a numeric comparison, else it is strcmp(). 0N/A * Modeled after strcmp(), compare two version-ids for a Prefix 0N/A * Match as defined in JSR 56. 0N/A * Modeled after strcmp(), compare two version-ids for an Exact 0N/A * Match as defined in JSR 56. 0N/A * Return true if this simple-element (as defined in JSR 56) forms 0N/A * an acceptable match. 0N/A * JSR 56 is modified by the Java Web Start <rel> Developer Guide 0N/A * where it is stated "... Java Web Start will not consider an installed 0N/A * non-FCS (i.e., milestone) JRE as a match. ... a JRE from Sun 0N/A * Microsystems, Inc., is by convention a non-FCS (milestone) JRE 0N/A * if there is a dash (-) in the version string." 0N/A * An undocumented caveat to the above is that an exact match with a 0N/A * hyphen is accepted as a development extension. 0N/A * These modifications are addressed by the specific comparisons 0N/A * for releases with hyphens. 0N/A * Return true if this element (as defined in JSR 56) forms 0N/A * an acceptable match. An element is the intersection (and) 0N/A * of multiple simple-elements. 0N/A * Checks if release is acceptable by the specification version-string. 0N/A * Return true if this version-string (as defined in JSR 56) forms 0N/A * an acceptable match. A version-string is the union (or) of multiple 0N/A * Return true if this is a valid simple-element (as defined in JSR 56). 0N/A * The official grammar for a simple-element is: 0N/A * simple-element ::= version-id | version-id modifier 0N/A * modifier ::= '+' | '*' 0N/A * version-id ::= string ( separator string )* 0N/A * string ::= char ( char )* 0N/A * char ::= Any ASCII character except a space, an 0N/A * ampersand, a separator or a modifier 0N/A * separator ::= '.' | '-' | '_' 0N/A * However, for efficiency, it is time to abandon the top down parser 0N/A * implementation. After deleting the potential trailing modifier, we 0N/A * are left with a version-id. 0N/A * Note that a valid version-id has three simple properties: 0N/A * 1) Doesn't contain a space, an ampersand or a modifier. 0N/A * 2) Doesn't begin or end with a separator. 0N/A * 3) Doesn't contain two adjacent separators. 0N/A * Any other line noise constitutes a valid version-id. 0N/A * Return true if this is a valid element (as defined in JSR 56). 0N/A * An element is the intersection (and) of multiple simple-elements. 0N/A * Validates a version string by the extended JSR 56 grammar.