108
108
/** the default jvm */
109
109
protected String defaultArch = null;
111
/** A signed JNLP file is missing from the main jar */
112
private boolean missingSignedJNLP = false;
114
/** JNLP file contains special properties */
115
private boolean containsSpecialProperties = false;
118
* List of acceptable properties (not-special)
120
private String[] generalProperties = SecurityDesc.getJnlpRIAPermissions();
111
122
{ // initialize defaults if security allows
113
124
defaultLocale = Locale.getDefault();
174
185
* @throws ParseException if the JNLP file was invalid
176
187
public JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
188
this(location, version, strict, policy, null);
192
* Create a JNLPFile from a URL and a version, checking for updates
193
* using the specified policy.
195
* @param location the location of the JNLP file
196
* @param version the version of the JNLP file
197
* @param strict whether to enforce the spec when
198
* @param policy the update policy
199
* @param forceCodebase codebase to use if not specified in JNLP file.
200
* @throws IOException if an IO exception occurred
201
* @throws ParseException if the JNLP file was invalid
203
protected JNLPFile(URL location, Version version, boolean strict, UpdatePolicy policy, URL forceCodebase) throws IOException, ParseException {
177
204
Node root = Parser.getRootNode(openURL(location, version, policy));
178
parse(root, strict, location);
205
parse(root, strict, location, forceCodebase);
180
207
//Downloads the original jnlp file into the cache if possible
181
208
//(i.e. If the jnlp file being launched exist locally, but it
222
249
* @throws ParseException if the JNLP file was invalid
224
251
public JNLPFile(InputStream input, boolean strict) throws ParseException {
225
parse(Parser.getRootNode(input), strict, null);
252
parse(Parser.getRootNode(input), strict, null, null);
574
601
* @param strict whether to enforce the spec when
575
602
* @param location the file location or null
577
private void parse(Node root, boolean strict, URL location) throws ParseException {
604
private void parse(Node root, boolean strict, URL location, URL forceCodebase) throws ParseException {
579
606
//if (location != null)
580
607
// location = new URL(location, "."); // remove filename
582
Parser parser = new Parser(this, location, root, strict, true); // true == allow extensions
609
Parser parser = new Parser(this, location, root, strict, true, forceCodebase); // true == allow extensions
584
611
// JNLP tag information
585
612
specVersion = parser.getSpecVersion();
592
619
launchType = parser.getLauncher(root);
593
620
component = parser.getComponent(root);
594
621
security = parser.getSecurity(root);
623
checkForSpecialProperties();
595
625
} catch (ParseException ex) {
597
627
} catch (Exception ex) {
636
* Inspects the JNLP file to check if it contains any special properties
638
private void checkForSpecialProperties() {
640
for (ResourcesDesc res : resources) {
641
for (PropertyDesc propertyDesc : res.getProperties()) {
643
for (int i = 0; i < generalProperties.length; i++) {
644
String property = propertyDesc.getKey();
646
if (property.equals(generalProperties[i])) {
648
} else if (!property.equals(generalProperties[i])
649
&& i == generalProperties.length - 1) {
650
containsSpecialProperties = true;
607
661
* @return true if the JNLP file specifies things that can only be
608
662
* applied on a new vm (eg: different max heap memory)
674
728
return new DownloadOptions(usePack, useVersion);
732
* Returns a boolean after determining if a signed JNLP warning should be
733
* displayed in the 'More Information' panel.
735
* @return true if a warning should be displayed; otherwise false
737
public boolean requiresSignedJNLPWarning() {
738
return (missingSignedJNLP && containsSpecialProperties);
742
* Informs that a signed JNLP file is missing in the main jar
744
public void setSignedJNLPAsMissing() {
745
missingSignedJNLP = true;