import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
String pdpFile = XACMLPapServlet.getPDPFile();
if (pdpFile == null) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "PDP File name is undefined");
String pdpFile = XACMLPapServlet.getPDPFile();
if (pdpFile == null) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "PDP File name is undefined");
}
if (pdpPath == null) {
pdpPath = Paths.get(pdpFile);
if (Files.notExists(pdpPath)) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "File doesn't exist in the specified Path");
}
if (pdpPath == null) {
pdpPath = Paths.get(pdpFile);
if (Files.notExists(pdpPath)) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "File doesn't exist in the specified Path");
}
if (pdpPath.toString().endsWith(".properties")) {
readProps();
} else {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "Not a .properties file");
}
if (pdpPath.toString().endsWith(".properties")) {
readProps();
} else {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "Not a .properties file");
}
if (pdpMap == null || pdpMap.isEmpty()) {
logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Cannot Proceed without PDP_URLs");
}
if (pdpMap == null || pdpMap.isEmpty()) {
logger.debug(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Cannot Proceed without PDP_URLs");
- private static void readPDPParam(String pdpVal) throws PAPException{
- if(pdpVal.contains(",")){
+ private static void readPDPParam(String pdpVal) throws PAPException {
+ if (pdpVal.contains(",")) {
// 1:2 will be UserID:Password
String userID = pdpValues.get(1);
String pass = PeCryptoUtils.decrypt(pdpValues.get(2));
Base64.Encoder encoder = Base64.getEncoder();
// 0 - PDPURL
// 1:2 will be UserID:Password
String userID = pdpValues.get(1);
String pass = PeCryptoUtils.decrypt(pdpValues.get(2));
Base64.Encoder encoder = Base64.getEncoder();
// 0 - PDPURL
- pdpMap.put(pdpValues.get(0), encoder.encodeToString((userID+":"+pass).getBytes(StandardCharsets.UTF_8)));
- }else{
+ pdpMap.put(pdpValues.get(0),
+ encoder.encodeToString((userID + ":" + pass).getBytes(StandardCharsets.UTF_8)));
+ } else {
try {
readFile();
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exeption reading Properties file");
}
String encoding = null;
try {
readFile();
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exeption reading Properties file");
}
String encoding = null;
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exception encoding");
}
return encoding;
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exception encoding");
}
return encoding;