Change-Id: I8b4012a055d34a54a58046edef7dc539428832be
Issue-ID: DMAAP-1195
Signed-off-by: econwar <conor.ward@est.tech>
12 files changed:
HTTP_PORT = (String) props.get("org.onap.dmaap.datarouter.provserver.http.port");\r
Class.forName(DB_DRIVER);\r
} catch (IOException e) {\r
HTTP_PORT = (String) props.get("org.onap.dmaap.datarouter.provserver.http.port");\r
Class.forName(DB_DRIVER);\r
} catch (IOException e) {\r
- intlogger.error("PROV9003 Opening properties: " + e.getMessage());\r
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage(), e);\r
System.exit(1);\r
} catch (ClassNotFoundException e) {\r
intlogger.error("PROV9004 cannot find the DB driver: " + e);\r
System.exit(1);\r
} catch (ClassNotFoundException e) {\r
intlogger.error("PROV9004 cannot find the DB driver: " + e);\r
try {\r
connection = queue.remove();\r
} catch (NoSuchElementException nseEx) {\r
try {\r
connection = queue.remove();\r
} catch (NoSuchElementException nseEx) {\r
+ intlogger.error("PROV9006 No connection on queue: " + nseEx.getMessage(), nseEx);\r
int n = 0;\r
do {\r
// Try up to 3 times to get a connection\r
int n = 0;\r
do {\r
// Try up to 3 times to get a connection\r
runInitScript(connection, 1);\r
}\r
} catch (SQLException e) {\r
runInitScript(connection, 1);\r
}\r
} catch (SQLException e) {\r
- intlogger\r
- .error("PROV9000: The database credentials are not working: " + e.getMessage());\r
+ intlogger.error("PROV9000: The database credentials are not working: " + e.getMessage(), e);\r
return false;\r
} finally {\r
if (connection != null) {\r
return false;\r
} finally {\r
if (connection != null) {\r
rs.close();\r
}\r
} catch (SQLException e) {\r
rs.close();\r
}\r
} catch (SQLException e) {\r
- intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());\r
+ intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage(), e);\r
lineReader.close();\r
strBuilder.setLength(0);\r
} catch (Exception e) {\r
lineReader.close();\r
strBuilder.setLength(0);\r
} catch (Exception e) {\r
- intlogger.error("PROV9002 Error when initializing table: " + e.getMessage());\r
+ intlogger.error("PROV9002 Error when initializing table: " + e.getMessage(), e);\r
System.exit(1);\r
}\r
}\r
System.exit(1);\r
}\r
}\r
}
} catch (Exception e) {
}
} catch (Exception e) {
- intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: ", e.getMessage());
+ intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: " + e.getMessage(), e);
return false;
}
return false;
return false;
}
return false;
intlogger.debug(message);
}
} catch (Exception e) {
intlogger.debug(message);
}
} catch (Exception e) {
- intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: ", e.getMessage());
+ intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: " + e.getMessage(), e);
return false;
}
return false;
return false;
}
return false;
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.io.File;\r
import java.io.FileInputStream;\r
import java.io.IOException;\r
import java.io.File;\r
import java.io.FileInputStream;\r
import java.io.IOException;\r
public static final String ENV_VAR = "PROVSRVR";\r
public static final String PROMPT = "dr-route> ";\r
public static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";\r
public static final String ENV_VAR = "PROVSRVR";\r
public static final String PROMPT = "dr-route> ";\r
public static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";\r
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
\r
private final String server;\r
private int width = 120; // screen width (for list)\r
\r
private final String server;\r
private int width = 120; // screen width (for list)\r
try {\r
trustStore.load(instream, truststore_pw.toCharArray());\r
} catch (Exception x) {\r
try {\r
trustStore.load(instream, truststore_pw.toCharArray());\r
} catch (Exception x) {\r
- System.err.println("Problem reading truststore: " + x);\r
+ intlogger.error("Problem reading truststore: " + x.getMessage(), x);\r
throw x;\r
} finally {\r
try {\r
instream.close();\r
} catch (Exception ignore) {\r
throw x;\r
} finally {\r
try {\r
instream.close();\r
} catch (Exception ignore) {\r
+ intlogger.error("Ignore error closing input stream: " + ignore.getMessage(), ignore);\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
+ intlogger.error("PROV0006 doDelete: " + e.getMessage(), e);\r
} finally {\r
meth.releaseConnection();\r
}\r
} finally {\r
meth.releaseConnection();\r
}\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
- System.err.println(e);\r
+ intlogger.error("PROV0005 doGet: " + e.getMessage(), e);\r
} finally {\r
meth.releaseConnection();\r
}\r
} finally {\r
meth.releaseConnection();\r
}\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
printErrorText(entity);\r
}\r
} catch (Exception e) {\r
+ intlogger.error("PROV0009 doPost: " + e.getMessage(), e);\r
} finally {\r
meth.releaseConnection();\r
}\r
} finally {\r
meth.releaseConnection();\r
}\r
try {
response.sendError(errorCode, message);
} catch (IOException ioe) {
try {
response.sendError(errorCode, message);
} catch (IOException ioe) {
- intlogger.error("IOException" + ioe.getMessage());
+ intlogger.error("IOException" + ioe.getMessage(), ioe);
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.net.InetAddress;\r
import java.net.UnknownHostException;\r
import java.util.Collection;\r
import java.net.InetAddress;\r
import java.net.UnknownHostException;\r
import java.util.Collection;\r
* @version $Id: JSONUtilities.java,v 1.1 2013/04/26 21:00:26 eby Exp $\r
*/\r
public class JSONUtilities {\r
* @version $Id: JSONUtilities.java,v 1.1 2013/04/26 21:00:26 eby Exp $\r
*/\r
public class JSONUtilities {\r
+\r
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
/**\r
* Does the String <i>v</i> represent a valid Internet address (with or without a\r
* mask length appended).\r
/**\r
* Does the String <i>v</i> represent a valid Internet address (with or without a\r
* mask length appended).\r
}\r
return true;\r
} catch (UnknownHostException e) {\r
}\r
return true;\r
} catch (UnknownHostException e) {\r
+ intlogger.error("PROV0001: " + e.getMessage(), e);\r
* *
******************************************************************************/
* *
******************************************************************************/
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
*/
private static Map<String, Object> keyPool = new LinkedHashMap<String, Object>(keyPoolSize);
*/
private static Map<String, Object> keyPool = new LinkedHashMap<String, Object>(keyPoolSize);
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
+
/**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
/**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
* Construct an empty JSONObject.
*/
public LOGJSONObject() {
* Construct an empty JSONObject.
*/
public LOGJSONObject() {
- this.map = new LinkedHashMap<String, Object>();
+ this.map = new LinkedHashMap<>();
*
* @param jo A JSONObject.
* @param names An array of strings.
*
* @param jo A JSONObject.
* @param names An array of strings.
- * @throws JSONException
- * @throws JSONException If a value is a non-finite number or if a name is duplicated.
*/
public LOGJSONObject(LOGJSONObject jo, String[] names) {
this();
*/
public LOGJSONObject(LOGJSONObject jo, String[] names) {
this();
try {
this.putOnce(names[i], jo.opt(names[i]));
} catch (Exception ignore) {
try {
this.putOnce(names[i], jo.opt(names[i]));
} catch (Exception ignore) {
+ intlogger.error("PROV0001 LOGJSONObject: " + ignore.getMessage(), ignore);
* @throws JSONException If there is a syntax error in the source string
* or a duplicated key.
*/
* @throws JSONException If there is a syntax error in the source string
* or a duplicated key.
*/
- public LOGJSONObject(JSONTokener x) throws JSONException {
+ public LOGJSONObject(JSONTokener x) {
this();
char c;
String key;
this();
char c;
String key;
* @throws JSONException if the key is not found or
* if the value is not a Number object and cannot be converted to a number.
*/
* @throws JSONException if the key is not found or
* if the value is not a Number object and cannot be converted to a number.
*/
- public double getDouble(String key) throws JSONException {
+ public double getDouble(String key) {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a number.");
+ intlogger.error("JSONObject[" + quote(key) + "] is not a number.", e);
+ throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
* @throws JSONException if the key is not found or if the value cannot
* be converted to an integer.
*/
* @throws JSONException if the key is not found or if the value cannot
* be converted to an integer.
*/
- public int getInt(String key) throws JSONException {
+ public int getInt(String key) {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
Object object = this.get(key);
try {
return object instanceof Number
? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not an int.");
+ intlogger.error("JSONObject[" + quote(key) + "] is not an int.", e);
+ throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a long.");
+ intlogger.error("JSONObject[" + quote(key) + "] is not a long.", e);
+ throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
* @return A string which is the value.
* @throws JSONException if there is no string value for the key.
*/
* @return A string which is the value.
* @throws JSONException if there is no string value for the key.
*/
- public String getString(String key) throws JSONException {
+ public String getString(String key) {
Object object = this.get(key);
if (object instanceof String) {
return (String) object;
Object object = this.get(key);
if (object instanceof String) {
return (String) object;
* @throws JSONException If there is already a property with this name
* that is not an Integer, Long, Double, or Float.
*/
* @throws JSONException If there is already a property with this name
* that is not an Integer, Long, Double, or Float.
*/
- public LOGJSONObject increment(String key) throws JSONException {
+ public LOGJSONObject increment(String key) {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
try {
return this.getBoolean(key);
} catch (Exception e) {
try {
return this.getBoolean(key);
} catch (Exception e) {
+ intlogger.trace("Using defaultValue: " + defaultValue, e);
try {
return this.getDouble(key);
} catch (Exception e) {
try {
return this.getDouble(key);
} catch (Exception e) {
+ intlogger.trace("Using defaultValue: " + defaultValue, e);
try {
return this.getInt(key);
} catch (Exception e) {
try {
return this.getInt(key);
} catch (Exception e) {
+ intlogger.trace("Using defaultValue: " + defaultValue, e);
}
}
} catch (Exception ignore) {
}
}
} catch (Exception ignore) {
+ intlogger.trace("populateMap: " + ignore.getMessage(), ignore);
synchronized (sw.getBuffer()) {
try {
return quote(string, sw).toString();
synchronized (sw.getBuffer()) {
try {
return quote(string, sw).toString();
- } catch (IOException ignored) {
- // will never happen - we are writing to a string writer
+ } catch (IOException e) {
+ intlogger.trace("Ignore Exception message: ", e);
- } catch (Exception ignore) {
+ } catch (Exception e) {
+ intlogger.trace("Ignore Exception message: ", e);
* @param o The object to test.
* @throws JSONException If o is a non-finite number.
*/
* @param o The object to test.
* @throws JSONException If o is a non-finite number.
*/
- public static void testValidity(Object o) throws JSONException {
+ public static void testValidity(Object o) {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
try {
return this.toString(0);
} catch (Exception e) {
try {
return this.toString(0);
} catch (Exception e) {
+ intlogger.trace("Exception: ", e);
}
return new LOGJSONObject(object);
} catch (Exception exception) {
}
return new LOGJSONObject(object);
} catch (Exception exception) {
+ intlogger.trace("Exception: ", exception);
}\r
} catch (SQLException e) {\r
logger.warn("PROV8003 Invalid value in record: " + line);\r
}\r
} catch (SQLException e) {\r
logger.warn("PROV8003 Invalid value in record: " + line);\r
- logger.debug(e.toString());\r
+ logger.debug(e.toString(), e);\r
} catch (NumberFormatException e) {\r
logger.warn("PROV8004 Invalid number in record: " + line);\r
logger.debug(e.toString());\r
} catch (NumberFormatException e) {\r
logger.warn("PROV8004 Invalid number in record: " + line);\r
logger.debug(e.toString());\r
logger.debug(e.toString());\r
} catch (Exception e) {\r
logger.warn("PROV8006 Invalid pattern in record: " + line);\r
logger.debug(e.toString());\r
} catch (Exception e) {\r
logger.warn("PROV8006 Invalid pattern in record: " + line);\r
- logger.debug(e.toString());\r
+ logger.debug(e.toString(), e);\r
logdir = p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir");\r
String s = p.getProperty("org.onap.dmaap.datarouter.provserver.logretention", "30");\r
\r
logdir = p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir");\r
String s = p.getProperty("org.onap.dmaap.datarouter.provserver.logretention", "30");\r
\r
- this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");;\r
+ this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");\r
\r
long n = 30;\r
try {\r
\r
long n = 30;\r
try {\r
}\r
}\r
} catch (Exception e) {\r
}\r
}\r
} catch (Exception e) {\r
- utilsLogger.error("Exception: " + e.getMessage());\r
+ utilsLogger.error("Exception: " + e.getMessage(), e);\r
}\r
}\r
} catch (ClassNotFoundException e) {\r
}\r
}\r
} catch (ClassNotFoundException e) {\r
- logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.");\r
+ logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.", e);\r
}\r
}\r
logger.info("ThrottleFilter is DISABLED for /publish requests.");\r
}\r
}\r
logger.info("ThrottleFilter is DISABLED for /publish requests.");\r
t = times.get(0);\r
}\r
} catch (IndexOutOfBoundsException e) {\r
t = times.get(0);\r
}\r
} catch (IndexOutOfBoundsException e) {\r
+ logger.trace("Exception: " + e.getMessage(), e);\r
}\r
return times.size();\r
}\r
}\r
return times.size();\r
}\r
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
\r
package org.onap.dmaap.datarouter.provisioning.utils;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.net.InetAddress;\r
import java.net.UnknownHostException;\r
import java.util.Arrays;\r
import java.net.InetAddress;\r
import java.net.UnknownHostException;\r
import java.util.Arrays;\r
* @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $\r
*/\r
public class URLUtilities {\r
* @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $\r
*/\r
public class URLUtilities {\r
+ private static final EELFLogger utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");\r
/**\r
* Generate the URL used to access a feed.\r
*\r
/**\r
* Generate the URL used to access a feed.\r
*\r
this_pod = InetAddress.getLocalHost().getHostName();\r
System.out.println("this_pod: " + this_pod);\r
} catch (UnknownHostException e) {\r
this_pod = InetAddress.getLocalHost().getHostName();\r
System.out.println("this_pod: " + this_pod);\r
} catch (UnknownHostException e) {\r
+ utilsLogger.trace("UnkownHostException: " + e.getMessage(), e);\r
this_pod = "";\r
}\r
System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));\r
this_pod = "";\r
}\r
System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));\r
try {
Files.createDirectory(Paths.get(outputDirectory));
} catch (IOException e) {
try {
Files.createDirectory(Paths.get(outputDirectory));
} catch (IOException e) {
- logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage());
+ logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage(), e);
}
basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes());
}
}
basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes());
}
try {
instance = new SubscriberProps(propsPath);
} catch (IOException ioe) {
try {
instance = new SubscriberProps(propsPath);
} catch (IOException ioe) {
- subLogger.error("IO Exception: " + ioe.getMessage());
+ subLogger.error("IO Exception: " + ioe.getMessage(), ioe);