Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature/multinod…
Browse files Browse the repository at this point in the history
…es-mode

Conflicts:
	web/src/main/webapp/WEB-INF/config-security/config-security-mapping.xml
  • Loading branch information
François Prunayre committed Dec 10, 2013
2 parents 36a6fae + 1c5b0a1 commit ea2eaa1
Show file tree
Hide file tree
Showing 32 changed files with 1,390 additions and 116 deletions.
6 changes: 4 additions & 2 deletions common/src/main/java/org/fao/geonet/utils/XmlRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ protected final Element executeAndReadResponse(HttpRequestBase httpMethod) throw
final ClientHttpResponse httpResponse = doExecute(httpMethod);

if (httpResponse.getRawStatusCode() > 399) {
throw new BadServerResponseEx(httpResponse.getStatusText()+" -- Response Code: "+httpResponse.getRawStatusCode());
throw new BadServerResponseEx(httpResponse.getStatusText() +
" -- URI: " + httpMethod.getURI() +
" -- Response Code: " + httpResponse.getRawStatusCode());
}

byte[] data = null;
Expand All @@ -111,7 +113,7 @@ protected final Element executeAndReadResponse(HttpRequestBase httpMethod) throw

catch(JDOMException e)
{
throw new BadXmlResponseEx(new String(data, "UTF8"));
throw new BadXmlResponseEx("Response: " + new String(data, "UTF8") + " (from URI " + httpMethod.getURI() + ")");
}

finally
Expand Down
56 changes: 56 additions & 0 deletions core/src/main/java/org/fao/geonet/kernel/AddElemValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.fao.geonet.kernel;

import com.google.common.collect.Lists;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.utils.Log;
import org.fao.geonet.utils.Xml;
import org.jdom.Element;
import org.jdom.JDOMException;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
* A simple container class for some add methods in {@link EditLib}
* Created by Jesse on 12/10/13.
*/
public class AddElemValue {
private final String stringValue;
private final Element nodeValue;

public AddElemValue(String stringValue) {
String finalStringVal = stringValue;
Element finalNodeVal = null;
if (stringValue.trim().startsWith("<")) {
try {
finalNodeVal = Xml.loadString(stringValue, false);
finalStringVal = null;
} catch (JDOMException e) {
Log.debug(Geonet.EDITORADDELEMENT, "Invalid XML fragment to insert " + stringValue + ". Error is: " + e.getMessage());
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
this.nodeValue = finalNodeVal;
this.stringValue = finalStringVal;
}

public AddElemValue(Element nodeValue) {
this.nodeValue = nodeValue;
this.stringValue = null;
}

public boolean isXml() {
return nodeValue != null;
}
public String getStringValue() {
return stringValue;
}

public Element getNodeValue() {
return nodeValue;
}
}
Loading

0 comments on commit ea2eaa1

Please sign in to comment.