git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270906 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -262,7 +262,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||
| String[] pathElements = actualClasspath.list(); | |||
| for (int i = 0; i < pathElements.length; ++i) { | |||
| try { | |||
| addPathElement((String)pathElements[i]); | |||
| addPathElement(pathElements[i]); | |||
| } | |||
| catch (BuildException e) { | |||
| // ignore path elements which are invalid relative to the project | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2000-2001 The Apache Software Foundation. All rights | |||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| @@ -146,7 +146,8 @@ public class Ant extends Task { | |||
| private void reinit() { | |||
| init(); | |||
| for (int i=0; i<properties.size(); i++) { | |||
| final int count = properties.size(); | |||
| for (int i = 0; i < count; i++) { | |||
| Property p = (Property) properties.elementAt(i); | |||
| Property newP = (Property) newProject.createTask("property"); | |||
| newP.setName(p.getName()); | |||
| @@ -165,7 +166,8 @@ public class Ant extends Task { | |||
| private void initializeProject() { | |||
| Vector listeners = project.getBuildListeners(); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| final int count = properties.size(); | |||
| for (int i = 0; i < count; i++) { | |||
| newProject.addBuildListener((BuildListener)listeners.elementAt(i)); | |||
| } | |||
| @@ -205,10 +207,9 @@ public class Ant extends Task { | |||
| // set user-defined or all properties from calling project | |||
| Hashtable prop1; | |||
| if (inheritAll == true) { | |||
| if (inheritAll) { | |||
| prop1 = project.getProperties(); | |||
| } | |||
| else { | |||
| } else { | |||
| prop1 = project.getUserProperties(); | |||
| // set Java built-in properties separately, | |||
| @@ -225,7 +226,7 @@ public class Ant extends Task { | |||
| } | |||
| String value = (String) prop1.get(arg); | |||
| if (inheritAll == true){ | |||
| if (inheritAll){ | |||
| newProject.setProperty(arg, value); | |||
| } else { | |||
| newProject.setUserProperty(arg, value); | |||
| @@ -236,8 +237,7 @@ public class Ant extends Task { | |||
| protected void handleOutput(String line) { | |||
| if (newProject != null) { | |||
| newProject.demuxOutput(line, false); | |||
| } | |||
| else { | |||
| } else { | |||
| super.handleOutput(line); | |||
| } | |||
| } | |||
| @@ -245,8 +245,7 @@ public class Ant extends Task { | |||
| protected void handleErrorOutput(String line) { | |||
| if (newProject != null) { | |||
| newProject.demuxOutput(line, true); | |||
| } | |||
| else { | |||
| } else { | |||
| super.handleErrorOutput(line); | |||
| } | |||
| } | |||
| @@ -260,7 +259,7 @@ public class Ant extends Task { | |||
| reinit(); | |||
| } | |||
| if ( (dir == null) && (inheritAll == true) ) { | |||
| if ( (dir == null) && (inheritAll) ) { | |||
| dir = project.getBaseDir(); | |||
| } | |||
| @@ -344,7 +343,7 @@ public class Ant extends Task { | |||
| continue; | |||
| } | |||
| Object o = thisReferences.remove(refid); | |||
| thisReferences.remove(refid); | |||
| String toRefid = ref.getToRefid(); | |||
| if (toRefid == null) { | |||
| toRefid = refid; | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2000-2001 The Apache Software Foundation. All rights | |||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| @@ -253,21 +253,22 @@ public class AntStructure extends Task { | |||
| Enumeration enum = ih.getNestedElements(); | |||
| while (enum.hasMoreElements()) { | |||
| v.addElement((String) enum.nextElement()); | |||
| v.addElement(enum.nextElement()); | |||
| } | |||
| if (v.isEmpty()) { | |||
| sb.append("EMPTY"); | |||
| } else { | |||
| sb.append("("); | |||
| for (int i=0; i<v.size(); i++) { | |||
| final int count = v.size(); | |||
| for (int i = 0; i < count; i++) { | |||
| if (i != 0) { | |||
| sb.append(" | "); | |||
| } | |||
| sb.append(v.elementAt(i)); | |||
| } | |||
| sb.append(")"); | |||
| if (v.size() > 1 || !v.elementAt(0).equals("#PCDATA")) { | |||
| if (count > 1 || !v.elementAt(0).equals("#PCDATA")) { | |||
| sb.append("*"); | |||
| } | |||
| } | |||
| @@ -324,7 +325,8 @@ public class AntStructure extends Task { | |||
| sb.append(">").append(lSep); | |||
| out.println(sb); | |||
| for (int i=0; i<v.size(); i++) { | |||
| final int count = v.size(); | |||
| for (int i = 0; i < count; i++) { | |||
| String nestedName = (String) v.elementAt(i); | |||
| if (!"#PCDATA".equals(nestedName) && | |||
| !TASKS.equals(nestedName) && | |||
| @@ -341,7 +343,8 @@ public class AntStructure extends Task { | |||
| * Does this String match the XML-NMTOKEN production? | |||
| */ | |||
| protected boolean isNmtoken(String s) { | |||
| for (int i = 0; i < s.length(); i++) { | |||
| final int length = s.length(); | |||
| for (int i = 0; i < length; i++) { | |||
| char c = s.charAt(i); | |||
| // XXX - we are ommitting CombiningChar and Extender here | |||
| if (!Character.isLetterOrDigit(c) && | |||
| @@ -360,13 +360,13 @@ public class Checksum extends MatchingTask implements Condition { | |||
| fis.close(); | |||
| fis = null; | |||
| byte[] fileDigest = messageDigest.digest (); | |||
| String checksum = ""; | |||
| StringBuffer checksum = new StringBuffer(); | |||
| for (int i = 0; i < fileDigest.length; i++) { | |||
| String hexStr = Integer.toHexString(0x00ff & fileDigest[i]); | |||
| if (hexStr.length() < 2) { | |||
| checksum += "0"; | |||
| checksum.append("0"); | |||
| } | |||
| checksum += hexStr; | |||
| checksum.append(hexStr); | |||
| } | |||
| //can either be a property name string or a file | |||
| Object destination = includeFileMap.get(src); | |||
| @@ -375,7 +375,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| if (isCondition) { | |||
| checksumMatches = checksum.equals(property); | |||
| } else { | |||
| project.setProperty(prop, checksum); | |||
| project.setProperty(prop, checksum.toString()); | |||
| } | |||
| } else if (destination instanceof java.io.File) { | |||
| if (isCondition) { | |||
| @@ -398,7 +398,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| } else { | |||
| File dest = (File) destination; | |||
| fos = new FileOutputStream(dest); | |||
| fos.write(checksum.getBytes()); | |||
| fos.write(checksum.toString().getBytes()); | |||
| fos.close(); | |||
| fos = null; | |||
| } | |||