Have a simple method for connection,
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
public class Connection {
public boolean connect(URL url, String requestType) {
HttpURLConnection connection = null;
try {
URLConnection urlConnection = url.openConnection();
if (urlConnection instanceof HttpURLConnection) {
connection = (HttpURLConnection) urlConnection;
connection.setRequestMethod(requestType);
connection.setRequestProperty("Authorization", getAuth()); //$NON-NLS-1$
}
if (connection == null) {
return false;
}
connection.connect();
return connection.getResponseCode() == HttpURLConnection.HTTP_OK;
} catch (IOException e) {
return false;
}
}
}
In case of URL path not being a valid one, FileNotFoundException is getting logged as an error in AppyDynamics. How to prevent AppDynamics from catching these exceptions since as part of the code its handled as a boolean return but AppDynamics is flooded with FileNotFoundException. Thanks in advance.
Update As per AppDynamics documentation https://docs.appdynamics.com/display/PRO44/Errors+and+Exceptions An HTTP error response, such as a status code 404 or 500 response get recorded as a transaction snapshot error. As i know at this point in my code above response 404 is legitimate. How can I modify my code to prevent AppDynamics showing it up ? Any Suggestions will be helpful.