Skip to content

Commit ae15c86

Browse files
authored
Merge pull request #1679 from ivangalkin/try_1651
Path::toRealPath() can throw RuntimeExceptions, catch them
2 parents f33d014 + 4cf9c35 commit ae15c86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxIssuesReportSensor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void execute(SensorContext context) {
118118
} catch (Exception e) {
119119
String msg = new StringBuilder(256)
120120
.append("Cannot feed the data into sonar, details: '")
121-
.append(e)
121+
.append(CxxUtils.getStackTrace(e))
122122
.append("'")
123123
.toString();
124124
LOG.error(msg);
@@ -143,10 +143,10 @@ private InputFile getInputFileTryRealPath(SensorContext sensorContext, String pa
143143
Path realPath;
144144
try {
145145
realPath = absolutePath.toRealPath(LinkOption.NOFOLLOW_LINKS);
146-
} catch (IOException e) {
146+
} catch (IOException | RuntimeException e) {
147147
if (LOG.isDebugEnabled()) {
148148
LOG.debug("Unable to get the real path: module '{}', baseDir '{}', path '{}', exception '{}'",
149-
sensorContext.module().key(), sensorContext.fileSystem().baseDir(), path, e);
149+
sensorContext.module().key(), sensorContext.fileSystem().baseDir(), path, e.getMessage());
150150
}
151151
return null;
152152
}

0 commit comments

Comments
 (0)