IllegalStateException in CFamilySensor after latest plugin version

Must-share information (formatted with Markdown):

Our last successful scan was a few days ago when the CFamily plugin version was 6.32.0.44918

It seems in past this was something that needed to be fixed in the CFamily plugin. Here’s an excerpt of the Azure DevOps pipeline code analysis task where the error is reported including the full java stack:

2022-09-02T21:25:44.8528005Z ##[error]21:25:44.851 ERROR: Exception in thread pool-3-thread-1
java.lang.IllegalStateException: C:/agent3/_work/1/s/redacted/path/to/file.h.
2022-09-02T21:25:44.8530274Z 21:25:44.851 ERROR: Exception in thread pool-3-thread-1
2022-09-02T21:25:44.8531196Z java.lang.IllegalStateException: C:/agent3/_work/1/s/redacted/path/to/file.h.
2022-09-02T21:25:44.8535994Z ##[error]at com.sonar.cpp.jni.FileSystemOperations.realPath(FileSystemOperations.java:57)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1224)
	at com.sonar.cpp.fs.CanonicalPathCache.computeIfAbsent(CanonicalPathCache.java:17)
	at com.sonar.cpp.plugin.CFamilySensor.lambda$save$20(CFamilySensor.java:972)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:972)
2022-09-02T21:25:44.8540465Z 	at com.sonar.cpp.jni.FileSystemOperations.realPath(FileSystemOperations.java:57)
2022-09-02T21:25:44.8541473Z 	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1224)
2022-09-02T21:25:44.8542482Z 	at com.sonar.cpp.fs.CanonicalPathCache.computeIfAbsent(CanonicalPathCache.java:17)
2022-09-02T21:25:44.8543532Z 	at com.sonar.cpp.plugin.CFamilySensor.lambda$save$20(CFamilySensor.java:972)
2022-09-02T21:25:44.8544570Z 	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
2022-09-02T21:25:44.8545705Z 	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
2022-09-02T21:25:44.8546701Z 	at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:972)
2022-09-02T21:25:44.8549043Z ##[error]at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:946)
	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
2022-09-02T21:25:44.8551159Z 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$19(CFamilySensor.java:946)
2022-09-02T21:25:44.8552206Z 	at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
2022-09-02T21:25:44.8553984Z ##[error]at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2022-09-02T21:25:44.8555741Z 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2022-09-02T21:25:44.8557502Z ##[error]at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2022-09-02T21:25:44.8559061Z 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2022-09-02T21:25:44.8561692Z ##[error]at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
2022-09-02T21:25:44.8563817Z 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
2022-09-02T21:25:44.8564970Z 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
2022-09-02T21:25:44.8566530Z ##[error]at java.base/java.lang.Thread.run(Thread.java:832)
2022-09-02T21:25:44.8567989Z 	at java.base/java.lang.Thread.run(Thread.java:832)

I can grab more logs and share unredacted info privately as needed. Thanks!

Hello @bob,

It looks like you are affected by a known issue when include directive contain an extra dot at the end of the file name: [CPP-3750] - Jira

In your case, the source code probably contains something like:

#include "Practice/EligibilitySetupDlg.h." // Notice the extra '.'

While this extra dot is ignored when compiling your code, it becomes harmful during analysis and generates the message you have in your log (with the extra dot too).

Even is we plan to support this situation in the future, correcting your code is probably the way to go.

That makes perfect sense, thanks!