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/20 03:13:30 UTC

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

I just committed an update build.xml that worked fine.  Plus a bunch of
other small fixes.  You may want to grab that to work from.

Eric Pugh

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


Well, I have never used that class, so I can definitly NOT venture an
opinion!  Having said that, if you provide patches to fix the code, and good
unit tests to prove the old code works and the new code works, then I would
be happy to apply your fixes.

What would be great is to first submit a patch that PROVES that properties
at the root fails.  Then, I can run a test, take your patches, and see that
the test case starts passing!

Eric Pugh

-----Original Message-----
From: Brian E. Dunbar [mailto:bdunbar@dunbarconsulting.org]
Sent: Thursday, June 19, 2003 6:03 PM
To: Jakarta Commons Developers List
Subject: RE: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


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

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

Posted by "Brian E. Dunbar" <bd...@dunbarconsulting.org>.
Some of the files appeared to have gotten stripped in transfer. Here are the
missing files.

Brian



-----Original Message-----
From: Brian E. Dunbar [mailto:bdunbar@dunbarconsulting.org]
Sent: Friday, June 20, 2003 5:14 PM
To: Jakarta Commons Developers List
Subject: RE: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


Eric,

I have made the changes and provided a test case as you suggested.

The files I have attached contain the following:

maven.xml-Added copy target to copy the test.properties file to
testClasspath.properties at the root of the classpath.

project.xml-removed the TestClassProperties from being excluded from tests.

TestClassPropertiesConfiguration.java-Added new unit test to test loading
from the classpath in various path formats.

TestBasePropertiesConfiguration.java-Added a test to test properties that
reference another property using the ${property} notation. This was
unrelated to the original changes that I proposed.

test.properties-Added two properties for testing references to previous
properties.

If you put the above changes in place and run maven you can see that it
fails the tests. Place the following files in place and everything should
test OK.

ClassPropertiesConfiguration.java-Changes to first attempt to load the
properties file via the provided class. If that fails it attempts to load
from the classloader.

Let me know if you have any questions,

Brian Dunbar



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

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

I have made the changes and provided a test case as you suggested.

The files I have attached contain the following:

maven.xml-Added copy target to copy the test.properties file to
testClasspath.properties at the root of the classpath.

project.xml-removed the TestClassProperties from being excluded from tests.

TestClassPropertiesConfiguration.java-Added new unit test to test loading
from the classpath in various path formats.

TestBasePropertiesConfiguration.java-Added a test to test properties that
reference another property using the ${property} notation. This was
unrelated to the original changes that I proposed.

test.properties-Added two properties for testing references to previous
properties.

If you put the above changes in place and run maven you can see that it
fails the tests. Place the following files in place and everything should
test OK.

ClassPropertiesConfiguration.java-Changes to first attempt to load the
properties file via the provided class. If that fails it attempts to load
from the classloader.

Let me know if you have any questions,

Brian Dunbar


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


I just committed an update build.xml that worked fine.  Plus a bunch of
other small fixes.  You may want to grab that to work from.

Eric Pugh

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


Well, I have never used that class, so I can definitly NOT venture an
opinion!  Having said that, if you provide patches to fix the code, and good
unit tests to prove the old code works and the new code works, then I would
be happy to apply your fixes.

What would be great is to first submit a patch that PROVES that properties
at the root fails.  Then, I can run a test, take your patches, and see that
the test case starts passing!

Eric Pugh

-----Original Message-----
From: Brian E. Dunbar [mailto:bdunbar@dunbarconsulting.org]
Sent: Thursday, June 19, 2003 6:03 PM
To: Jakarta Commons Developers List
Subject: RE: [Configuration]Missing Jars for Build and Bug with
ClassPropertiesConfiguration


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