
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Linux, Apache Configuration 1.5
|
|
| Resolution Date: |
20/May/08 12:11 PM
|
Things used to work fine in 1.3, but now when I'm trying 1.5 my JUnit test suite is breaking when adding new properties. Here is what I'm doing,
1) I already have a configuration as following,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<default>Bye</default>
</property>
</test>
2) Now I need to add two new properties under <test>,
<property name="newFirst">
<value>first</value>
</property>
<property name="newSecond">
<value>second</value>
</property>
3) Here is the code I'm using,
a) First create a new HierarchicalConfiguration.Node
private HierarchicalConfiguration.Node createNode(String name, Object value) {
HierarchicalConfiguration.Node node = new HierarchicalConfiguration.Node(name);
node.setValue(value);
return node;
}
b) Add the node to the list
List<HierarchicalConfiguration.Node> attrNodes = new ArrayList<HierarchicalConfiguration.Node>();
Node attrNode = createNode(attrName, newPropertyName);
attrNode.setAttribute(true);
attrNodes.add(attrNode);
c) Call addNodes on XMLConfiguration,
conf.addNodes(attrPath, attrNodes);
I run this in a look for each new property I need to add. For first property, I get element count for the test.property as 3 (conf.getMaxIndex(key)) - so I insert at test.property(3), which is right, but for the second property I get element count as 5 --> This is wrong, it should have been 4 (because I just added 1).
I check the saved the configuration file after adding those two new properties and it looks wrong too. Here is what I get,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<value>Hi</value>
default>Bye</default>
</property>
<property>
<name>newFirst</name>
</property>
<property>
<value>first</value>
</property>
<property>
<name>newSecond</name>
</property>
<property>
<value>second</value>
</property>
</test>
The total element count for test.property gives me 7 ==> I was expecting 5.
There seems to have some code change in 1.5 releated to addNodes (for ex., CONFIGURATION-287). I'm not sure if I need to change the way I was calling addNodes before. It works fine with 1.3, but 1.5 completely fails on adding new properties.
I do need 1.5 for other bug fixes ( CONFIGURATION-268 and some other), but I can't use it until the addNodes behave correctly.
Marking this as blocker as I'm blocked because of this issue. If there is a workaround then please let me know.
|
|
Description
|
Things used to work fine in 1.3, but now when I'm trying 1.5 my JUnit test suite is breaking when adding new properties. Here is what I'm doing,
1) I already have a configuration as following,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<default>Bye</default>
</property>
</test>
2) Now I need to add two new properties under <test>,
<property name="newFirst">
<value>first</value>
</property>
<property name="newSecond">
<value>second</value>
</property>
3) Here is the code I'm using,
a) First create a new HierarchicalConfiguration.Node
private HierarchicalConfiguration.Node createNode(String name, Object value) {
HierarchicalConfiguration.Node node = new HierarchicalConfiguration.Node(name);
node.setValue(value);
return node;
}
b) Add the node to the list
List<HierarchicalConfiguration.Node> attrNodes = new ArrayList<HierarchicalConfiguration.Node>();
Node attrNode = createNode(attrName, newPropertyName);
attrNode.setAttribute(true);
attrNodes.add(attrNode);
c) Call addNodes on XMLConfiguration,
conf.addNodes(attrPath, attrNodes);
I run this in a look for each new property I need to add. For first property, I get element count for the test.property as 3 (conf.getMaxIndex(key)) - so I insert at test.property(3), which is right, but for the second property I get element count as 5 --> This is wrong, it should have been 4 (because I just added 1).
I check the saved the configuration file after adding those two new properties and it looks wrong too. Here is what I get,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<value>Hi</value>
default>Bye</default>
</property>
<property>
<name>newFirst</name>
</property>
<property>
<value>first</value>
</property>
<property>
<name>newSecond</name>
</property>
<property>
<value>second</value>
</property>
</test>
The total element count for test.property gives me 7 ==> I was expecting 5.
There seems to have some code change in 1.5 releated to addNodes (for ex., CONFIGURATION-287). I'm not sure if I need to change the way I was calling addNodes before. It works fine with 1.3, but 1.5 completely fails on adding new properties.
I do need 1.5 for other bug fixes ( CONFIGURATION-268 and some other), but I can't use it until the addNodes behave correctly.
Marking this as blocker as I'm blocked because of this issue. If there is a workaround then please let me know. |
Show » |
made changes - 18/May/08 08:21 AM
| Field |
Original Value |
New Value |
|
Description
|
Things used to work fine in 1.3, but now when I'm trying 1.5 my JUnit test suite is breaking when adding new properties. Here is what I'm doing,
1) I already have a configuration as following,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<value>Hi</value>
<default>Bye</default>
</property>
</test>
2) Now I need to add two new properties under <test>,
<property name="newFirst">
<value>first</value>
</property>
<property name="newSecond">
<value>second</value>
</property>
3) Here is the code I'm using,
a) First create a new HierarchicalConfiguration.Node
private HierarchicalConfiguration.Node createNode(String name, Object value) {
HierarchicalConfiguration.Node node = new HierarchicalConfiguration.Node(name);
node.setValue(value);
return node;
}
b) Add the node to the list
List<HierarchicalConfiguration.Node> attrNodes = new ArrayList<HierarchicalConfiguration.Node>();
Node attrNode = createNode(attrName, newPropertyName);
attrNode.setAttribute(true);
attrNodes.add(attrNode);
c) Call addNodes on XMLConfiguration,
conf.addNodes(attrPath, attrNodes);
I run this in a look for each new property I need to add. For first property, I get element count for the test.property as 3 (conf.getMaxIndex(key)) - so I insert at test.property(3), which is right, but for the second property I get element count as 5 --> This is wrong, it should have been 4 (because I just added 1).
I check the saved the configuration file after adding those two new properties and it looks wrong too. Here is what I get,
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<value>Hi</value>
<default>Bye</default>
</property>
<property>
<name>newFirst</name>
</property>
<property>
<value>first</value>
</property>
<property>
<name>newSecond</name>
</property>
<property>
<value>second</value>
</property>
</test>
The total element count for test.property gives me 7 ==> I was expecting 5.
There seems to have some code change in 1.5 releated to addNodes (for ex., CONFIGURATION-287). I'm not sure if I need to change the way I was calling addNodes before. It works fine with 1.3, but 1.5 completely fails on adding new properties.
I do need 1.5 for other bug fixes ( CONFIGURATION-268 and some other), but I can't use it until the addNodes behave correctly.
Marking this as blocker as I'm blocked because of this issue. If there is a workaround then please let me know.
|
Things used to work fine in 1.3, but now when I'm trying 1.5 my JUnit test suite is breaking when adding new properties. Here is what I'm doing,
1) I already have a configuration as following,
{code:xml}
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<default>Bye</default>
</property>
</test>
{code}
2) Now I need to add two new properties under <test>,
{code:xml}
<property name="newFirst">
<value>first</value>
</property>
<property name="newSecond">
<value>second</value>
</property>
{code}
3) Here is the code I'm using,
a) First create a new HierarchicalConfiguration.Node
{code:java}
private HierarchicalConfiguration.Node createNode(String name, Object value) {
HierarchicalConfiguration.Node node = new HierarchicalConfiguration.Node(name);
node.setValue(value);
return node;
}
{code}
b) Add the node to the list
{code:java}
List<HierarchicalConfiguration.Node> attrNodes = new ArrayList<HierarchicalConfiguration.Node>();
Node attrNode = createNode(attrName, newPropertyName);
attrNode.setAttribute(true);
attrNodes.add(attrNode);
{code}
c) Call addNodes on XMLConfiguration,
{code:java}
conf.addNodes(attrPath, attrNodes);
{code}
I run this in a look for each new property I need to add. For first property, I get element count for the test.property as 3 (conf.getMaxIndex(key)) - so I insert at test.property(3), which is right, but for the second property I get element count as 5 --> This is wrong, it should have been 4 (because I just added 1).
I check the saved the configuration file after adding those two new properties and it looks wrong too. Here is what I get,
{code:xml}
<test>
<property name="isOk">
<value>true</value>
<default>false</default>
</property>
<property name="intProperty">
<value>900</value>
<default>500</default>
</property>
<property extra="0" name="stringProperty">
<value>Hi</value>
default>Bye</default>
</property>
<property>
<name>newFirst</name>
</property>
<property>
<value>first</value>
</property>
<property>
<name>newSecond</name>
</property>
<property>
<value>second</value>
</property>
</test>
{code}
The total element count for test.property gives me 7 ==> I was expecting 5.
There seems to have some code change in 1.5 releated to addNodes (for ex., CONFIGURATION-287). I'm not sure if I need to change the way I was calling addNodes before. It works fine with 1.3, but 1.5 completely fails on adding new properties.
I do need 1.5 for other bug fixes ( CONFIGURATION-268 and some other), but I can't use it until the addNodes behave correctly.
Marking this as blocker as I'm blocked because of this issue. If there is a workaround then please let me know.
|
|
Summary
|
XMLConfiguration addNodes() not behaving correctly (in 1.5)
|
XMLConfiguration addNodes() not behaving correctly
|
|
Fix Version/s
|
|
1.6
[ 12312450
]
|
made changes - 19/May/08 05:30 AM
|
Priority
|
Blocker
[ 1
]
|
Major
[ 3
]
|
made changes - 20/May/08 12:11 PM
|
Resolution
|
|
Fixed
[ 1
]
|
|
Status
|
Open
[ 1
]
|
Resolved
[ 5
]
|
made changes - 22/Aug/09 07:36 PM
|
Status
|
Resolved
[ 5
]
|
Closed
[ 6
]
|
|
is supposed to be,
In my code,
1) I first add the <property> tag under the <test> element - by calling conf.addNodes
2) Then I add the name attribute to the newly added property - again by calling conf.addNodes
3) Then I add the value tag under property - again by calling conf.addNodes
I do create a new HierarchicalConfiguration.Node every time to add it.
It all used to work fine in 1.3, but it's failing in 1.5.
Note, my reloading strategy is false - not sure if that has anything to do with this.