[Minor] Removed all //$NON-NLS-1$

This commit is contained in:
Robert von Burg 2023-04-04 11:24:12 +02:00
parent e94f66a296
commit c58f5a1cd9
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
183 changed files with 1046 additions and 1046 deletions

View File

@ -59,7 +59,7 @@ public enum ComponentState {
}
private IllegalStateException getIllegalStateEx(ComponentState newState, String componentName) {
String msg = "Moving from state {0} to state {1} is not allowed for component " + componentName; //$NON-NLS-1$
String msg = "Moving from state {0} to state {1} is not allowed for component " + componentName;
msg = MessageFormat.format(msg, this, newState);
throw new IllegalStateException(msg);
}

View File

@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
*/
public class StrolchAgent {
public static final String AGENT_VERSION_PROPERTIES = "/agentVersion.properties"; //$NON-NLS-1$
public static final String AGENT_VERSION_PROPERTIES = "/agentVersion.properties";
private static final Logger logger = LoggerFactory.getLogger(StrolchAgent.class);
@ -295,7 +295,7 @@ public class StrolchAgent {
*/
void setup(String environment, File configPathF, File dataPathF, File tempPathF) {
String msg = "[{0}] Setting up Strolch Container using the following paths:"; //$NON-NLS-1$
String msg = "[{0}] Setting up Strolch Container using the following paths:";
logger.info(MessageFormat.format(msg, environment));
logger.info(" - Config: " + configPathF.getAbsolutePath());
logger.info(" - Data: " + dataPathF.getAbsolutePath());
@ -312,12 +312,12 @@ public class StrolchAgent {
RuntimeConfiguration config = this.strolchConfiguration.getRuntimeConfiguration();
logger.info(MessageFormat.format("Setup Agent {0}:{1}", config.getApplicationName(),
config.getEnvironment())); //$NON-NLS-1$
config.getEnvironment()));
}
protected void assertContainerStarted() {
if (this.container == null || this.container.getState() != ComponentState.STARTED) {
String msg = "Container is not yet started!"; //$NON-NLS-1$
String msg = "Container is not yet started!";
throw new IllegalStateException(msg);
}
}
@ -358,7 +358,7 @@ public class StrolchAgent {
queryResult.setAgentVersion(agentVersion);
} catch (IOException e) {
String msg = MessageFormat.format("Failed to read version properties for agent: {0}",
e.getMessage()); //$NON-NLS-1$
e.getMessage());
queryResult.getErrors().add(msg);
logger.error(msg, e);
}
@ -370,7 +370,7 @@ public class StrolchAgent {
ComponentVersion componentVersion = component.getVersion();
queryResult.add(componentVersion);
} catch (Exception e) {
String msg = "Failed to read version properties for component {0} due to: {1}"; //$NON-NLS-1$
String msg = "Failed to read version properties for component {0} due to: {1}";
msg = MessageFormat.format(msg, component.getName(), e.getMessage());
queryResult.getErrors().add(msg);
logger.error(msg, e);

View File

@ -25,7 +25,7 @@ public class StrolchBootstrapper extends DefaultHandler {
private static final Logger logger = LoggerFactory.getLogger(StrolchBootstrapper.class);
public static final String APP_VERSION_PROPERTIES = "/appVersion.properties"; //$NON-NLS-1$
public static final String APP_VERSION_PROPERTIES = "/appVersion.properties";
private static final String SYS_PROP_USER_DIR = "user.dir";
private static final String STROLCH_BOOTSTRAP = "StrolchBootstrap";
@ -44,9 +44,9 @@ public class StrolchBootstrapper extends DefaultHandler {
public static final String ENV_STROLCH_ENV = "STROLCH_ENV";
public static final String ENV_STROLCH_PATH = "STROLCH_PATH";
public static final String PATH_CONFIG = "config"; //$NON-NLS-1$
public static final String PATH_DATA = "data"; //$NON-NLS-1$
public static final String PATH_TEMP = "temp"; //$NON-NLS-1$
public static final String PATH_CONFIG = "config";
public static final String PATH_DATA = "data";
public static final String PATH_TEMP = "temp";
// input
private String environment;
@ -145,7 +145,7 @@ public class StrolchBootstrapper extends DefaultHandler {
// root path: readable directory
if (!rootSrcPath.isDirectory() || !rootSrcPath.canRead()) {
String msg = "[{0}] Root src path is not readable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Root src path is not readable at {1}";
msg = MessageFormat.format(msg, environment, rootSrcPath);
throw new StrolchConfigurationException(msg);
}
@ -154,7 +154,7 @@ public class StrolchBootstrapper extends DefaultHandler {
File configPathF = new File(rootSrcPath, PATH_CONFIG);
File configurationFile = new File(configPathF, ConfigurationParser.STROLCH_CONFIGURATION_XML);
if (!configurationFile.isFile() || !configurationFile.canRead()) {
String msg = "[{0}] Source Configuration file is not readable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Source Configuration file is not readable at {1}";
msg = MessageFormat.format(msg, environment, configurationFile);
throw new StrolchConfigurationException(msg);
}
@ -162,27 +162,27 @@ public class StrolchBootstrapper extends DefaultHandler {
// if destination exists, make sure it is a directory and empty
if (rootDstPath.exists()) {
if (!rootDstPath.isDirectory()) {
String msg = "[{0}] Destination root exists and is not a directory at {1}"; //$NON-NLS-1$
String msg = "[{0}] Destination root exists and is not a directory at {1}";
msg = MessageFormat.format(msg, environment, rootDstPath.getAbsolutePath());
throw new StrolchConfigurationException(msg);
}
if (requireNonNull(rootDstPath.list()).length != 0) {
String msg = "[{0}] Destination root exists and is not empty at {1}"; //$NON-NLS-1$
String msg = "[{0}] Destination root exists and is not empty at {1}";
msg = MessageFormat.format(msg, environment, rootDstPath.getAbsolutePath());
throw new StrolchConfigurationException(msg);
}
} else if (!rootDstPath.mkdir()) {
String msg = "[{0}] Destination root does not exist and could not be created. Either parent does not exist, or permission is denied at {1}"; //$NON-NLS-1$
String msg = "[{0}] Destination root does not exist and could not be created. Either parent does not exist, or permission is denied at {1}";
msg = MessageFormat.format(msg, environment, rootDstPath.getAbsolutePath());
throw new StrolchConfigurationException(msg);
}
String msg = "[{0}] Copying source {1} to {2}"; //$NON-NLS-1$
String msg = "[{0}] Copying source {1} to {2}";
logger.info(
MessageFormat.format(msg, environment, rootSrcPath.getAbsolutePath(), rootDstPath.getAbsolutePath()));
if (!FileHelper.copy(rootSrcPath.listFiles(), rootDstPath, true)) {
msg = "[{0}] Failed to copy source files from {1} to {2}"; //$NON-NLS-1$
msg = "[{0}] Failed to copy source files from {1} to {2}";
msg = MessageFormat.format(msg, environment, rootSrcPath.getAbsolutePath(), rootDstPath.getAbsolutePath());
throw new RuntimeException(msg);
}
@ -271,13 +271,13 @@ public class StrolchBootstrapper extends DefaultHandler {
private StrolchAgent setup() {
DBC.PRE.assertNotEmpty("Environment must be set!", this.environment);
DBC.PRE.assertNotNull("configPathF must be set!", this.configPathF); //$NON-NLS-1$
DBC.PRE.assertNotNull("dataPathF must be set!", this.dataPathF); //$NON-NLS-1$
DBC.PRE.assertNotNull("tempPathF must be set!", this.tempPathF); //$NON-NLS-1$
DBC.PRE.assertNotNull("configPathF must be set!", this.configPathF);
DBC.PRE.assertNotNull("dataPathF must be set!", this.dataPathF);
DBC.PRE.assertNotNull("tempPathF must be set!", this.tempPathF);
// config path: readable directory
if (!this.configPathF.isDirectory() || !this.configPathF.canRead()) {
String msg = "[{0}] Config path is not readable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Config path is not readable at {1}";
msg = MessageFormat.format(msg, environment, this.configPathF);
throw new StrolchConfigurationException(msg);
}
@ -285,31 +285,31 @@ public class StrolchBootstrapper extends DefaultHandler {
// get path to configuration file
File configurationFile = new File(this.configPathF, ConfigurationParser.STROLCH_CONFIGURATION_XML);
if (!configurationFile.isFile() || !configurationFile.canRead()) {
String msg = "[{0}] Configuration file is not readable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Configuration file is not readable at {1}";
msg = MessageFormat.format(msg, environment, configurationFile);
throw new StrolchConfigurationException(msg);
}
// data path: writable directory
if (!this.dataPathF.exists() && !this.dataPathF.mkdir()) {
String msg = "[{0}] Could not create missing data path at {1}"; //$NON-NLS-1$
String msg = "[{0}] Could not create missing data path at {1}";
msg = MessageFormat.format(msg, environment, this.dataPathF);
throw new StrolchConfigurationException(msg);
}
if (!this.dataPathF.isDirectory() || !this.dataPathF.canRead() || !this.dataPathF.canWrite()) {
String msg = "[{0}] Data path is not a directory or readable or writeable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Data path is not a directory or readable or writeable at {1}";
msg = MessageFormat.format(msg, environment, this.dataPathF);
throw new StrolchConfigurationException(msg);
}
// tmp path: writable directory
if (!this.tempPathF.exists() && !this.tempPathF.mkdir()) {
String msg = "[{0}] Could not create missing temp path at {1}"; //$NON-NLS-1$
String msg = "[{0}] Could not create missing temp path at {1}";
msg = MessageFormat.format(msg, environment, this.tempPathF);
throw new StrolchConfigurationException(msg);
}
if (!this.tempPathF.isDirectory() || !this.tempPathF.canRead() || !this.tempPathF.canWrite()) {
String msg = "[{0}] Temp path is not a directory or readable or writeable at {1}"; //$NON-NLS-1$
String msg = "[{0}] Temp path is not a directory or readable or writeable at {1}";
msg = MessageFormat.format(msg, environment, this.tempPathF);
throw new StrolchConfigurationException(msg);
}

View File

@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
*/
public class StrolchComponent {
public static final String COMPONENT_VERSION_PROPERTIES = "/componentVersion.properties"; //$NON-NLS-1$
public static final String COMPONENT_VERSION_PROPERTIES = "/componentVersion.properties";
protected static final Logger logger = LoggerFactory.getLogger(StrolchComponent.class);
private final ComponentContainer container;
private final String componentName;
@ -194,7 +194,7 @@ public class StrolchComponent {
*/
protected void assertStarted() {
if (getState() != ComponentState.STARTED) {
String msg = "Component {0} is not yet started!"; //$NON-NLS-1$
String msg = "Component {0} is not yet started!";
throw new IllegalStateException(MessageFormat.format(msg, this.componentName));
}
}
@ -205,7 +205,7 @@ public class StrolchComponent {
*/
protected void assertContainerStarted() {
if (this.container.getState() != ComponentState.STARTED) {
String msg = "Container is not yet started!"; //$NON-NLS-1$
String msg = "Container is not yet started!";
throw new IllegalStateException(msg);
}
}
@ -551,7 +551,7 @@ public class StrolchComponent {
if (this.version == null) {
try (InputStream stream = getClass().getResourceAsStream(COMPONENT_VERSION_PROPERTIES)) {
if (stream == null) {
throw new RuntimeException("/componentVersion.properties does not exist"); //$NON-NLS-1$
throw new RuntimeException("/componentVersion.properties does not exist");
}
Properties properties = new Properties();
properties.load(stream);

View File

@ -50,7 +50,7 @@ public class AuditingAuditMapFacade implements AuditTrail {
private final boolean observeAccessReads;
public AuditingAuditMapFacade(AuditTrail auditTrail, boolean observeAccessReads) {
DBC.PRE.assertNotNull("auditTrail must be set!", auditTrail); //$NON-NLS-1$
DBC.PRE.assertNotNull("auditTrail must be set!", auditTrail);
this.auditTrail = auditTrail;
this.observeAccessReads = observeAccessReads;

View File

@ -62,7 +62,7 @@ public abstract class AuditingElementMapFacade<T extends StrolchRootElement> imp
protected boolean observeAccessReads;
public AuditingElementMapFacade(ElementMap<T> elementMap, boolean readOnly, boolean observeAccessReads) {
DBC.PRE.assertNotNull("ElementMap must be set!", elementMap); //$NON-NLS-1$
DBC.PRE.assertNotNull("ElementMap must be set!", elementMap);
this.elementMap = elementMap;
this.readOnly = readOnly;
this.observeAccessReads = observeAccessReads;

View File

@ -93,7 +93,7 @@ public class CachedAuditTrail extends TransientAuditTrail {
// last is to perform DB changes
long daoRemoved = getDbDao(tx).removeAll(type, dateRange);
if (removed != daoRemoved) {
String msg = "Removed {0} elements from cached map, but dao removed {1} elements!"; //$NON-NLS-1$
String msg = "Removed {0} elements from cached map, but dao removed {1} elements!";
logger.error(MessageFormat.format(msg, removed, daoRemoved));
}
return removed;

View File

@ -160,7 +160,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> extends Tra
long daoRemoved = getDbDao(tx).removeAll();
if (removed != daoRemoved) {
String msg = "Removed {0} elements from cached map, but dao removed {1} elements!"; //$NON-NLS-1$
String msg = "Removed {0} elements from cached map, but dao removed {1} elements!";
logger.error(MessageFormat.format(msg, removed, daoRemoved));
}
@ -177,7 +177,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> extends Tra
long daoRemoved = getDbDao(tx).removeAllBy(type);
if (removed != daoRemoved) {
String msg = "Removed {0} elements from cached map for type {1}, but dao removed {3} elements!"; //$NON-NLS-1$
String msg = "Removed {0} elements from cached map for type {1}, but dao removed {3} elements!";
logger.error(MessageFormat.format(msg, removed, type, daoRemoved));
}
@ -194,7 +194,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> extends Tra
throws StrolchException {
T t = getDbDao(tx).queryBy(type, id, version);
if (assertExists && t == null) {
String msg = "The element with type \"{0}\" and id \"{1}\" and version \"{2}\" does not exist!"; //$NON-NLS-1$
String msg = "The element with type \"{0}\" and id \"{1}\" and version \"{2}\" does not exist!";
msg = MessageFormat.format(msg, type, id, version);
throw new StrolchException(msg);
}
@ -251,7 +251,7 @@ public abstract class CachedElementMap<T extends StrolchRootElement> extends Tra
// make sure the given element is the latest version
T current = getBy(tx, type, id, true);
if (!current.getVersion().equals(elementVersion)) {
String msg = "Can not undo the version {0} as it is not the latest!"; //$NON-NLS-1$
String msg = "Can not undo the version {0} as it is not the latest!";
msg = MessageFormat.format(msg, elementVersion);
throw new StrolchException(msg);
}

View File

@ -47,13 +47,13 @@ public class CachedRealm extends InternalStrolchRealm {
@Override
public StrolchTransaction openTx(Certificate certificate, String action, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return this.persistenceHandler.openTx(this, certificate, action, readOnly);
}
@Override
public StrolchTransaction openTx(Certificate certificate, Class<?> clazz, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return this.persistenceHandler.openTx(this, certificate, clazz.getName(), readOnly);
}

View File

@ -86,7 +86,7 @@ public class ComponentContainerImpl implements ComponentContainer {
public <T> T getComponent(Class<T> clazz) throws IllegalArgumentException {
T component = (T) this.componentMap.get(clazz);
if (component == null) {
String msg = "The component does not exist for class {0}"; //$NON-NLS-1$
String msg = "The component does not exist for class {0}";
msg = MessageFormat.format(msg, clazz.getName());
throw new IllegalArgumentException(msg);
}
@ -162,13 +162,13 @@ public class ComponentContainerImpl implements ComponentContainer {
Class<?> implClass = Class.forName(impl);
if (!apiClass.isAssignableFrom(implClass)) {
String msg = "Component {0} has invalid configuration: Impl class {1} is not assignable to Api class {2}"; //$NON-NLS-1$
String msg = "Component {0} has invalid configuration: Impl class {1} is not assignable to Api class {2}";
msg = MessageFormat.format(msg, componentName, impl, api);
throw new StrolchConfigurationException(msg);
}
if (!StrolchComponent.class.isAssignableFrom(implClass)) {
String msg = "Component {0} has invalid configuration: Impl class {1} is not a subclass of {2}"; //$NON-NLS-1$
String msg = "Component {0} has invalid configuration: Impl class {1} is not a subclass of {2}";
msg = MessageFormat.format(msg, componentName, impl, StrolchComponent.class.getName());
throw new StrolchConfigurationException(msg);
}
@ -185,14 +185,14 @@ public class ComponentContainerImpl implements ComponentContainer {
} catch (NoSuchMethodException e) {
String msg = "Could not load class for component {0} due to missing constructor with signature (ComponentContainer.class, String.class)"; //$NON-NLS-1$
String msg = "Could not load class for component {0} due to missing constructor with signature (ComponentContainer.class, String.class)";
msg = MessageFormat.format(msg, componentName, e.getMessage());
throw new StrolchConfigurationException(msg, e);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SecurityException |
IllegalArgumentException | InvocationTargetException e) {
String msg = "Could not load class for component {0} due to: {1}"; //$NON-NLS-1$
String msg = "Could not load class for component {0} due to: {1}";
msg = MessageFormat.format(msg, componentName, e.getMessage());
throw new StrolchConfigurationException(msg, e);
}
@ -205,7 +205,7 @@ public class ComponentContainerImpl implements ComponentContainer {
// set the application locale
Locale.setDefault(strolchConfiguration.getRuntimeConfiguration().getLocale());
String msg = "Application {0}:{1} is using locale {2} and timezone {3}"; //$NON-NLS-1$
String msg = "Application {0}:{1} is using locale {2} and timezone {3}";
String environment = getEnvironment();
String applicationName = getApplicationName();
System.setProperty("user.timezone", getTimezone());
@ -238,7 +238,7 @@ public class ComponentContainerImpl implements ComponentContainer {
this.state = ComponentState.SETUP;
long took = System.nanoTime() - start;
msg = "{0}:{1} Strolch Container setup with {2} components. Took {3}"; //$NON-NLS-1$
msg = "{0}:{1} Strolch Container setup with {2} components. Took {3}";
logger.info(MessageFormat.format(msg, applicationName, environment, this.componentMap.size(),
formatNanoDuration(took)));
}
@ -249,7 +249,7 @@ public class ComponentContainerImpl implements ComponentContainer {
long start = System.nanoTime();
// now we can initialize the components
String msg = "{0}:{1} Initializing {2} Strolch Components..."; //$NON-NLS-1$
String msg = "{0}:{1} Initializing {2} Strolch Components...";
String environment = getEnvironment();
String applicationName = getApplicationName();
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size()));
@ -260,7 +260,7 @@ public class ComponentContainerImpl implements ComponentContainer {
this.state = ComponentState.INITIALIZED;
long took = System.nanoTime() - start;
msg = "{0}:{1} All {2} Strolch Components have been initialized. Took {3}"; //$NON-NLS-1$
msg = "{0}:{1} All {2} Strolch Components have been initialized. Took {3}";
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size(),
formatNanoDuration(took)));
}
@ -270,7 +270,7 @@ public class ComponentContainerImpl implements ComponentContainer {
long start = System.nanoTime();
String msg = "{0}:{1} Starting {2} Strolch Components..."; //$NON-NLS-1$
String msg = "{0}:{1} Starting {2} Strolch Components...";
String environment = getEnvironment();
String applicationName = getApplicationName();
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size()));
@ -305,7 +305,7 @@ public class ComponentContainerImpl implements ComponentContainer {
}
}
msg = "{0}:{1} All {2} Strolch Components started for version {3}. Took {4}. Strolch is now ready to be used. Have fun =))"; //$NON-NLS-1$
msg = "{0}:{1} All {2} Strolch Components started for version {3}. Took {4}. Strolch is now ready to be used. Have fun =))";
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size(),
getAgent().getVersion().getAppVersion().getArtifactVersion(), tookS));
}
@ -329,17 +329,17 @@ public class ComponentContainerImpl implements ComponentContainer {
}
}
String msg = "{0}:{1} Stopping {2} Strolch Components..."; //$NON-NLS-1$
String msg = "{0}:{1} Stopping {2} Strolch Components...";
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size()));
if (this.dependencyAnalyzer == null) {
logger.info("Strolch was not yet setup, nothing to stop"); //$NON-NLS-1$
logger.info("Strolch was not yet setup, nothing to stop");
} else {
Set<ComponentController> rootUpstreamComponents = this.dependencyAnalyzer.findRootDownstreamComponents();
containerStateHandler.stop(rootUpstreamComponents);
long took = System.nanoTime() - start;
msg = "{0}:{1} All {2} Strolch Components have been stopped. Took {3}"; //$NON-NLS-1$
msg = "{0}:{1} All {2} Strolch Components have been stopped. Took {3}";
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size(),
formatNanoDuration(took)));
}
@ -352,19 +352,19 @@ public class ComponentContainerImpl implements ComponentContainer {
long start = System.nanoTime();
String msg = "{0}:{1} Destroying {2} Strolch Components..."; //$NON-NLS-1$
String msg = "{0}:{1} Destroying {2} Strolch Components...";
String environment = getEnvironment();
String applicationName = getApplicationName();
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size()));
if (this.dependencyAnalyzer == null) {
logger.info("Strolch was not yet setup, nothing to destroy"); //$NON-NLS-1$
logger.info("Strolch was not yet setup, nothing to destroy");
} else {
Set<ComponentController> rootUpstreamComponents = this.dependencyAnalyzer.findRootDownstreamComponents();
containerStateHandler.destroy(rootUpstreamComponents);
long took = System.nanoTime() - start;
msg = "{0}:{1} All {2} Strolch Components have been destroyed! Took {3}"; //$NON-NLS-1$
msg = "{0}:{1} All {2} Strolch Components have been destroyed! Took {3}";
logger.info(MessageFormat.format(msg, applicationName, environment, this.controllerMap.size(),
formatNanoDuration(took)));
this.controllerMap.clear();

View File

@ -66,7 +66,7 @@ public class ComponentContainerStateHandler {
}
long took = System.nanoTime() - start;
String msg = "Initialized component {0}. Took {1}"; //$NON-NLS-1$
String msg = "Initialized component {0}. Took {1}";
logger.info(MessageFormat.format(msg, componentName, formatNanoDuration(took)));
}
@ -96,7 +96,7 @@ public class ComponentContainerStateHandler {
}
long took = System.nanoTime() - start;
String msg = "Started component {0}. Took {1}"; //$NON-NLS-1$
String msg = "Started component {0}. Took {1}";
logger.info(MessageFormat.format(msg, componentName, formatNanoDuration(took)));
}
@ -121,13 +121,13 @@ public class ComponentContainerStateHandler {
try {
component.stop();
} catch (Exception e) {
String msg = "Failed to stop component {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to stop component {0} due to {1}";
msg = MessageFormat.format(msg, componentName, e.getMessage());
logger.error(msg, e);
}
long took = System.nanoTime() - start;
String msg = "Stopped component {0}. Took {1}"; //$NON-NLS-1$
String msg = "Stopped component {0}. Took {1}";
logger.info(MessageFormat.format(msg, componentName, formatNanoDuration(took)));
}
@ -151,13 +151,13 @@ public class ComponentContainerStateHandler {
try {
component.destroy();
} catch (Exception e) {
String msg = "Failed to destroy component {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to destroy component {0} due to {1}";
msg = MessageFormat.format(msg, componentName, e.getMessage());
logger.error(msg, e);
}
long took = System.nanoTime() - start;
String msg = "Destroyed component {0}. Took {1}"; //$NON-NLS-1$
String msg = "Destroyed component {0}. Took {1}";
logger.info(MessageFormat.format(msg, componentName, formatNanoDuration(took)));
}

View File

@ -31,7 +31,7 @@ public class ComponentController {
public ComponentController(StrolchComponent component) {
if (component == null)
throw new IllegalArgumentException("Component may not be null!"); //$NON-NLS-1$
throw new IllegalArgumentException("Component may not be null!");
this.component = component;
this.upstreamDependencies = new HashSet<>();
this.downstreamDependencies = new HashSet<>();
@ -68,7 +68,7 @@ public class ComponentController {
public void addUpstreamDependency(ComponentController controller) {
if (equals(controller)) {
String msg = "{0} can not depend on itself!"; //$NON-NLS-1$
String msg = "{0} can not depend on itself!";
msg = MessageFormat.format(msg, controller);
throw new StrolchConfigurationException(msg);
}
@ -97,7 +97,7 @@ public class ComponentController {
private void validateNoCyclicDependency(ComponentController controller) {
if (controller.hasTransitiveUpstreamDependency(this)) {
String msg = "{0} has transitive upstream dependeny to {1}!"; //$NON-NLS-1$
String msg = "{0} has transitive upstream dependeny to {1}!";
msg = MessageFormat.format(msg, this, controller);
throw new StrolchConfigurationException(msg);
}

View File

@ -146,7 +146,7 @@ public class ComponentDependencyAnalyzer {
for (String dependencyName : dependencies) {
ComponentController dependency = this.controllerMap.get(dependencyName);
if (dependency == null) {
String msg = "Component {0} is missing required dependency {1}"; //$NON-NLS-1$
String msg = "Component {0} is missing required dependency {1}";
msg = MessageFormat.format(msg, name, dependencyName);
throw new StrolchConfigurationException(msg);
}
@ -162,9 +162,9 @@ public class ComponentDependencyAnalyzer {
*/
private void logDependencies(int depth, Set<ComponentController> components) {
if (depth == 1) {
logger.info("Dependency tree:"); //$NON-NLS-1$
logger.info("Dependency tree:");
}
String inset = StringHelper.normalizeLength("", depth * 2, false, ' '); //$NON-NLS-1$
String inset = StringHelper.normalizeLength("", depth * 2, false, ' ');
for (ComponentController controller : components) {
logger.info(inset + controller.getComponent().getName() + ": "
+ controller.getComponent().getClass().getName());

View File

@ -66,6 +66,6 @@ public enum DataStoreMode {
return dataStoreMode;
}
throw new IllegalArgumentException(MessageFormat.format("There is no data store mode ''{0}''", modeS)); //$NON-NLS-1$
throw new IllegalArgumentException(MessageFormat.format("There is no data store mode ''{0}''", modeS));
}
}

View File

@ -140,7 +140,7 @@ public class DefaultObserverHandler implements ObserverHandler {
try {
observer.add(key, elements);
} catch (Exception e) {
String msg = "Failed to update observer {0} with {1} due to {2}"; //$NON-NLS-1$
String msg = "Failed to update observer {0} with {1} due to {2}";
msg = MessageFormat.format(msg, key, observer, e.getMessage());
logger.error(msg, e);
@ -158,7 +158,7 @@ public class DefaultObserverHandler implements ObserverHandler {
try {
observer.update(key, elements);
} catch (Exception e) {
String msg = "Failed to update observer {0} with {1} due to {2}"; //$NON-NLS-1$
String msg = "Failed to update observer {0} with {1} due to {2}";
msg = MessageFormat.format(msg, key, observer, e.getMessage());
logger.error(msg, e);
@ -176,7 +176,7 @@ public class DefaultObserverHandler implements ObserverHandler {
try {
observer.remove(key, elements);
} catch (Exception e) {
String msg = "Failed to update observer {0} with {1} due to {2}"; //$NON-NLS-1$
String msg = "Failed to update observer {0} with {1} due to {2}";
msg = MessageFormat.format(msg, key, observer, e.getMessage());
logger.error(msg, e);
@ -199,14 +199,14 @@ public class DefaultObserverHandler implements ObserverHandler {
@Override
public void registerObserver(String key, Observer observer) {
this.observerMap.addElement(key, observer);
String msg = MessageFormat.format("Registered observer {0} with {1}", key, observer); //$NON-NLS-1$
String msg = MessageFormat.format("Registered observer {0} with {1}", key, observer);
logger.info(msg);
}
@Override
public void unregisterObserver(String key, Observer observer) {
if (this.observerMap.removeElement(key, observer)) {
String msg = MessageFormat.format("Unregistered observer {0} with {1}", key, observer); //$NON-NLS-1$
String msg = MessageFormat.format("Unregistered observer {0} with {1}", key, observer);
logger.info(msg);
}
}

View File

@ -36,13 +36,13 @@ import li.strolch.utils.dbc.DBC;
*/
public class DefaultRealmHandler extends StrolchComponent implements RealmHandler {
public static final String PROP_ENABLE_AUDIT_TRAIL = "enableAuditTrail"; //$NON-NLS-1$
public static final String PROP_ENABLE_AUDIT_TRAIL_FOR_READ = "enableAuditTrailForRead"; //$NON-NLS-1$
public static final String PROP_ENABLE_OBSERVER_UPDATES = "enableObserverUpdates"; //$NON-NLS-1$
public static final String PROP_ENABLE_VERSIONING = "enableVersioning"; //$NON-NLS-1$
public static final String PREFIX_DATA_STORE_MODE = "dataStoreMode"; //$NON-NLS-1$
public static final String PREFIX_DATA_STORE_FILE = "dataStoreFile"; //$NON-NLS-1$
public static final String PROP_REALMS = "realms"; //$NON-NLS-1$
public static final String PROP_ENABLE_AUDIT_TRAIL = "enableAuditTrail";
public static final String PROP_ENABLE_AUDIT_TRAIL_FOR_READ = "enableAuditTrailForRead";
public static final String PROP_ENABLE_OBSERVER_UPDATES = "enableObserverUpdates";
public static final String PROP_ENABLE_VERSIONING = "enableVersioning";
public static final String PREFIX_DATA_STORE_MODE = "dataStoreMode";
public static final String PREFIX_DATA_STORE_FILE = "dataStoreFile";
public static final String PROP_REALMS = "realms";
protected Map<String, InternalStrolchRealm> realms;
@ -57,10 +57,10 @@ public class DefaultRealmHandler extends StrolchComponent implements RealmHandle
@Override
public StrolchRealm getRealm(String realm) throws StrolchException {
DBC.PRE.assertNotEmpty("Realm name must be set!", realm); //$NON-NLS-1$
DBC.PRE.assertNotEmpty("Realm name must be set!", realm);
StrolchRealm strolchRealm = this.realms.get(realm);
if (strolchRealm == null) {
String msg = "No realm is configured with the name {0}"; //$NON-NLS-1$
String msg = "No realm is configured with the name {0}";
msg = MessageFormat.format(msg, realm);
throw new StrolchException(msg);
}

View File

@ -31,13 +31,13 @@ public class ElementMapHelpers {
String interpretation = refP.getInterpretation();
if (!interpretation.equals(expectedInterpretation)) {
String msg = "{0} is not an expected element reference as its interpretation is {1} instead of {2}"; //$NON-NLS-1$
String msg = "{0} is not an expected element reference as its interpretation is {1} instead of {2}";
throw new StrolchException(
MessageFormat.format(msg, refP.getLocator(), interpretation, expectedInterpretation));
}
if (refP.getUom().equals(UOM_NONE)) {
String msg = "{0} is not an expected element reference as its UOM is not set to a type it is set to {1}!"; //$NON-NLS-1$
String msg = "{0} is not an expected element reference as its UOM is not set to a type it is set to {1}!";
throw new StrolchException(MessageFormat.format(msg, refP.getLocator(), UOM_NONE));
}
}

View File

@ -45,13 +45,13 @@ public class EmptyRealm extends InternalStrolchRealm {
@Override
public StrolchTransaction openTx(Certificate certificate, String action, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return new TransientTransaction(this.container, this, certificate, action, readOnly);
}
@Override
public StrolchTransaction openTx(Certificate certificate, Class<?> clazz, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return new TransientTransaction(this.container, this, certificate, clazz.getName(),readOnly);
}
@ -91,7 +91,7 @@ public class EmptyRealm extends InternalStrolchRealm {
@Override
public void start(PrivilegeContext privilegeContext) {
super.start(privilegeContext);
logger.info(MessageFormat.format("Initialized EMPTY Realm {0}", getRealm())); //$NON-NLS-1$
logger.info(MessageFormat.format("Initialized EMPTY Realm {0}", getRealm()));
}
@Override

View File

@ -34,8 +34,8 @@ import org.slf4j.LoggerFactory;
*/
public abstract class InternalStrolchRealm implements StrolchRealm {
public static final String PROP_TRY_LOCK_TIME_UNIT = "tryLockTimeUnit"; //$NON-NLS-1$
public static final String PROP_TRY_LOCK_TIME = "tryLockTime"; //$NON-NLS-1$
public static final String PROP_TRY_LOCK_TIME_UNIT = "tryLockTimeUnit";
public static final String PROP_TRY_LOCK_TIME = "tryLockTime";
protected static final Logger logger = LoggerFactory.getLogger(StrolchRealm.class);
private final String realm;
private LockHandler lockHandler;
@ -48,7 +48,7 @@ public abstract class InternalStrolchRealm implements StrolchRealm {
protected ComponentContainer container;
public InternalStrolchRealm(String realm) {
DBC.PRE.assertNotEmpty("RealmName may not be empty!", realm); //$NON-NLS-1$
DBC.PRE.assertNotEmpty("RealmName may not be empty!", realm);
this.realm = realm;
}
@ -59,7 +59,7 @@ public abstract class InternalStrolchRealm implements StrolchRealm {
@Override
public void lock(Locator locator) {
DBC.PRE.assertNotNull("Can not lock a null pointer =)", locator); //$NON-NLS-1$
DBC.PRE.assertNotNull("Can not lock a null pointer =)", locator);
this.lockHandler.lock(locator);
}
@ -105,24 +105,24 @@ public abstract class InternalStrolchRealm implements StrolchRealm {
this.versioningEnabled = configuration.getBoolean(enableVersioningKey, Boolean.FALSE);
if (this.auditTrailEnabled)
logger.info("Enabling AuditTrail for realm " + getRealm()); //$NON-NLS-1$
logger.info("Enabling AuditTrail for realm " + getRealm());
else
logger.info("AuditTrail not enabled for realm " + getRealm()); //$NON-NLS-1$
logger.info("AuditTrail not enabled for realm " + getRealm());
if (this.auditTrailEnabledForRead)
logger.info("Enabling AuditTrail for read for realm " + getRealm()); //$NON-NLS-1$
logger.info("Enabling AuditTrail for read for realm " + getRealm());
else
logger.info("AuditTrail not enabled for read for realm " + getRealm()); //$NON-NLS-1$
logger.info("AuditTrail not enabled for read for realm " + getRealm());
if (this.updateObservers)
logger.info("Enabling Observer Updates for realm " + getRealm()); //$NON-NLS-1$
logger.info("Enabling Observer Updates for realm " + getRealm());
else
logger.info("Observer Updates not enabled for realm " + getRealm()); //$NON-NLS-1$
logger.info("Observer Updates not enabled for realm " + getRealm());
if (this.versioningEnabled)
logger.info("Enabling Versioning for realm " + getRealm()); //$NON-NLS-1$
logger.info("Enabling Versioning for realm " + getRealm());
else
logger.info("Versioning not enabled for realm " + getRealm()); //$NON-NLS-1$
logger.info("Versioning not enabled for realm " + getRealm());
logger.info(
MessageFormat.format("Using a locking try timeout of {0}s", timeUnit.toSeconds(time))); //$NON-NLS-1$
MessageFormat.format("Using a locking try timeout of {0}s", timeUnit.toSeconds(time)));
}
@Override
@ -148,7 +148,7 @@ public abstract class InternalStrolchRealm implements StrolchRealm {
@Override
public ObserverHandler getObserverHandler() throws IllegalArgumentException {
if (!this.updateObservers)
throw new IllegalArgumentException("ObserverUpdates are not enabled!"); //$NON-NLS-1$
throw new IllegalArgumentException("ObserverUpdates are not enabled!");
return this.observerHandler;
}

View File

@ -87,7 +87,7 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
T t = getBy(tx, TEMPLATE, type);
if (assertExists && t == null) {
String msg = "The template with type \"{0}\" does not exist!"; //$NON-NLS-1$
String msg = "The template with type \"{0}\" does not exist!";
throw new StrolchElementNotFoundException(MessageFormat.format(msg, type));
}
@ -116,7 +116,7 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
}
if (assertExists && t == null) {
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist!"; //$NON-NLS-1$
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist!";
throw new StrolchElementNotFoundException(MessageFormat.format(msg, type, id));
}
@ -135,7 +135,7 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
String id = refP.getValue();
T t = getBy(tx, type, id, false);
if (assertExists && t == null) {
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\""; //$NON-NLS-1$
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\"";
throw new StrolchElementNotFoundException(MessageFormat.format(msg, type, id, refP.getLocator()));
}
return t;
@ -153,7 +153,7 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
.map(id -> {
T t = getBy(tx, type, id, false);
if (assertExists && t == null) {
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\""; //$NON-NLS-1$
String msg = "The element with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\"";
throw new StrolchElementNotFoundException(
MessageFormat.format(msg, type, id, refP.getLocator()));
}
@ -256,7 +256,7 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
// assert no object already exists with this id
if (byType.containsKey(element.getId())) {
String msg = "An element already exists with the id \"{0}\". Elements of the same class must always have a unique id, regardless of their type!"; //$NON-NLS-1$
String msg = "An element already exists with the id \"{0}\". Elements of the same class must always have a unique id, regardless of their type!";
msg = MessageFormat.format(msg, element.getId());
throw new StrolchPersistenceException(msg);
}
@ -298,14 +298,14 @@ public abstract class TransientElementMap<T extends StrolchRootElement> implemen
protected void internalUpdate(StrolchTransaction tx, T element) {
Map<String, T> byType = this.elementMap.get(element.getType());
if (byType == null) {
String msg = "The element does not yet exist with the type \"{0}\" and id \"{1}\". Use add() for new objects!"; //$NON-NLS-1$
String msg = "The element does not yet exist with the type \"{0}\" and id \"{1}\". Use add() for new objects!";
msg = MessageFormat.format(msg, element.getType(), element.getId());
throw new StrolchPersistenceException(msg);
}
// assert object already exists with this id
if (!byType.containsKey(element.getId())) {
String msg = "The element does not yet exist with the type \"{0}\" and id \"{1}\". Use add() for new objects!"; //$NON-NLS-1$
String msg = "The element does not yet exist with the type \"{0}\" and id \"{1}\". Use add() for new objects!";
msg = MessageFormat.format(msg, element.getType(), element.getId());
throw new StrolchPersistenceException(msg);
}

View File

@ -53,13 +53,13 @@ public class TransientRealm extends InternalStrolchRealm {
@Override
public StrolchTransaction openTx(Certificate certificate, String action, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return new TransientTransaction(this.container, this, certificate, action, readOnly);
}
@Override
public StrolchTransaction openTx(Certificate certificate, Class<?> clazz, boolean readOnly) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("Certificate must be set!", certificate);
return new TransientTransaction(this.container, this, certificate, clazz.getName(), readOnly);
}
@ -89,7 +89,7 @@ public class TransientRealm extends InternalStrolchRealm {
String key = StrolchConstants.makeRealmKey(getRealm(), DefaultRealmHandler.PREFIX_DATA_STORE_FILE);
if (!configuration.hasProperty(key)) {
String msg = "There is no data store file for realm {0}. Set a property with key {1}"; //$NON-NLS-1$
String msg = "There is no data store file for realm {0}. Set a property with key {1}";
msg = MessageFormat.format(msg, getRealm(), key);
throw new StrolchConfigurationException(msg);
}
@ -128,11 +128,11 @@ public class TransientRealm extends InternalStrolchRealm {
String durationS = StringHelper.formatNanoDuration(statistics.durationNanos);
logger.info(MessageFormat
.format("Loaded XML Model file {0} for realm {1} took {2}.", this.modelFile.getName(), //$NON-NLS-1$
.format("Loaded XML Model file {0} for realm {1} took {2}.", this.modelFile.getName(),
getRealm(), durationS));
logger.info(MessageFormat.format("Loaded {0} Orders", statistics.nrOfOrders)); //$NON-NLS-1$
logger.info(MessageFormat.format("Loaded {0} Resources", statistics.nrOfResources)); //$NON-NLS-1$
logger.info(MessageFormat.format("Loaded {0} Activities", statistics.nrOfActivities)); //$NON-NLS-1$
logger.info(MessageFormat.format("Loaded {0} Orders", statistics.nrOfOrders));
logger.info(MessageFormat.format("Loaded {0} Resources", statistics.nrOfResources));
logger.info(MessageFormat.format("Loaded {0} Activities", statistics.nrOfActivities));
}
@Override

View File

@ -86,10 +86,10 @@ public abstract class AbstractTransaction implements StrolchTransaction {
public AbstractTransaction(ComponentContainer container, StrolchRealm realm, Certificate certificate, String action,
boolean readOnly) {
DBC.PRE.assertNotNull("container must be set!", container); //$NON-NLS-1$
DBC.PRE.assertNotNull("realm must be set!", realm); //$NON-NLS-1$
DBC.PRE.assertNotNull("certificate must be set!", certificate); //$NON-NLS-1$
DBC.PRE.assertNotNull("action must be set!", action); //$NON-NLS-1$
DBC.PRE.assertNotNull("container must be set!", container);
DBC.PRE.assertNotNull("realm must be set!", realm);
DBC.PRE.assertNotNull("certificate must be set!", certificate);
DBC.PRE.assertNotNull("action must be set!", action);
TransactionThreadLocal.setTx(this);
@ -499,7 +499,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
// Order/<type>/<id>/Bag/<id>/<param_id>
if (locator.getSize() < 3) {
String msg = "The locator is invalid as it does not have at least three path elements (e.g. Resource/MyType/@id): {0}"; //$NON-NLS-1$
String msg = "The locator is invalid as it does not have at least three path elements (e.g. Resource/MyType/@id): {0}";
msg = MessageFormat.format(msg, locator.toString());
throw new StrolchModelException(msg);
}
@ -514,13 +514,13 @@ public abstract class AbstractTransaction implements StrolchTransaction {
case Tags.ORDER -> getOrderBy(type, id);
case Tags.ACTIVITY -> getActivityBy(type, id);
default -> throw new StrolchModelException(
MessageFormat.format("Unknown object class {0}", objectClassType)); //$NON-NLS-1$
MessageFormat.format("Unknown object class {0}", objectClassType));
};
if (rootElement == null) {
if (allowNull)
return null;
String msg = "No top level object could be found with locator {0}"; //$NON-NLS-1$
String msg = "No top level object could be found with locator {0}";
throw new StrolchModelException(MessageFormat.format(msg, locator));
}
@ -536,7 +536,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
if (bag == null) {
if (allowNull)
return null;
String msg = "Could not find ParameterBag for locator {0} on element {1}"; //$NON-NLS-1$
String msg = "Could not find ParameterBag for locator {0} on element {1}";
throw new StrolchModelException(MessageFormat.format(msg, locator, rootElement.getLocator()));
}
@ -548,7 +548,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
if (parameter == null) {
if (allowNull)
return null;
String msg = "Could not find Parameter for locator {0} on element {1}"; //$NON-NLS-1$
String msg = "Could not find Parameter for locator {0} on element {1}";
throw new StrolchModelException(MessageFormat.format(msg, locator, bag.getLocator()));
}
return (T) parameter;
@ -556,7 +556,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
} else if (stateOrBagOrActivity.equals(Tags.TIMED_STATE)) {
if (elements.size() != 5) {
String msg = "Missing state Id on locator {0}"; //$NON-NLS-1$
String msg = "Missing state Id on locator {0}";
throw new StrolchModelException(MessageFormat.format(msg, locator));
}
@ -574,7 +574,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
String next = iter.next();
if (!(element instanceof Activity)) {
String msg = "Invalid locator {0} with part {1} as not an Activity but deeper element specified"; //$NON-NLS-1$
String msg = "Invalid locator {0} with part {1} as not an Activity but deeper element specified";
throw new StrolchModelException(MessageFormat.format(msg, locator, next));
}
@ -587,7 +587,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
if (allowNull)
return null;
String msg = "Invalid locator {0} with part {1}"; //$NON-NLS-1$
String msg = "Invalid locator {0} with part {1}";
throw new StrolchModelException(MessageFormat.format(msg, locator, stateOrBagOrActivity));
}
@ -776,7 +776,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
ElementMapHelpers.assertIsRefParam(INTERPRETATION_ORDER_REF, refP);
if (assertExists && refP.isEmpty()) {
String msg = "The Order with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\""; //$NON-NLS-1$
String msg = "The Order with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\"";
throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator()));
}
@ -890,7 +890,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
ElementMapHelpers.assertIsRefParam(INTERPRETATION_RESOURCE_REF, refP);
if (assertExists && refP.isEmpty()) {
String msg = "The Resource with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\""; //$NON-NLS-1$
String msg = "The Resource with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\"";
throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator()));
}
@ -1020,7 +1020,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
ElementMapHelpers.assertIsRefParam(INTERPRETATION_ACTIVITY_REF, refP);
if (assertExists && refP.isEmpty()) {
String msg = "The Activity with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\""; //$NON-NLS-1$
String msg = "The Activity with type \"{0}\" and id \"{1}\" does not exist for param \"{2}\"";
throw new StrolchException(MessageFormat.format(msg, refP.getUom(), refP.getValue(), refP.getLocator()));
}
@ -1553,7 +1553,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
} catch (Exception e) {
this.closeStrategy = TransactionCloseStrategy.ROLLBACK;
String msg = "Strolch Transaction for realm {0} failed due to {1}"; //$NON-NLS-1$
String msg = "Strolch Transaction for realm {0} failed due to {1}";
msg = MessageFormat.format(msg, getRealmName(), getExceptionMessage(e));
throw new StrolchTransactionException(msg, e);
}
@ -1599,7 +1599,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
handleRollback(start);
} catch (Exception exc) {
logger.error("Failed to roll back after failing to undo commands: " + exc.getMessage(),
exc); //$NON-NLS-1$
exc);
}
logger.error("Transaction failed due to " + e.getMessage(), e);
handleFailure(false, start, ex);
@ -1623,7 +1623,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
@Override
public void autoCloseableRollback() {
long start = System.nanoTime();
logger.warn(MessageFormat.format("Rolling back TX for realm {0}...", getRealmName())); //$NON-NLS-1$
logger.warn(MessageFormat.format("Rolling back TX for realm {0}...", getRealmName()));
try {
this.txResult.setState(TransactionState.ROLLING_BACK);
undoCommands();
@ -1709,22 +1709,22 @@ public abstract class AbstractTransaction implements StrolchTransaction {
sb.append("TX user=");
sb.append(this.certificate.getUsername());
sb.append(", realm="); //$NON-NLS-1$
sb.append(", realm=");
sb.append(getRealmName());
sb.append(", took="); //$NON-NLS-1$
sb.append(", took=");
sb.append(formatNanoDuration(txDuration));
sb.append(", action=");
sb.append(this.action);
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
sb.append(", close=");
sb.append(formatNanoDuration(closeDuration));
}
if (isAuditTrailEnabled() && auditTrailDuration >= 100000000L) {
sb.append(", auditTrail="); //$NON-NLS-1$
sb.append(", auditTrail=");
sb.append(formatNanoDuration(auditTrailDuration));
}
@ -1747,27 +1747,27 @@ public abstract class AbstractTransaction implements StrolchTransaction {
sb.append("TX user=");
sb.append(this.certificate.getUsername());
sb.append(", realm="); //$NON-NLS-1$
sb.append(", realm=");
sb.append(getRealmName());
sb.append(", took="); //$NON-NLS-1$
sb.append(", took=");
sb.append(formatNanoDuration(txDuration));
sb.append(", action=");
sb.append(this.action);
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
sb.append(", close=");
sb.append(formatNanoDuration(closeDuration));
}
if (isAuditTrailEnabled() && auditTrailDuration >= 100000000L) {
sb.append(", auditTrail="); //$NON-NLS-1$
sb.append(", auditTrail=");
sb.append(formatNanoDuration(auditTrailDuration));
}
if (isObserverUpdatesEnabled() && observerUpdateDuration >= 100000000L) {
sb.append(", updates="); //$NON-NLS-1$
sb.append(", updates=");
sb.append(formatNanoDuration(observerUpdateDuration));
}
logger.info(sb.toString());
@ -1786,17 +1786,17 @@ public abstract class AbstractTransaction implements StrolchTransaction {
sb.append("TX ROLLBACK user=");
sb.append(this.certificate.getUsername());
sb.append(", realm="); //$NON-NLS-1$
sb.append(", realm=");
sb.append(getRealmName());
sb.append(" failed="); //$NON-NLS-1$
sb.append(" failed=");
sb.append(formatNanoDuration(txDuration));
sb.append(", action=");
sb.append(this.action);
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
sb.append(", close=");
sb.append(formatNanoDuration(closeDuration));
}
logger.warn(sb.toString());
@ -1816,17 +1816,17 @@ public abstract class AbstractTransaction implements StrolchTransaction {
sb.append("TX FAILED user=");
sb.append(this.certificate.getUsername());
sb.append(", realm="); //$NON-NLS-1$
sb.append(", realm=");
sb.append(getRealmName());
sb.append(" failed="); //$NON-NLS-1$
sb.append(" failed=");
sb.append(formatNanoDuration(txDuration));
sb.append(", action=");
sb.append(this.action);
if (closeDuration >= 100000000L) {
sb.append(", close="); //$NON-NLS-1$
sb.append(", close=");
sb.append(formatNanoDuration(closeDuration));
}
@ -1838,7 +1838,7 @@ public abstract class AbstractTransaction implements StrolchTransaction {
"agent.tx.failed").withException(e).value("reason", e));
}
String msg = "Strolch Transaction for realm {0} failed due to {1}\n{2}"; //$NON-NLS-1$
String msg = "Strolch Transaction for realm {0} failed due to {1}\n{2}";
msg = MessageFormat.format(msg, getRealmName(), getExceptionMessage(e), sb.toString());
StrolchTransactionException ex = new StrolchTransactionException(msg, e);

View File

@ -64,13 +64,13 @@ public class StrolchConstants extends StrolchModelConstants {
*/
public static class StrolchPrivilegeConstants {
public static final String PRIVILEGE = "Privilege"; //$NON-NLS-1$
public static final String CERTIFICATE = "Certificate"; //$NON-NLS-1$
public static final String LOGIN = "Login"; //$NON-NLS-1$
public static final String LOGOUT = "Logout"; //$NON-NLS-1$
public static final String SESSION_TIME_OUT = "SessionTimeout"; //$NON-NLS-1$
public static final String ROLE = "Role"; //$NON-NLS-1$
public static final String USER = "User"; //$NON-NLS-1$
public static final String PRIVILEGE = "Privilege";
public static final String CERTIFICATE = "Certificate";
public static final String LOGIN = "Login";
public static final String LOGOUT = "Logout";
public static final String SESSION_TIME_OUT = "SessionTimeout";
public static final String ROLE = "Role";
public static final String USER = "User";
public static final String PRIVILEGE_GET_ROLE = PrivilegeHandler.PRIVILEGE_GET_ROLE;
public static final String PRIVILEGE_ADD_ROLE = PrivilegeHandler.PRIVILEGE_ADD_ROLE;

View File

@ -66,7 +66,7 @@ public abstract class AbstractionConfiguration {
public String[] getStringArray(String key, String defValue) {
String value = getValue(key, defValue);
String[] values = value.split(","); //$NON-NLS-1$
String[] values = value.split(",");
for (int i = 0; i < values.length; i++) {
values[i] = values[i].trim();
}
@ -81,12 +81,12 @@ public abstract class AbstractionConfiguration {
public boolean getBoolean(String key, Boolean defValue) {
String value = this.configurationValues.get(key);
if (StringHelper.isNotEmpty(value)) {
if (value.equalsIgnoreCase("true")) //$NON-NLS-1$
if (value.equalsIgnoreCase("true"))
return true;
else if (value.equalsIgnoreCase("false")) //$NON-NLS-1$
else if (value.equalsIgnoreCase("false"))
return false;
String msg = "Component {0} has non-boolean configuration value for {1} = {2}!"; //$NON-NLS-1$
String msg = "Component {0} has non-boolean configuration value for {1} = {2}!";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -103,7 +103,7 @@ public abstract class AbstractionConfiguration {
try {
return Integer.decode(value);
} catch (NumberFormatException e) {
String msg = "Component {0} has non-integer configuration value for {1} = {2}!"; //$NON-NLS-1$
String msg = "Component {0} has non-integer configuration value for {1} = {2}!";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -121,7 +121,7 @@ public abstract class AbstractionConfiguration {
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
String msg = "Component {0} has non-long configuration value for {1} = {2}!"; //$NON-NLS-1$
String msg = "Component {0} has non-long configuration value for {1} = {2}!";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -137,7 +137,7 @@ public abstract class AbstractionConfiguration {
File configFile = new File(configuration.getConfigPath(), value);
if (!configFile.isFile() || !configFile.canRead()) {
String msg = "Component {0} requires configuration file for configuration property ''{1}'' which does not exist with value: {2}"; //$NON-NLS-1$
String msg = "Component {0} requires configuration file for configuration property ''{1}'' which does not exist with value: {2}";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -149,7 +149,7 @@ public abstract class AbstractionConfiguration {
File dataDir = new File(configuration.getDataPath(), value);
if (checkExists && !dataDir.isDirectory() || !dataDir.canRead()) {
String msg = "Component {0} requires data directory for configuration property ''{1}'' which does not exist with value: {2}"; //$NON-NLS-1$
String msg = "Component {0} requires data directory for configuration property ''{1}'' which does not exist with value: {2}";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -161,7 +161,7 @@ public abstract class AbstractionConfiguration {
File dataFile = new File(configuration.getDataPath(), value);
if (checkExists && !dataFile.isFile() || !dataFile.canRead()) {
String msg = "Component {0} requires data file for configuration property ''{1}'' which does not exist with value: {2}"; //$NON-NLS-1$
String msg = "Component {0} requires data file for configuration property ''{1}'' which does not exist with value: {2}";
msg = MessageFormat.format(msg, this.name, key, value);
throw new StrolchConfigurationException(msg);
}
@ -179,14 +179,14 @@ public abstract class AbstractionConfiguration {
}
private void logDefValueUse(String key, Object defValue) {
String msg = "{0}: Using default for key {1}={2}"; //$NON-NLS-1$
String msg = "{0}: Using default for key {1}={2}";
msg = MessageFormat.format(msg, this.name, key, defValue);
logger.info(msg);
}
private void assertDefValueExist(String key, Object defValue) {
if (defValue == null) {
String msg = "Component {0} is missing the configuration value with key ''{1}''!"; //$NON-NLS-1$
String msg = "Component {0} is missing the configuration value with key ''{1}''!";
msg = MessageFormat.format(msg, this.name, key);
throw new StrolchConfigurationException(msg);
}

View File

@ -24,34 +24,34 @@ import li.strolch.utils.helper.XmlHelper;
public class ConfigurationParser {
public static final String STROLCH_CONFIGURATION_XML = "StrolchConfiguration.xml"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_XML = "StrolchConfiguration.xml";
public static StrolchConfiguration parseConfiguration(String environment, File configPathF, File dataPathF,
File tempPathF) {
DBC.PRE.assertNotEmpty("environment value must be set!", environment); //$NON-NLS-1$
DBC.PRE.assertNotNull("configPathF must be set!", configPathF); //$NON-NLS-1$
DBC.PRE.assertNotNull("dataPathF must be set!", dataPathF); //$NON-NLS-1$
DBC.PRE.assertNotNull("tempPathF must be set!", tempPathF); //$NON-NLS-1$
DBC.PRE.assertNotEquals("environment must be a value other than 'global'!", ConfigurationTags.ENV_GLOBAL, //$NON-NLS-1$
DBC.PRE.assertNotEmpty("environment value must be set!", environment);
DBC.PRE.assertNotNull("configPathF must be set!", configPathF);
DBC.PRE.assertNotNull("dataPathF must be set!", dataPathF);
DBC.PRE.assertNotNull("tempPathF must be set!", tempPathF);
DBC.PRE.assertNotEquals("environment must be a value other than 'global'!", ConfigurationTags.ENV_GLOBAL,
environment);
// config path: readable directory
if (!configPathF.isDirectory() || !configPathF.canRead()) {
String msg = "Config path is not readable at {0}"; //$NON-NLS-1$
String msg = "Config path is not readable at {0}";
msg = MessageFormat.format(msg, configPathF);
throw new StrolchConfigurationException(msg);
}
// data path: writable directory
if (!dataPathF.isDirectory() || !dataPathF.canRead() || !dataPathF.canWrite()) {
String msg = "Data path is not a directory or readable or writeable at {0}"; //$NON-NLS-1$
String msg = "Data path is not a directory or readable or writeable at {0}";
msg = MessageFormat.format(msg, dataPathF);
throw new StrolchConfigurationException(msg);
}
// tmp path: writable directory
if (!tempPathF.isDirectory() || !tempPathF.canRead() || !tempPathF.canWrite()) {
String msg = "Temp path is not a directory or readable or writeable at {0}"; //$NON-NLS-1$
String msg = "Temp path is not a directory or readable or writeable at {0}";
msg = MessageFormat.format(msg, tempPathF);
throw new StrolchConfigurationException(msg);
}
@ -59,7 +59,7 @@ public class ConfigurationParser {
// get path to configuration file
File configurationFile = new File(configPathF, STROLCH_CONFIGURATION_XML);
if (!configurationFile.isFile() || !configurationFile.canRead()) {
String msg = "Configuration file is not readable at {0}"; //$NON-NLS-1$
String msg = "Configuration file is not readable at {0}";
msg = MessageFormat.format(msg, configurationFile);
throw new StrolchConfigurationException(msg);
}
@ -72,7 +72,7 @@ public class ConfigurationParser {
ConfigurationBuilder globalEnvBuilder = configurationParser.getGlobalEnvBuilder();
ConfigurationBuilder envBuilder = configurationParser.getEnvBuilder();
if (envBuilder == null) {
String msg = "The environment {0} does not exist!"; //$NON-NLS-1$
String msg = "The environment {0} does not exist!";
msg = MessageFormat.format(msg, environment);
throw new StrolchConfigurationException(msg);
}

View File

@ -78,9 +78,9 @@ public class ConfigurationSaxParser extends DefaultHandler {
switch (locator.toString()) {
case STROLCH_CONFIGURATION_ENV -> {
String env = attributes.getValue(ID);
DBC.PRE.assertNotEmpty("attribute 'id' must be set on element 'env'", env); //$NON-NLS-1$
DBC.PRE.assertNotEmpty("attribute 'id' must be set on element 'env'", env);
if (this.envBuilders.containsKey(env)) {
String msg = "Environment {0} already exists!"; //$NON-NLS-1$
String msg = "Environment {0} already exists!";
throw new IllegalStateException(MessageFormat.format(msg, env));
}
this.currentEnvironment = env;
@ -128,14 +128,14 @@ public class ConfigurationSaxParser extends DefaultHandler {
private ConfigurationBuilder getEnvBuilder(String environment) {
if (StringHelper.isEmpty(environment))
throw new IllegalStateException("environment must be set!"); //$NON-NLS-1$
throw new IllegalStateException("environment must be set!");
else if (environment.equals(ENV_GLOBAL))
return this.globalEnvBuilder;
ConfigurationBuilder envBuilder = this.envBuilders.get(environment);
if (envBuilder == null)
throw new IllegalStateException(
MessageFormat.format("No ConfigurationBuilder exists for env {0}", environment)); //$NON-NLS-1$
MessageFormat.format("No ConfigurationBuilder exists for env {0}", environment));
return envBuilder;
}
@ -173,7 +173,7 @@ public class ConfigurationSaxParser extends DefaultHandler {
private void assertExpectedLocator(Locator expectedLocator, Locator actualLocator) {
if (!expectedLocator.equals(actualLocator)) {
String msg = "Locator mismatch. Expected {0}. Current: {1}"; //$NON-NLS-1$
String msg = "Locator mismatch. Expected {0}. Current: {1}";
msg = MessageFormat.format(msg, expectedLocator, actualLocator);
throw new IllegalStateException(msg);
}
@ -185,8 +185,8 @@ public class ConfigurationSaxParser extends DefaultHandler {
protected StringBuilder valueBuffer;
public ElementHandler(ConfigurationBuilder configurationBuilder, Locator locator) {
DBC.PRE.assertNotNull("configurationBuilder must be set!", configurationBuilder); //$NON-NLS-1$
DBC.PRE.assertNotNull("locator must be set!", locator); //$NON-NLS-1$
DBC.PRE.assertNotNull("configurationBuilder must be set!", configurationBuilder);
DBC.PRE.assertNotNull("locator must be set!", locator);
this.configurationBuilder = configurationBuilder;
this.locator = locator;
}
@ -275,7 +275,7 @@ public class ConfigurationSaxParser extends DefaultHandler {
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if (this.propertyName != null) {
String msg = "Opening another tag {0} although {1} is still open!"; //$NON-NLS-1$
String msg = "Opening another tag {0} although {1} is still open!";
msg = MessageFormat.format(msg, this.propertyName, qName);
throw new IllegalStateException(msg);
}
@ -287,7 +287,7 @@ public class ConfigurationSaxParser extends DefaultHandler {
@Override
public void endElement(String uri, String localName, String qName) {
if (this.propertyName == null || !this.propertyName.equals(qName)) {
String msg = "Previous tag {0} was not closed before new tag {1}!"; //$NON-NLS-1$
String msg = "Previous tag {0} was not closed before new tag {1}!";
msg = MessageFormat.format(msg, this.propertyName, qName);
throw new IllegalStateException(msg);
}
@ -394,7 +394,7 @@ public class ConfigurationSaxParser extends DefaultHandler {
public void addProperty(String key, String value) {
if (StringHelper.isEmpty(key))
throw new IllegalStateException("Key is empty!"); //$NON-NLS-1$
throw new IllegalStateException("Key is empty!");
this.properties.put(key, value);
}

View File

@ -20,19 +20,19 @@ package li.strolch.runtime.configuration;
*/
public class ConfigurationTags {
public static final String ENV_GLOBAL = "global"; //$NON-NLS-1$
public static final String ENV_GLOBAL = "global";
public static final String STROLCH_CONFIGURATION_ENV_COMPONENT_PROPERTIES = "StrolchConfiguration/env/Component/Properties"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_ENV_COMPONENT = "StrolchConfiguration/env/Component"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_ENV_RUNTIME_PROPERTIES = "StrolchConfiguration/env/Runtime/Properties"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_ENV_RUNTIME = "StrolchConfiguration/env/Runtime"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_ENV = "StrolchConfiguration/env"; //$NON-NLS-1$
public static final String STROLCH_CONFIGURATION_ENV_COMPONENT_PROPERTIES = "StrolchConfiguration/env/Component/Properties";
public static final String STROLCH_CONFIGURATION_ENV_COMPONENT = "StrolchConfiguration/env/Component";
public static final String STROLCH_CONFIGURATION_ENV_RUNTIME_PROPERTIES = "StrolchConfiguration/env/Runtime/Properties";
public static final String STROLCH_CONFIGURATION_ENV_RUNTIME = "StrolchConfiguration/env/Runtime";
public static final String STROLCH_CONFIGURATION_ENV = "StrolchConfiguration/env";
public static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
public static final String ID = "id"; //$NON-NLS-1$
public static final String DEPENDS = "depends"; //$NON-NLS-1$
public static final String IMPL = "impl"; //$NON-NLS-1$
public static final String API = "api"; //$NON-NLS-1$
public static final String NAME = "name"; //$NON-NLS-1$
public static final String APPLICATION_NAME = "applicationName";
public static final String ID = "id";
public static final String DEPENDS = "depends";
public static final String IMPL = "impl";
public static final String API = "api";
public static final String NAME = "name";
}

View File

@ -22,9 +22,9 @@ import java.util.Map;
public class RuntimeConfiguration extends AbstractionConfiguration {
public static final String PROP_LOCALE = "locale"; //$NON-NLS-1$
public static final String RUNTIME = "Runtime"; //$NON-NLS-1$
public static final String PROP_TIMEZONE = "timezone"; //$NON-NLS-1$
public static final String PROP_LOCALE = "locale";
public static final String RUNTIME = "Runtime";
public static final String PROP_TIMEZONE = "timezone";
private final String applicationName;
private final String environment;
@ -40,21 +40,21 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
// config path: readable directory
if (!configPathF.isDirectory() || !configPathF.canRead()) {
String msg = "Config path is not readable at {0}"; //$NON-NLS-1$
String msg = "Config path is not readable at {0}";
msg = MessageFormat.format(msg, configPathF);
throw new StrolchConfigurationException(msg);
}
// data path: writable directory
if (!dataPathF.isDirectory() || !dataPathF.canRead() || !dataPathF.canWrite()) {
String msg = "Data path is not a directory or readable or writeable at {0}"; //$NON-NLS-1$
String msg = "Data path is not a directory or readable or writeable at {0}";
msg = MessageFormat.format(msg, dataPathF);
throw new StrolchConfigurationException(msg);
}
// tmp path: writable directory
if (!tempPathF.isDirectory() || !tempPathF.canRead() || !tempPathF.canWrite()) {
String msg = "Temp path is not a directory or readable or writeable at {0}"; //$NON-NLS-1$
String msg = "Temp path is not a directory or readable or writeable at {0}";
msg = MessageFormat.format(msg, tempPathF);
throw new StrolchConfigurationException(msg);
}
@ -112,7 +112,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
public File getConfigFile(String context, String fileName, boolean checkExists) {
File configFile = new File(getConfigPath(), fileName);
if (checkExists && (!configFile.isFile() || !configFile.canRead())) {
String msg = "[{0}] requires config file which does not exist with name: {1}"; //$NON-NLS-1$
String msg = "[{0}] requires config file which does not exist with name: {1}";
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
}
@ -134,7 +134,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
public File getDataFile(String context, String fileName, boolean checkExists) {
File dataFile = new File(getDataPath(), fileName);
if (checkExists && (!dataFile.isFile() || !dataFile.canRead())) {
String msg = "[{0}] requires data file which does not exist with name: {1}"; //$NON-NLS-1$
String msg = "[{0}] requires data file which does not exist with name: {1}";
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
}
@ -156,7 +156,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
public File getDataDir(String context, String dirName, boolean checkExists) {
File dataDir = new File(getDataPath(), dirName);
if (checkExists && (!dataDir.isDirectory() || !dataDir.canRead())) {
String msg = "[{0}] requires data directory which does not exist with name: {1}"; //$NON-NLS-1$
String msg = "[{0}] requires data directory which does not exist with name: {1}";
msg = MessageFormat.format(msg, getName(), context, dirName);
throw new StrolchConfigurationException(msg);
}

View File

@ -45,7 +45,7 @@ public class StrolchConfiguration {
public ComponentConfiguration getComponentConfiguration(String componentName) {
ComponentConfiguration componentConfiguration = this.configurationByComponent.get(componentName);
if (componentConfiguration == null) {
String msg = "No configuration exists for the component {0}"; //$NON-NLS-1$
String msg = "No configuration exists for the component {0}";
msg = MessageFormat.format(msg, componentName);
throw new StrolchConfigurationException(msg);
}

View File

@ -34,14 +34,14 @@ import li.strolch.utils.helper.StringHelper;
*/
public class StrolchEnvironment {
public static final String ENV_PROPERTIES_FILE = "ENV.properties"; //$NON-NLS-1$
public static final String ENV_PROPERTIES_FILE = "ENV.properties";
private static final Logger logger = LoggerFactory.getLogger(StrolchEnvironment.class);
public static String getEnvironmentFromSystemProperties() {
String environment = System.getProperties().getProperty(StrolchConstants.ENV_STROLCH);
if (StringHelper.isEmpty(environment)) {
String msg = "The system property {0} is missing!"; //$NON-NLS-1$
String msg = "The system property {0} is missing!";
throw new StrolchConfigurationException(MessageFormat.format(msg, StrolchConstants.ENV_STROLCH));
}
@ -51,19 +51,19 @@ public class StrolchEnvironment {
public static String getEnvironmentFromEnvProperties(File rootPath) {
File envF = new File(rootPath, ENV_PROPERTIES_FILE);
DBC.PRE.assertExists(
MessageFormat.format("{0} does not exist in {1}", ENV_PROPERTIES_FILE, rootPath.getAbsolutePath()), //$NON-NLS-1$
MessageFormat.format("{0} does not exist in {1}", ENV_PROPERTIES_FILE, rootPath.getAbsolutePath()),
envF);
Properties envP = new Properties();
try (InputStream fin = Files.newInputStream(envF.toPath())) {
envP.load(fin);
} catch (Exception e) {
throw new StrolchConfigurationException(
MessageFormat.format("Failed to load {0} in {1}", ENV_PROPERTIES_FILE, rootPath), e); //$NON-NLS-1$
MessageFormat.format("Failed to load {0} in {1}", ENV_PROPERTIES_FILE, rootPath), e);
}
String environment = envP.getProperty(StrolchConstants.ENV_STROLCH);
if (StringHelper.isEmpty(environment)) {
String msg = "The property {0} does not exist in {1}"; //$NON-NLS-1$
String msg = "The property {0} does not exist in {1}";
msg = MessageFormat.format(msg, StrolchConstants.ENV_STROLCH, envF.getAbsolutePath());
throw new StrolchConfigurationException(msg);
}
@ -80,7 +80,7 @@ public class StrolchEnvironment {
try {
envP.load(stream);
} catch (Exception e) {
throw new StrolchConfigurationException(MessageFormat.format("Failed to load {0}", ENV_PROPERTIES_FILE), e); //$NON-NLS-1$
throw new StrolchConfigurationException(MessageFormat.format("Failed to load {0}", ENV_PROPERTIES_FILE), e);
} finally {
try {
stream.close();
@ -91,7 +91,7 @@ public class StrolchEnvironment {
String environment = envP.getProperty(StrolchConstants.ENV_STROLCH);
if (StringHelper.isEmpty(environment)) {
String msg = "The property {0} does not exist in {1}"; //$NON-NLS-1$
String msg = "The property {0} does not exist in {1}";
msg = MessageFormat.format(msg, StrolchConstants.ENV_STROLCH, ENV_PROPERTIES_FILE);
throw new StrolchConfigurationException(msg);
}

View File

@ -50,8 +50,8 @@ import li.strolch.utils.helper.XmlHelper;
public class DefaultStrolchPrivilegeHandler extends StrolchComponent implements PrivilegeHandler {
public static final String PROP_PRIVILEGE_CONFIG_FILE = "privilegeConfigFile"; //$NON-NLS-1$
public static final String PRIVILEGE_CONFIG_XML = "PrivilegeConfig.xml"; //$NON-NLS-1$
public static final String PROP_PRIVILEGE_CONFIG_FILE = "privilegeConfigFile";
public static final String PRIVILEGE_CONFIG_XML = "PrivilegeConfig.xml";
private li.strolch.privilege.handler.PrivilegeHandler privilegeHandler;
@ -100,7 +100,7 @@ public class DefaultStrolchPrivilegeHandler extends StrolchComponent implements
// make sure file exists
if (!privilegeXmlFile.exists()) {
String msg = "Privilege file does not exist at path {0}"; //$NON-NLS-1$
String msg = "Privilege file does not exist at path {0}";
msg = MessageFormat.format(msg, privilegeXmlFile.getAbsolutePath());
throw new PrivilegeException(msg);
}
@ -132,7 +132,7 @@ public class DefaultStrolchPrivilegeHandler extends StrolchComponent implements
return PrivilegeInitializationHelper.initializeFromXml(containerModel);
} catch (Exception e) {
String msg = "Failed to load Privilege configuration from {0}"; //$NON-NLS-1$
String msg = "Failed to load Privilege configuration from {0}";
msg = MessageFormat.format(msg, privilegeXmlFile.getAbsolutePath());
throw new PrivilegeException(msg, e);
}

View File

@ -50,7 +50,7 @@ public class ModelPrivilege implements PrivilegePolicy {
// DefaultPrivilege policy expects the privilege value to be a string
if (!(object instanceof StrolchRootElement rootElement)) {
String msg = Restrictable.class.getName() + PrivilegeMessages
.getString("Privilege.illegalArgument.nonstrolchrootelement"); //$NON-NLS-1$
.getString("Privilege.illegalArgument.nonstrolchrootelement");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}

View File

@ -49,8 +49,8 @@ public class DefaultEnumHandler extends StrolchComponent implements EnumHandler
@Override
public StrolchEnum getEnum(Certificate certificate, String name, Locale locale, boolean withoutHidden) {
DBC.PRE.assertNotEmpty("Enum name must be given!", name); //$NON-NLS-1$
DBC.PRE.assertNotNull("Locale must be given!", locale); //$NON-NLS-1$
DBC.PRE.assertNotEmpty("Enum name must be given!", name);
DBC.PRE.assertNotNull("Locale must be given!", locale);
try (StrolchTransaction tx = openTx(certificate, true)) {
return getEnum(tx, name, locale, withoutHidden);
@ -102,7 +102,7 @@ public class DefaultEnumHandler extends StrolchComponent implements EnumHandler
if (enumeration.hasParameterBag(localeS))
return enumeration.getParameterBag(localeS);
String msg = "No enumeration exists for language {0} on enumeration {1}"; //$NON-NLS-1$
String msg = "No enumeration exists for language {0} on enumeration {1}";
msg = MessageFormat.format(msg, locale, enumeration.getLocator());
throw new StrolchException(msg);
}

View File

@ -59,7 +59,7 @@ public abstract class AbstractService<T extends ServiceArgument, U extends Servi
* the privilegeContext to set
*/
public final void setPrivilegeContext(PrivilegeContext privilegeContext) {
DBC.PRE.assertNull("PrivilegeContext is already set!", this.privilegeContext); //$NON-NLS-1$
DBC.PRE.assertNull("PrivilegeContext is already set!", this.privilegeContext);
this.privilegeContext = privilegeContext;
}
@ -548,7 +548,7 @@ public abstract class AbstractService<T extends ServiceArgument, U extends Servi
if (isArgumentRequired() && argument == null) {
String msg = "Failed to perform service {0} because no argument was passed although it is required!"; //$NON-NLS-1$
String msg = "Failed to perform service {0} because no argument was passed although it is required!";
msg = MessageFormat.format(msg, getClass());
logger.error(msg);
@ -562,7 +562,7 @@ public abstract class AbstractService<T extends ServiceArgument, U extends Servi
U serviceResult = internalDoService(argument);
if (serviceResult == null) {
String msg = "Service {0} is not properly implemented as it returned a null result!"; //$NON-NLS-1$
String msg = "Service {0} is not properly implemented as it returned a null result!";
msg = MessageFormat.format(msg, this.getClass().getName());
throw new StrolchException(msg);
}

View File

@ -93,7 +93,7 @@ public class DefaultServiceHandler extends StrolchComponent implements ServiceHa
} catch (PrivilegeException e) {
long end = System.nanoTime();
String msg = "User {0}: Service {1} failed after {2} due to {3}"; //$NON-NLS-1$
String msg = "User {0}: Service {1} failed after {2} due to {3}";
String svcName = service.getClass().getName();
msg = MessageFormat.format(msg, username, svcName, formatNanoDuration(end - start), e.getMessage());
logger.error(msg);
@ -144,7 +144,7 @@ public class DefaultServiceHandler extends StrolchComponent implements ServiceHa
} catch (Exception e) {
long end = System.nanoTime();
String msg = "User {0}: Service failed {1} after {2} due to {3}"; //$NON-NLS-1$
String msg = "User {0}: Service failed {1} after {2} due to {3}";
msg = MessageFormat.format(msg, username, service.getClass().getName(), formatNanoDuration(end - start),
e.getMessage());
logger.error(msg);
@ -173,7 +173,7 @@ public class DefaultServiceHandler extends StrolchComponent implements ServiceHa
long end = System.nanoTime();
String msg = "User {0}: Service {1} took {2}"; //$NON-NLS-1$
String msg = "User {0}: Service {1} took {2}";
String username = certificate.getUsername();
String svcName = service.getClass().getName();

View File

@ -47,7 +47,7 @@ import li.strolch.utils.helper.StringHelper;
public class RuntimeMock implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(RuntimeMock.class);
private static final String TARGET = "target"; //$NON-NLS-1$
private static final String TARGET = "target";
private ComponentContainer container;
private StrolchAgent agent;
@ -82,7 +82,7 @@ public class RuntimeMock implements AutoCloseable {
public RuntimeMock mockRuntime() {
if (!this.targetPathF.getParentFile().getName().equals(TARGET)) {
String msg = "Mocking path must be in a maven target: {0}"; //$NON-NLS-1$
String msg = "Mocking path must be in a maven target: {0}";
msg = MessageFormat.format(msg, this.targetPathF.getAbsolutePath());
throw new RuntimeException(msg);
}
@ -90,28 +90,28 @@ public class RuntimeMock implements AutoCloseable {
File configSrc = new File(this.srcPathF, StrolchBootstrapper.PATH_CONFIG);
if (!configSrc.isDirectory() || !configSrc.canRead()) {
String msg = "Could not find config source in: {0}"; //$NON-NLS-1$
String msg = "Could not find config source in: {0}";
msg = MessageFormat.format(msg, configSrc.getAbsolutePath());
throw new RuntimeException(msg);
}
if (this.targetPathF.exists()) {
logger.info("Deleting all files in " + this.targetPathF.getAbsolutePath()); //$NON-NLS-1$
logger.info("Deleting all files in " + this.targetPathF.getAbsolutePath());
if (!FileHelper.deleteFile(this.targetPathF, true)) {
String msg = "Failed to delete {0}"; //$NON-NLS-1$
String msg = "Failed to delete {0}";
msg = MessageFormat.format(msg, this.targetPathF.getAbsolutePath());
throw new RuntimeException(msg);
}
}
if (!this.targetPathF.mkdirs()) {
String msg = "Failed to create {0}"; //$NON-NLS-1$
String msg = "Failed to create {0}";
msg = MessageFormat.format(msg, this.targetPathF.getAbsolutePath());
throw new RuntimeException(msg);
}
logger.info(
MessageFormat.format("Mocking runtime from {0} to {1}", this.srcPathF.getAbsolutePath(), //$NON-NLS-1$
MessageFormat.format("Mocking runtime from {0} to {1}", this.srcPathF.getAbsolutePath(),
this.targetPathF.getAbsolutePath()));
// setup the container
@ -133,7 +133,7 @@ public class RuntimeMock implements AutoCloseable {
this.container = this.agent.getContainer();
} catch (Exception e) {
logger.error("Failed to start mocked container due to: " + e.getMessage(), e); //$NON-NLS-1$
logger.error("Failed to start mocked container due to: " + e.getMessage(), e);
destroyRuntime();
throw e;
}
@ -149,13 +149,13 @@ public class RuntimeMock implements AutoCloseable {
try {
this.agent.stop();
} catch (Exception e) {
logger.info("Failed to stop container: " + e.getMessage()); //$NON-NLS-1$
logger.info("Failed to stop container: " + e.getMessage());
}
try {
this.agent.destroy();
} catch (Exception e) {
logger.info("Failed to destroy container: " + e.getMessage()); //$NON-NLS-1$
logger.info("Failed to destroy container: " + e.getMessage());
}
return this;

View File

@ -33,7 +33,7 @@ import org.junit.Test;
*/
public class PolicyHandlerTest {
public static final String PATH_EMPTY_RUNTIME = "target/PolicyHandlerTest/"; //$NON-NLS-1$
public static final String PATH_EMPTY_RUNTIME = "target/PolicyHandlerTest/";
@Test
public void shouldInstantiatePolicies() throws Exception {

View File

@ -536,16 +536,16 @@ public class ControllerDependencyTest {
public void shouldAddDependencies() {
ComponentContainerImpl container = new ComponentContainerImpl(null);
StrolchComponent component = new StrolchComponent(container, "1"); //$NON-NLS-1$
StrolchComponent component = new StrolchComponent(container, "1");
ComponentController controller = new ComponentController(component);
StrolchComponent upstreamDependencyComp1 = new StrolchComponent(container, "1"); //$NON-NLS-1$
StrolchComponent upstreamDependencyComp1 = new StrolchComponent(container, "1");
ComponentController upstreamDependency1 = new ComponentController(upstreamDependencyComp1);
StrolchComponent upstreamDependencyComp2 = new StrolchComponent(container, "1"); //$NON-NLS-1$
StrolchComponent upstreamDependencyComp2 = new StrolchComponent(container, "1");
ComponentController upstreamDependency2 = new ComponentController(upstreamDependencyComp2);
StrolchComponent transitiveUpstreamDependencyComp2 = new StrolchComponent(container, "1"); //$NON-NLS-1$
StrolchComponent transitiveUpstreamDependencyComp2 = new StrolchComponent(container, "1");
ComponentController transitiveUpstreamDependency2 = new ComponentController(transitiveUpstreamDependencyComp2);
controller.addUpstreamDependency(upstreamDependency1);

View File

@ -75,7 +75,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
public void setType(String type) {
assertNotReadonly();
if (isEmpty(type)) {
String msg = "Type may not be empty on element {0}"; //$NON-NLS-1$
String msg = "Type may not be empty on element {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}
@ -138,7 +138,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
this.parameterBagMap = new HashMap<>(1, 1.0F);
ParameterBag bag = this.parameterBagMap.get(BAG_PARAMETERS);
if (bag == null) {
String msg = "No parameter bag exists with key {0}"; //$NON-NLS-1$
String msg = "No parameter bag exists with key {0}";
msg = MessageFormat.format(msg, BAG_PARAMETERS);
throw new StrolchException(msg);
}
@ -153,7 +153,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
this.parameterBagMap = new HashMap<>(1, 1.0F);
ParameterBag bag = this.parameterBagMap.get(bagKey);
if (bag == null) {
String msg = "No parameter bag exists with key {0}"; //$NON-NLS-1$
String msg = "No parameter bag exists with key {0}";
msg = MessageFormat.format(msg, bagKey);
throw new StrolchException(msg);
}

View File

@ -44,7 +44,7 @@ public class Locator {
/**
* The separator used when formatting a {@link Locator} object ot a string
*/
public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
public static final String PATH_SEPARATOR = "/";
/**
* {@link List} of path elements, with the first being the top level or root element
@ -66,7 +66,7 @@ public class Locator {
private Locator(List<String> pathElements) throws StrolchException {
if (pathElements == null) {
throw new StrolchException(
"The path elements may not be null and must contain at least 1 item"); //$NON-NLS-1$
"The path elements may not be null and must contain at least 1 item");
}
this.pathElements = List.copyOf(pathElements);
}
@ -216,7 +216,7 @@ public class Locator {
*/
private List<String> parsePath(String path) throws StrolchException {
if (StringHelper.isEmpty(path)) {
throw new StrolchException("A path may not be empty!"); //$NON-NLS-1$
throw new StrolchException("A path may not be empty!");
}
String[] elements = path.split(Locator.PATH_SEPARATOR);
return Arrays.asList(elements);
@ -414,7 +414,7 @@ public class Locator {
*/
public Locator build() {
if (this.pathElements.isEmpty()) {
throw new StrolchException("The path elements must contain at least 1 item"); //$NON-NLS-1$
throw new StrolchException("The path elements must contain at least 1 item");
}
return new Locator(this.pathElements);
}

View File

@ -84,7 +84,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
public void setType(String type) {
assertNotReadonly();
if (StringHelper.isEmpty(type)) {
String msg = "Type may not be empty on element {0}"; //$NON-NLS-1$
String msg = "Type may not be empty on element {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}

View File

@ -29,16 +29,16 @@ import li.strolch.utils.dbc.DBC;
*/
public enum State {
CREATED("Created"), //$NON-NLS-1$
PLANNING("Planning"), //$NON-NLS-1$
PLANNED("Planned"), //$NON-NLS-1$
EXECUTABLE("Executable"), //$NON-NLS-1$
EXECUTION("Execution"), //$NON-NLS-1$
WARNING("Warning"), //$NON-NLS-1$
ERROR("Error"), //$NON-NLS-1$
STOPPED("Stopped"), //$NON-NLS-1$
EXECUTED("Executed"), //$NON-NLS-1$
CLOSED("Closed"); //$NON-NLS-1$
CREATED("Created"),
PLANNING("Planning"),
PLANNED("Planned"),
EXECUTABLE("Executable"),
EXECUTION("Execution"),
WARNING("Warning"),
ERROR("Error"),
STOPPED("Stopped"),
EXECUTED("Executed"),
CLOSED("Closed");
private final String state;

View File

@ -23,14 +23,14 @@ import li.strolch.privilege.base.PrivilegeConstants;
public class StrolchModelConstants {
public static final String DEFAULT_XML_VERSION = "1.0"; //$NON-NLS-1$
public static final String DEFAULT_XML_VERSION = "1.0";
public static final String DEFAULT_ENCODING = StandardCharsets.UTF_8.name(); //$NON-NLS-1$
public static final String DEFAULT_ENCODING = StandardCharsets.UTF_8.name();
/**
* The type to set on {@link StrolchRootElement StrolchRootElements} when defining a template for a type of element
*/
public static final String TEMPLATE = "Template"; //$NON-NLS-1$
public static final String TEMPLATE = "Template";
public static final String SUFFIX_REF = "-Ref";
@ -38,35 +38,35 @@ public class StrolchModelConstants {
* This interpretation value indicates that the value of the {@link Parameter} should be understood as an
* enumeration
*/
public static final String INTERPRETATION_ENUMERATION = "Enumeration"; //$NON-NLS-1$
public static final String INTERPRETATION_ENUMERATION = "Enumeration";
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to a {@link Resource}
*/
public static final String INTERPRETATION_RESOURCE_REF = Tags.RESOURCE + SUFFIX_REF; //$NON-NLS-1$
public static final String INTERPRETATION_RESOURCE_REF = Tags.RESOURCE + SUFFIX_REF;
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to an {@link Order}
*/
public static final String INTERPRETATION_ORDER_REF = Tags.ORDER + SUFFIX_REF; //$NON-NLS-1$
public static final String INTERPRETATION_ORDER_REF = Tags.ORDER + SUFFIX_REF;
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to an {@link Activity}
*/
public static final String INTERPRETATION_ACTIVITY_REF = Tags.ACTIVITY + SUFFIX_REF; //$NON-NLS-1$
public static final String INTERPRETATION_ACTIVITY_REF = Tags.ACTIVITY + SUFFIX_REF;
/**
* This interpretation value indicates that the {@link Parameter} has no defined interpretation
*/
public static final String INTERPRETATION_NONE = "None"; //$NON-NLS-1$
public static final String INTERPRETATION_NONE = "None";
/**
* This uom value indicates that the {@link Parameter} has no defined uom
*/
public static final String UOM_NONE = "None"; //$NON-NLS-1$
public static final String UOM_NONE = "None";
public static final String INTERNAL = "internal";

View File

@ -221,13 +221,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
@Override
@ -261,13 +261,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
@Override
@ -307,13 +307,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
},
@ -342,13 +342,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
},
@ -462,13 +462,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
@Override
@ -504,13 +504,13 @@ public enum StrolchValueType {
@Override
public StrolchTimedState<? extends IValue<?>> timedStateInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("TimeStates of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("TimeStates of type {0} are not supported!", getType()));
}
@Override
public IValue<?> valueInstance(String valueAsString) {
throw new UnsupportedOperationException(
MessageFormat.format("Values of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Values of type {0} are not supported!", getType()));
}
@Override
@ -531,19 +531,19 @@ public enum StrolchValueType {
@Override
public JsonPrimitive valueToJson(Object value) {
throw new UnsupportedOperationException(
MessageFormat.format("Formatting of type {0} is not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Formatting of type {0} is not supported!", getType()));
}
@Override
public Object parseValue(String value) {
throw new UnsupportedOperationException(
MessageFormat.format("Parsing value of type {0} is not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parsing value of type {0} is not supported!", getType()));
}
@Override
public Parameter<?> parameterInstance() {
throw new UnsupportedOperationException(
MessageFormat.format("Parameters of type {0} are not supported!", getType())); //$NON-NLS-1$
MessageFormat.format("Parameters of type {0} are not supported!", getType()));
}
@Override

View File

@ -576,7 +576,7 @@ public class Activity extends AbstractStrolchRootElement
String next = locator.get(i);
if (!(element instanceof Activity)) {
String msg = "Invalid locator {0} with part {1} as not an Activity but deeper element specified"; //$NON-NLS-1$
String msg = "Invalid locator {0} with part {1} as not an Activity but deeper element specified";
throw new StrolchModelException(MessageFormat.format(msg, locator, next));
}

View File

@ -49,7 +49,7 @@ public class AuditSaxReader extends DefaultHandler {
case Tags.Audit.USERNAME, Tags.Audit.FIRSTNAME, Tags.Audit.LASTNAME, Tags.Audit.DATE, Tags.Audit.ELEMENT_TYPE, Tags.Audit.ELEMENT_SUB_TYPE, Tags.Audit.ELEMENT_ACCESSED, Tags.Audit.NEW_VERSION, Tags.Audit.ACTION, Tags.Audit.ACCESS_TYPE ->
this.sb = new StringBuilder();
default -> throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}
@ -102,7 +102,7 @@ public class AuditSaxReader extends DefaultHandler {
this.sb = null;
}
default -> throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}

View File

@ -24,7 +24,7 @@ public class AuditToSaxWriterVisitor implements AuditVisitor<Void> {
writeElement(audit);
this.writer.flush();
} catch (XMLStreamException e) {
String msg = "Failed to write Audit {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to write Audit {0} due to {1}";
msg = MessageFormat.format(msg, audit.getId(), e.getMessage());
throw new StrolchException(msg, e);
}

View File

@ -70,7 +70,7 @@ public class StrolchElementFromJsonVisitor {
String date = jsonObject.get(Json.DATE).getAsString();
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse(date));
} else {
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse(StringHelper.DASH)); //$NON-NLS-1$
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse(StringHelper.DASH));
}
if (jsonObject.has(Json.STATE)) {
@ -113,7 +113,7 @@ public class StrolchElementFromJsonVisitor {
if (resource.hasTimedState(stateId)) {
timedState = resource.getTimedState(stateId);
if (valueType != timedState.getValueType()) {
String msg = "Existing TimedState {0} has change of type to {1}"; //$NON-NLS-1$
String msg = "Existing TimedState {0} has change of type to {1}";
msg = MessageFormat.format(msg, stateId, timedState.getValueType());
throw new StrolchException(msg);
}
@ -126,7 +126,7 @@ public class StrolchElementFromJsonVisitor {
// consistency of JSON key and object.id
if (!stateId.equals(timedState.getId())) {
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!";
msg = MessageFormat.format(msg, timeStateJ);
throw new StrolchException(msg);
}
@ -142,7 +142,7 @@ public class StrolchElementFromJsonVisitor {
timedState.setHidden(timeStateJ.get(Json.HIDDEN).getAsBoolean());
if (!this.overwriteExisting && resource.hasTimedState(stateId)) {
String msg = "Not overwriting elements, and TimedState {0} already exists!"; //$NON-NLS-1$
String msg = "Not overwriting elements, and TimedState {0} already exists!";
msg = MessageFormat.format(msg, stateId);
throw new StrolchException(msg);
}
@ -232,7 +232,7 @@ public class StrolchElementFromJsonVisitor {
}
}
default -> {
String msg = "Check the values of the jsonObject: {0} unknown object Type {1} !"; //$NON-NLS-1$
String msg = "Check the values of the jsonObject: {0} unknown object Type {1} !";
msg = MessageFormat.format(msg, elementJsonObject, objectType);
throw new StrolchException(msg);
}
@ -245,7 +245,7 @@ public class StrolchElementFromJsonVisitor {
strolchElement.setId(jsonObject.get(Json.ID).getAsString());
strolchElement.setName(jsonObject.get(Json.NAME).getAsString());
} else {
String msg = "Check the values of the jsonObject: {0} either id or name attribute is null!"; //$NON-NLS-1$
String msg = "Check the values of the jsonObject: {0} either id or name attribute is null!";
msg = MessageFormat.format(msg, jsonObject);
throw new StrolchException(msg);
}
@ -257,7 +257,7 @@ public class StrolchElementFromJsonVisitor {
if (jsonObject.has(Json.TYPE)) {
groupedParameterizedElement.setType(jsonObject.get(Json.TYPE).getAsString());
} else {
String msg = "Check the values of the jsonObject: {0} type attribute is null!"; //$NON-NLS-1$
String msg = "Check the values of the jsonObject: {0} type attribute is null!";
msg = MessageFormat.format(msg, jsonObject);
throw new StrolchException(msg);
}
@ -273,7 +273,7 @@ public class StrolchElementFromJsonVisitor {
String bagId = entry.getKey();
JsonElement jsonElement = entry.getValue();
if (!jsonElement.isJsonObject()) {
String msg = "Check the values of the jsonElement: {0} it is not a JsonObject!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} it is not a JsonObject!";
msg = MessageFormat.format(msg, bagId);
throw new StrolchException(msg);
}
@ -288,13 +288,13 @@ public class StrolchElementFromJsonVisitor {
fillElement(bagJsonObject, bag);
if (!bagId.equals(bag.getId())) {
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!";
msg = MessageFormat.format(msg, bagId);
throw new StrolchException(msg);
}
if (!this.overwriteExisting && groupedParameterizedElement.hasParameterBag(bagId)) {
String msg = "Not overwriting elements, and ParameterBag {0} already exists!"; //$NON-NLS-1$
String msg = "Not overwriting elements, and ParameterBag {0} already exists!";
msg = MessageFormat.format(msg, bagId);
throw new StrolchException(msg);
}
@ -310,7 +310,7 @@ public class StrolchElementFromJsonVisitor {
if (jsonObject.has(Json.TYPE)) {
parameterizedElement.setType(jsonObject.get(Json.TYPE).getAsString());
} else {
String msg = "Check the values of the jsonObject: {0} type attribute is null!"; //$NON-NLS-1$
String msg = "Check the values of the jsonObject: {0} type attribute is null!";
msg = MessageFormat.format(msg, jsonObject);
throw new StrolchException(msg);
}
@ -325,7 +325,7 @@ public class StrolchElementFromJsonVisitor {
String paramId = entry.getKey();
JsonElement jsonElement = entry.getValue();
if (!jsonElement.isJsonObject()) {
String msg = "Check the values of the jsonElement: {0} it is not a JsonObject!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} it is not a JsonObject!";
msg = MessageFormat.format(msg, jsonElement);
throw new StrolchException(msg);
}
@ -339,7 +339,7 @@ public class StrolchElementFromJsonVisitor {
if (parameterizedElement.hasParameter(paramId)) {
parameter = parameterizedElement.getParameter(paramId);
if (paramValueType != parameter.getValueType()) {
String msg = "Existing Parameter {0} has change of type to {1}"; //$NON-NLS-1$
String msg = "Existing Parameter {0} has change of type to {1}";
msg = MessageFormat.format(msg, paramId, parameter.getValueType());
throw new StrolchException(msg);
}
@ -349,13 +349,13 @@ public class StrolchElementFromJsonVisitor {
fillElement(paramJsonObject, parameter);
if (!paramId.equals(parameter.getId())) {
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} JsonObject key not same as object.id!";
msg = MessageFormat.format(msg, jsonElement);
throw new StrolchException(msg);
}
if (!this.overwriteExisting && parameterizedElement.hasParameter(paramId)) {
String msg = "Not overwriting elements, and Parameter {0} already exists!"; //$NON-NLS-1$
String msg = "Not overwriting elements, and Parameter {0} already exists!";
msg = MessageFormat.format(msg, paramId);
throw new StrolchException(msg);
}
@ -421,7 +421,7 @@ public class StrolchElementFromJsonVisitor {
action.addChange(valueChange);
} catch (Exception e1) {
String msg = "Check the values of the jsonElement: {0} Fields invalid!"; //$NON-NLS-1$
String msg = "Check the values of the jsonElement: {0} Fields invalid!";
msg = MessageFormat.format(msg, e);
throw new StrolchException(msg, e1);
}

View File

@ -52,7 +52,7 @@ public abstract class AbstractListParameter<E> extends AbstractParameter<List<E>
*/
protected void validateValue(List<E> values) throws StrolchException {
if (values == null) {
String msg = "Can not set null value on Parameter {0}"; //$NON-NLS-1$
String msg = "Can not set null value on Parameter {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}
@ -71,7 +71,7 @@ public abstract class AbstractListParameter<E> extends AbstractParameter<List<E>
*/
protected void validateValue(Collection<E> values) throws StrolchException {
if (values == null) {
String msg = "Can not set null value on Parameter {0}"; //$NON-NLS-1$
String msg = "Can not set null value on Parameter {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}

View File

@ -188,7 +188,7 @@ public abstract class AbstractParameter<T> extends AbstractStrolchElement implem
*/
protected void validateValue(T value) throws StrolchException {
if (value == null) {
String msg = "Can not set null value on Parameter {0}"; //$NON-NLS-1$
String msg = "Can not set null value on Parameter {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}

View File

@ -26,8 +26,8 @@ import java.util.stream.Stream;
*/
public interface ListParameter<E> extends Parameter<List<E>> {
String VALUE_SEPARATOR1 = ";"; //$NON-NLS-1$
String VALUE_SEPARATOR2 = ","; //$NON-NLS-1$
String VALUE_SEPARATOR1 = ";";
String VALUE_SEPARATOR2 = ",";
/**
* Returns the value at the given index of this {@link ListParameter}'s value

View File

@ -97,7 +97,7 @@ public class StringParameter extends AbstractParameter<String> {
public void setValueE(Enum<?> value) {
assertNotReadonly();
if (value == null) {
String msg = "Can not set null value on Parameter {0}"; //$NON-NLS-1$
String msg = "Can not set null value on Parameter {0}";
msg = MessageFormat.format(msg, getLocator());
throw new StrolchException(msg);
}

View File

@ -48,7 +48,7 @@ public class StrolchElementFromDomVisitor {
String state = element.getAttribute(Tags.STATE);
if (StringHelper.isEmpty(date)) {
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse("-")); //$NON-NLS-1$
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse("-"));
} else {
order.setDate(ISO8601FormatFactory.getInstance().getDateFormat().parse(date));
}
@ -102,7 +102,7 @@ public class StrolchElementFromDomVisitor {
} else if (hidden.equalsIgnoreCase(Boolean.FALSE.toString())) {
timedState.setHidden(false);
} else {
String msg = "Boolean string must be either {0} or {1}"; //$NON-NLS-1$
String msg = "Boolean string must be either {0} or {1}";
msg = MessageFormat.format(msg, Boolean.TRUE.toString(), Boolean.FALSE.toString());
throw new StrolchException(msg);
}
@ -173,7 +173,7 @@ public class StrolchElementFromDomVisitor {
strolchElement.setId(id);
strolchElement.setName(name);
} else {
String msg = "Check the values of the element: {0} either id or name attribute is null!"; //$NON-NLS-1$
String msg = "Check the values of the element: {0} either id or name attribute is null!";
msg = MessageFormat.format(msg, element.getNodeName());
throw new StrolchException(msg);
}
@ -268,7 +268,7 @@ public class StrolchElementFromDomVisitor {
} else if (hidden.equalsIgnoreCase(Boolean.FALSE.toString())) {
param.setHidden(false);
} else {
String msg = "Boolean string must be either {0} or {1}"; //$NON-NLS-1$
String msg = "Boolean string must be either {0} or {1}";
msg = MessageFormat.format(msg, Boolean.TRUE.toString(), Boolean.FALSE.toString());
throw new StrolchException(msg);
}

View File

@ -61,7 +61,7 @@ public class StrolchElementToSaxVisitor implements StrolchRootElementVisitor<Voi
toSax(activity);
} catch (Exception e) {
String msg = "Failed to transform Activity {0} to XML due to {1}"; //$NON-NLS-1$
String msg = "Failed to transform Activity {0} to XML due to {1}";
msg = MessageFormat.format(msg, activity.getLocator(), e.getMessage());
throw new RuntimeException(msg, e);
}
@ -76,7 +76,7 @@ public class StrolchElementToSaxVisitor implements StrolchRootElementVisitor<Voi
toSax(order);
} catch (SAXException e) {
String msg = "Failed to transform Order {0} to XML due to {1}"; //$NON-NLS-1$
String msg = "Failed to transform Order {0} to XML due to {1}";
msg = MessageFormat.format(msg, order.getLocator(), e.getMessage());
throw new RuntimeException(msg, e);
}
@ -91,7 +91,7 @@ public class StrolchElementToSaxVisitor implements StrolchRootElementVisitor<Voi
toSax(resource);
} catch (Exception e) {
String msg = "Failed to transform Resource {0} to XML due to {1}"; //$NON-NLS-1$
String msg = "Failed to transform Resource {0} to XML due to {1}";
msg = MessageFormat.format(msg, resource.getLocator(), e.getMessage());
throw new RuntimeException(msg, e);
}

View File

@ -59,7 +59,7 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit
writeElement(activity);
this.writer.flush();
} catch (XMLStreamException e) {
String msg = "Failed to write Activity {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to write Activity {0} due to {1}";
msg = MessageFormat.format(msg, activity.getLocator(), e.getMessage());
throw new StrolchException(msg, e);
}
@ -74,7 +74,7 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit
writeElement(order);
this.writer.flush();
} catch (XMLStreamException e) {
String msg = "Failed to write Order {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to write Order {0} due to {1}";
msg = MessageFormat.format(msg, order.getLocator(), e.getMessage());
throw new StrolchException(msg, e);
}
@ -89,7 +89,7 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit
writeElement(resource);
this.writer.flush();
} catch (XMLStreamException e) {
String msg = "Failed to write Resource {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to write Resource {0} due to {1}";
msg = MessageFormat.format(msg, resource.getLocator(), e.getMessage());
throw new StrolchException(msg, e);
}

View File

@ -323,7 +323,7 @@ public class XmlModelSaxReader extends DefaultHandler {
default:
throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}
@ -426,7 +426,7 @@ public class XmlModelSaxReader extends DefaultHandler {
default:
throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}
}

View File

@ -74,7 +74,7 @@ public class XmlModelSaxStreamReader extends XmlModelSaxReader {
case Tags.INCLUDE_FILE -> {
String msg = "The {0} can''t handle Tags of type {1}";
msg = MessageFormat.format(msg, XmlModelSaxStreamReader.class.getName(), Tags.INCLUDE_FILE);
throw new IllegalArgumentException(msg); //$NON-NLS-1$
throw new IllegalArgumentException(msg);
}
default -> super.startElement(uri, localName, qName, attributes);
}
@ -93,12 +93,12 @@ public class XmlModelSaxStreamReader extends XmlModelSaxReader {
long endNanos = System.nanoTime();
this.statistics.durationNanos = endNanos - startNanos;
String msg = "SAX parsed stream took {0}"; //$NON-NLS-1$
String msg = "SAX parsed stream took {0}";
logger.info(MessageFormat.format(msg, StringHelper.formatNanoDuration(this.statistics.durationNanos)));
} catch (ParserConfigurationException | SAXException | IOException e) {
String msg = "Parsing failed due to internal error: {0}"; //$NON-NLS-1$
String msg = "Parsing failed due to internal error: {0}";
throw new StrolchException(MessageFormat.format(msg, e.getMessage()), e);
}
}

View File

@ -59,7 +59,7 @@ public class StringTimeVariableTest {
Set<AString> testSet = new HashSet<>();
StringSetValue testValue = new StringSetValue(testSet);
this.testSets.put(i, testValue);
testSet.add(new AString("string " + i)); //$NON-NLS-1$
testSet.add(new AString("string " + i));
this.timeVariable.setValueAt(i, new StringSetValue(testSet));
}
}
@ -96,7 +96,7 @@ public class StringTimeVariableTest {
public void testApplyChange() {
Set<AString> testSet = new HashSet<>();
testSet.add(new AString("Martin")); //$NON-NLS-1$
testSet.add(new AString("Martin"));
StringSetValue testValue = new StringSetValue(testSet);
this.timeVariable = new TimeVariable<>();
@ -109,7 +109,7 @@ public class StringTimeVariableTest {
// check the future values
Collection<ITimeValue<IValue<Set<AString>>>> futureValues = this.timeVariable.getFutureValues(0L);
for (ITimeValue<IValue<Set<AString>>> iTimeValue : futureValues) {
logger.info("++ " + iTimeValue); //$NON-NLS-1$
logger.info("++ " + iTimeValue);
}
assertEquals(1, futureValues.size()); // a empty one is left
@ -123,7 +123,7 @@ public class StringTimeVariableTest {
Set<AString> testSet = new HashSet<>();
StringSetValue testValue = new StringSetValue(testSet);
this.testSets.put(i, testValue);
testSet.add(new AString("same string")); //$NON-NLS-1$
testSet.add(new AString("same string"));
this.timeVariable.setValueAt(i, new StringSetValue(testSet));
}

View File

@ -64,7 +64,7 @@ public class ValueTests {
public void testStringSetInverse() {
Set<AString> aStrings = new HashSet<>();
for (int i = 0; i < 10; i++) {
aStrings.add(new AString("string " + i)); //$NON-NLS-1$
aStrings.add(new AString("string " + i));
}
IValue<Set<AString>> value = new StringSetValue(aStrings);
IValue<Set<AString>> inverse = value.getInverse();
@ -80,13 +80,13 @@ public class ValueTests {
Set<AString> aStrings1 = new HashSet<>();
for (int i = 0; i < 10; i++) {
aStrings1.add(new AString("string " + i)); //$NON-NLS-1$
aStrings1.add(new AString("string " + i));
}
IValue<Set<AString>> value1 = new StringSetValue(aStrings1);
Set<AString> aStrings2 = new HashSet<>();
for (int i = 0; i < 9; i++) {
aStrings2.add(new AString("string " + i, true)); //$NON-NLS-1$
aStrings2.add(new AString("string " + i, true));
}
IValue<Set<AString>> value2 = new StringSetValue(aStrings2);

View File

@ -87,12 +87,12 @@ public class PostgreSqlAuditDao implements AuditDao {
return true;
String msg = MessageFormat
.format("Non unique number of elements with type {0} and id {1}", type, id); //$NON-NLS-1$
.format("Non unique number of elements with type {0} and id {1}", type, id);
throw new StrolchPersistenceException(msg);
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e);
}
}
@ -109,7 +109,7 @@ public class PostgreSqlAuditDao implements AuditDao {
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e);
}
}
@ -127,7 +127,7 @@ public class PostgreSqlAuditDao implements AuditDao {
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query size due to: " + e.getMessage(), e);
}
}
@ -142,7 +142,7 @@ public class PostgreSqlAuditDao implements AuditDao {
}
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e);
}
return keySet;
@ -164,11 +164,11 @@ public class PostgreSqlAuditDao implements AuditDao {
if (result.next())
throw new StrolchPersistenceException(
"Non unique result for query: " + queryBySql + " (type=" + type + ", id="
+ id); //$NON-NLS-1$
+ id);
return audit;
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e);
}
}
@ -188,7 +188,7 @@ public class PostgreSqlAuditDao implements AuditDao {
}
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e);
}
return list;
@ -204,12 +204,12 @@ public class PostgreSqlAuditDao implements AuditDao {
if (count != 1) {
throw new StrolchPersistenceException(MessageFormat
.format("Expected to insert 1 record, but inserted {0} for audit {2}", count,
audit.getId())); //$NON-NLS-1$
audit.getId()));
}
} catch (SQLException e) {
throw new StrolchPersistenceException(
MessageFormat.format("Failed to insert Audit {0} due to {1}", audit, //$NON-NLS-1$
MessageFormat.format("Failed to insert Audit {0} due to {1}", audit,
e.getLocalizedMessage()), e);
}
}
@ -232,12 +232,12 @@ public class PostgreSqlAuditDao implements AuditDao {
if (count != 1) {
throw new StrolchPersistenceException(MessageFormat
.format("Expected to update 1 record, but updated {0} for audit {2}", count,
audit.getId())); //$NON-NLS-1$
audit.getId()));
}
} catch (SQLException e) {
throw new StrolchPersistenceException(
MessageFormat.format("Failed to update Audit {0} due to {1}", audit, //$NON-NLS-1$
MessageFormat.format("Failed to update Audit {0} due to {1}", audit,
e.getLocalizedMessage()), e);
}
}
@ -257,13 +257,13 @@ public class PostgreSqlAuditDao implements AuditDao {
int count = preparedStatement.executeUpdate();
if (count != 1) {
String msg = "Expected to delete 1 audit with id {0} but deleted {1} elements!"; //$NON-NLS-1$
String msg = "Expected to delete 1 audit with id {0} but deleted {1} elements!";
msg = MessageFormat.format(msg, audit.getId(), count);
throw new StrolchPersistenceException(msg);
}
} catch (SQLException e) {
throw new StrolchPersistenceException(MessageFormat.format("Failed to remove {0} due to {2}", //$NON-NLS-1$
throw new StrolchPersistenceException(MessageFormat.format("Failed to remove {0} due to {2}",
audit.getId(), e.getLocalizedMessage()), e);
}
}
@ -287,7 +287,7 @@ public class PostgreSqlAuditDao implements AuditDao {
} catch (SQLException e) {
throw new StrolchPersistenceException(
MessageFormat.format("Failed to remove all elements due to {0}", //$NON-NLS-1$
MessageFormat.format("Failed to remove all elements due to {0}",
e.getLocalizedMessage()), e);
}
}

View File

@ -80,7 +80,7 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
return messages;
} catch (SQLException e) {
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e); //$NON-NLS-1$
throw new StrolchPersistenceException("Failed to query types due to: " + e.getMessage(), e);
}
}
@ -95,7 +95,7 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
if (count != 1) {
throw new StrolchPersistenceException(MessageFormat
.format("Expected to insert 1 log_message record, but inserted {0} for LogMessage {1}", count,
logMessage.getId())); //$NON-NLS-1$
logMessage.getId()));
}
int nrOfInserts = setValues(logMessage, valuesStatement);
@ -104,7 +104,7 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
} catch (SQLException e) {
throw new StrolchPersistenceException(
MessageFormat.format("Failed to insert LogMessage {0} due to {1}", logMessage.getId(), //$NON-NLS-1$
MessageFormat.format("Failed to insert LogMessage {0} due to {1}", logMessage.getId(),
e.getLocalizedMessage()), e);
}
}
@ -127,7 +127,7 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
} catch (SQLException e) {
throw new StrolchPersistenceException(MessageFormat
.format("Failed to update LogMessage state {0} due to {1}", logMessage.getId(), //$NON-NLS-1$
.format("Failed to update LogMessage state {0} due to {1}", logMessage.getId(),
e.getLocalizedMessage()), e);
}
}
@ -162,7 +162,7 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
remove(removeStatement, removeValuesStatement, logMessage);
} catch (SQLException e) {
throw new StrolchPersistenceException(MessageFormat.format("Failed to remove {0} due to {1}", //$NON-NLS-1$
throw new StrolchPersistenceException(MessageFormat.format("Failed to remove {0} due to {1}",
logMessage.getId(), e.getLocalizedMessage()), e);
}
}
@ -187,13 +187,13 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
int[] countAll = removeStatement.executeBatch();
if (countAll.length != nrOfRemoves) {
String msg = "Expected to delete {0} LogMessages but deleted {1} elements!"; //$NON-NLS-1$
String msg = "Expected to delete {0} LogMessages but deleted {1} elements!";
msg = MessageFormat.format(msg, nrOfRemoves, countAll.length);
throw new StrolchPersistenceException(msg);
}
for (int count : countAll) {
if (count != 1) {
String msg = "Expected to delete 1 LogMessages per delete statement but deleted {0} elements!"; //$NON-NLS-1$
String msg = "Expected to delete 1 LogMessages per delete statement but deleted {0} elements!";
msg = MessageFormat.format(msg, nrOfRemoves, count);
throw new StrolchPersistenceException(msg);
}
@ -201,13 +201,13 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
countAll = removeValuesStatement.executeBatch();
if (countAll.length != nrOfRemoves) {
String msg = "Expected to execute {0} delete value statements but executed {1} elements!"; //$NON-NLS-1$
String msg = "Expected to execute {0} delete value statements but executed {1} elements!";
msg = MessageFormat.format(msg, nrOfRemoves, countAll.length);
throw new StrolchPersistenceException(msg);
}
for (int i = 0; i < countAll.length; i++) {
if (countAll[i] != nrOfValueRemoves[i]) {
String msg = "Expected to delete {0} values for LogMessage {1} but deleted {2} elements!"; //$NON-NLS-1$
String msg = "Expected to delete {0} values for LogMessage {1} but deleted {2} elements!";
msg = MessageFormat.format(msg, nrOfValueRemoves[i], logMessages.get(i).getId(), countAll[i]);
throw new StrolchPersistenceException(msg);
}
@ -227,14 +227,14 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
int count = removeStatement.executeUpdate();
if (count != 1) {
String msg = "Expected to delete 1 LogMessage with id {0} but deleted {1} elements!"; //$NON-NLS-1$
String msg = "Expected to delete 1 LogMessage with id {0} but deleted {1} elements!";
msg = MessageFormat.format(msg, logMessage.getId(), count);
throw new StrolchPersistenceException(msg);
}
count = removeValuesStatement.executeUpdate();
if (count != logMessage.getValues().size()) {
String msg = "Expected to delete {0} values for LogMessage with id {1} but deleted {2} elements!"; //$NON-NLS-1$
String msg = "Expected to delete {0} values for LogMessage with id {1} but deleted {2} elements!";
msg = MessageFormat.format(msg, logMessage.getValues().size(), logMessage.getId(), count);
throw new StrolchPersistenceException(msg);
}
@ -244,14 +244,14 @@ public class PostgreSqlLogMessageDao implements LogMessageDao {
if (ints.length != nrOfInserts) {
throw new StrolchPersistenceException(MessageFormat
.format("Expected to insert {0} value record, but inserted {1} for LogMessage {2}", nrOfInserts,
ints.length, logMessage.getId())); //$NON-NLS-1$
ints.length, logMessage.getId()));
}
for (int i = 0; i < ints.length; i++) {
if (ints[i] != 1) {
throw new StrolchPersistenceException(MessageFormat
.format("Expected to insert 1 record per value, but inserted {0} for value at index {1} for LogMessage {2}",
ints[i], i, logMessage.getId())); //$NON-NLS-1$
ints[i], i, logMessage.getId()));
}
}
}

View File

@ -42,11 +42,11 @@ import org.postgresql.Driver;
*/
public class PostgreSqlPersistenceHandler extends StrolchComponent implements PersistenceHandler {
public static final String SCRIPT_PREFIX_STROLCH = "strolch"; //$NON-NLS-1$
public static final String SCRIPT_PREFIX_ARCHIVE = "archive"; //$NON-NLS-1$
public static final String PROP_DATA_TYPE = "dataType"; //$NON-NLS-1$
public static final String DATA_TYPE_XML = "xml"; //$NON-NLS-1$
public static final String DATA_TYPE_JSON = "json"; //$NON-NLS-1$
public static final String SCRIPT_PREFIX_STROLCH = "strolch";
public static final String SCRIPT_PREFIX_ARCHIVE = "archive";
public static final String PROP_DATA_TYPE = "dataType";
public static final String DATA_TYPE_XML = "xml";
public static final String DATA_TYPE_JSON = "json";
private Map<String, DataSource> dsMap;
private DataType dataType;
@ -106,10 +106,10 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
// if allowed, perform DB initialization
if (!allowDataInitOnSchemaCreate) {
logger.info("Data Initialization not enabled as 'allowDataInitOnSchemaCreate' is false!"); //$NON-NLS-1$
logger.info("Data Initialization not enabled as 'allowDataInitOnSchemaCreate' is false!");
} else {
Map<String, DbMigrationState> dbMigrationStates = schemaVersionCheck.getDbMigrationStates();
String msg = "Data Initialization is enabled, checking for {0} realms if DB initialization is required..."; //$NON-NLS-1$
String msg = "Data Initialization is enabled, checking for {0} realms if DB initialization is required...";
logger.info(MessageFormat.format(msg, dbMigrationStates.size()));
PrivilegeHandler privilegeHandler = getContainer().getPrivilegeHandler();
StrolchAgent agent = getContainer().getAgent();
@ -145,14 +145,14 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
DataSource ds = this.dsMap.get(realm);
if (ds == null) {
String msg = MessageFormat.format("There is no DataSource registered for the realm {0}",
realm); //$NON-NLS-1$
realm);
throw new StrolchPersistenceException(msg);
}
try {
return ds.getConnection();
} catch (Exception e) {
String msg = "Failed to open a connection to {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to open a connection to {0} due to {1}";
throw new StrolchPersistenceException(MessageFormat.format(msg, ds, e.getMessage()), e);
}
}

View File

@ -65,7 +65,7 @@ public class PostgreSqlStrolchTransaction extends AbstractTransaction {
try {
this.connection.close();
} catch (Exception e) {
logger.error("Failed to close connection due to " + e.getMessage(), e); //$NON-NLS-1$
logger.error("Failed to close connection due to " + e.getMessage(), e);
}
}
}

View File

@ -34,13 +34,13 @@ import org.slf4j.LoggerFactory;
public class CachedJsonDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/cachedJsonRuntime/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedJsonRuntime"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/cachedJsonRuntime/";
public static final String DB_STORE_PATH_DIR = "dbStore";
public static final String CONFIG_SRC = "src/test/resources/cachedJsonRuntime";
public static final String DB_URL = "jdbc:postgresql://localhost/testdb"; //$NON-NLS-1$
public static final String DB_USERNAME = "testuser"; //$NON-NLS-1$
public static final String DB_PASSWORD = "test"; //$NON-NLS-1$
public static final String DB_URL = "jdbc:postgresql://localhost/testdb";
public static final String DB_USERNAME = "testuser";
public static final String DB_PASSWORD = "test";
private static final Logger logger = LoggerFactory.getLogger(CachedJsonDaoTest.class);

View File

@ -34,13 +34,13 @@ import org.slf4j.LoggerFactory;
public class CachedJsonVersioningDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/cachedJsonRuntimeVersioning/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedJsonRuntimeVersioning"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/cachedJsonRuntimeVersioning/";
public static final String DB_STORE_PATH_DIR = "dbStore";
public static final String CONFIG_SRC = "src/test/resources/cachedJsonRuntimeVersioning";
public static final String DB_URL = "jdbc:postgresql://localhost/testdb"; //$NON-NLS-1$
public static final String DB_USERNAME = "testuser"; //$NON-NLS-1$
public static final String DB_PASSWORD = "test"; //$NON-NLS-1$
public static final String DB_URL = "jdbc:postgresql://localhost/testdb";
public static final String DB_USERNAME = "testuser";
public static final String DB_PASSWORD = "test";
private static final Logger logger = LoggerFactory.getLogger(CachedJsonVersioningDaoTest.class);

View File

@ -34,13 +34,13 @@ import org.slf4j.LoggerFactory;
public class CachedVersioningDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/cachedRuntimeVersioning/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedRuntimeVersioning"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/cachedRuntimeVersioning/";
public static final String DB_STORE_PATH_DIR = "dbStore";
public static final String CONFIG_SRC = "src/test/resources/cachedRuntimeVersioning";
public static final String DB_URL = "jdbc:postgresql://localhost/testdb"; //$NON-NLS-1$
public static final String DB_USERNAME = "testuser"; //$NON-NLS-1$
public static final String DB_PASSWORD = "test"; //$NON-NLS-1$
public static final String DB_URL = "jdbc:postgresql://localhost/testdb";
public static final String DB_USERNAME = "testuser";
public static final String DB_PASSWORD = "test";
private static final Logger logger = LoggerFactory.getLogger(CachedVersioningDaoTest.class);

View File

@ -98,7 +98,7 @@ public class DbSchemaCreationTest {
}
} catch (SQLException e) {
String msg = "Failed to open DB connection to URL {0} due to: {1}"; //$NON-NLS-1$
String msg = "Failed to open DB connection to URL {0} due to: {1}";
msg = MessageFormat.format(msg, dbUrl, e.getMessage());
throw new DbException(msg, e);
}

View File

@ -87,7 +87,7 @@ public class DbSchemaMigrationTest {
dbCheck.migrateSchema(con, DEFAULT_REALM, currentVersion, expectedDbVersion);
} catch (SQLException e) {
String msg = "Failed to open DB connection to URL {0} due to: {1}"; //$NON-NLS-1$
String msg = "Failed to open DB connection to URL {0} due to: {1}";
msg = MessageFormat.format(msg, dbUrl, e.getMessage());
throw new DbException(msg, e);
}

View File

@ -49,9 +49,9 @@ import org.junit.Test;
*/
public class ObserverUpdateTest {
public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/";
public static final String DB_STORE_PATH_DIR = "dbStore";
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime";
protected static RuntimeMock runtimeMock;
@ -120,20 +120,20 @@ public class ObserverUpdateTest {
PrivilegeHandler privilegeHandler = runtimeMock.getAgent().getContainer().getPrivilegeHandler();
Certificate certificate = privilegeHandler
.authenticate("test", "test".toCharArray()); //$NON-NLS-1$ //$NON-NLS-2$
.authenticate("test", "test".toCharArray()); //$NON-NLS-2$
// create order
Order newOrder = createOrder("MyTestOrder", "Test Name", "TestType", new Date(),
State.CREATED); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = realm.openTx(certificate, "test", false)) { //$NON-NLS-1$
State.CREATED);//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = realm.openTx(certificate, "test", false)) {
tx.add(newOrder);
tx.commitOnClose();
}
// create resource
Resource newResource = createResource("MyTestResource", "Test Name",
"TestType"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = realm.openTx(certificate, "test", false)) { //$NON-NLS-1$
"TestType");//$NON-NLS-2$ //$NON-NLS-3$
try (StrolchTransaction tx = realm.openTx(certificate, "test", false)) {
tx.add(newResource);
tx.commitOnClose();
}

View File

@ -46,15 +46,15 @@ public class RealmTest extends AbstractModelTest {
public static final String DB_URL1 = "jdbc:postgresql://localhost/testdb1";
public static final String DB_URL2 = "jdbc:postgresql://localhost/testdb2";
private static final String TEST_USER2 = "testuser2"; //$NON-NLS-1$
private static final String TEST_USER1 = "testuser1"; //$NON-NLS-1$
private static final String TEST = "test"; //$NON-NLS-1$
private static final String FIRST = "first"; //$NON-NLS-1$
private static final String SECOND = "second"; //$NON-NLS-1$
private static final String TEST_USER2 = "testuser2";
private static final String TEST_USER1 = "testuser1";
private static final String TEST = "test";
private static final String FIRST = "first";
private static final String SECOND = "second";
public static final String RUNTIME_PATH = "target/realmtest/"; //$NON-NLS-1$
public static final String DB_STORE_PATH_DIR = "dbStore"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/realmtest"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/realmtest/";
public static final String DB_STORE_PATH_DIR = "dbStore";
public static final String CONFIG_SRC = "src/test/resources/realmtest";
protected static RuntimeMock runtimeMock;
@ -92,9 +92,9 @@ public class RealmTest extends AbstractModelTest {
@Test
public void testDifferentRealms() {
String expectedId1 = "@realmTestId1"; //$NON-NLS-1$
String expectedId2 = "@realmTestId2"; //$NON-NLS-1$
String type = "Bla"; //$NON-NLS-1$
String expectedId1 = "@realmTestId1";
String expectedId2 = "@realmTestId2";
String type = "Bla";
PrivilegeHandler privilegeHandler = runtimeMock.getAgent().getContainer().getPrivilegeHandler();
Certificate certificate = privilegeHandler.authenticate(TEST, TEST.toCharArray());
@ -102,7 +102,7 @@ public class RealmTest extends AbstractModelTest {
{
StrolchRealm firstRealm = runtimeMock.getRealm(FIRST);
assertEquals(DataStoreMode.CACHED, firstRealm.getMode());
Resource expectedRes1 = ModelGenerator.createResource(expectedId1, "Bla bla", type); //$NON-NLS-1$
Resource expectedRes1 = ModelGenerator.createResource(expectedId1, "Bla bla", type);
try (StrolchTransaction tx = firstRealm.openTx(certificate, TEST, false)) {
tx.add(expectedRes1);
tx.commitOnClose();
@ -110,14 +110,14 @@ public class RealmTest extends AbstractModelTest {
try (StrolchTransaction tx = firstRealm.openTx(certificate, TEST, true)) {
Resource res = tx.getResourceBy(type, expectedId1);
assertEquals("Should find object previously added in same realm!", expectedRes1, res); //$NON-NLS-1$
assertEquals("Should find object previously added in same realm!", expectedRes1, res);
}
}
{
StrolchRealm secondRealm = runtimeMock.getRealm(SECOND);
assertEquals(DataStoreMode.CACHED, secondRealm.getMode());
Resource expectedRes2 = ModelGenerator.createResource(expectedId2, "Bla bla", type); //$NON-NLS-1$
Resource expectedRes2 = ModelGenerator.createResource(expectedId2, "Bla bla", type);
try (StrolchTransaction tx = secondRealm.openTx(certificate, TEST, false)) {
tx.add(expectedRes2);
tx.commitOnClose();
@ -125,7 +125,7 @@ public class RealmTest extends AbstractModelTest {
try (StrolchTransaction tx = secondRealm.openTx(certificate, TEST, true)) {
Resource res = tx.getResourceBy(type, expectedId2);
assertEquals("Should find object previously added in same realm!", expectedRes2, res); //$NON-NLS-1$
assertEquals("Should find object previously added in same realm!", expectedRes2, res);
}
}
@ -133,7 +133,7 @@ public class RealmTest extends AbstractModelTest {
StrolchRealm secondRealm = runtimeMock.getRealm(SECOND);
try (StrolchTransaction tx = secondRealm.openTx(certificate, TEST, true)) {
Resource res = tx.getResourceBy(type, expectedId1);
assertNull("Should not find object added in differenct realm!", res); //$NON-NLS-1$
assertNull("Should not find object added in differenct realm!", res);
}
}
}

View File

@ -53,9 +53,9 @@ import li.strolch.xmlpers.api.*;
public class XmlPersistenceHandler extends StrolchComponent implements PersistenceHandler {
public static final String PROP_DB_STORE_PATH = "dbStorePath";
public static final String PROP_DB_IGNORE_REALM = "ignoreRealm"; //$NON-NLS-1$
public static final String PROP_DB_IGNORE_REALM = "ignoreRealm";
public static final String PROP_ALLOW_DATA_INIT_ON_EMPTY_DB = "allowDataInitOnEmptyDb";
public static final String PROP_VERBOSE = "verbose"; //$NON-NLS-1$
public static final String PROP_VERBOSE = "verbose";
private Map<String, PersistenceStore> persistenceStoreMap;

View File

@ -74,7 +74,7 @@ public class LogMessageSaxReader extends DefaultHandler {
this.properties.setProperty(key, value);
}
default -> throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}
@ -138,7 +138,7 @@ public class LogMessageSaxReader extends DefaultHandler {
default:
throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
MessageFormat.format("The element ''{0}'' is unhandled!", qName));
}
}

View File

@ -27,7 +27,7 @@ public class LogMessageToSaxWriterVisitor {
writeElement(logMessage);
this.writer.flush();
} catch (XMLStreamException e) {
String msg = "Failed to write LogMessage {0} due to {1}"; //$NON-NLS-1$
String msg = "Failed to write LogMessage {0} due to {1}";
msg = MessageFormat.format(msg, logMessage.getId(), e.getMessage());
throw new StrolchException(msg, e);
}

View File

@ -33,9 +33,9 @@ import org.junit.Test;
public class ExistingDbTest {
private static final String TEST = "test"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/existingDbRuntime/"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/existingDbRuntime"; //$NON-NLS-1$
private static final String TEST = "test";
public static final String RUNTIME_PATH = "target/existingDbRuntime/";
public static final String CONFIG_SRC = "src/test/resources/existingDbRuntime";
protected static RuntimeMock runtimeMock;
@ -72,11 +72,11 @@ public class ExistingDbTest {
try (StrolchTransaction tx = runtimeMock.getRealm(StrolchConstants.DEFAULT_REALM)
.openTx(certificate, TEST, true)) {
Resource resource = tx.getResourceBy("MyType", "@1"); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull("Should be able to read existing element from db", resource); //$NON-NLS-1$
Resource resource = tx.getResourceBy("MyType", "@1"); //$NON-NLS-2$
assertNotNull("Should be able to read existing element from db", resource);
Order order = tx.getOrderBy("MyType", "@1"); //$NON-NLS-1$//$NON-NLS-2$
assertNotNull("Should be able to read existing element from db", order); //$NON-NLS-1$
Order order = tx.getOrderBy("MyType", "@1");//$NON-NLS-2$
assertNotNull("Should be able to read existing element from db", order);
}
}
}

View File

@ -43,9 +43,9 @@ import org.junit.Test;
*/
public class ObserverUpdateTest {
private static final String TEST = "test"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime"; //$NON-NLS-1$
private static final String TEST = "test";
public static final String RUNTIME_PATH = "target/observerUpdateStrolchRuntime/";
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime";
protected static RuntimeMock runtimeMock;

View File

@ -29,8 +29,8 @@ import org.junit.BeforeClass;
public class XmlCachedDaoTest extends AbstractModelTest {
public static final String RUNTIME_PATH = "target/cachedStrolchRuntime/"; //$NON-NLS-1$
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime"; //$NON-NLS-1$
public static final String RUNTIME_PATH = "target/cachedStrolchRuntime/";
public static final String CONFIG_SRC = "src/test/resources/cachedRuntime";
protected static RuntimeMock runtimeMock;

View File

@ -170,11 +170,11 @@ public class DefaultEncryptionHandler implements EncryptionHandler {
// test non-salt hash algorithm
try {
hashPasswordWithoutSalt("test".toCharArray()); //$NON-NLS-1$
hashPasswordWithoutSalt("test".toCharArray());
DefaultEncryptionHandler.logger.info(MessageFormat
.format("Using non-salt hashing algorithm {0}", this.nonSaltAlgorithm)); //$NON-NLS-1$
.format("Using non-salt hashing algorithm {0}", this.nonSaltAlgorithm));
} catch (Exception e) {
String msg = "[{0}] Defined parameter {1} is invalid because of underlying exception: {2}"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid because of underlying exception: {2}";
msg = MessageFormat.format(msg, EncryptionHandler.class.getName(), XML_PARAM_HASH_ALGORITHM_NON_SALT,
e.getLocalizedMessage());
throw new PrivilegeException(msg, e);
@ -182,11 +182,11 @@ public class DefaultEncryptionHandler implements EncryptionHandler {
// test hash algorithm
try {
hashPassword("test".toCharArray(), "test".getBytes()); //$NON-NLS-1$
hashPassword("test".toCharArray(), "test".getBytes());
DefaultEncryptionHandler.logger
.info(MessageFormat.format("Using hashing algorithm {0}", this.algorithm)); //$NON-NLS-1$
.info(MessageFormat.format("Using hashing algorithm {0}", this.algorithm));
} catch (Exception e) {
String msg = "[{0}] Defined parameter {1} is invalid because of underlying exception: {2}"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid because of underlying exception: {2}";
msg = MessageFormat
.format(msg, EncryptionHandler.class.getName(), XML_PARAM_HASH_ALGORITHM, e.getLocalizedMessage());
throw new PrivilegeException(msg, e);

View File

@ -623,13 +623,13 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get existing user
User existingUser = this.persistenceHandler.getUser(userRep.getUsername());
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", userRep.getUsername())); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", userRep.getUsername()));
// if nothing to do, then stop
if (isEmpty(userRep.getFirstname()) && isEmpty(userRep.getLastname()) && userRep.getLocale() == null && (
userRep.getProperties() == null || userRep.getProperties().isEmpty())) {
throw new PrivilegeModelException(
format("All updateable fields are empty for update of user {0}", //$NON-NLS-1$
format("All updateable fields are empty for update of user {0}",
userRep.getUsername()));
}
@ -721,7 +721,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get user
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
// validate that this user may add this role to this user
prvCtx.validateAction(new SimpleRestrictable(PRIVILEGE_ADD_ROLE_TO_USER, new Tuple(existingUser, roleName)));
@ -729,13 +729,13 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// check that user not already has role
Set<String> currentRoles = existingUser.getRoles();
if (currentRoles.contains(roleName)) {
String msg = format("User {0} already has role {1}", username, roleName); //$NON-NLS-1$
String msg = format("User {0} already has role {1}", username, roleName);
throw new PrivilegeModelException(msg);
}
// validate that the role exists
if (this.persistenceHandler.getRole(roleName) == null) {
String msg = format("Role {0} does not exist!", roleName); //$NON-NLS-1$
String msg = format("Role {0} does not exist!", roleName);
throw new PrivilegeModelException(msg);
}
@ -773,7 +773,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
// validate that this user may remove this role from this user
prvCtx.validateAction(
@ -782,7 +782,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// ignore if user does not have role
Set<String> currentRoles = existingUser.getRoles();
if (!currentRoles.contains(roleName)) {
String msg = format("User {0} does not have role {1}", existingUser.getUsername(), roleName); //$NON-NLS-1$
String msg = format("User {0} does not have role {1}", existingUser.getUsername(), roleName);
throw new PrivilegeModelException(msg);
}
@ -816,7 +816,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
// create new user
User newUser = new User(existingUser.getUserId(), existingUser.getUsername(), existingUser.getPassword(),
@ -853,11 +853,11 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
if (existingUser.getUserState().isRemote())
throw new PrivilegeModelException(
format("User {0} is remote and can not set password!", username)); //$NON-NLS-1$
format("User {0} is remote and can not set password!", username));
// create new user
User newUser = new User(existingUser.getUserId(), existingUser.getUsername(), existingUser.getPassword(),
@ -888,7 +888,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
UserHistory history = existingUser.getHistory().getClone();
@ -953,7 +953,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User existingUser = this.persistenceHandler.getUser(username);
if (existingUser == null)
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
// create new user
User newUser = new User(existingUser.getUserId(), existingUser.getUsername(), existingUser.getPassword(),
@ -1095,14 +1095,14 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get role
Role existingRole = this.persistenceHandler.getRole(roleName);
if (existingRole == null) {
String msg = format("Role {0} does not exist!", roleName); //$NON-NLS-1$
String msg = format("Role {0} does not exist!", roleName);
throw new PrivilegeModelException(msg);
}
// validate that policy exists if needed
String policy = privilegeRep.getPolicy();
if (policy != null && !this.policyMap.containsKey(policy)) {
String msg = "Policy {0} for Privilege {1} does not exist"; //$NON-NLS-1$
String msg = "Policy {0} for Privilege {1} does not exist";
msg = format(msg, policy, privilegeRep.getName());
throw new PrivilegeModelException(msg);
}
@ -1151,12 +1151,12 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get role
Role existingRole = this.persistenceHandler.getRole(roleName);
if (existingRole == null) {
throw new PrivilegeModelException(format("Role {0} does not exist!", roleName)); //$NON-NLS-1$
throw new PrivilegeModelException(format("Role {0} does not exist!", roleName));
}
// ignore if role does not have privilege
if (!existingRole.hasPrivilege(privilegeName)) {
String msg = format("Role {0} does not have Privilege {1}", roleName, privilegeName); //$NON-NLS-1$
String msg = format("Role {0} does not have Privilege {1}", roleName, privilegeName);
throw new PrivilegeModelException(msg);
}
@ -1257,7 +1257,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User user = this.persistenceHandler.getUser(username);
if (user == null) {
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
}
// initiate the challenge
@ -1278,7 +1278,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// get User
User user = this.persistenceHandler.getUser(username);
if (user == null) {
throw new PrivilegeModelException(format("User {0} does not exist!", username)); //$NON-NLS-1$
throw new PrivilegeModelException(format("User {0} does not exist!", username));
}
// validate the response
@ -1317,7 +1317,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
try {
// username must be at least 2 characters in length
if (username == null || username.length() < 2) {
String msg = format("The given username ''{0}'' is shorter than 2 characters", username); //$NON-NLS-1$
String msg = format("The given username ''{0}'' is shorter than 2 characters", username);
throw new InvalidCredentialsException(msg);
}
@ -1328,7 +1328,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
Set<String> userRoles = user.getRoles();
if (userRoles.isEmpty())
throw new InvalidCredentialsException(
format("User {0} does not have any roles defined!", username)); //$NON-NLS-1$
format("User {0} does not have any roles defined!", username));
if (user.isPasswordChangeRequested()) {
if (usage == Usage.SINGLE)
@ -1360,7 +1360,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
this.persistenceHandler.persist();
// log
logger.info(format("User {0} authenticated: {1}", username, certificate)); //$NON-NLS-1$
logger.info(format("User {0} authenticated: {1}", username, certificate));
// return the certificate
return certificate;
@ -1369,7 +1369,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
throw e;
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
String msg = "User {0} failed to authenticate: {1}"; //$NON-NLS-1$
String msg = "User {0} failed to authenticate: {1}";
msg = format(msg, username, e.getMessage());
throw new PrivilegeException(msg, e);
} finally {
@ -1422,7 +1422,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
persistSessions();
// log
logger.info(format("User {0} authenticated: {1}", user.getUsername(), certificate)); //$NON-NLS-1$
logger.info(format("User {0} authenticated: {1}", user.getUsername(), certificate));
return certificate;
}
@ -1468,7 +1468,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
persistSessions();
// log
logger.info(format("User {0} refreshed session: {1}", user.getUsername(), refreshedCert)); //$NON-NLS-1$
logger.info(format("User {0} refreshed session: {1}", user.getUsername(), refreshedCert));
// return the certificate
return refreshedCert;
@ -1477,7 +1477,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
throw e;
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
String msg = "User {0} failed to refresh session: {1}"; //$NON-NLS-1$
String msg = "User {0} failed to refresh session: {1}";
msg = format(msg, certificate.getUsername(), e.getMessage());
throw new PrivilegeException(msg, e);
}
@ -1618,13 +1618,13 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
User user = this.persistenceHandler.getUser(username);
// no user means no authentication
if (user == null) {
String msg = format("There is no user defined with the username {0}", username); //$NON-NLS-1$
String msg = format("There is no user defined with the username {0}", username);
throw new InvalidCredentialsException(msg);
}
// make sure not a system user - they may not login in
if (user.getUserState() == UserState.SYSTEM) {
String msg = "User {0} is a system user and may not login!"; //$NON-NLS-1$
String msg = "User {0} is a system user and may not login!";
msg = format(msg, username);
throw new InvalidCredentialsException(msg);
}
@ -1632,7 +1632,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// validate if user is allowed to login
// this also capture the trying to login of SYSTEM user
if (user.getUserState() != UserState.ENABLED) {
String msg = "User {0} does not have state {1} and can not login!"; //$NON-NLS-1$
String msg = "User {0} does not have state {1} and can not login!";
msg = format(msg, username, UserState.ENABLED);
throw new AccessDeniedException(msg);
}
@ -1640,7 +1640,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
byte[] pwHash = user.getPassword();
if (pwHash == null)
throw new InvalidCredentialsException(
format("User {0} has no password and may not login!", username)); //$NON-NLS-1$
format("User {0} has no password and may not login!", username));
byte[] salt = user.getSalt();
// we only work with hashed passwords
@ -1656,7 +1656,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// validate password
if (!Arrays.equals(passwordHash, pwHash))
throw new InvalidCredentialsException(format("Password is incorrect for {0}", username)); //$NON-NLS-1$
throw new InvalidCredentialsException(format("Password is incorrect for {0}", username));
// see if we need to update the hash
if (user.getHashAlgorithm() == null || user.getHashIterations() != this.encryptionHandler.getIterations()
@ -1784,9 +1784,9 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// return true if object was really removed
boolean loggedOut = privilegeContext != null;
if (loggedOut)
logger.info(format("User {0} logged out.", certificate.getUsername())); //$NON-NLS-1$
logger.info(format("User {0} logged out.", certificate.getUsername()));
else
logger.warn("User already logged out!"); //$NON-NLS-1$
logger.warn("User already logged out!");
return loggedOut;
}
@ -1800,11 +1800,11 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
public void validateSystemSession(PrivilegeContext ctx) throws PrivilegeException {
// ctx must not be null
if (ctx == null)
throw new PrivilegeException("PrivilegeContext may not be null!"); //$NON-NLS-1$
throw new PrivilegeException("PrivilegeContext may not be null!");
// validate user state is system
if (ctx.getUserRep().getUserState() != UserState.SYSTEM) {
String msg = "The PrivilegeContext's user {0} does not have expected user state {1}"; //$NON-NLS-1$
String msg = "The PrivilegeContext's user {0} does not have expected user state {1}";
msg = format(msg, ctx.getUserRep().getUsername(), UserState.SYSTEM);
throw new PrivilegeException(msg);
}
@ -1813,7 +1813,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
Certificate certificate = ctx.getCertificate();
PrivilegeContext privilegeContext = this.privilegeContextMap.get(certificate.getSessionId());
if (privilegeContext == null) {
String msg = format("There is no session information for {0}", certificate); //$NON-NLS-1$
String msg = format("There is no session information for {0}", certificate);
throw new NotAuthenticatedException(msg);
}
@ -1827,7 +1827,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// validate certificate has not been tampered with
Certificate sessionCertificate = privilegeContext.getCertificate();
if (!sessionCertificate.equals(certificate)) {
String msg = "Received illegal certificate for session id {0}"; //$NON-NLS-1$
String msg = "Received illegal certificate for session id {0}";
msg = format(msg, certificate.getSessionId());
throw new PrivilegeException(msg);
}
@ -1845,19 +1845,19 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// certificate must not be null
if (certificate == null)
throw new PrivilegeException("Certificate may not be null!"); //$NON-NLS-1$
throw new PrivilegeException("Certificate may not be null!");
// first see if a session exists for this certificate
PrivilegeContext privilegeContext = this.privilegeContextMap.get(certificate.getSessionId());
if (privilegeContext == null) {
String msg = format("There is no session information for {0}", certificate); //$NON-NLS-1$
String msg = format("There is no session information for {0}", certificate);
throw new NotAuthenticatedException(msg);
}
// validate certificate has not been tampered with
Certificate sessionCertificate = privilegeContext.getCertificate();
if (!sessionCertificate.equals(certificate)) {
String msg = "Received illegal certificate for session id {0}"; //$NON-NLS-1$
String msg = "Received illegal certificate for session id {0}";
msg = format(msg, certificate.getSessionId());
throw new PrivilegeException(msg);
}
@ -1867,7 +1867,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
ZonedDateTime dateTime = sessionCertificate.getLoginTime();
if (dateTime.plusHours(1).isBefore(ZonedDateTime.now())) {
invalidate(sessionCertificate);
throw new NotAuthenticatedException("Certificate has already expired!"); //$NON-NLS-1$
throw new NotAuthenticatedException("Certificate has already expired!");
}
}
@ -1946,7 +1946,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
Map<String, Class<PrivilegePolicy>> policyMap) {
if (this.initialized)
throw new PrivilegeModelException("Already initialized!"); //$NON-NLS-1$
throw new PrivilegeModelException("Already initialized!");
this.policyMap = policyMap;
this.encryptionHandler = encryptionHandler;
@ -1984,9 +1984,9 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
this.autoPersistOnUserChangesData = false;
} else if (autoPersistS.equals(Boolean.TRUE.toString())) {
this.autoPersistOnUserChangesData = true;
logger.info("Enabling automatic persistence when user changes their data."); //$NON-NLS-1$
logger.info("Enabling automatic persistence when user changes their data.");
} else {
String msg = "Parameter {0} has illegal value {1}. Overriding with {2}"; //$NON-NLS-1$
String msg = "Parameter {0} has illegal value {1}. Overriding with {2}";
msg = format(msg, PARAM_AUTO_PERSIST_ON_USER_CHANGES_DATA, autoPersistS, Boolean.FALSE);
logger.error(msg);
this.autoPersistOnUserChangesData = false;
@ -2002,29 +2002,29 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
String persistSessionsPathS = parameterMap.get(PARAM_PERSIST_SESSIONS_PATH);
if (isEmpty(persistSessionsPathS)) {
String msg = "Parameter {0} has illegal value {1}."; //$NON-NLS-1$
String msg = "Parameter {0} has illegal value {1}.";
msg = format(msg, PARAM_PERSIST_SESSIONS_PATH, persistSessionsPathS);
throw new PrivilegeModelException(msg);
}
File persistSessionsPath = new File(persistSessionsPathS);
if (!persistSessionsPath.getParentFile().isDirectory()) {
String msg = "Path for param {0} is invalid as parent does not exist or is not a directory. Value: {1}"; //$NON-NLS-1$
String msg = "Path for param {0} is invalid as parent does not exist or is not a directory. Value: {1}";
msg = format(msg, PARAM_PERSIST_SESSIONS_PATH, persistSessionsPath.getAbsolutePath());
throw new PrivilegeModelException(msg);
}
if (persistSessionsPath.exists() && (!persistSessionsPath.isFile() || !persistSessionsPath.canWrite())) {
String msg = "Path for param {0} is invalid as file exists but is not a file or not writeable. Value: {1}"; //$NON-NLS-1$
String msg = "Path for param {0} is invalid as file exists but is not a file or not writeable. Value: {1}";
msg = format(msg, PARAM_PERSIST_SESSIONS_PATH, persistSessionsPath.getAbsolutePath());
throw new PrivilegeModelException(msg);
}
this.persistSessionsPath = persistSessionsPath;
logger.info(format("Enabling persistence of sessions to {0}", //$NON-NLS-1$
logger.info(format("Enabling persistence of sessions to {0}",
this.persistSessionsPath.getAbsolutePath()));
} else {
String msg = "Parameter {0} has illegal value {1}. Overriding with {2}"; //$NON-NLS-1$
String msg = "Parameter {0} has illegal value {1}. Overriding with {2}";
msg = format(msg, PARAM_PERSIST_SESSIONS, persistSessionsS, Boolean.FALSE);
logger.error(msg);
this.persistSessions = false;
@ -2042,26 +2042,26 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
try {
this.privilegeConflictResolution = PrivilegeConflictResolution.valueOf(privilegeConflictResolutionS);
} catch (Exception e) {
String msg = "Parameter {0} has illegal value {1}."; //$NON-NLS-1$
String msg = "Parameter {0} has illegal value {1}.";
msg = format(msg, PARAM_PRIVILEGE_CONFLICT_RESOLUTION, privilegeConflictResolutionS);
throw new PrivilegeModelException(msg);
}
}
logger.info("Privilege conflict resolution set to " + this.privilegeConflictResolution); //$NON-NLS-1$
logger.info("Privilege conflict resolution set to " + this.privilegeConflictResolution);
}
private void handleSecretParams(Map<String, String> parameterMap) {
String secretKeyS = parameterMap.get(PARAM_SECRET_KEY);
if (isEmpty(secretKeyS)) {
String msg = "Parameter {0} may not be empty"; //$NON-NLS-1$
String msg = "Parameter {0} may not be empty";
msg = format(msg, PARAM_SECRET_KEY, PARAM_PRIVILEGE_CONFLICT_RESOLUTION);
throw new PrivilegeModelException(msg);
}
String secretSaltS = parameterMap.get(PARAM_SECRET_SALT);
if (isEmpty(secretSaltS)) {
String msg = "Parameter {0} may not be empty"; //$NON-NLS-1$
String msg = "Parameter {0} may not be empty";
msg = format(msg, PARAM_SECRET_SALT, PARAM_PRIVILEGE_CONFLICT_RESOLUTION);
throw new PrivilegeModelException(msg);
}
@ -2164,7 +2164,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
IPrivilege privilege = role.getPrivilege(privilegeName);
String policy = privilege.getPolicy();
if (policy != null && !this.policyMap.containsKey(policy)) {
String msg = "Policy {0} for Privilege {1} does not exist on role {2}"; //$NON-NLS-1$
String msg = "Policy {0} for Privilege {1} does not exist on role {2}";
msg = format(msg, policy, privilege.getName(), role);
throw new PrivilegeModelException(msg);
}
@ -2225,9 +2225,9 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
private PrivilegeContext initiateSystemPrivilege(String username, Restrictable restrictable) {
if (username == null)
throw new PrivilegeException("systemUsername may not be null!"); //$NON-NLS-1$
throw new PrivilegeException("systemUsername may not be null!");
if (restrictable == null)
throw new PrivilegeException("action may not be null!"); //$NON-NLS-1$
throw new PrivilegeException("action may not be null!");
// get privilegeContext for this system user
PrivilegeContext systemUserPrivilegeContext = getSystemUserPrivilegeContext(username);
@ -2257,20 +2257,20 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// no user means no authentication
if (user == null) {
String msg = format("The system user with username {0} does not exist!", systemUsername); //$NON-NLS-1$
String msg = format("The system user with username {0} does not exist!", systemUsername);
throw new AccessDeniedException(msg);
}
// validate password
byte[] pwHash = user.getPassword();
if (pwHash != null) {
String msg = format("System users must not have a password: {0}", user.getUsername()); //$NON-NLS-1$
String msg = format("System users must not have a password: {0}", user.getUsername());
throw new AccessDeniedException(msg);
}
// validate user state is system
if (user.getUserState() != UserState.SYSTEM) {
String msg = "The system {0} user does not have expected user state {1}"; //$NON-NLS-1$
String msg = "The system {0} user does not have expected user state {1}";
msg = format(msg, user.getUsername(), UserState.SYSTEM);
throw new PrivilegeException(msg);
}
@ -2278,7 +2278,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// validate user has at least one role
if (user.getRoles().isEmpty()) {
String msg = format("The system user {0} does not have any roles defined!",
user.getUsername()); //$NON-NLS-1$
user.getUsername());
throw new PrivilegeException(msg);
}
@ -2297,7 +2297,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
// log
if (logger.isDebugEnabled()) {
String msg = "The system user ''{0}'' is logged in with session {1}"; //$NON-NLS-1$
String msg = "The system user ''{0}'' is logged in with session {1}";
msg = format(msg, user.getUsername(), systemUserCertificate.getSessionId());
logger.info(msg);
}
@ -2334,7 +2334,7 @@ public class DefaultPrivilegeHandler implements PrivilegeHandler {
policy = policyClazz.getConstructor().newInstance();
} catch (Exception e) {
String msg = "The class for the policy with the name {0} does not exist!{1}"; //$NON-NLS-1$
String msg = "The class for the policy with the name {0} does not exist!{1}";
msg = format(msg, policyName, policyName);
throw new PrivilegeModelException(msg, e);
}

View File

@ -167,37 +167,37 @@ public interface PrivilegeHandler {
/**
* configuration parameter to define a secret_key
*/
String PARAM_SECRET_KEY = "secretKey"; //$NON-NLS-1$
String PARAM_SECRET_KEY = "secretKey";
/**
* configuration parameter to define if session refreshing is allowed
*/
String PARAM_ALLOW_SESSION_REFRESH = "allowSessionRefresh"; //$NON-NLS-1$
String PARAM_ALLOW_SESSION_REFRESH = "allowSessionRefresh";
/**
* configuration parameter to define if username is case insensitive
*/
String PARAM_CASE_INSENSITIVE_USERNAME = "caseInsensitiveUsername"; //$NON-NLS-1$
String PARAM_CASE_INSENSITIVE_USERNAME = "caseInsensitiveUsername";
/**
* configuration parameter to define a secret salt
*/
String PARAM_SECRET_SALT = "secretSalt"; //$NON-NLS-1$
String PARAM_SECRET_SALT = "secretSalt";
/**
* configuration parameter to define automatic persisting on password change
*/
String PARAM_AUTO_PERSIST_ON_USER_CHANGES_DATA = "autoPersistOnUserChangesData"; //$NON-NLS-1$
String PARAM_AUTO_PERSIST_ON_USER_CHANGES_DATA = "autoPersistOnUserChangesData";
/**
* configuration parameter to define if sessions should be persisted
*/
String PARAM_PERSIST_SESSIONS = "persistSessions"; //$NON-NLS-1$
String PARAM_PERSIST_SESSIONS = "persistSessions";
/**
* configuration parameter to define where sessions are to be persisted
*/
String PARAM_PERSIST_SESSIONS_PATH = "persistSessionsPath"; //$NON-NLS-1$
String PARAM_PERSIST_SESSIONS_PATH = "persistSessionsPath";
/**
* configuration parameter to define {@link PrivilegeConflictResolution}

View File

@ -154,7 +154,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
String basePath = this.parameterMap.get(XML_PARAM_BASE_PATH);
File basePathF = new File(basePath);
if (!basePathF.exists() && !basePathF.isDirectory()) {
String msg = "[{0}] Defined parameter {1} does not point to a valid path at {2}"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} does not point to a valid path at {2}";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_BASE_PATH, basePathF.getAbsolutePath());
throw new PrivilegeException(msg);
}
@ -162,7 +162,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
// get users file name
String usersFileName = this.parameterMap.get(XML_PARAM_USERS_FILE);
if (StringHelper.isEmpty(usersFileName)) {
String msg = "[{0}] Defined parameter {1} is not valid as it is empty!"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is not valid as it is empty!";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_USERS_FILE);
throw new PrivilegeException(msg);
}
@ -170,25 +170,25 @@ public class XmlPersistenceHandler implements PersistenceHandler {
// get roles file name
String rolesFileName = this.parameterMap.get(XML_PARAM_ROLES_FILE);
if (StringHelper.isEmpty(rolesFileName)) {
String msg = "[{0}] Defined parameter {1} is not valid as it is empty!"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is not valid as it is empty!";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_ROLES_FILE);
throw new PrivilegeException(msg);
}
// validate users file exists
String usersPathS = basePath + "/" + usersFileName; //$NON-NLS-1$
String usersPathS = basePath + "/" + usersFileName;
File usersPath = new File(usersPathS);
if (!usersPath.exists()) {
String msg = "[{0}] Defined parameter {1} is invalid as users file does not exist at path {2}"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid as users file does not exist at path {2}";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_USERS_FILE, usersPath.getAbsolutePath());
throw new PrivilegeException(msg);
}
// validate roles file exists
String rolesPathS = basePath + "/" + rolesFileName; //$NON-NLS-1$
String rolesPathS = basePath + "/" + rolesFileName;
File rolesPath = new File(rolesPathS);
if (!rolesPath.exists()) {
String msg = "[{0}] Defined parameter {1} is invalid as roles file does not exist at path {2}"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid as roles file does not exist at path {2}";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_ROLES_FILE, rolesPath.getAbsolutePath());
throw new PrivilegeException(msg);
}
@ -200,7 +200,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
this.caseInsensitiveUsername = Boolean.parseBoolean(this.parameterMap.get(PARAM_CASE_INSENSITIVE_USERNAME));
if (reload())
logger.info("Privilege Data loaded."); //$NON-NLS-1$
logger.info("Privilege Data loaded.");
}
/**
@ -238,8 +238,8 @@ public class XmlPersistenceHandler implements PersistenceHandler {
this.userMapDirty = false;
this.roleMapDirty = false;
logger.info(format("Read {0} Users", this.userMap.size())); //$NON-NLS-1$
logger.info(format("Read {0} Roles", this.roleMap.size())); //$NON-NLS-1$
logger.info(format("Read {0} Users", this.userMap.size()));
logger.info(format("Read {0} Roles", this.roleMap.size()));
// validate referenced roles exist
for (User user : users) {
@ -267,7 +267,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
// get users file name
String usersFileName = this.parameterMap.get(XML_PARAM_USERS_FILE);
if (usersFileName == null || usersFileName.isEmpty()) {
String msg = "[{0}] Defined parameter {1} is invalid"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_USERS_FILE);
throw new PrivilegeException(msg);
}
@ -275,7 +275,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
// get roles file name
String rolesFileName = this.parameterMap.get(XML_PARAM_ROLES_FILE);
if (rolesFileName == null || rolesFileName.isEmpty()) {
String msg = "[{0}] Defined parameter {1} is invalid"; //$NON-NLS-1$
String msg = "[{0}] Defined parameter {1} is invalid";
msg = format(msg, PersistenceHandler.class.getName(), XML_PARAM_ROLES_FILE);
throw new PrivilegeException(msg);
}

View File

@ -56,7 +56,7 @@ public class PrivilegeInitializationHelper {
// make sure file exists
if (!privilegeXmlFile.exists()) {
String msg = "Privilege file does not exist at path {0}"; //$NON-NLS-1$
String msg = "Privilege file does not exist at path {0}";
msg = MessageFormat.format(msg, privilegeXmlFile.getAbsolutePath());
throw new PrivilegeException(msg);
}
@ -65,7 +65,7 @@ public class PrivilegeInitializationHelper {
try (InputStream fin = Files.newInputStream(privilegeXmlFile.toPath())) {
return initializeFromXml(fin);
} catch (Exception e) {
String msg = "Failed to load configuration from {0}"; //$NON-NLS-1$
String msg = "Failed to load configuration from {0}";
msg = MessageFormat.format(msg, privilegeXmlFile.getAbsolutePath());
throw new PrivilegeException(msg, e);
}
@ -109,7 +109,7 @@ public class PrivilegeInitializationHelper {
try {
encryptionHandler.initialize(parameterMap);
} catch (Exception e) {
String msg = "EncryptionHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "EncryptionHandler {0} could not be initialized";
msg = MessageFormat.format(msg, encryptionHandlerClassName);
throw new PrivilegeException(msg, e);
}
@ -126,7 +126,7 @@ public class PrivilegeInitializationHelper {
try {
passwordStrengthHandler.initialize(parameterMap);
} catch (Exception e) {
String msg = "PasswordStrengthHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "PasswordStrengthHandler {0} could not be initialized";
msg = MessageFormat.format(msg, passwordStrengthHandlerClassName);
throw new PrivilegeException(msg, e);
}
@ -138,7 +138,7 @@ public class PrivilegeInitializationHelper {
try {
persistenceHandler.initialize(parameterMap);
} catch (Exception e) {
String msg = "PersistenceHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "PersistenceHandler {0} could not be initialized";
msg = MessageFormat.format(msg, persistenceHandlerClassName);
throw new PrivilegeException(msg, e);
}
@ -151,7 +151,7 @@ public class PrivilegeInitializationHelper {
try {
challengeHandler.initialize(parameterMap);
} catch (Exception e) {
String msg = "UserChallengeHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "UserChallengeHandler {0} could not be initialized";
msg = MessageFormat.format(msg, persistenceHandlerClassName);
throw new PrivilegeException(msg, e);
}
@ -167,7 +167,7 @@ public class PrivilegeInitializationHelper {
try {
ssoHandler.initialize(parameterMap);
} catch (Exception e) {
String msg = "SingleSignOnHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "SingleSignOnHandler {0} could not be initialized";
msg = MessageFormat.format(msg, ssoHandlerClassName);
throw new PrivilegeException(msg, e);
}
@ -190,7 +190,7 @@ public class PrivilegeInitializationHelper {
privilegeHandler.initialize(parameterMap, encryptionHandler, passwordStrengthHandler, persistenceHandler,
challengeHandler, ssoHandler, policyMap);
} catch (Exception e) {
String msg = "PrivilegeHandler {0} could not be initialized"; //$NON-NLS-1$
String msg = "PrivilegeHandler {0} could not be initialized";
msg = MessageFormat.format(msg, privilegeHandler.getClass().getName());
throw new PrivilegeException(msg, e);
}

View File

@ -23,7 +23,7 @@ import java.util.ResourceBundle;
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class PrivilegeMessages {
private static final String BUNDLE_NAME = "PrivilegeMessages"; //$NON-NLS-1$
private static final String BUNDLE_NAME = "PrivilegeMessages";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

View File

@ -90,22 +90,22 @@ public final class Certificate implements Serializable {
// validate arguments are not null
if (StringHelper.isEmpty(sessionId)) {
throw new PrivilegeException("sessionId is null!"); //$NON-NLS-1$
throw new PrivilegeException("sessionId is null!");
}
if (StringHelper.isEmpty(username)) {
throw new PrivilegeException("username is null!"); //$NON-NLS-1$
throw new PrivilegeException("username is null!");
}
if (StringHelper.isEmpty(authToken)) {
throw new PrivilegeException("authToken is null!"); //$NON-NLS-1$
throw new PrivilegeException("authToken is null!");
}
if (userState == null) {
throw new PrivilegeException("userState is null!"); //$NON-NLS-1$
throw new PrivilegeException("userState is null!");
}
if (usage == null) {
throw new PrivilegeException("usage is null!"); //$NON-NLS-1$
throw new PrivilegeException("usage is null!");
}
if (source == null) {
throw new PrivilegeException("source is null!"); //$NON-NLS-1$
throw new PrivilegeException("source is null!");
}
this.usage = usage;

View File

@ -75,7 +75,7 @@ public class PrivilegeContext {
public void assertHasPrivilege(String privilegeName) throws AccessDeniedException {
if (!this.privileges.containsKey(privilegeName)) {
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.user"), //$NON-NLS-1$
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.user"),
userRep.getUsername(), privilegeName);
throw new AccessDeniedException(msg);
}
@ -87,7 +87,7 @@ public class PrivilegeContext {
public void assertHasRole(String roleName) throws AccessDeniedException {
if (!this.userRep.hasRole(roleName)) {
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.role"), //$NON-NLS-1$
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.role"),
userRep.getUsername(), roleName);
throw new AccessDeniedException(msg);
}
@ -99,7 +99,7 @@ public class PrivilegeContext {
return;
}
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.role"), //$NON-NLS-1$
String msg = MessageFormat.format(PrivilegeMessages.getString("Privilege.noprivilege.role"),
userRep.getUsername(), String.join(", ", roleNames));
throw new AccessDeniedException(msg);
}
@ -121,7 +121,7 @@ public class PrivilegeContext {
public PrivilegePolicy getPolicy(String policyName) throws PrivilegeException {
PrivilegePolicy policy = this.policies.get(policyName);
if (policy == null) {
String msg = "The PrivilegePolicy {0} does not exist on the PrivilegeContext!"; //$NON-NLS-1$
String msg = "The PrivilegePolicy {0} does not exist on the PrivilegeContext!";
throw new PrivilegeException(MessageFormat.format(msg, policyName));
}
return policy;
@ -173,7 +173,7 @@ public class PrivilegeContext {
IPrivilege privilege = this.privileges.get(privilegeName);
if (privilege == null) {
String msg = MessageFormat
.format(PrivilegeMessages.getString("Privilege.accessdenied.noprivilege"), //$NON-NLS-1$
.format(PrivilegeMessages.getString("Privilege.accessdenied.noprivilege"),
getUsername(), privilegeName, restrictable.getClass().getName(),
restrictable.getPrivilegeValue());
throw new AccessDeniedException(msg);

View File

@ -72,18 +72,18 @@ public class PrivilegeRep implements Serializable {
public void validate() {
if (StringHelper.isEmpty(this.name)) {
throw new PrivilegeException("No name defined!"); //$NON-NLS-1$
throw new PrivilegeException("No name defined!");
}
if (StringHelper.isEmpty(this.policy)) {
throw new PrivilegeException("policy is null!"); //$NON-NLS-1$
throw new PrivilegeException("policy is null!");
}
if (this.denyList == null) {
throw new PrivilegeException("denyList is null"); //$NON-NLS-1$
throw new PrivilegeException("denyList is null");
}
if (this.allowList == null) {
throw new PrivilegeException("allowList is null"); //$NON-NLS-1$
throw new PrivilegeException("allowList is null");
}
}

View File

@ -56,7 +56,7 @@ public class RoleRep implements Serializable {
*/
public void validate() {
if (StringHelper.isEmpty(this.name))
throw new PrivilegeException("name is null"); //$NON-NLS-1$
throw new PrivilegeException("name is null");
if (this.privileges != null && !this.privileges.isEmpty()) {
for (PrivilegeRep privilege : this.privileges) {

View File

@ -102,29 +102,29 @@ public class UserRep implements Serializable {
public void validate() {
if (StringHelper.isEmpty(this.userId))
throw new PrivilegeException("userId is null or empty"); //$NON-NLS-1$
throw new PrivilegeException("userId is null or empty");
if (StringHelper.isEmpty(this.username))
throw new PrivilegeException("username is null or empty"); //$NON-NLS-1$
throw new PrivilegeException("username is null or empty");
// username must be at least 2 characters in length
if (this.username.length() < 2) {
String msg = MessageFormat
.format("The given username ''{0}'' is shorter than 2 characters", this.username); //$NON-NLS-1$
.format("The given username ''{0}'' is shorter than 2 characters", this.username);
throw new PrivilegeException(msg);
}
if (this.userState == null)
throw new PrivilegeException("userState is null"); //$NON-NLS-1$
throw new PrivilegeException("userState is null");
if (StringHelper.isEmpty(this.firstname))
throw new PrivilegeException("firstname is null or empty"); //$NON-NLS-1$
throw new PrivilegeException("firstname is null or empty");
if (StringHelper.isEmpty(this.lastname))
throw new PrivilegeException("lastname is null or empty"); //$NON-NLS-1$
throw new PrivilegeException("lastname is null or empty");
if (this.roles == null || this.roles.isEmpty())
throw new PrivilegeException("roles is null or empty"); //$NON-NLS-1$
throw new PrivilegeException("roles is null or empty");
}
/**

View File

@ -181,19 +181,19 @@ public class PrivilegeContainerModel {
this.policies.put(privilegeName, clazz);
} catch (InstantiationException | InvocationTargetException e) {
String msg = "Configured Privilege Policy {0} with class {1} could not be instantiated."; //$NON-NLS-1$
String msg = "Configured Privilege Policy {0} with class {1} could not be instantiated.";
msg = MessageFormat.format(msg, privilegeName, policyClassName);
throw new PrivilegeException(msg, e);
} catch (IllegalAccessException e) {
String msg = "Configured Privilege Policy {0} with class {1} can not be accessed."; //$NON-NLS-1$
String msg = "Configured Privilege Policy {0} with class {1} can not be accessed.";
msg = MessageFormat.format(msg, privilegeName, policyClassName);
throw new PrivilegeException(msg, e);
} catch (ClassNotFoundException e) {
String msg = "Configured Privilege Policy {0} with class {1} does not exist."; //$NON-NLS-1$
String msg = "Configured Privilege Policy {0} with class {1} does not exist.";
msg = MessageFormat.format(msg, privilegeName, policyClassName);
throw new PrivilegeException(msg, e);
} catch (NoSuchMethodException e) {
String msg = "Configured Privilege Policy {0} with class {1} has missing parameterless constructor"; //$NON-NLS-1$
String msg = "Configured Privilege Policy {0} with class {1} has missing parameterless constructor";
msg = MessageFormat.format(msg, privilegeName, policyClassName);
throw new PrivilegeException(msg, e);
}

View File

@ -74,19 +74,19 @@ public final class PrivilegeImpl implements IPrivilege {
public PrivilegeImpl(String name, String policy, boolean allAllowed, Set<String> denyList, Set<String> allowList) {
if (StringHelper.isEmpty(name)) {
throw new PrivilegeException("No name defined!"); //$NON-NLS-1$
throw new PrivilegeException("No name defined!");
}
if (StringHelper.isEmpty(policy)) {
throw new PrivilegeException(
MessageFormat.format("Policy may not be empty for Privilege {0}!", name)); //$NON-NLS-1$
MessageFormat.format("Policy may not be empty for Privilege {0}!", name));
}
if (denyList == null) {
throw new PrivilegeException(
MessageFormat.format("denyList is null for Privilege {0}!", name)); //$NON-NLS-1$
MessageFormat.format("denyList is null for Privilege {0}!", name));
}
if (allowList == null) {
throw new PrivilegeException(
MessageFormat.format("allowList is null for Privilege {0}!", name)); //$NON-NLS-1$
MessageFormat.format("allowList is null for Privilege {0}!", name));
}
this.name = name;

View File

@ -53,10 +53,10 @@ public final class Role {
public Role(String name, Map<String, IPrivilege> privilegeMap) {
if (StringHelper.isEmpty(name)) {
throw new PrivilegeException("No name defined!"); //$NON-NLS-1$
throw new PrivilegeException("No name defined!");
}
if (privilegeMap == null) {
throw new PrivilegeException("No privileges defined!"); //$NON-NLS-1$
throw new PrivilegeException("No privileges defined!");
}
this.name = name;
@ -73,11 +73,11 @@ public final class Role {
String name = roleRep.getName();
if (StringHelper.isEmpty(name)) {
throw new PrivilegeException("No name defined!"); //$NON-NLS-1$
throw new PrivilegeException("No name defined!");
}
if (roleRep.getPrivileges() == null) {
throw new PrivilegeException("Privileges may not be null!"); //$NON-NLS-1$
throw new PrivilegeException("Privileges may not be null!");
}
// build privileges from rep

View File

@ -94,16 +94,16 @@ public final class User {
Map<String, String> propertyMap, boolean passwordChangeRequested, UserHistory history) {
if (StringHelper.isEmpty(userId))
throw new PrivilegeException("No UserId defined!"); //$NON-NLS-1$
throw new PrivilegeException("No UserId defined!");
if (userState == null)
throw new PrivilegeException("No userState defined!"); //$NON-NLS-1$
throw new PrivilegeException("No userState defined!");
if (StringHelper.isEmpty(username))
throw new PrivilegeException("No username defined!"); //$NON-NLS-1$
throw new PrivilegeException("No username defined!");
if (userState != UserState.SYSTEM) {
if (StringHelper.isEmpty(lastname))
throw new PrivilegeException("No lastname defined!"); //$NON-NLS-1$
throw new PrivilegeException("No lastname defined!");
if (StringHelper.isEmpty(firstname))
throw new PrivilegeException("No firstname defined!"); //$NON-NLS-1$
throw new PrivilegeException("No firstname defined!");
}
if (history == null)

View File

@ -74,7 +74,7 @@ public class DefaultPrivilege implements PrivilegePolicy {
// DefaultPrivilege policy expects the privilege value to be a string
if (!(object instanceof String)) {
String msg = Restrictable.class.getName() + PrivilegeMessages
.getString("Privilege.illegalArgument.nonstring"); //$NON-NLS-1$
.getString("Privilege.illegalArgument.nonstring");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}

View File

@ -45,14 +45,14 @@ public class PrivilegePolicyHelper {
*/
public static String preValidate(IPrivilege privilege, Restrictable restrictable) throws PrivilegeException {
if (privilege == null)
throw new PrivilegeException(PrivilegeMessages.getString("Privilege.privilegeNull")); //$NON-NLS-1$
throw new PrivilegeException(PrivilegeMessages.getString("Privilege.privilegeNull"));
if (restrictable == null)
throw new PrivilegeException(PrivilegeMessages.getString("Privilege.restrictableNull")); //$NON-NLS-1$
throw new PrivilegeException(PrivilegeMessages.getString("Privilege.restrictableNull"));
// get the PrivilegeName
String privilegeName = restrictable.getPrivilegeName();
if (StringHelper.isEmpty(privilegeName)) {
String msg = PrivilegeMessages.getString("Privilege.privilegeNameEmpty"); //$NON-NLS-1$
String msg = PrivilegeMessages.getString("Privilege.privilegeNameEmpty");
throw new PrivilegeException(MessageFormat.format(msg, restrictable));
}
@ -107,7 +107,7 @@ public class PrivilegePolicyHelper {
if (assertHasPrivilege) {
String msg = MessageFormat
.format(PrivilegeMessages.getString("Privilege.accessdenied.noprivilege.value"), //$NON-NLS-1$
.format(PrivilegeMessages.getString("Privilege.accessdenied.noprivilege.value"),
ctx.getUsername(), privilege.getName(), privilegeValue, restrictable.getClass().getName());
throw new AccessDeniedException(msg);

View File

@ -68,7 +68,7 @@ public class RoleAccessPrivilege implements PrivilegePolicy {
// RoleAccessPrivilege policy expects the privilege value to be a role
if (!(object instanceof Tuple tuple)) {
String msg = Restrictable.class.getName() + PrivilegeMessages
.getString("Privilege.illegalArgument.nontuple"); //$NON-NLS-1$
.getString("Privilege.illegalArgument.nontuple");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}
@ -100,7 +100,7 @@ public class RoleAccessPrivilege implements PrivilegePolicy {
}
default -> {
String msg = Restrictable.class.getName() + PrivilegeMessages.getString(
"Privilege.roleAccessPrivilege.unknownPrivilege"); //$NON-NLS-1$
"Privilege.roleAccessPrivilege.unknownPrivilege");
msg = MessageFormat.format(msg, privilegeName);
throw new PrivilegeException(msg);
}

View File

@ -67,7 +67,7 @@ public class UserAccessPrivilege implements PrivilegePolicy {
// RoleAccessPrivilege policy expects the privilege value to be a role
if (!(object instanceof Tuple tuple)) {
String msg = Restrictable.class.getName() + PrivilegeMessages
.getString("Privilege.illegalArgument.nontuple"); //$NON-NLS-1$
.getString("Privilege.illegalArgument.nontuple");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}
@ -124,7 +124,7 @@ public class UserAccessPrivilege implements PrivilegePolicy {
return checkByAllowDenyValues(ctx, privilege, restrictable, roleName, assertHasPrivilege);
}
default -> {
String msg = PrivilegeMessages.getString("Privilege.userAccessPrivilege.unknownPrivilege"); //$NON-NLS-1$
String msg = PrivilegeMessages.getString("Privilege.userAccessPrivilege.unknownPrivilege");
msg = MessageFormat.format(msg, privilegeName, this.getClass().getName());
throw new PrivilegeException(msg);
}

View File

@ -70,7 +70,7 @@ public class UserAccessWithSameOrganisationPrivilege extends UserAccessPrivilege
// RoleAccessPrivilege policy expects the privilege value to be a role
if (!(object instanceof Tuple tuple)) {
String msg = Restrictable.class.getName() + PrivilegeMessages.getString(
"Privilege.illegalArgument.nontuple"); //$NON-NLS-1$
"Privilege.illegalArgument.nontuple");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}
@ -109,7 +109,7 @@ public class UserAccessWithSameOrganisationPrivilege extends UserAccessPrivilege
}
default -> {
String msg = Restrictable.class.getName() + PrivilegeMessages.getString(
"Privilege.userAccessPrivilege.unknownPrivilege"); //$NON-NLS-1$
"Privilege.userAccessPrivilege.unknownPrivilege");
msg = MessageFormat.format(msg, privilegeName);
throw new PrivilegeException(msg);
}

View File

@ -66,7 +66,7 @@ public class UsernameFromCertificatePrivilege implements PrivilegePolicy {
// RoleAccessPrivilege policy expects the privilege value to be a role
if (!(object instanceof Certificate cert)) {
String msg = Restrictable.class.getName() + PrivilegeMessages
.getString("Privilege.illegalArgument.noncertificate"); //$NON-NLS-1$
.getString("Privilege.illegalArgument.noncertificate");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}

View File

@ -71,7 +71,7 @@ public class UsernameFromCertificateWithSameOrganisationPrivilege extends Userna
// RoleAccessPrivilege policy expects the privilege value to be a role
if (!(object instanceof Certificate cert)) {
String msg = Restrictable.class.getName() + PrivilegeMessages.getString(
"Privilege.illegalArgument.noncertificate"); //$NON-NLS-1$
"Privilege.illegalArgument.noncertificate");
msg = MessageFormat.format(msg, restrictable.getClass().getSimpleName());
throw new PrivilegeException(msg);
}

View File

@ -178,7 +178,7 @@ public class PrivilegeRolesSaxReader extends DefaultHandler {
case XmlConstants.XML_ROLE -> {
Role role = new Role(this.roleName, this.privileges);
getRoles().add(role);
logger.info(MessageFormat.format("New Role: {0}", role)); //$NON-NLS-1$
logger.info(MessageFormat.format("New Role: {0}", role));
init();
}
}

View File

@ -213,7 +213,7 @@ public class PrivilegeUsersSaxReader extends DefaultHandler {
User user = new User(this.userId, this.username, this.password, this.salt, this.hashAlgorithm,
hashIterations, hashKeyLength, this.firstName, this.lastname, this.userState, this.userRoles,
this.locale, this.parameters, this.passwordChangeRequested, this.history);
logger.info(MessageFormat.format("New User: {0}", user)); //$NON-NLS-1$
logger.info(MessageFormat.format("New User: {0}", user));
getUsers().add(user);
}
default -> {

Some files were not shown because too many files have changed in this diff Show More