Skip to content

Commit 517eb15

Browse files
ghislainpiotsonartech
authored andcommitted
SONARPY-2816 Improve exception message in HardCodedCredentialsCheck (#223)
GitOrigin-RevId: 232d52f7e4abeaab63a429da4e3f10d0ddc27d37
1 parent 4af3650 commit 517eb15

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

python-checks/src/main/java/org/sonar/python/checks/HardcodedCredentialsCallCheck.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.sonar.python.checks;
1818

1919
import com.google.gson.Gson;
20+
import com.google.gson.JsonSyntaxException;
2021
import java.io.IOException;
2122
import java.io.InputStreamReader;
2223
import java.util.List;
@@ -182,8 +183,9 @@ private CredentialMethod[] loadMethodsFromResource(String resourcePath) {
182183
.map(InputStreamReader::new)
183184
.map(reader -> gson.fromJson(reader, CredentialMethod[].class))
184185
.orElseThrow(() -> new IllegalStateException("Unable to open resource: " + resourcePath));
185-
} catch (IOException e) {
186-
throw new IllegalStateException("Unable to read methods metadata from " + resourcePath, e);
186+
} catch (IOException | JsonSyntaxException e) {
187+
throw new IllegalStateException("Unable to read methods metadata from " + resourcePath + ". If the analysis has already experienced a fatal exception before, this " +
188+
"exception can be ignored.", e);
187189
}
188190
}
189191
}

0 commit comments

Comments
 (0)