* ============LICENSE_START=======================================================
* ONAP-XACML
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
if (Files.notExists(this.repository)) {
Files.createDirectory(repository);
}
- if (Files.isDirectory(this.repository) == false) {
+ if (!Files.isDirectory(this.repository)) {
throw new PAPException ("Repository is NOT a directory: " + this.repository.toAbsolutePath());
}
- if (Files.isWritable(this.repository) == false) {
+ if (!Files.isWritable(this.repository)) {
throw new PAPException ("Repository is NOT writable: " + this.repository.toAbsolutePath());
}
//
// If it exists already
//
if (Files.exists(groupPath)) {
- logger.warn(addGroup + id + " directory exists" + groupPath.toString());
+ logger.warn(addGroup + id + " directory exists");
} else {
try {
//
Path policyProperties = Paths.get(groupPath.toString(), "xacml.policy.properties");
if (Files.exists(policyProperties)) {
- logger.warn(addGroup + id + " file exists: " + policyProperties.toString());
+ logger.warn(addGroup + id + " file exists");
} else {
Properties props = new Properties();
props.setProperty(XACMLProperties.PROP_REFERENCEDPOLICIES, "");
props.store(os, "");
}
} catch (IOException e) {
- PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create " + policyProperties);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create policyProperties");
throw new PAPException("Failed to create " + id);
}
}
Path pipProperties = Paths.get(groupPath.toString(), "xacml.pip.properties");
Properties props = new Properties();
if (Files.exists(pipProperties)) {
- logger.warn(addGroup + id + " file exists: " + pipProperties.toString());
+ logger.warn(addGroup + id + " file exists.");
} else {
try {
props = setPIPProperties(props);
props.store(os, "");
}
} catch (IOException e) {
- PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + pipProperties);
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create pipProperties");
throw new PAPException("Failed to create " + id);
}
this.doSave();
} else {
PolicyLogger.error("Failed to add to new group, putting back into original group.");
- if (((StdPDPGroup) currentGroup).removePDP(pdp) == false) {
+ if (!((StdPDPGroup) currentGroup).removePDP(pdp)) {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
}
}
// the only things that the user can change are name and description
currentPDP.setDescription(pdp.getDescription());
currentPDP.setName(pdp.getName());
- if (currentPDP instanceof OnapPDP && pdp instanceof OnapPDP) {
- ((OnapPDP)currentPDP).setJmxPort(((OnapPDP)pdp).getJmxPort());
+ if (currentPDP instanceof OnapPDP) {
+ ((OnapPDP)currentPDP).setJmxPort(pdp.getJmxPort());
}
this.doSave();
}
// Save the configuration
//
this.saveConfiguration();
- } catch (IOException e) {
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
- } catch (PAPException e) {
+ } catch (IOException|PAPException e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
}
}