Re: [OpenMap Users] PropUtils.getResourceOrFileOrURL(PropUtils.java:735) - fails under web start

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 26 Jan 2010 10:50:12 -0500

Hi Carsten,

What version of OM are you using? Have you tried this with the beta?

I just looked at the PropUtils code, and can't tell where this is failing compared to your stack trace. The getResourceOrFileOrURL method does look like it eventually gets to code that looks like your fix, though, creating a File and testing for it. I guess the difference is that once a file is found, a URL is created from it, and that's what gets returned from the method. Although in the beta, it uses file.getURI().getURL() as opposed to file.getURL() that was in 4.6.5.

- Don

On Jan 26, 2010, at 3:25 AM, Carsten Ø. Madsen wrote:

> Hello
>
> I'm not sure this is a bug in PropUtils but running something like this under java web start (tested on 1.6.17 under windows XP)
>
> String openMapUserFile = System.getProperty("user.home") + "/openmap.properties";
> Properties props = PropertyHandler.fetchProperties(PropUtils.getResourceOrFileOrURL(openMapUserFile));
>
> results in:
>
> java.lang.IllegalArgumentException: name
> at sun.misc.URLClassPath$Loader.findResource(Unknown Source)
> at sun.misc.URLClassPath.findResource(Unknown Source)
> at java.net.URLClassLoader$2.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findResource(Unknown Source)
> at com.sun.jnlp.JNLPClassLoader.findResource(Unknown Source)
> at java.lang.ClassLoader.getResource(Unknown Source)
> at com.sun.jnlp.JNLPClassLoader.access$001(Unknown Source)
> at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at com.sun.jnlp.JNLPClassLoader.getResource(Unknown Source)
> at com.bbn.openmap.util.PropUtils.getResourceOrFileOrURL(PropUtils.java:735)
> at com.bbn.openmap.util.PropUtils.getResourceOrFileOrURL(PropUtils.java:680)
>
> Running it as a regular java app works fine.
>
> I have changed it to:
>
> String openMapUserFile = System.getProperty("user.home") + "/openmap.properties";
> File openmapProperties = new File(openMapUserFile);
> Properties props = new Properties();
> if (openmapProperties.exists()) {
> FileInputStream fis = new FileInputStream(openmapProperties);
> props.load(fis);
> fis.close();
> }
>
> Could PropUtils be made java web start aware so I can continue to use getResourceOrFileOrURL?
>
> BTW: The problem has a stack trace similar to this http://openmap.bbn.com/mailArchives/openmap-users/2005-06/4132.html
>
> BR
> Carsten
>
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe openmap-users"]

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jan 26 2010 - 10:50:48 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT