more fix for defect #16
This commit is contained in:
parent
76452fb5fe
commit
ee61857f6c
@ -57,26 +57,20 @@ public class PropertyXMLEncoder extends XmlElement {
|
|||||||
super(rootName);
|
super(rootName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void add(final String key, final String value) {
|
public void set(final String key, final String value) {
|
||||||
if (key != null && value != null) {
|
if (key != null && value != null) {
|
||||||
add(this.getRoot(), key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void set(final String key, final String value) {
|
|
||||||
set(getRoot(), key, value);
|
set(getRoot(), key, value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void set(final Element e, final String key, final String value){
|
private void set(final Element e, final String key, final String value){
|
||||||
if (!key.contains("/")) {
|
if (!key.contains("/")) {
|
||||||
if (key != null && value != null) {
|
|
||||||
Element pp = null;
|
Element pp = null;
|
||||||
if ((pp = contains(key)) == null)
|
if ((pp = contains(key)) == null)
|
||||||
add(key, value);
|
add(e,key, value);
|
||||||
else {
|
else {
|
||||||
remove(pp);
|
remove(pp);
|
||||||
add(key, value);
|
add(e,key, value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final int i = key.indexOf("/");
|
final int i = key.indexOf("/");
|
||||||
@ -86,11 +80,19 @@ public class PropertyXMLEncoder extends XmlElement {
|
|||||||
Element child = e.getChild(childName);
|
Element child = e.getChild(childName);
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
child = new Element(childName);
|
child = new Element(childName);
|
||||||
|
e.addContent(child);
|
||||||
|
add(child,newkey,value);
|
||||||
}
|
}
|
||||||
set(child, newkey, value);
|
set(child, newkey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(final String key, final String value) {
|
||||||
|
if (key != null && value != null) {
|
||||||
|
add(this.getRoot(), key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void add(Element e, String key, String value) {
|
private void add(Element e, String key, String value) {
|
||||||
if (!key.contains("/")) {
|
if (!key.contains("/")) {
|
||||||
e.addContent(new Element(key).setText(value));
|
e.addContent(new Element(key).setText(value));
|
||||||
|
|||||||
@ -90,6 +90,7 @@ public class GSCoverageEncoderTest extends TestCase {
|
|||||||
dim2.addPresentation(Presentation.LIST);
|
dim2.addPresentation(Presentation.LIST);
|
||||||
encoder.addMetadata("elev", dim2);
|
encoder.addMetadata("elev", dim2);
|
||||||
|
|
||||||
|
if (LOGGER.isInfoEnabled())
|
||||||
LOGGER.info(encoder.toString());
|
LOGGER.info(encoder.toString());
|
||||||
|
|
||||||
final Element el=encoder.contains("metadata");
|
final Element el=encoder.contains("metadata");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user