use of lucee.runtime.security.SerialNumber in project Lucee by lucee.
the class XMLConfigAdmin method updateSerial.
public void updateSerial(String serial) throws PageException {
checkWriteAccess();
if (!(config instanceof ConfigServer)) {
throw new SecurityException("can't change serial number from this context, access is denied");
}
Element root = doc.getDocumentElement();
if (!StringUtil.isEmpty(serial)) {
serial = serial.trim();
if (!new SerialNumber(serial).isValid(serial))
throw new SecurityException("serial number is invalid");
root.setAttribute("serial-number", serial);
} else {
try {
root.removeAttribute("serial-number");
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
try {
root.removeAttribute("serial");
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
Aggregations