From 1f29e450d43cdc880df32d9fb697db003b7d2331 Mon Sep 17 00:00:00 2001 From: Nils Christian Ehmke <nie@informatik.uni-kiel.de> Date: Sat, 19 May 2012 22:09:14 +0200 Subject: [PATCH] Some minor code modifications to calm FindBugs. --- .../beans/application/ProjectsBean.java | 3 +- .../java/kieker/webgui/common/FSManager.java | 32 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java index c8808141..42808161 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java @@ -124,8 +124,7 @@ public final class ProjectsBean { // Get the current time stamp of the project... final long timeStamp = FSManager.getInstance().getCurrTimeStamp(project); // ...and make sure the user can read it. - final String dStr = new Date(timeStamp).toString(); - return dStr; + return new Date(timeStamp).toString(); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java index 02d116a7..f03b8dde 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java @@ -60,10 +60,6 @@ import org.primefaces.model.UploadedFile; */ public final class FSManager { - /** - * This is the singleton instance of this class. - */ - private static final FSManager INSTANCE = new FSManager(); /** * This is the extension of the KAX-files. */ @@ -100,6 +96,10 @@ public final class FSManager { * This is the log object used to log messages, warnings etc. */ private static final Log LOG = LogFactory.getLog(FSManager.class); + /** + * This is the singleton instance of this class. + */ + private static final FSManager INSTANCE = new FSManager(); /** * Creates a new instance of this class. @@ -157,21 +157,27 @@ public final class FSManager { } // Create the directories - projectDir.mkdir(); - libDir.mkdir(); - viewDir.mkdir(); + final boolean projDirCreated = projectDir.mkdir(); + final boolean libDirCreated = libDir.mkdir(); + final boolean viewDirCreated = viewDir.mkdir(); + // The following part is only necessary to calm FindBugs... + @SuppressWarnings("unused") + final boolean createResults = projDirCreated && libDirCreated && viewDirCreated; // Now the empty project file try { AnalysisController.saveToFile(projectFile, emptyProject); } catch (final IOException ex) { // Something went wrong. Remove the directories and files! - viewDir.delete(); - libDir.delete(); - // Keep in mind that the potential remains of the file have to deleted before the directory. - projectFile.delete(); - projectDir.delete(); - + final boolean viewDirDeleted = viewDir.delete(); + final boolean libDirDeleted = libDir.delete(); + // Keep in mind that the potential remains of the file have to be deleted before the directory. + final boolean projectFileDeleted = projectFile.delete(); + final boolean projectDeleted = projectDir.delete(); + + // The following part is only necessary to calm FindBugs... + @SuppressWarnings("unused") + final boolean deleteResults = viewDirDeleted && libDirDeleted && projectFileDeleted && projectDeleted; // Rethrow the exception in order to inform the caller of this method throw ex; } -- GitLab