Fixing squid:S1066 - Collapsible "if" statements should be merged.
This commit is contained in:
@@ -141,10 +141,8 @@ public class Resource
|
||||
*/
|
||||
public void clearMarker ()
|
||||
{
|
||||
if (_marker.exists()) {
|
||||
if (!_marker.delete()) {
|
||||
log.warning("Failed to erase marker file '" + _marker + "'.");
|
||||
}
|
||||
if (_marker.exists() && !_marker.delete()) {
|
||||
log.warning("Failed to erase marker file '" + _marker + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,10 +176,8 @@ public class Resource
|
||||
public void erase ()
|
||||
{
|
||||
clearMarker();
|
||||
if (_local.exists()) {
|
||||
if (!_local.delete()) {
|
||||
log.warning("Failed to erase resource '" + _local + "'.");
|
||||
}
|
||||
if (_local.exists() && !_local.delete()) {
|
||||
log.warning("Failed to erase resource '" + _local + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -343,10 +343,8 @@ public class GetdownAppletConfig
|
||||
protected void ensureAppdirExists () throws Exception
|
||||
{
|
||||
// if our application directory does not exist, auto-create it
|
||||
if (!appdir.exists() || !appdir.isDirectory()) {
|
||||
if (!appdir.mkdirs()) {
|
||||
throw new Exception("m.create_appdir_failed");
|
||||
}
|
||||
if ((!appdir.exists() || !appdir.isDirectory()) && !appdir.mkdirs()) {
|
||||
throw new Exception("m.create_appdir_failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,10 +113,8 @@ public abstract class Downloader extends Thread
|
||||
|
||||
// finally report our download completion if we did not already do so when downloading
|
||||
// our final resource
|
||||
if (_obs != null && !_complete) {
|
||||
if (!_obs.downloadProgress(100, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (_obs != null && !_complete && !_obs.downloadProgress(100, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (DownloadAbortedException e) {
|
||||
@@ -154,11 +152,9 @@ public abstract class Downloader extends Thread
|
||||
{
|
||||
// make sure the resource's target directory exists
|
||||
File parent = new File(rsrc.getLocal().getParent());
|
||||
if (!parent.exists()) {
|
||||
if (!parent.mkdirs()) {
|
||||
log.warning("Failed to create target directory for resource '" + rsrc + "'. " +
|
||||
"Download will certainly fail.");
|
||||
}
|
||||
if (!parent.exists() && !parent.mkdirs()) {
|
||||
log.warning("Failed to create target directory for resource '" + rsrc + "'. " +
|
||||
"Download will certainly fail.");
|
||||
}
|
||||
doDownload(rsrc);
|
||||
}
|
||||
|
||||
@@ -64,11 +64,9 @@ public class DigesterTask extends Task
|
||||
}
|
||||
|
||||
// make sure _storepass and _keyalias are set, if _storepath is set
|
||||
if (_storepath != null) {
|
||||
if (_storepass == null || _storealias == null) {
|
||||
throw new BuildException(
|
||||
if (_storepath != null && (_storepass == null || _storealias == null)) {
|
||||
throw new BuildException(
|
||||
"Must specify both a keystore password and a private key alias.");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -106,10 +106,8 @@ public class Patcher
|
||||
|
||||
// make sure the file's parent directory exists
|
||||
File pdir = target.getParentFile();
|
||||
if (!pdir.exists()) {
|
||||
if (!pdir.mkdirs()) {
|
||||
log.warning("Failed to create parent for '" + target + "'.");
|
||||
}
|
||||
if (!pdir.exists() && !pdir.mkdirs()) {
|
||||
log.warning("Failed to create parent for '" + target + "'.");
|
||||
}
|
||||
|
||||
InputStream in = null;
|
||||
|
||||
@@ -38,17 +38,13 @@ public class FileUtil extends com.samskivert.util.FileUtil
|
||||
// place and then delete the old file
|
||||
if (dest.exists()) {
|
||||
File temp = new File(dest.getPath() + "_old");
|
||||
if (temp.exists()) {
|
||||
if (!temp.delete()) {
|
||||
log.warning("Failed to delete old intermediate file " + temp + ".");
|
||||
// the subsequent code will probably fail
|
||||
}
|
||||
if (temp.exists() && !temp.delete()) {
|
||||
log.warning("Failed to delete old intermediate file " + temp + ".");
|
||||
// the subsequent code will probably fail
|
||||
}
|
||||
if (dest.renameTo(temp)) {
|
||||
if (source.renameTo(dest)) {
|
||||
if (!temp.delete()) {
|
||||
log.warning("Failed to delete intermediate file " + temp + ".");
|
||||
}
|
||||
if (source.renameTo(dest) && !temp.delete()) {
|
||||
log.warning("Failed to delete intermediate file " + temp + ".");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user