* org.onap.dmaap
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public class AafConnection extends BaseLoggingClass {
-
-
+
+
private String aafCred;
private String unit_test;
-
+
private HttpsURLConnection uc;
unit_test = p.getProperty( "UnitTest", "No" );
}
-
+
private boolean makeConnection( String pURL ) {
-
+
try {
URL u = new URL( pURL );
uc = (HttpsURLConnection) u.openConnection();
return(false);
} catch (Exception e) {
logger.error("Error", e);
- errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_ERROR, pURL, e.getMessage() );
- e.printStackTrace();
+ errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_ERROR, pURL, e.getMessage());
return(false);
}
sb.append( line );
}
} catch (IOException ex ) {
- errorLogger.error( DmaapbcLogMessageEnum.IO_EXCEPTION, ex.getMessage());
+ errorLogger.error( DmaapbcLogMessageEnum.IO_EXCEPTION + ex.getMessage(),ex);
}
-
+
return sb.toString();
}
String auth = "Basic " + Base64.encodeBase64String(aafCred.getBytes());
int rc = -1;
-
+
if ( ! makeConnection( pURL ) ) {
return rc;
};
-
+
byte[] postData = obj.getBytes();
//logger.info( "post fields=" + postData ); //byte isn't very readable
logger.error("Error", e);
}
} catch ( SSLHandshakeException she ) {
- errorLogger.error( DmaapbcLogMessageEnum.SSL_HANDSHAKE_ERROR, pURL);
+ errorLogger.error( DmaapbcLogMessageEnum.SSL_HANDSHAKE_ERROR +"For:- "+pURL,she);
}
try {
rc = uc.getResponseCode();