| @@ -315,8 +315,7 @@ public class AntTypeDefinition { | |||||
| noArg = false; | noArg = false; | ||||
| } | } | ||||
| //now we instantiate | //now we instantiate | ||||
| T o = ctor.newInstance( | |||||
| ((noArg) ? new Object[0] : new Object[] {project})); | |||||
| T o = ctor.newInstance(noArg ? new Object[0] : new Object[] {project}); | |||||
| //set up project references. | //set up project references. | ||||
| project.setProjectReference(o); | project.setProjectReference(o); | ||||
| @@ -331,12 +330,12 @@ public class AntTypeDefinition { | |||||
| * @return true if the definitions are the same. | * @return true if the definitions are the same. | ||||
| */ | */ | ||||
| public boolean sameDefinition(AntTypeDefinition other, Project project) { | public boolean sameDefinition(AntTypeDefinition other, Project project) { | ||||
| return (other != null && other.getClass() == getClass() | |||||
| return other != null && other.getClass() == getClass() | |||||
| && other.getTypeClass(project).equals(getTypeClass(project)) | && other.getTypeClass(project).equals(getTypeClass(project)) | ||||
| && other.getExposedClass(project).equals(getExposedClass(project)) | && other.getExposedClass(project).equals(getExposedClass(project)) | ||||
| && other.restrict == restrict | && other.restrict == restrict | ||||
| && other.adapterClass == adapterClass | && other.adapterClass == adapterClass | ||||
| && other.adaptToClass == adaptToClass); | |||||
| && other.adaptToClass == adaptToClass; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -710,9 +710,9 @@ public class ComponentHelper { | |||||
| } | } | ||||
| Class<?> oldClass = old.getExposedClass(project); | Class<?> oldClass = old.getExposedClass(project); | ||||
| boolean isTask = oldClass != null && Task.class.isAssignableFrom(oldClass); | boolean isTask = oldClass != null && Task.class.isAssignableFrom(oldClass); | ||||
| project.log("Trying to override old definition of " | |||||
| + (isTask ? "task " : "datatype ") + name, (def.similarDefinition(old, | |||||
| project)) ? Project.MSG_VERBOSE : Project.MSG_WARN); | |||||
| project.log(String.format("Trying to override old definition of %s %s", | |||||
| isTask ? "task" : "datatype", name), def.similarDefinition(old, | |||||
| project) ? Project.MSG_VERBOSE : Project.MSG_WARN); | |||||
| } | } | ||||
| project.log(" +Datatype " + name + " " + def.getClassName(), Project.MSG_DEBUG); | project.log(" +Datatype " + name + " " + def.getClassName(), Project.MSG_DEBUG); | ||||
| antTypeTable.put(name, def); | antTypeTable.put(name, def); | ||||
| @@ -268,7 +268,7 @@ public class Project implements ResourceFactory { | |||||
| public Project createSubProject() { | public Project createSubProject() { | ||||
| Project subProject = null; | Project subProject = null; | ||||
| try { | try { | ||||
| subProject = (getClass().newInstance()); | |||||
| subProject = getClass().newInstance(); | |||||
| } catch (final Exception e) { | } catch (final Exception e) { | ||||
| subProject = new Project(); | subProject = new Project(); | ||||
| } | } | ||||
| @@ -927,7 +927,7 @@ public class Project implements ResourceFactory { | |||||
| throw new BuildException("Ant cannot work on Java prior to 1.8"); | throw new BuildException("Ant cannot work on Java prior to 1.8"); | ||||
| } | } | ||||
| log("Detected Java version: " + javaVersion + " in: " | log("Detected Java version: " + javaVersion + " in: " | ||||
| + System.getProperty("java.home"), MSG_VERBOSE); | |||||
| + JavaEnvUtils.getJavaHome(), MSG_VERBOSE); | |||||
| log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); | log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); | ||||
| } | } | ||||
| @@ -1716,9 +1716,9 @@ public class Project implements ResourceFactory { | |||||
| * <code>false</code> otherwise. | * <code>false</code> otherwise. | ||||
| */ | */ | ||||
| public static boolean toBoolean(final String s) { | public static boolean toBoolean(final String s) { | ||||
| return ("on".equalsIgnoreCase(s) | |||||
| return "on".equalsIgnoreCase(s) | |||||
| || "true".equalsIgnoreCase(s) | || "true".equalsIgnoreCase(s) | ||||
| || "yes".equalsIgnoreCase(s)); | |||||
| || "yes".equalsIgnoreCase(s); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1828,7 +1828,7 @@ public class Project implements ResourceFactory { | |||||
| .collect(Collectors.joining(",")) | .collect(Collectors.joining(",")) | ||||
| + " is " + ret, MSG_VERBOSE); | + " is " + ret, MSG_VERBOSE); | ||||
| final Vector<Target> complete = (returnAll) ? ret : new Vector<>(ret); | |||||
| final Vector<Target> complete = returnAll ? ret : new Vector<>(ret); | |||||
| for (final String curTarget : targetTable.keySet()) { | for (final String curTarget : targetTable.keySet()) { | ||||
| final String st = state.get(curTarget); | final String st = state.get(curTarget); | ||||
| if (st == null) { | if (st == null) { | ||||
| @@ -104,7 +104,7 @@ public class DispatchUtils { | |||||
| } catch (InvocationTargetException ie) { | } catch (InvocationTargetException ie) { | ||||
| Throwable t = ie.getTargetException(); | Throwable t = ie.getTargetException(); | ||||
| if (t instanceof BuildException) { | if (t instanceof BuildException) { | ||||
| throw ((BuildException) t); | |||||
| throw (BuildException) t; | |||||
| } else { | } else { | ||||
| throw new BuildException(t); | throw new BuildException(t); | ||||
| } | } | ||||
| @@ -143,16 +143,13 @@ public class MailLogger extends DefaultLogger { | |||||
| } | } | ||||
| Values values = new Values() | Values values = new Values() | ||||
| .mailhost(getValue(properties, "mailhost", "localhost")) | .mailhost(getValue(properties, "mailhost", "localhost")) | ||||
| .port(Integer.parseInt( | |||||
| getValue( | |||||
| properties, "port", | |||||
| String.valueOf(MailMessage.DEFAULT_PORT)))) | |||||
| .port(Integer.parseInt(getValue(properties, "port", | |||||
| String.valueOf(MailMessage.DEFAULT_PORT)))) | |||||
| .user(getValue(properties, "user", "")) | .user(getValue(properties, "user", "")) | ||||
| .password(getValue(properties, "password", "")) | .password(getValue(properties, "password", "")) | ||||
| .ssl(Project.toBoolean(getValue(properties, | |||||
| "ssl", "off"))) | |||||
| .ssl(Project.toBoolean(getValue(properties, "ssl", "off"))) | |||||
| .starttls(Project.toBoolean(getValue(properties, | .starttls(Project.toBoolean(getValue(properties, | ||||
| "starttls.enable", "off"))) | |||||
| "starttls.enable", "off"))) | |||||
| .from(getValue(properties, "from", null)) | .from(getValue(properties, "from", null)) | ||||
| .replytoList(getValue(properties, "replyto", "")) | .replytoList(getValue(properties, "replyto", "")) | ||||
| .toList(getValue(properties, prefix + ".to", null)) | .toList(getValue(properties, prefix + ".to", null)) | ||||
| @@ -161,9 +158,8 @@ public class MailLogger extends DefaultLogger { | |||||
| .mimeType(getValue(properties, "mimeType", DEFAULT_MIME_TYPE)) | .mimeType(getValue(properties, "mimeType", DEFAULT_MIME_TYPE)) | ||||
| .charset(getValue(properties, "charset", "")) | .charset(getValue(properties, "charset", "")) | ||||
| .body(getValue(properties, prefix + ".body", "")) | .body(getValue(properties, prefix + ".body", "")) | ||||
| .subject(getValue( | |||||
| properties, prefix + ".subject", | |||||
| (success) ? "Build Success" : "Build Failure")); | |||||
| .subject(getValue(properties, prefix + ".subject", | |||||
| success ? "Build Success" : "Build Failure")); | |||||
| if (values.user().isEmpty() | if (values.user().isEmpty() | ||||
| && values.password().isEmpty() | && values.password().isEmpty() | ||||
| && !values.ssl() && !values.starttls()) { | && !values.ssl() && !values.starttls()) { | ||||
| @@ -364,7 +364,7 @@ public abstract class AbstractCvsTask extends Task { | |||||
| log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | log("Caught exception: " + e.getMessage(), Project.MSG_WARN); | ||||
| } catch (BuildException e) { | } catch (BuildException e) { | ||||
| if (failOnError) { | if (failOnError) { | ||||
| throw(e); | |||||
| throw e; | |||||
| } | } | ||||
| Throwable t = e.getCause(); | Throwable t = e.getCause(); | ||||
| if (t == null) { | if (t == null) { | ||||
| @@ -134,8 +134,8 @@ public class Exit extends Task { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
| boolean fail = (nestedConditionPresent()) ? testNestedCondition() | |||||
| : (testIfCondition() && testUnlessCondition()); | |||||
| boolean fail = nestedConditionPresent() ? testNestedCondition() | |||||
| : testIfCondition() && testUnlessCondition(); | |||||
| if (fail) { | if (fail) { | ||||
| String text = null; | String text = null; | ||||
| if (message != null && !message.trim().isEmpty()) { | if (message != null && !message.trim().isEmpty()) { | ||||
| @@ -231,7 +231,7 @@ public class Exit extends Task { | |||||
| * @return <code>boolean</code>. | * @return <code>boolean</code>. | ||||
| */ | */ | ||||
| private boolean nestedConditionPresent() { | private boolean nestedConditionPresent() { | ||||
| return (nestedCondition != null); | |||||
| return nestedCondition != null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -420,10 +420,9 @@ public class FixCRLF extends MatchingTask implements ChainableReader { | |||||
| throws BuildException { | throws BuildException { | ||||
| this.srcFile = srcFile; | this.srcFile = srcFile; | ||||
| try { | try { | ||||
| reader = new BufferedReader( | |||||
| ((encoding == null) ? new FileReader(srcFile) | |||||
| : new InputStreamReader( | |||||
| Files.newInputStream(srcFile.toPath()), encoding)), INBUFLEN); | |||||
| reader = new BufferedReader(encoding == null ? new FileReader(srcFile) | |||||
| : new InputStreamReader(Files.newInputStream(srcFile.toPath()), | |||||
| encoding), INBUFLEN); | |||||
| nextLine(); | nextLine(); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| @@ -169,9 +169,9 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||||
| private void log(String line) { | private void log(String line) { | ||||
| if (!emacsMode) { | if (!emacsMode) { | ||||
| task.log("", (error ? Project.MSG_ERR : Project.MSG_WARN)); | |||||
| task.log("", error ? Project.MSG_ERR : Project.MSG_WARN); | |||||
| } | } | ||||
| task.log(line, (error ? Project.MSG_ERR : Project.MSG_WARN)); | |||||
| task.log(line, error ? Project.MSG_ERR : Project.MSG_WARN); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -266,9 +266,9 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public boolean sameDefinition(AntTypeDefinition other, Project project) { | public boolean sameDefinition(AntTypeDefinition other, Project project) { | ||||
| return (other != null && other.getClass() == getClass() && parent != null | |||||
| && parent.sameDefinition(((PreSetDefinition) other).parent, project) | |||||
| && element.similar(((PreSetDefinition) other).element)); | |||||
| return other != null && other.getClass() == getClass() && parent != null | |||||
| && parent.sameDefinition(((PreSetDefinition) other).parent, project) | |||||
| && element.similar(((PreSetDefinition) other).element); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -279,12 +279,11 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer { | |||||
| * @return true if the definitions are similar. | * @return true if the definitions are similar. | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public boolean similarDefinition( | |||||
| AntTypeDefinition other, Project project) { | |||||
| return (other != null && other.getClass().getName().equals( | |||||
| getClass().getName()) && parent != null | |||||
| && parent.similarDefinition(((PreSetDefinition) other).parent, project) | |||||
| && element.similar(((PreSetDefinition) other).element)); | |||||
| public boolean similarDefinition(AntTypeDefinition other, Project project) { | |||||
| return other != null && other.getClass().getName().equals(getClass().getName()) | |||||
| && parent != null | |||||
| && parent.similarDefinition(((PreSetDefinition) other).parent, project) | |||||
| && element.similar(((PreSetDefinition) other).element); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -114,7 +114,7 @@ public class Recorder extends Task implements SubBuildListener { | |||||
| * @param append if true, append to a previous file. | * @param append if true, append to a previous file. | ||||
| */ | */ | ||||
| public void setAppend(boolean append) { | public void setAppend(boolean append) { | ||||
| this.append = (append ? Boolean.TRUE : Boolean.FALSE); | |||||
| this.append = append ? Boolean.TRUE : Boolean.FALSE; | |||||
| } | } | ||||
| @@ -695,8 +695,7 @@ public class Redirector { | |||||
| /** outStreams */ | /** outStreams */ | ||||
| private void outStreams() { | private void outStreams() { | ||||
| if (out != null && out.length > 0) { | if (out != null && out.length > 0) { | ||||
| final String logHead = "Output " | |||||
| + ((appendOut) ? "appended" : "redirected") + " to "; | |||||
| final String logHead = "Output " + (appendOut ? "appended" : "redirected") + " to "; | |||||
| outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE, | outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE, | ||||
| appendOut, createEmptyFilesOut); | appendOut, createEmptyFilesOut); | ||||
| } | } | ||||
| @@ -717,8 +716,7 @@ public class Redirector { | |||||
| private void errorStreams() { | private void errorStreams() { | ||||
| if (error != null && error.length > 0) { | if (error != null && error.length > 0) { | ||||
| final String logHead = "Error " | |||||
| + ((appendErr) ? "appended" : "redirected") + " to "; | |||||
| final String logHead = "Error " + (appendErr ? "appended" : "redirected") + " to "; | |||||
| errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE, | errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE, | ||||
| appendErr, createEmptyFilesErr); | appendErr, createEmptyFilesErr); | ||||
| } else if (!(logError || outputStream == null) && errorProperty == null) { | } else if (!(logError || outputStream == null) && errorProperty == null) { | ||||
| @@ -254,7 +254,7 @@ public class Touch extends Task { | |||||
| } | } | ||||
| } | } | ||||
| log("Setting millis to " + workmillis + " from datetime attribute", | log("Setting millis to " + workmillis + " from datetime attribute", | ||||
| ((millis < 0) ? Project.MSG_DEBUG : Project.MSG_VERBOSE)); | |||||
| millis < 0 ? Project.MSG_DEBUG : Project.MSG_VERBOSE); | |||||
| setMillis(workmillis); | setMillis(workmillis); | ||||
| // only set if successful to this point: | // only set if successful to this point: | ||||
| dateTimeConfigured = true; | dateTimeConfigured = true; | ||||
| @@ -352,7 +352,7 @@ public class Touch extends Task { | |||||
| private void touch(File file, long modTime) { | private void touch(File file, long modTime) { | ||||
| if (!file.exists()) { | if (!file.exists()) { | ||||
| log("Creating " + file, | log("Creating " + file, | ||||
| ((verbose) ? Project.MSG_INFO : Project.MSG_VERBOSE)); | |||||
| verbose ? Project.MSG_INFO : Project.MSG_VERBOSE); | |||||
| try { | try { | ||||
| FILE_UTILS.createNewFile(file, mkdirs); | FILE_UTILS.createNewFile(file, mkdirs); | ||||
| } catch (IOException ioe) { | } catch (IOException ioe) { | ||||
| @@ -264,12 +264,12 @@ public class Os implements Condition { | |||||
| boolean isNT = false; | boolean isNT = false; | ||||
| if (isWindows) { | if (isWindows) { | ||||
| //there are only four 9x platforms that we look for | //there are only four 9x platforms that we look for | ||||
| is9x = (OS_NAME.contains("95") | |||||
| //wince isn't really 9x, but crippled enough to | |||||
| //be a muchness. Ant doesn't run on CE, anyway. | |||||
| is9x = OS_NAME.contains("95") | |||||
| || OS_NAME.contains("98") | || OS_NAME.contains("98") | ||||
| || OS_NAME.contains("me") | || OS_NAME.contains("me") | ||||
| //wince isn't really 9x, but crippled enough to | |||||
| //be a muchness. Ant doesn't run on CE, anyway. | |||||
| || OS_NAME.contains("ce")); | |||||
| || OS_NAME.contains("ce"); | |||||
| isNT = !is9x; | isNT = !is9x; | ||||
| } | } | ||||
| switch (family) { | switch (family) { | ||||
| @@ -479,7 +479,7 @@ public class SchemaValidate extends XMLValidateTask { | |||||
| public int hashCode() { | public int hashCode() { | ||||
| int result; | int result; | ||||
| // CheckStyle:MagicNumber OFF | // CheckStyle:MagicNumber OFF | ||||
| result = (namespace == null ? 0 : namespace.hashCode()); | |||||
| result = namespace == null ? 0 : namespace.hashCode(); | |||||
| result = 29 * result + (file == null ? 0 : file.hashCode()); | result = 29 * result + (file == null ? 0 : file.hashCode()); | ||||
| result = 29 * result + (url == null ? 0 : url.hashCode()); | result = 29 * result + (url == null ? 0 : url.hashCode()); | ||||
| // CheckStyle:MagicNumber OFF | // CheckStyle:MagicNumber OFF | ||||
| @@ -364,7 +364,7 @@ public class XMLValidateTask extends Task { | |||||
| * @return true when a SAX1 parser is in use | * @return true when a SAX1 parser is in use | ||||
| */ | */ | ||||
| protected boolean isSax1Parser() { | protected boolean isSax1Parser() { | ||||
| return (xmlReader instanceof ParserAdapter); | |||||
| return xmlReader instanceof ParserAdapter; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1081,12 +1081,7 @@ public class IPlanetEjbc { | |||||
| * be run to bring the stubs and skeletons up to date. | * be run to bring the stubs and skeletons up to date. | ||||
| */ | */ | ||||
| public boolean mustBeRecompiled(File destDir) { | public boolean mustBeRecompiled(File destDir) { | ||||
| long sourceModified = sourceClassesModified(destDir); | |||||
| long destModified = destClassesModified(destDir); | |||||
| return (destModified < sourceModified); | |||||
| return destClassesModified(destDir) < sourceClassesModified(destDir); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1236,8 +1231,7 @@ public class IPlanetEjbc { | |||||
| * names for the stubs and skeletons to be generated. | * names for the stubs and skeletons to be generated. | ||||
| */ | */ | ||||
| private String[] classesToGenerate() { | private String[] classesToGenerate() { | ||||
| String[] classnames = (iiop) | |||||
| ? new String[NUM_CLASSES_WITH_IIOP] | |||||
| String[] classnames = iiop ? new String[NUM_CLASSES_WITH_IIOP] | |||||
| : new String[NUM_CLASSES_WITHOUT_IIOP]; | : new String[NUM_CLASSES_WITHOUT_IIOP]; | ||||
| final String remotePkg = remote.getPackageName() + "."; | final String remotePkg = remote.getPackageName() + "."; | ||||
| @@ -467,7 +467,7 @@ public final class Extension { | |||||
| * @return true if the specified extension is compatible with this extension | * @return true if the specified extension is compatible with this extension | ||||
| */ | */ | ||||
| public boolean isCompatibleWith(final Extension required) { | public boolean isCompatibleWith(final Extension required) { | ||||
| return (COMPATIBLE == getCompatibilityWith(required)); | |||||
| return COMPATIBLE == getCompatibilityWith(required); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -876,7 +876,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||||
| * @return true if the file exists | * @return true if the file exists | ||||
| */ | */ | ||||
| public boolean exists() { | public boolean exists() { | ||||
| return (ftpFile != null); | |||||
| return ftpFile != null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -103,7 +103,7 @@ public abstract class EnumeratedAttribute { | |||||
| * @return true if the value is valid | * @return true if the value is valid | ||||
| */ | */ | ||||
| public final boolean containsValue(String value) { | public final boolean containsValue(String value) { | ||||
| return (indexOfValue(value) != -1); | |||||
| return indexOfValue(value) != -1; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -331,8 +331,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
| * @param tryUserDir if true try the user directory if the file is not present | * @param tryUserDir if true try the user directory if the file is not present | ||||
| */ | */ | ||||
| public void addExisting(Path source, boolean tryUserDir) { | public void addExisting(Path source, boolean tryUserDir) { | ||||
| File userDir = (tryUserDir) ? new File(System.getProperty("user.dir")) | |||||
| : null; | |||||
| File userDir = tryUserDir ? new File(System.getProperty("user.dir")) : null; | |||||
| for (String name : source.list()) { | for (String name : source.list()) { | ||||
| File f = resolveFile(getProject(), name); | File f = resolveFile(getProject(), name); | ||||
| @@ -348,7 +348,7 @@ public class Permissions { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return ("Permission: " + className + " (\"" + name + "\", \"" + actions + "\")"); | |||||
| return String.format("Permission: %s (\"%s\", \"%s\")", className, name, actions); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -342,7 +342,7 @@ public class RedirectorElement extends DataType { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
| } | } | ||||
| this.append = ((append) ? Boolean.TRUE : Boolean.FALSE); | |||||
| this.append = append ? Boolean.TRUE : Boolean.FALSE; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -356,7 +356,7 @@ public class RedirectorElement extends DataType { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
| } | } | ||||
| this.alwaysLog = ((alwaysLog) ? Boolean.TRUE : Boolean.FALSE); | |||||
| this.alwaysLog = alwaysLog ? Boolean.TRUE : Boolean.FALSE; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -368,8 +368,7 @@ public class RedirectorElement extends DataType { | |||||
| if (isReference()) { | if (isReference()) { | ||||
| throw tooManyAttributes(); | throw tooManyAttributes(); | ||||
| } | } | ||||
| this.createEmptyFiles = ((createEmptyFiles) | |||||
| ? Boolean.TRUE : Boolean.FALSE); | |||||
| this.createEmptyFiles = createEmptyFiles ? Boolean.TRUE : Boolean.FALSE; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -278,8 +278,8 @@ public final class SelectorUtils { | |||||
| } | } | ||||
| // Find the pattern between padIdxStart & padIdxTmp in str between | // Find the pattern between padIdxStart & padIdxTmp in str between | ||||
| // strIdxStart & strIdxEnd | // strIdxStart & strIdxEnd | ||||
| int patLength = (patIdxTmp - patIdxStart - 1); | |||||
| int strLength = (strIdxEnd - strIdxStart + 1); | |||||
| int patLength = patIdxTmp - patIdxStart - 1; | |||||
| int strLength = strIdxEnd - strIdxStart + 1; | |||||
| int foundIdx = -1; | int foundIdx = -1; | ||||
| strLoop: | strLoop: | ||||
| for (int i = 0; i <= strLength - patLength; i++) { | for (int i = 0; i <= strLength - patLength; i++) { | ||||
| @@ -433,8 +433,8 @@ public final class SelectorUtils { | |||||
| } | } | ||||
| // Find the pattern between padIdxStart & padIdxTmp in str between | // Find the pattern between padIdxStart & padIdxTmp in str between | ||||
| // strIdxStart & strIdxEnd | // strIdxStart & strIdxEnd | ||||
| int patLength = (patIdxTmp - patIdxStart - 1); | |||||
| int strLength = (strIdxEnd - strIdxStart + 1); | |||||
| int patLength = patIdxTmp - patIdxStart - 1; | |||||
| int strLength = strIdxEnd - strIdxStart + 1; | |||||
| int foundIdx = -1; | int foundIdx = -1; | ||||
| strLoop: | strLoop: | ||||
| for (int i = 0; i <= strLength - patLength; i++) { | for (int i = 0; i <= strLength - patLength; i++) { | ||||
| @@ -45,7 +45,7 @@ public class EqualComparator implements Comparator<Object> { | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| return (o1.equals(o2)) ? 0 : 1; | |||||
| return o1.equals(o2) ? 0 : 1; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -459,7 +459,7 @@ public class ModifiedSelector extends BaseExtendSelector | |||||
| + resource.getName() | + resource.getName() | ||||
| + "' does not provide an InputStream, so it is not checked. " | + "' does not provide an InputStream, so it is not checked. " | ||||
| + "According to 'selres' attribute value it is " | + "According to 'selres' attribute value it is " | ||||
| + ((selectResourcesWithoutInputStream) ? "" : " not") | |||||
| + (selectResourcesWithoutInputStream ? "" : " not") | |||||
| + "selected.", Project.MSG_INFO); | + "selected.", Project.MSG_INFO); | ||||
| return selectResourcesWithoutInputStream; | return selectResourcesWithoutInputStream; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -118,7 +118,7 @@ public class PropertiesfileCache implements Cache { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public boolean isValid() { | public boolean isValid() { | ||||
| return (cachefile != null); | |||||
| return cachefile != null; | |||||
| } | } | ||||
| @@ -91,7 +91,7 @@ public class Base64Converter { | |||||
| out[outIndex++] = ALPHABET[bits6]; | out[outIndex++] = ALPHABET[bits6]; | ||||
| bits6 = (bits24 & POS_1_MASK) >> POS_1_SHIFT; | bits6 = (bits24 & POS_1_MASK) >> POS_1_SHIFT; | ||||
| out[outIndex++] = ALPHABET[bits6]; | out[outIndex++] = ALPHABET[bits6]; | ||||
| bits6 = (bits24 & POS_0_MASK); | |||||
| bits6 = bits24 & POS_0_MASK; | |||||
| out[outIndex++] = ALPHABET[bits6]; | out[outIndex++] = ALPHABET[bits6]; | ||||
| } | } | ||||
| if (octetString.length - i == 2) { | if (octetString.length - i == 2) { | ||||
| @@ -515,7 +515,7 @@ public class DOMElementWriter { | |||||
| int prevEnd = 0; | int prevEnd = 0; | ||||
| int cdataEndPos = value.indexOf("]]>"); | int cdataEndPos = value.indexOf("]]>"); | ||||
| while (prevEnd < len) { | while (prevEnd < len) { | ||||
| final int end = (cdataEndPos < 0 ? len : cdataEndPos); | |||||
| final int end = cdataEndPos < 0 ? len : cdataEndPos; | |||||
| // Write out stretches of legal characters in the range [prevEnd, end). | // Write out stretches of legal characters in the range [prevEnd, end). | ||||
| int prevLegalCharPos = prevEnd; | int prevLegalCharPos = prevEnd; | ||||
| while (prevLegalCharPos < end) { | while (prevLegalCharPos < end) { | ||||
| @@ -1181,7 +1181,7 @@ public class FileUtils { | |||||
| if (!l.endsWith(File.separator)) { | if (!l.endsWith(File.separator)) { | ||||
| l += File.separator; | l += File.separator; | ||||
| } | } | ||||
| return (p.startsWith(l)) ? p.substring(l.length()) : p; | |||||
| return p.startsWith(l) ? p.substring(l.length()) : p; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -42,7 +42,7 @@ public interface BZip2Constants { | |||||
| int N_GROUPS = 6; | int N_GROUPS = 6; | ||||
| int G_SIZE = 50; | int G_SIZE = 50; | ||||
| int N_ITERS = 4; | int N_ITERS = 4; | ||||
| int MAX_SELECTORS = (2 + (900000 / G_SIZE)); | |||||
| int MAX_SELECTORS = 2 + 900000 / G_SIZE; | |||||
| int NUM_OVERSHOOT_BYTES = 20; | int NUM_OVERSHOOT_BYTES = 20; | ||||
| /** | /** | ||||
| @@ -686,17 +686,17 @@ class BlockSort { | |||||
| i2 -= lastPlus1; | i2 -= lastPlus1; | ||||
| } | } | ||||
| workDoneShadow++; | workDoneShadow++; | ||||
| } else if ((quadrant[i1 + 3] > quadrant[i2 + 3])) { | |||||
| } else if (quadrant[i1 + 3] > quadrant[i2 + 3]) { | |||||
| continue HAMMER; | continue HAMMER; | ||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| } | } | ||||
| } else if ((block[i1 + 4] & 0xff) > (block[i2 + 4] & 0xff)) { | |||||
| } else if ((block[i2 + 4] & 0xff) < (block[i1 + 4] & 0xff)) { | |||||
| continue HAMMER; | continue HAMMER; | ||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| } | } | ||||
| } else if ((quadrant[i1 + 2] > quadrant[i2 + 2])) { | |||||
| } else if (quadrant[i1 + 2] > quadrant[i2 + 2]) { | |||||
| continue HAMMER; | continue HAMMER; | ||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| @@ -706,7 +706,7 @@ class BlockSort { | |||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| } | } | ||||
| } else if ((quadrant[i1 + 1] > quadrant[i2 + 1])) { | |||||
| } else if (quadrant[i1 + 1] > quadrant[i2 + 1]) { | |||||
| continue HAMMER; | continue HAMMER; | ||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| @@ -716,7 +716,7 @@ class BlockSort { | |||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| } | } | ||||
| } else if ((quadrant[i1] > quadrant[i2])) { | |||||
| } else if (quadrant[i1] > quadrant[i2]) { | |||||
| continue HAMMER; | continue HAMMER; | ||||
| } else { | } else { | ||||
| break HAMMER; | break HAMMER; | ||||
| @@ -900,8 +900,8 @@ class BlockSort { | |||||
| } | } | ||||
| } | } | ||||
| private static final int SETMASK = (1 << 21); | |||||
| private static final int CLEARMASK = (~SETMASK); | |||||
| private static final int SETMASK = 1 << 21; | |||||
| private static final int CLEARMASK = ~SETMASK; | |||||
| final void mainSort(final CBZip2OutputStream.Data dataShadow, | final void mainSort(final CBZip2OutputStream.Data dataShadow, | ||||
| final int lastShadow) { | final int lastShadow) { | ||||
| @@ -1024,7 +1024,7 @@ class BlockSort { | |||||
| copy[j] = ftab[(j << 8) + ss] & CLEARMASK; | copy[j] = ftab[(j << 8) + ss] & CLEARMASK; | ||||
| } | } | ||||
| for (int j = ftab[ss << 8] & CLEARMASK, hj = (ftab[(ss + 1) << 8] & CLEARMASK); j < hj; j++) { | |||||
| for (int j = ftab[ss << 8] & CLEARMASK, hj = ftab[ss + 1 << 8] & CLEARMASK; j < hj; j++) { | |||||
| final int fmap_j = fmap[j]; | final int fmap_j = fmap[j]; | ||||
| c1 = block[fmap_j] & 0xff; | c1 = block[fmap_j] & 0xff; | ||||
| if (!bigDone[c1]) { | if (!bigDone[c1]) { | ||||
| @@ -143,14 +143,14 @@ public class CBZip2OutputStream extends OutputStream | |||||
| * purposes. If you don't know what it means then you don't need | * purposes. If you don't know what it means then you don't need | ||||
| * it. | * it. | ||||
| */ | */ | ||||
| protected static final int SETMASK = (1 << 21); | |||||
| protected static final int SETMASK = 1 << 21; | |||||
| /** | /** | ||||
| * This constant is accessible by subclasses for historical | * This constant is accessible by subclasses for historical | ||||
| * purposes. If you don't know what it means then you don't need | * purposes. If you don't know what it means then you don't need | ||||
| * it. | * it. | ||||
| */ | */ | ||||
| protected static final int CLEARMASK = (~SETMASK); | |||||
| protected static final int CLEARMASK = ~SETMASK; | |||||
| /** | /** | ||||
| * This constant is accessible by subclasses for historical | * This constant is accessible by subclasses for historical | ||||
| @@ -322,14 +322,9 @@ public class CBZip2OutputStream extends OutputStream | |||||
| final int weight_n1 = weight[n1]; | final int weight_n1 = weight[n1]; | ||||
| final int weight_n2 = weight[n2]; | final int weight_n2 = weight[n2]; | ||||
| weight[nNodes] = (((weight_n1 & 0xffffff00) | |||||
| + (weight_n2 & 0xffffff00)) | |||||
| | | |||||
| (1 + (((weight_n1 & 0x000000ff) | |||||
| > (weight_n2 & 0x000000ff)) | |||||
| ? (weight_n1 & 0x000000ff) | |||||
| : (weight_n2 & 0x000000ff)) | |||||
| )); | |||||
| weight[nNodes] = (weight_n1 & 0xffffff00) + (weight_n2 & 0xffffff00) | |||||
| | 1 + ((weight_n1 & 0x000000ff) > (weight_n2 & 0x000000ff) | |||||
| ? weight_n1 & 0x000000ff : weight_n2 & 0x000000ff); | |||||
| parent[nNodes] = -1; | parent[nNodes] = -1; | ||||
| nHeap++; | nHeap++; | ||||
| @@ -1565,7 +1560,7 @@ public class CBZip2OutputStream extends OutputStream | |||||
| super(); | super(); | ||||
| final int n = blockSize100k * BZip2Constants.baseBlockSize; | final int n = blockSize100k * BZip2Constants.baseBlockSize; | ||||
| this.block = new byte[(n + 1 + NUM_OVERSHOOT_BYTES)]; | |||||
| this.block = new byte[n + 1 + NUM_OVERSHOOT_BYTES]; | |||||
| this.fmap = new int[n]; | this.fmap = new int[n]; | ||||
| this.sfmap = new char[2 * n]; | this.sfmap = new char[2 * n]; | ||||
| } | } | ||||
| @@ -44,10 +44,10 @@ import java.util.Arrays; | |||||
| public class TarBuffer { | public class TarBuffer { | ||||
| /** Default record size */ | /** Default record size */ | ||||
| public static final int DEFAULT_RCDSIZE = (512); | |||||
| public static final int DEFAULT_RCDSIZE = 512; | |||||
| /** Default block size */ | /** Default block size */ | ||||
| public static final int DEFAULT_BLKSIZE = (DEFAULT_RCDSIZE * 20); | |||||
| public static final int DEFAULT_BLKSIZE = DEFAULT_RCDSIZE * 20; | |||||
| private InputStream inStream; | private InputStream inStream; | ||||
| private OutputStream outStream; | private OutputStream outStream; | ||||
| @@ -123,7 +123,7 @@ public class TarBuffer { | |||||
| this.debug = false; | this.debug = false; | ||||
| this.blockSize = blockSize; | this.blockSize = blockSize; | ||||
| this.recordSize = recordSize; | this.recordSize = recordSize; | ||||
| this.recsPerBlock = (this.blockSize / this.recordSize); | |||||
| this.recsPerBlock = this.blockSize / this.recordSize; | |||||
| this.blockBuffer = new byte[this.blockSize]; | this.blockBuffer = new byte[this.blockSize]; | ||||
| if (this.inStream != null) { | if (this.inStream != null) { | ||||
| @@ -183,8 +183,7 @@ public class TarBuffer { | |||||
| */ | */ | ||||
| public void skipRecord() throws IOException { | public void skipRecord() throws IOException { | ||||
| if (debug) { | if (debug) { | ||||
| System.err.println("SkipRecord: recIdx = " + currRecIdx | |||||
| + " blkIdx = " + currBlkIdx); | |||||
| System.err.printf("SkipRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx); | |||||
| } | } | ||||
| if (inStream == null) { | if (inStream == null) { | ||||
| @@ -206,8 +205,7 @@ public class TarBuffer { | |||||
| */ | */ | ||||
| public byte[] readRecord() throws IOException { | public byte[] readRecord() throws IOException { | ||||
| if (debug) { | if (debug) { | ||||
| System.err.println("ReadRecord: recIdx = " + currRecIdx | |||||
| + " blkIdx = " + currBlkIdx); | |||||
| System.err.printf("ReadRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx); | |||||
| } | } | ||||
| if (inStream == null) { | if (inStream == null) { | ||||
| @@ -223,9 +221,7 @@ public class TarBuffer { | |||||
| byte[] result = new byte[recordSize]; | byte[] result = new byte[recordSize]; | ||||
| System.arraycopy(blockBuffer, | |||||
| (currRecIdx * recordSize), result, 0, | |||||
| recordSize); | |||||
| System.arraycopy(blockBuffer, currRecIdx * recordSize, result, 0, recordSize); | |||||
| currRecIdx++; | currRecIdx++; | ||||
| @@ -250,8 +246,7 @@ public class TarBuffer { | |||||
| int bytesNeeded = blockSize; | int bytesNeeded = blockSize; | ||||
| while (bytesNeeded > 0) { | while (bytesNeeded > 0) { | ||||
| long numBytes = inStream.read(blockBuffer, offset, | |||||
| bytesNeeded); | |||||
| long numBytes = inStream.read(blockBuffer, offset, bytesNeeded); | |||||
| // | // | ||||
| // NOTE | // NOTE | ||||
| @@ -289,9 +284,8 @@ public class TarBuffer { | |||||
| if (numBytes != blockSize) { | if (numBytes != blockSize) { | ||||
| if (debug) { | if (debug) { | ||||
| System.err.println("ReadBlock: INCOMPLETE READ " | |||||
| + numBytes + " of " + blockSize | |||||
| + " bytes read."); | |||||
| System.err.printf("ReadBlock: INCOMPLETE READ %d of %d bytes read.%n", | |||||
| numBytes, blockSize); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -328,8 +322,8 @@ public class TarBuffer { | |||||
| */ | */ | ||||
| public void writeRecord(byte[] record) throws IOException { | public void writeRecord(byte[] record) throws IOException { | ||||
| if (debug) { | if (debug) { | ||||
| System.err.println("WriteRecord: recIdx = " + currRecIdx | |||||
| + " blkIdx = " + currBlkIdx); | |||||
| System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n", | |||||
| currRecIdx, currBlkIdx); | |||||
| } | } | ||||
| if (outStream == null) { | if (outStream == null) { | ||||
| @@ -350,9 +344,7 @@ public class TarBuffer { | |||||
| writeBlock(); | writeBlock(); | ||||
| } | } | ||||
| System.arraycopy(record, 0, blockBuffer, | |||||
| (currRecIdx * recordSize), | |||||
| recordSize); | |||||
| System.arraycopy(record, 0, blockBuffer, currRecIdx * recordSize, recordSize); | |||||
| currRecIdx++; | currRecIdx++; | ||||
| } | } | ||||
| @@ -368,8 +360,7 @@ public class TarBuffer { | |||||
| */ | */ | ||||
| public void writeRecord(byte[] buf, int offset) throws IOException { | public void writeRecord(byte[] buf, int offset) throws IOException { | ||||
| if (debug) { | if (debug) { | ||||
| System.err.println("WriteRecord: recIdx = " + currRecIdx | |||||
| + " blkIdx = " + currBlkIdx); | |||||
| System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx); | |||||
| } | } | ||||
| if (outStream == null) { | if (outStream == null) { | ||||
| @@ -390,9 +381,7 @@ public class TarBuffer { | |||||
| writeBlock(); | writeBlock(); | ||||
| } | } | ||||
| System.arraycopy(buf, offset, blockBuffer, | |||||
| (currRecIdx * recordSize), | |||||
| recordSize); | |||||
| System.arraycopy(buf, offset, blockBuffer, currRecIdx * recordSize, recordSize); | |||||
| currRecIdx++; | currRecIdx++; | ||||
| } | } | ||||
| @@ -447,8 +436,7 @@ public class TarBuffer { | |||||
| if (outStream != null) { | if (outStream != null) { | ||||
| flushBlock(); | flushBlock(); | ||||
| if (outStream != System.out | |||||
| && outStream != System.err) { | |||||
| if (outStream != System.out && outStream != System.err) { | |||||
| outStream.close(); | outStream.close(); | ||||
| outStream = null; | outStream = null; | ||||
| @@ -215,7 +215,7 @@ public class TarInputStream extends FilterInputStream { | |||||
| } | } | ||||
| skip -= numRead; | skip -= numRead; | ||||
| } | } | ||||
| return (numToSkip - skip); | |||||
| return numToSkip - skip; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -136,7 +136,7 @@ public final class ZipEightByteInteger { | |||||
| public static byte[] getBytes(BigInteger value) { | public static byte[] getBytes(BigInteger value) { | ||||
| byte[] result = new byte[8]; | byte[] result = new byte[8]; | ||||
| long val = value.longValue(); | long val = value.longValue(); | ||||
| result[0] = (byte) ((val & BYTE_MASK)); | |||||
| result[0] = (byte) (val & BYTE_MASK); | |||||
| result[BYTE_1] = (byte) ((val & BYTE_1_MASK) >> BYTE_1_SHIFT); | result[BYTE_1] = (byte) ((val & BYTE_1_MASK) >> BYTE_1_SHIFT); | ||||
| result[BYTE_2] = (byte) ((val & BYTE_2_MASK) >> BYTE_2_SHIFT); | result[BYTE_2] = (byte) ((val & BYTE_2_MASK) >> BYTE_2_SHIFT); | ||||
| result[BYTE_3] = (byte) ((val & BYTE_3_MASK) >> BYTE_3_SHIFT); | result[BYTE_3] = (byte) ((val & BYTE_3_MASK) >> BYTE_3_SHIFT); | ||||
| @@ -1003,8 +1003,7 @@ public class ZipFile implements Closeable { | |||||
| if (ent2 == null) { | if (ent2 == null) { | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| final long val = (ent1.getOffsetEntry().headerOffset | |||||
| - ent2.getOffsetEntry().headerOffset); | |||||
| final long val = ent1.getOffsetEntry().headerOffset - ent2.getOffsetEntry().headerOffset; | |||||
| return val == 0 ? 0 : val < 0 ? -1 : +1; | return val == 0 ? 0 : val < 0 ? -1 : +1; | ||||
| }; | }; | ||||
| @@ -127,7 +127,7 @@ public final class ZipLong implements Cloneable { | |||||
| * must be non-negative and no larger than <tt>buf.length-4</tt> | * must be non-negative and no larger than <tt>buf.length-4</tt> | ||||
| */ | */ | ||||
| public static void putLong(long value, byte[] buf, int offset) { | public static void putLong(long value, byte[] buf, int offset) { | ||||
| buf[offset++] = (byte) ((value & BYTE_MASK)); | |||||
| buf[offset++] = (byte) (value & BYTE_MASK); | |||||
| buf[offset++] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT); | buf[offset++] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT); | ||||
| buf[offset++] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT); | buf[offset++] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT); | ||||
| buf[offset] = (byte) ((value & BYTE_3_MASK) >> BYTE_3_SHIFT); | buf[offset] = (byte) ((value & BYTE_3_MASK) >> BYTE_3_SHIFT); | ||||
| @@ -1565,8 +1565,8 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
| } | } | ||||
| // requires version 2 as we are going to store length info | // requires version 2 as we are going to store length info | ||||
| // in the data descriptor | // in the data descriptor | ||||
| return (isDeflatedToOutputStream(zipMethod)) | |||||
| ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION; | |||||
| return isDeflatedToOutputStream(zipMethod) | |||||
| ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION; | |||||
| } | } | ||||
| private boolean isDeflatedToOutputStream(int zipMethod) { | private boolean isDeflatedToOutputStream(int zipMethod) { | ||||
| @@ -1613,9 +1613,7 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
| * @return boolean | * @return boolean | ||||
| */ | */ | ||||
| private boolean hasZip64Extra(ZipEntry ze) { | private boolean hasZip64Extra(ZipEntry ze) { | ||||
| return ze.getExtraField(Zip64ExtendedInformationExtraField | |||||
| .HEADER_ID) | |||||
| != null; | |||||
| return ze.getExtraField(Zip64ExtendedInformationExtraField.HEADER_ID) != null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -770,7 +770,7 @@ public class ModifiedSelectorTest { | |||||
| results); // result | results); // result | ||||
| } finally { | } finally { | ||||
| // cleanup the environment | // cleanup the environment | ||||
| (new File(cachefile)).delete(); | |||||
| new File(cachefile).delete(); | |||||
| bft.deletePropertiesfile(); | bft.deletePropertiesfile(); | ||||
| } | } | ||||
| } | } | ||||