public void setIdentity(String id) {
String new_ident=null;
char [] c = {'\0'};
String endtag = new String(c);
if (id.endsWith(endtag)) {
new_ident = new String (id.substring(0,id.length()-1) +"\\"+ "0");
} else {
new_ident=id;
}
try {
Node n = this.documentRoot.getElementsByTagName("IDENTIDAD_PRINCIPAL").
item(0);
try {
n.getFirstChild().setNodeValue(new_ident);
}
catch (Exception e) {
// no hay datos, hay que crear el nodo de datos
n.appendChild(documentRoot.createTextNode(id));
}
AlmacenIdentidades.getInstance().reloadConfiguration();
}
catch (Exception e) {
logger.severe(
"Error trying to set the tag IDENTIDAD_PRINCIPAL in the config file: " +
e.getMessage());
JOptionPane.showMessageDialog(null,
"Error trying to set the tag IDENTIDAD_PRINCIPAL in the config file",
"FATAL ERROR", JOptionPane.ERROR_MESSAGE);
System.exit( -1);
}
}