ConnectionException does not show exception message when calling getMessage()
- Dominant language
- Java
- Stars
- 276
- Forks
- 223
- PR merge metrics
- No merged PRs in 30d
Description
I am not able to get an exception message for ConnectionException when calling getMessage(). I have to use ((LoginFault) c).getExceptionMessage() to get the exception message.
Please use the below screen shot for tor your reference.
`public class SFConnect {
private static final String AUTH_ENDPOINT = "%s/services/Soap/u/49.0";
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
properties.load(SFConnect.class.getClass().getResourceAsStream("/application.properties"));
try {
String login_url = properties.getProperty("SF_BASE_URL");
String username = properties.getProperty("USERNAME");
String pass = properties.getProperty("PASSWORD");
ConnectorConfig config = new ConnectorConfig();
config.setUsername(username);
config.setPassword(pass);
config.setAuthEndpoint(String.format(AUTH_ENDPOINT, login_url));
PartnerConnection connection = Connector.newConnection(config);
System.out.println(connection.getConfig().getSessionId());
}catch (ConnectionException c) {
System.out.println("Message: " + c.getMessage());
System.out.println("LocalizedMessage: " + c.getLocalizedMessage());
System.out.println("LoginFault: " + ((LoginFault) c).getExceptionMessage());
}
}
}`
Output:
Message: null
LocalizedMessage: null
LoginFault: Invalid username, password, security token; or user locked out.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with ConnectionException and the Connector.newConnection(config) call shown in the report, then trace how the login fault message is stored and exposed. Reproduce the sample failure and verify that getMessage() and getLocalizedMessage() return the same useful message as LoginFault.getExceptionMessage().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100