You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by EP...@upstate.com on 2003/06/19 23:37:53 UTC

RE: [Configuration]Missing Jars for Build and Bug with ClassPrope rtiesConfiguration

Brian,

What kinds of errors are you getting.  commons-configuration is built using
maven.  One of maven's target's produces the build.xml file.  We really need
a message in there, "don't edit this, it is generated by maven!"

I regenerated the buid.xml file using maven and was sucessful.  If you need
an updated build.xml, I can email it to you directly.  I'll try and commit
it to cvs this evening!

I am not sure about Item 2, this is streching my level of understanding.
Would this mean though that I could have properties files in both a class
sub directory and in the root?

eric



-----Original Message-----
From: Brian E. Dunbar [mailto:bdunbar@dunbarconsulting.org]
Sent: Thursday, June 19, 2003 5:28 PM
To: commons-dev@jakarta.apache.org
Subject: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


Item 1:

I was building commons-configuration from scratch and it was having problems
retrieving some of the jar files from ibiblio. I made fixes to the build.xml
file to add/modify some lines to get it to work. My fixed build.xml is
attached.


Item 2:

The ClassPropertiesConfiguration seems to only be able to load properties
files from within the package of the class passed into the constructor. I
have been unable to successfully load a properties file from the root of the
classpath by placing a "/" at the beginning of the name (as the source code
indicates one should do). The source code indicates that the Javadoc for
loading resources says that all URL's start with a "/", but I am unable to
find that in the javadoc for ClassLoader and in testing I have been unable
to get ClassLoader to load a file that beings with a "/".

If I am correct, I propose that ClassPropertiesConfiguration be changed as
described below. In my experience it is more likely that properties files
need to be loaded from the root of the classpath then from a specific
package within the classpath (but that is my experience).

Use the classloader of class that is provided by the constructor.
Add a constructor that indicates whether to use relative or absolute.
Change getPropertyStream to utilize the relative or absolute flag.
Add a test case that checks that absolute paths work.

I will gladly submit a patch to do the above if what I propose makes sense.

Brian Dunbar

RE: [Configuration]Missing Jars for Build and Bug with ClassPropertiesConfiguration

Posted by "Brian E. Dunbar" <bd...@dunbarconsulting.org>.
Eric,

I should have picked up on the fact that it is maven driven given the
maven.xml file.

Yes, this change would allow you to have properties file found on the
classpath either at the root of the classpath or at the package
subdirectory. The code and Javadoc currently claims to support both, but the
implementation of access them at the root appears to be broken (unless I am
missing something).

Brian

-----Original Message-----
From: EPugh@upstate.com [mailto:EPugh@upstate.com]
Sent: Thursday, June 19, 2003 5:38 PM
To: commons-dev@jakarta.apache.org
Subject: RE: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


Brian,

What kinds of errors are you getting.  commons-configuration is built using
maven.  One of maven's target's produces the build.xml file.  We really need
a message in there, "don't edit this, it is generated by maven!"

I regenerated the buid.xml file using maven and was sucessful.  If you need
an updated build.xml, I can email it to you directly.  I'll try and commit
it to cvs this evening!

I am not sure about Item 2, this is streching my level of understanding.
Would this mean though that I could have properties files in both a class
sub directory and in the root?

eric



-----Original Message-----
From: Brian E. Dunbar [mailto:bdunbar@dunbarconsulting.org]
Sent: Thursday, June 19, 2003 5:28 PM
To: commons-dev@jakarta.apache.org
Subject: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


Item 1:

I was building commons-configuration from scratch and it was having problems
retrieving some of the jar files from ibiblio. I made fixes to the build.xml
file to add/modify some lines to get it to work. My fixed build.xml is
attached.


Item 2:

The ClassPropertiesConfiguration seems to only be able to load properties
files from within the package of the class passed into the constructor. I
have been unable to successfully load a properties file from the root of the
classpath by placing a "/" at the beginning of the name (as the source code
indicates one should do). The source code indicates that the Javadoc for
loading resources says that all URL's start with a "/", but I am unable to
find that in the javadoc for ClassLoader and in testing I have been unable
to get ClassLoader to load a file that beings with a "/".

If I am correct, I propose that ClassPropertiesConfiguration be changed as
described below. In my experience it is more likely that properties files
need to be loaded from the root of the classpath then from a specific
package within the classpath (but that is my experience).

Use the classloader of class that is provided by the constructor.
Add a constructor that indicates whether to use relative or absolute.
Change getPropertyStream to utilize the relative or absolute flag.
Add a test case that checks that absolute paths work.

I will gladly submit a patch to do the above if what I propose makes sense.

Brian Dunbar


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org