mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 01:29:43 +01:00
Coverity suggested cleanup
This commit is contained in:
@@ -948,9 +948,7 @@ public class Check extends Update {
|
|||||||
dealWithReferences();
|
dealWithReferences();
|
||||||
validateConfiguration();
|
validateConfiguration();
|
||||||
populateSettings();
|
populateSettings();
|
||||||
Engine engine = null;
|
try (Engine engine = new Engine(Check.class.getClassLoader())) {
|
||||||
try {
|
|
||||||
engine = new Engine(Check.class.getClassLoader());
|
|
||||||
if (isUpdateOnly()) {
|
if (isUpdateOnly()) {
|
||||||
log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN);
|
log("Deprecated 'UpdateOnly' property set; please use the UpdateTask instead", Project.MSG_WARN);
|
||||||
try {
|
try {
|
||||||
@@ -1002,9 +1000,6 @@ public class Check extends Update {
|
|||||||
log(msg, ex, Project.MSG_ERR);
|
log(msg, ex, Project.MSG_ERR);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup(true);
|
Settings.cleanup(true);
|
||||||
if (engine != null) {
|
|
||||||
engine.cleanup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -385,9 +385,7 @@ public class Update extends Purge {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws BuildException {
|
public void execute() throws BuildException {
|
||||||
populateSettings();
|
populateSettings();
|
||||||
Engine engine = null;
|
try (Engine engine = new Engine(Update.class.getClassLoader())) {
|
||||||
try {
|
|
||||||
engine = new Engine(Update.class.getClassLoader());
|
|
||||||
try {
|
try {
|
||||||
engine.doUpdates();
|
engine.doUpdates();
|
||||||
} catch (UpdateException ex) {
|
} catch (UpdateException ex) {
|
||||||
@@ -404,9 +402,6 @@ public class Update extends Purge {
|
|||||||
log(msg, Project.MSG_ERR);
|
log(msg, Project.MSG_ERR);
|
||||||
} finally {
|
} finally {
|
||||||
Settings.cleanup(true);
|
Settings.cleanup(true);
|
||||||
if (engine != null) {
|
|
||||||
engine.cleanup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,14 +359,8 @@ public class App {
|
|||||||
* connection to the database could not be established
|
* connection to the database could not be established
|
||||||
*/
|
*/
|
||||||
private void runUpdateOnly() throws UpdateException, DatabaseException {
|
private void runUpdateOnly() throws UpdateException, DatabaseException {
|
||||||
Engine engine = null;
|
try (Engine engine = new Engine()) {
|
||||||
try {
|
|
||||||
engine = new Engine();
|
|
||||||
engine.doUpdates();
|
engine.doUpdates();
|
||||||
} finally {
|
|
||||||
if (engine != null) {
|
|
||||||
engine.cleanup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,7 @@ public class UpdateMojo extends BaseDependencyCheckMojo {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void runCheck() throws MojoExecutionException, MojoFailureException {
|
public void runCheck() throws MojoExecutionException, MojoFailureException {
|
||||||
Engine engine = null;
|
try (Engine engine = initializeEngine()) {
|
||||||
try {
|
|
||||||
engine = initializeEngine();
|
|
||||||
engine.doUpdates();
|
engine.doUpdates();
|
||||||
} catch (DatabaseException ex) {
|
} catch (DatabaseException ex) {
|
||||||
if (getLog().isDebugEnabled()) {
|
if (getLog().isDebugEnabled()) {
|
||||||
@@ -84,11 +82,9 @@ public class UpdateMojo extends BaseDependencyCheckMojo {
|
|||||||
throw new MojoExecutionException(msg, ex);
|
throw new MojoExecutionException(msg, ex);
|
||||||
}
|
}
|
||||||
getLog().error(msg);
|
getLog().error(msg);
|
||||||
|
} finally {
|
||||||
|
Settings.cleanup();
|
||||||
}
|
}
|
||||||
if (engine != null) {
|
|
||||||
engine.cleanup();
|
|
||||||
}
|
|
||||||
Settings.cleanup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user