diff --git a/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/CppcheckSource.java b/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/CppcheckSource.java index 35c0dcb..a002a01 100644 --- a/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/CppcheckSource.java +++ b/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/CppcheckSource.java @@ -92,18 +92,7 @@ private void buildFileContent() { if (tempFile.exists()) { is = new FileInputStream(tempFile); } else { - // Reading real workspace file is more incorrect than correct, - // but the code is left here for backward compatibility with - // plugin version 1.14 and less - if (cppcheckWorkspaceFile.getFileName() == null) { - throw new IOException("The file doesn't exist."); - } - - File file = new File(cppcheckWorkspaceFile.getFileName()); - if (!file.exists()) { - throw new IOException("Can't access the file: " + file.toURI()); - } - is = new FileInputStream(file); + throw new IOException("File doesn't exist: " + tempFile.getAbsoluteFile()); } splitSourceFile(highlightSource(is)); diff --git a/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/model/CppcheckWorkspaceFile.java b/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/model/CppcheckWorkspaceFile.java index eaf32d4..86a3453 100644 --- a/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/model/CppcheckWorkspaceFile.java +++ b/src/main/java/com/thalesgroup/hudson/plugins/cppcheck/model/CppcheckWorkspaceFile.java @@ -105,7 +105,7 @@ public final String getFileName() { public String getTempName(final Run owner) { if (fileName != null) { - return owner.getParent().getRootDir().getAbsolutePath() + "/" + return owner.getRootDir().getAbsolutePath() + "/" + DIR_WORKSPACE_FILES + "/" + Integer.toHexString(fileName.hashCode()) + ".tmp"; }