Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 7d33205

Browse files
committed
Merge pull request #1698 from RajmeetBal/ThrowClientServiceExceptionWithMessage
When wrong user or password is used a message will also be sent with
2 parents d769aeb + 375dcbd commit 7d33205

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/ClientService.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ protected String getHttpProxy() throws ClientServicesException {
307307
* @param args
308308
* @throws ClientServicesException
309309
*/
310-
protected void forceAuthentication(Args args) throws ClientServicesException {
310+
protected void forceAuthentication(Args args) throws ClientServicesException, ClassNotFoundException {
311311
if (endpoint != null) {
312312
endpoint.authenticate(true);
313313
} else {
@@ -1313,8 +1313,12 @@ protected Response processResponse(HttpClient httpClient, HttpRequestBase httpRe
13131313
}
13141314

13151315
if(isResponseRequireAuthentication(httpResponse)){
1316-
forceAuthentication(args);
1317-
throw new ClientServicesException(new AuthenticationException());
1316+
try {
1317+
forceAuthentication(args);
1318+
} catch (ClassNotFoundException e) {
1319+
throw new ClientServicesException(new AuthenticationException(), "Force Authentication Failed: Check Username and UserId "+ e.getMessage());
1320+
}
1321+
throw new ClientServicesException(new AuthenticationException(), "Wrong username or password");
13181322
}
13191323

13201324
Handler format = findHandler(httpRequestBase, httpResponse, args.handler);

0 commit comments

Comments
 (0)