Add error code in json response
@@ -121,6 +121,7 @@ public class MCFChangePassword extends HttpServlet {
// read the output from the command
String s = null;
+ String errorCode = null;
while ((s = stdInput.readLine()) != null) {
LOGGER.info(s);
}
@@ -128,12 +129,17 @@ public class MCFChangePassword extends HttpServlet {
// read any errors from the attempted command
while ((s = stdError.readLine()) != null) {
LOGGER.warn(s);
+ errorCode = s;
}
// script
final PrintWriter out = response.getWriter();
+ if (errorCode == null)
jsonResponse.put(OutputConstants.CODE, CodesReturned.ALLOK.getValue());
+ else
+ jsonResponse.put(OutputConstants.CODE, CodesReturned.GENERALERROR.getValue());
+
out.print(jsonResponse);
}
@@ -161,7 +167,7 @@ public class MCFChangePassword extends HttpServlet {
if (nodeMap.getLength() >= 1) {
final Node node = nodeMap.item(0);
final Node node2 = nodeMap.item(1);
- if ((node.getNodeValue().toString().equals("org.apache.manifoldcf.login.password.obfuscated")) || (node.getNodeValue().toString().equals("org.apache.manifoldcf.apilogin.password.obfuscated"))) {
+ if ((node.getNodeValue().toString().equals("org.apache.manifoldcf.dbsuperuserpassword.obfuscated")) || (node.getNodeValue().toString().equals("org.apache.manifoldcf.apilogin.password.obfuscated"))) {
node2.setTextContent(password);
}
