git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272271 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -171,11 +171,7 @@ | |||
| <taskdef name="checkstyle" | |||
| classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/> | |||
| <mkdir dir="${bin.dir}/check"/> | |||
| <checkstyle maxlinelen="80" | |||
| memberpattern="[a-z].*" | |||
| parampattern="[a-z].*" | |||
| staticpattern="[a-z].*" | |||
| ignoreCastWhitespace="true"> | |||
| <checkstyle> | |||
| <fileset dir="${java.dir}"> | |||
| <include name="**/*.java"/> | |||
| <exclude name="**/org/apache/tools/ant/Task.java"/> | |||
| @@ -185,12 +181,7 @@ | |||
| <exclude name="**/builder/Ant1CompatBuilder.java"/> | |||
| </fileset> | |||
| </checkstyle> | |||
| <checkstyle maxlinelen="80" | |||
| memberpattern="[a-z].*" | |||
| parampattern="[a-z].*" | |||
| staticpattern="[a-z].*" | |||
| allowProtected="true" | |||
| ignoreCastWhitespace="true"> | |||
| <checkstyle allowProtected="true"> | |||
| <fileset dir="${java.dir}"> | |||
| <include name="**/org/apache/tools/ant/Task.java"/> | |||
| <include name="**/org/apache/tools/ant/ProjectComponent.java"/> | |||
| @@ -123,7 +123,7 @@ public class AntLibManager { | |||
| String libraryId = antLibrarySpec.getLibraryId(); | |||
| if (librarySpecs.containsKey(libraryId)) { | |||
| AntLibrarySpec currentSpec | |||
| = (AntLibrarySpec)librarySpecs.get(libraryId); | |||
| = (AntLibrarySpec) librarySpecs.get(libraryId); | |||
| throw new ExecutionException("Found more than one " | |||
| + "copy of library with id = " + libraryId | |||
| + " (" + libURLs[i] + ") + existing library at (" | |||
| @@ -162,10 +162,10 @@ public class AntLibManager { | |||
| // check if any already defined | |||
| for (Iterator i = librarySpecs.keySet().iterator(); i.hasNext();) { | |||
| String libraryId = (String)i.next(); | |||
| String libraryId = (String) i.next(); | |||
| if (libraries.containsKey(libraryId)) { | |||
| AntLibrary currentVersion | |||
| = (AntLibrary)libraries.get(libraryId); | |||
| = (AntLibrary) libraries.get(libraryId); | |||
| throw new ExecutionException("Ant Library \"" + libraryId | |||
| + "\" is already loaded from " | |||
| + currentVersion.getDefinitionURL()); | |||
| @@ -175,7 +175,7 @@ public class AntLibManager { | |||
| CircularDependencyChecker configuring | |||
| = new CircularDependencyChecker("configuring Ant libraries"); | |||
| for (Iterator i = librarySpecs.keySet().iterator(); i.hasNext();) { | |||
| String libraryId = (String)i.next(); | |||
| String libraryId = (String) i.next(); | |||
| if (!libraries.containsKey(libraryId)) { | |||
| configLibrary(initConfig, librarySpecs, libraryId, | |||
| configuring, libraries, libPathsMap); | |||
| @@ -272,7 +272,7 @@ public class AntLibManager { | |||
| configuring.visitNode(libraryId); | |||
| AntLibrarySpec librarySpec | |||
| = (AntLibrarySpec)librarySpecs.get(libraryId); | |||
| = (AntLibrarySpec) librarySpecs.get(libraryId); | |||
| String extendsId = librarySpec.getExtendsLibraryId(); | |||
| if (extendsId != null) { | |||
| if (!libraries.containsKey(extendsId)) { | |||
| @@ -310,20 +310,20 @@ public class AntLibManager { | |||
| } | |||
| for (Iterator i = urlsList.iterator(); i.hasNext();) { | |||
| antLibrary.addLibraryURL((URL)i.next()); | |||
| antLibrary.addLibraryURL((URL) i.next()); | |||
| } | |||
| if (extendsId != null) { | |||
| AntLibrary extendsLibrary | |||
| = (AntLibrary)libraries.get(extendsId); | |||
| = (AntLibrary) libraries.get(extendsId); | |||
| antLibrary.setExtendsLibrary(extendsLibrary); | |||
| } | |||
| antLibrary.setParentLoader(initConfig.getCommonLoader()); | |||
| libraries.put(libraryId, antLibrary); | |||
| List libPaths = (List)libPathsMap.get(libraryId); | |||
| List libPaths = (List) libPathsMap.get(libraryId); | |||
| if (libPaths != null) { | |||
| for (Iterator j = libPaths.iterator(); j.hasNext();) { | |||
| URL pathURL = (URL)j.next(); | |||
| URL pathURL = (URL) j.next(); | |||
| addLibPath(antLibrary, pathURL); | |||
| } | |||
| } | |||
| @@ -178,7 +178,7 @@ public class AntLibrary implements ComponentLibrary { | |||
| * component's definition | |||
| */ | |||
| public AntLibDefinition getDefinition(String definitionName) { | |||
| return (AntLibDefinition)definitions.get(definitionName); | |||
| return (AntLibDefinition) definitions.get(definitionName); | |||
| } | |||
| /** | |||
| @@ -218,7 +218,7 @@ public class AntLibrary implements ComponentLibrary { | |||
| Class factoryClass = Class.forName(factoryClassName, | |||
| true, getClassLoader()); | |||
| libFactory | |||
| = (AntLibFactory)factoryClass.newInstance(); | |||
| = (AntLibFactory) factoryClass.newInstance(); | |||
| libFactory.init(context); | |||
| } | |||
| return libFactory; | |||
| @@ -271,7 +271,7 @@ public class AntLibrary implements ComponentLibrary { | |||
| ClassLoader ourParent | |||
| = extendsLibrary == null ? parentLoader | |||
| : extendsLibrary.getClassLoader(); | |||
| return new URLClassLoader((URL[])libraryURLs.toArray(new URL[0]), | |||
| return new URLClassLoader((URL[]) libraryURLs.toArray(new URL[0]), | |||
| ourParent); | |||
| } | |||
| @@ -144,7 +144,7 @@ public class DynamicLibrary implements ComponentLibrary { | |||
| * component's definition | |||
| */ | |||
| public AntLibDefinition getDefinition(String definitionName) { | |||
| return (AntLibDefinition)definitions.get(definitionName); | |||
| return (AntLibDefinition) definitions.get(definitionName); | |||
| } | |||
| /** | |||
| @@ -134,7 +134,7 @@ public class AntConfig { | |||
| * library | |||
| */ | |||
| public List getLibraryPathList(String libraryId) { | |||
| List libraryPathList = (List)libPaths.get(libraryId); | |||
| List libraryPathList = (List) libPaths.get(libraryId); | |||
| if (libraryPathList == null) { | |||
| libraryPathList = new ArrayList(); | |||
| libPaths.put(libraryId, libraryPathList); | |||
| @@ -252,7 +252,7 @@ public class AntConfig { | |||
| Iterator i = otherConfig.libPaths.keySet().iterator(); | |||
| while (i.hasNext()) { | |||
| String libraryId = (String)i.next(); | |||
| String libraryId = (String) i.next(); | |||
| List currentList = getLibraryPathList(libraryId); | |||
| List combined = new ArrayList(); | |||
| combined.addAll(otherConfig.getLibraryPathList(libraryId)); | |||
| @@ -116,7 +116,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| public void fireBuildStarted(ModelElement element) { | |||
| BuildEvent event = new BuildEvent(element, BuildEvent.BUILD_STARTED); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.buildStarted(event); | |||
| } | |||
| } | |||
| @@ -132,7 +132,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| BuildEvent event = new BuildEvent(element, BuildEvent.BUILD_FINISHED, | |||
| cause); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.buildFinished(event); | |||
| } | |||
| } | |||
| @@ -145,7 +145,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| public void fireTargetStarted(ModelElement element) { | |||
| BuildEvent event = new BuildEvent(element, BuildEvent.TARGET_STARTED); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.targetStarted(event); | |||
| } | |||
| } | |||
| @@ -161,7 +161,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| BuildEvent event = new BuildEvent(element, BuildEvent.TARGET_FINISHED, | |||
| cause); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.targetFinished(event); | |||
| } | |||
| } | |||
| @@ -177,7 +177,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| } | |||
| BuildEvent event = new BuildEvent(task, BuildEvent.TASK_STARTED); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.taskStarted(event); | |||
| } | |||
| } | |||
| @@ -198,7 +198,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| BuildEvent event = new BuildEvent(task, BuildEvent.TASK_FINISHED, | |||
| cause); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.taskFinished(event); | |||
| } | |||
| } | |||
| @@ -214,7 +214,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| String message, int priority) { | |||
| BuildEvent event = new BuildEvent(source, message, priority); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| BuildListener listener = (BuildListener)i.next(); | |||
| BuildListener listener = (BuildListener) i.next(); | |||
| listener.messageLogged(event); | |||
| } | |||
| } | |||
| @@ -229,7 +229,7 @@ public class BuildEventSupport implements DemuxOutputReceiver { | |||
| * ) or information (<code>false</code>). | |||
| */ | |||
| public void threadOutput(String line, boolean isError) { | |||
| Task task = (Task)threadTasks.get(Thread.currentThread()); | |||
| Task task = (Task) threadTasks.get(Thread.currentThread()); | |||
| if (task == null) { | |||
| fireMessageLogged(this, line, | |||
| isError ? MessageLevel.MSG_ERR : MessageLevel.MSG_INFO); | |||
| @@ -116,7 +116,7 @@ public class ClassIntrospector { | |||
| && returnType.equals(Void.TYPE) | |||
| && args.length == 1 | |||
| && !args[0].isArray()) { | |||
| Integer depth = (Integer)classDepth.get(m.getDeclaringClass()); | |||
| Integer depth = (Integer) classDepth.get(m.getDeclaringClass()); | |||
| reflector.addAttributeMethod(m, depth.intValue(), | |||
| getPropertyName(name, "set"), converters); | |||
| } else if (name.startsWith("addConfigured") | |||
| @@ -165,7 +165,7 @@ public class ComponentManager implements ComponentService { | |||
| if (importAll) { | |||
| Iterator i = librarySpecs.keySet().iterator(); | |||
| while (i.hasNext()) { | |||
| String libraryId = (String)i.next(); | |||
| String libraryId = (String) i.next(); | |||
| importLibrary(libraryId); | |||
| } | |||
| } | |||
| @@ -219,7 +219,7 @@ public class ComponentManager implements ComponentService { | |||
| */ | |||
| public void addLibPath(String libraryId, URL libPath) | |||
| throws ExecutionException { | |||
| List libPaths = (List)libPathsMap.get(libraryId); | |||
| List libPaths = (List) libPathsMap.get(libraryId); | |||
| if (libPaths == null) { | |||
| libPaths = new ArrayList(); | |||
| libPathsMap.put(libraryId, libPaths); | |||
| @@ -227,7 +227,7 @@ public class ComponentManager implements ComponentService { | |||
| libPaths.add(libPath); | |||
| // If this library already exists give it the new path now | |||
| AntLibrary library = (AntLibrary)antLibraries.get(libraryId); | |||
| AntLibrary library = (AntLibrary) antLibraries.get(libraryId); | |||
| if (library != null) { | |||
| libManager.addLibPath(library, libPath); | |||
| } | |||
| @@ -240,13 +240,13 @@ public class ComponentManager implements ComponentService { | |||
| * @exception ExecutionException if the library cannot be imported | |||
| */ | |||
| public void importLibrary(String libraryId) throws ExecutionException { | |||
| AntLibrary library = (AntLibrary)antLibraries.get(libraryId); | |||
| AntLibrary library = (AntLibrary) antLibraries.get(libraryId); | |||
| if (library == null) { | |||
| throw new ExecutionException("Unable to import library " + libraryId | |||
| + " as it has not been loaded"); | |||
| } | |||
| for (Iterator i = library.getDefinitionNames(); i.hasNext();) { | |||
| String defName = (String)i.next(); | |||
| String defName = (String) i.next(); | |||
| importLibraryDef(library, defName, null); | |||
| } | |||
| addLibraryConverters(library); | |||
| @@ -266,7 +266,7 @@ public class ComponentManager implements ComponentService { | |||
| */ | |||
| public void importComponent(String libraryId, String defName, | |||
| String alias) throws ExecutionException { | |||
| AntLibrary library = (AntLibrary)antLibraries.get(libraryId); | |||
| AntLibrary library = (AntLibrary) antLibraries.get(libraryId); | |||
| if (library == null) { | |||
| throw new ExecutionException("Unable to import component from " | |||
| + "library \"" + libraryId + "\" as it has not been loaded"); | |||
| @@ -361,7 +361,7 @@ public class ComponentManager implements ComponentService { | |||
| // go through the libraries and import all standard ant libraries | |||
| for (Iterator i = antLibraries.keySet().iterator(); i.hasNext();) { | |||
| String libraryId = (String)i.next(); | |||
| String libraryId = (String) i.next(); | |||
| if (libraryId.startsWith(Constants.ANT_LIB_PREFIX)) { | |||
| // standard library - import whole library | |||
| importLibrary(libraryId); | |||
| @@ -392,7 +392,7 @@ public class ComponentManager implements ComponentService { | |||
| throws ExecutionException { | |||
| String libraryId = componentLibrary.getLibraryId(); | |||
| if (libFactories.containsKey(libraryId)) { | |||
| return (AntLibFactory)libFactories.get(libraryId); | |||
| return (AntLibFactory) libFactories.get(libraryId); | |||
| } | |||
| ExecutionContext context | |||
| = new ExecutionContext(frame, null, Location.UNKNOWN_LOCATION); | |||
| @@ -412,7 +412,7 @@ public class ComponentManager implements ComponentService { | |||
| * other details | |||
| */ | |||
| protected ImportInfo getDefinition(String name) { | |||
| return (ImportInfo)definitions.get(name); | |||
| return (ImportInfo) definitions.get(name); | |||
| } | |||
| /** | |||
| @@ -510,7 +510,7 @@ public class ComponentManager implements ComponentService { | |||
| */ | |||
| private Setter getSetter(Class c) { | |||
| if (setters.containsKey(c)) { | |||
| return (Setter)setters.get(c); | |||
| return (Setter) setters.get(c); | |||
| } | |||
| Setter setter = null; | |||
| if (DeferredTask.class.isAssignableFrom(c)) { | |||
| @@ -560,12 +560,12 @@ public class ComponentManager implements ComponentService { | |||
| ExecutionComponent execComponent = null; | |||
| if (addTaskAdapter) { | |||
| if (component instanceof Task) { | |||
| execComponent = (Task)component; | |||
| execComponent = (Task) component; | |||
| } else { | |||
| execComponent = new TaskAdapter(componentName, component); | |||
| } | |||
| } else if (component instanceof ExecutionComponent) { | |||
| execComponent = (ExecutionComponent)component; | |||
| execComponent = (ExecutionComponent) component; | |||
| } | |||
| // set the context loader to that for the component | |||
| @@ -639,7 +639,8 @@ public class ComponentManager implements ComponentService { | |||
| = libFactory.createComponent(typeClass, localName); | |||
| if (typeInstance instanceof ExecutionComponent) { | |||
| ExecutionComponent component = (ExecutionComponent)typeInstance; | |||
| ExecutionComponent component | |||
| = (ExecutionComponent) typeInstance; | |||
| ExecutionContext context = new ExecutionContext(frame, | |||
| component, model.getLocation()); | |||
| component.init(context, localName); | |||
| @@ -772,7 +773,7 @@ public class ComponentManager implements ComponentService { | |||
| factory.registerCreatedElement(nestedElement); | |||
| if (nestedElement instanceof ExecutionComponent) { | |||
| ExecutionComponent component | |||
| = (ExecutionComponent)nestedElement; | |||
| = (ExecutionComponent) nestedElement; | |||
| ExecutionContext context = new ExecutionContext(frame, | |||
| component, model.getLocation()); | |||
| component.init(context, nestedElementName); | |||
| @@ -806,7 +807,7 @@ public class ComponentManager implements ComponentService { | |||
| Setter setter = getSetter(element.getClass()); | |||
| // start by setting the attributes of this element | |||
| for (Iterator i = model.getAttributeNames(); i.hasNext();) { | |||
| String attributeName = (String)i.next(); | |||
| String attributeName = (String) i.next(); | |||
| String attributeValue = model.getAttributeValue(attributeName); | |||
| if (!setter.supportsAttribute(attributeName)) { | |||
| throw new ExecutionException(model.getType() | |||
| @@ -829,7 +830,7 @@ public class ComponentManager implements ComponentService { | |||
| // now do the nested elements | |||
| for (Iterator i = model.getNestedElements(); i.hasNext();) { | |||
| BuildElement nestedElementModel = (BuildElement)i.next(); | |||
| BuildElement nestedElementModel = (BuildElement) i.next(); | |||
| String nestedElementName = nestedElementModel.getType(); | |||
| ImportInfo info = getDefinition(nestedElementName); | |||
| if (element instanceof TaskContainer | |||
| @@ -838,8 +839,8 @@ public class ComponentManager implements ComponentService { | |||
| && !setter.supportsNestedElement(nestedElementName)) { | |||
| // it is a nested task | |||
| Task nestedTask | |||
| = (Task)createComponent(nestedElementModel); | |||
| TaskContainer container = (TaskContainer)element; | |||
| = (Task) createComponent(nestedElementModel); | |||
| TaskContainer container = (TaskContainer) element; | |||
| container.addNestedTask(nestedTask); | |||
| } else { | |||
| if (setter.supportsNestedAdder(nestedElementName)) { | |||
| @@ -902,7 +903,7 @@ public class ComponentManager implements ComponentService { | |||
| AntLibFactory libFactory = getLibFactory(library); | |||
| ClassLoader converterLoader = library.getClassLoader(); | |||
| for (Iterator i = library.getConverterClassNames(); i.hasNext();) { | |||
| className = (String)i.next(); | |||
| className = (String) i.next(); | |||
| Class converterClass | |||
| = Class.forName(className, true, converterLoader); | |||
| if (!Converter.class.isAssignableFrom(converterClass)) { | |||
| @@ -172,9 +172,9 @@ public class CoreDataService implements DataService { | |||
| Iterator i = fragments.iterator(); | |||
| Iterator j = propertyRefs.iterator(); | |||
| while (i.hasNext()) { | |||
| String fragment = (String)i.next(); | |||
| String fragment = (String) i.next(); | |||
| if (fragment == null) { | |||
| String propertyName = (String)j.next(); | |||
| String propertyName = (String) j.next(); | |||
| if (!isDataValueSet(propertyName)) { | |||
| if (!allowUnsetProperties) { | |||
| throw new ExecutionException("Property \"" | |||
| @@ -215,9 +215,9 @@ public class CoreDataService implements DataService { | |||
| Iterator i = fragments.iterator(); | |||
| Iterator j = propertyRefs.iterator(); | |||
| while (i.hasNext()) { | |||
| String fragment = (String)i.next(); | |||
| String fragment = (String) i.next(); | |||
| if (fragment == null) { | |||
| String propertyName = (String)j.next(); | |||
| String propertyName = (String) j.next(); | |||
| if (!replacementValues.containsKey(propertyName)) { | |||
| fragment = "${" + propertyName + "}"; | |||
| } else { | |||
| @@ -148,7 +148,7 @@ public class CoreExecService implements ExecService { | |||
| throw new ExecutionException("The Task was not configured with an" | |||
| + " appropriate context"); | |||
| } | |||
| ExecutionContext execContext = (ExecutionContext)context; | |||
| ExecutionContext execContext = (ExecutionContext) context; | |||
| frame.getEventSupport().fireTaskStarted(task); | |||
| Throwable failureCause = null; | |||
| @@ -74,7 +74,7 @@ public class DeferredSetter implements Setter { | |||
| */ | |||
| public void setAttribute(Object obj, String attributeName, | |||
| String value) throws ExecutionException { | |||
| DeferredTask task = (DeferredTask)obj; | |||
| DeferredTask task = (DeferredTask) obj; | |||
| task.setAttribute(attributeName, value); | |||
| } | |||
| @@ -99,7 +99,7 @@ public class DeferredSetter implements Setter { | |||
| */ | |||
| public void addText(Object obj, String text) | |||
| throws ExecutionException { | |||
| DeferredTask task = (DeferredTask)obj; | |||
| DeferredTask task = (DeferredTask) obj; | |||
| task.addText(text); | |||
| } | |||
| @@ -114,7 +114,7 @@ public class DeferredSetter implements Setter { | |||
| */ | |||
| public void addElement(Object obj, String elementName, Object value) | |||
| throws ExecutionException { | |||
| DeferredTask task = (DeferredTask)obj; | |||
| DeferredTask task = (DeferredTask) obj; | |||
| task.addElement(elementName, value); | |||
| } | |||
| @@ -112,6 +112,7 @@ public class ExecutionManager implements DemuxOutputReceiver { | |||
| throws ExecutionException { | |||
| this.config = config; | |||
| this.initConfig = initConfig; | |||
| init(); | |||
| } | |||
| /** | |||
| @@ -138,7 +139,7 @@ public class ExecutionManager implements DemuxOutputReceiver { | |||
| // add any additional libraries. | |||
| for (Iterator i = config.getLibraryLocations(); i.hasNext();) { | |||
| // try file first | |||
| String libLocation = (String)i.next(); | |||
| String libLocation = (String) i.next(); | |||
| libManager.loadLibs(librarySpecs, libLocation); | |||
| } | |||
| libManager.configLibraries(initConfig, librarySpecs, antLibraries, | |||
| @@ -162,14 +163,13 @@ public class ExecutionManager implements DemuxOutputReceiver { | |||
| throws AntException { | |||
| Throwable buildFailureCause = null; | |||
| try { | |||
| init(); | |||
| // start by validating the project we have been given. | |||
| project.validate(); | |||
| mainFrame = new Frame(antLibraries, initConfig, config); | |||
| for (Iterator j = eventSupport.getListeners(); j.hasNext();) { | |||
| BuildListener listener = (BuildListener)j.next(); | |||
| BuildListener listener = (BuildListener) j.next(); | |||
| mainFrame.addBuildListener(listener); | |||
| } | |||
| @@ -222,11 +222,7 @@ public class ExecutionManager implements DemuxOutputReceiver { | |||
| * @param isErr true if this content is from the thread's error stream. | |||
| */ | |||
| public void threadOutput(String line, boolean isErr) { | |||
| if (mainFrame == null) { | |||
| eventSupport.threadOutput(line, isErr); | |||
| } else { | |||
| mainFrame.threadOutput(line, isErr); | |||
| } | |||
| eventSupport.threadOutput(line, isErr); | |||
| } | |||
| } | |||
| @@ -87,7 +87,7 @@ import org.apache.ant.init.InitConfig; | |||
| * @author Conor MacNeill | |||
| * @created 14 January 2002 | |||
| */ | |||
| public class Frame implements DemuxOutputReceiver { | |||
| public class Frame { | |||
| /** the base dir of the project */ | |||
| private File baseDir; | |||
| @@ -188,7 +188,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| referencedFrames = new HashMap(); | |||
| for (Iterator i = project.getReferencedProjectNames(); i.hasNext();) { | |||
| String referenceName = (String)i.next(); | |||
| String referenceName = (String) i.next(); | |||
| Project referencedProject | |||
| = project.getReferencedProject(referenceName); | |||
| Frame referencedFrame = createFrame(referencedProject); | |||
| @@ -320,12 +320,12 @@ public class Frame implements DemuxOutputReceiver { | |||
| Map allProperties = new HashMap(dataValues); | |||
| Iterator i = referencedFrames.keySet().iterator(); | |||
| while (i.hasNext()) { | |||
| String refName = (String)i.next(); | |||
| String refName = (String) i.next(); | |||
| Frame refFrame = getReferencedFrame(refName); | |||
| Map refProperties = refFrame.getAllProperties(); | |||
| Iterator j = refProperties.keySet().iterator(); | |||
| while (j.hasNext()) { | |||
| String name = (String)j.next(); | |||
| String name = (String) j.next(); | |||
| Object value = refProperties.get(name); | |||
| allProperties.put(refName + Project.REF_DELIMITER + name, | |||
| value); | |||
| @@ -400,7 +400,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| * if there is no such project. | |||
| */ | |||
| protected Frame getReferencedFrame(String referenceName) { | |||
| return (Frame)referencedFrames.get(referenceName); | |||
| return (Frame) referencedFrames.get(referenceName); | |||
| } | |||
| /** | |||
| @@ -508,7 +508,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| */ | |||
| protected void addProperties(Map properties) throws ExecutionException { | |||
| for (Iterator i = properties.keySet().iterator(); i.hasNext();) { | |||
| String name = (String)i.next(); | |||
| String name = (String) i.next(); | |||
| Object value = properties.get(name); | |||
| setDataValue(name, value, false); | |||
| } | |||
| @@ -527,7 +527,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| = new Frame(standardLibs, initConfig, config); | |||
| newFrame.setProject(project); | |||
| for (Iterator j = eventSupport.getListeners(); j.hasNext();) { | |||
| BuildListener listener = (BuildListener)j.next(); | |||
| BuildListener listener = (BuildListener) j.next(); | |||
| newFrame.addBuildListener(listener); | |||
| } | |||
| return newFrame; | |||
| @@ -550,7 +550,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| */ | |||
| protected void addBuildListener(BuildListener listener) { | |||
| for (Iterator i = getReferencedFrames(); i.hasNext();) { | |||
| Frame referencedFrame = (Frame)i.next(); | |||
| Frame referencedFrame = (Frame) i.next(); | |||
| referencedFrame.addBuildListener(listener); | |||
| } | |||
| eventSupport.addBuildListener(listener); | |||
| @@ -563,7 +563,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| */ | |||
| protected void removeBuildListener(BuildListener listener) { | |||
| for (Iterator i = getReferencedFrames(); i.hasNext();) { | |||
| Frame subFrame = (Frame)i.next(); | |||
| Frame subFrame = (Frame) i.next(); | |||
| subFrame.removeBuildListener(listener); | |||
| } | |||
| eventSupport.removeBuildListener(listener); | |||
| @@ -589,7 +589,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| } | |||
| } else { | |||
| for (Iterator i = targets.iterator(); i.hasNext();) { | |||
| String targetName = (String)i.next(); | |||
| String targetName = (String) i.next(); | |||
| log("Executing target: " + targetName, MessageLevel.MSG_DEBUG); | |||
| executeTarget(targetName); | |||
| } | |||
| @@ -612,7 +612,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| // firstly build a list of fully qualified target names to execute. | |||
| List dependencyOrder = project.getTargetDependencies(targetName); | |||
| for (Iterator i = dependencyOrder.iterator(); i.hasNext();) { | |||
| String fullTargetName = (String)i.next(); | |||
| String fullTargetName = (String) i.next(); | |||
| Frame frame = getContainingFrame(fullTargetName); | |||
| String localTargetName = getNameInFrame(fullTargetName); | |||
| frame.executeTargetTasks(localTargetName); | |||
| @@ -632,12 +632,12 @@ public class Frame implements DemuxOutputReceiver { | |||
| protected void executeTasks(Iterator taskIterator) | |||
| throws ExecutionException { | |||
| while (taskIterator.hasNext()) { | |||
| BuildElement model = (BuildElement)taskIterator.next(); | |||
| BuildElement model = (BuildElement) taskIterator.next(); | |||
| // what sort of element is this. | |||
| try { | |||
| Object component = componentManager.createComponent(model); | |||
| if (component instanceof Task) { | |||
| execService.executeTask((Task)component); | |||
| execService.executeTask((Task) component); | |||
| } else { | |||
| String typeId | |||
| = model.getAspectValue(Constants.ANT_ASPECT, "id"); | |||
| @@ -718,25 +718,13 @@ public class Frame implements DemuxOutputReceiver { | |||
| */ | |||
| protected void initialize() throws ExecutionException { | |||
| for (Iterator i = getReferencedFrames(); i.hasNext();) { | |||
| Frame referencedFrame = (Frame)i.next(); | |||
| Frame referencedFrame = (Frame) i.next(); | |||
| referencedFrame.initialize(); | |||
| } | |||
| Iterator taskIterator = project.getTasks(); | |||
| executeTasks(taskIterator); | |||
| } | |||
| /** | |||
| * Handle the content from a single thread. This method will be called | |||
| * by the thread producing the content. The content is broken up into | |||
| * separate lines | |||
| * | |||
| * @param line the content produce by the current thread. | |||
| * @param isErr true if this content is from the thread's error stream. | |||
| */ | |||
| public void threadOutput(String line, boolean isErr) { | |||
| eventSupport.threadOutput(line, isErr); | |||
| } | |||
| /** | |||
| * Determine the base directory for each frame in the frame hierarchy | |||
| * | |||
| @@ -766,7 +754,7 @@ public class Frame implements DemuxOutputReceiver { | |||
| setDataValue(MagicProperties.BASEDIR, baseDir.getAbsolutePath(), true); | |||
| for (Iterator i = getReferencedFrames(); i.hasNext();) { | |||
| Frame refFrame = (Frame)i.next(); | |||
| Frame refFrame = (Frame) i.next(); | |||
| refFrame.determineBaseDirs(); | |||
| } | |||
| } | |||
| @@ -153,7 +153,7 @@ public class Reflector implements Setter { | |||
| throws ExecutionException { | |||
| String name = attributeName.toLowerCase(); | |||
| AttributeSetter as | |||
| = (AttributeSetter)attributeSetters.get(name); | |||
| = (AttributeSetter) attributeSetters.get(name); | |||
| if (as == null) { | |||
| throw new ExecutionException("Class " + obj.getClass().getName() | |||
| + " doesn't support the \"" + attributeName + "\" attribute"); | |||
| @@ -166,7 +166,7 @@ public class Reflector implements Setter { | |||
| } catch (InvocationTargetException ite) { | |||
| Throwable t = ite.getTargetException(); | |||
| if (t instanceof ExecutionException) { | |||
| throw (ExecutionException)t; | |||
| throw (ExecutionException) t; | |||
| } | |||
| throw new ExecutionException(t); | |||
| } | |||
| @@ -188,7 +188,7 @@ public class Reflector implements Setter { | |||
| * @return the class instance representing the type of the element adder | |||
| */ | |||
| public Class getType(String elementName) { | |||
| return (Class)elementTypes.get(elementName); | |||
| return (Class) elementTypes.get(elementName); | |||
| } | |||
| /** | |||
| @@ -214,7 +214,7 @@ public class Reflector implements Setter { | |||
| } catch (InvocationTargetException ite) { | |||
| Throwable t = ite.getTargetException(); | |||
| if (t instanceof ExecutionException) { | |||
| throw (ExecutionException)t; | |||
| throw (ExecutionException) t; | |||
| } | |||
| throw new ExecutionException(t); | |||
| } | |||
| @@ -232,7 +232,7 @@ public class Reflector implements Setter { | |||
| public void addElement(Object obj, String elementName, Object value) | |||
| throws ExecutionException { | |||
| String name = elementName.toLowerCase(); | |||
| ElementAdder adder = (ElementAdder)elementAdders.get(name); | |||
| ElementAdder adder = (ElementAdder) elementAdders.get(name); | |||
| if (adder == null) { | |||
| throw new ExecutionException("Class " + obj.getClass().getName() | |||
| + " doesn't support the \"" + elementName | |||
| @@ -246,7 +246,7 @@ public class Reflector implements Setter { | |||
| } catch (InvocationTargetException ite) { | |||
| Throwable t = ite.getTargetException(); | |||
| if (t instanceof ExecutionException) { | |||
| throw (ExecutionException)t; | |||
| throw (ExecutionException) t; | |||
| } | |||
| throw new ExecutionException(t); | |||
| } | |||
| @@ -266,7 +266,7 @@ public class Reflector implements Setter { | |||
| throws ExecutionException { | |||
| ElementCreator creator | |||
| = (ElementCreator)elementCreators.get(elementName.toLowerCase()); | |||
| = (ElementCreator) elementCreators.get(elementName.toLowerCase()); | |||
| if (creator == null) { | |||
| throw new ExecutionException("Class " | |||
| + container.getClass().getName() | |||
| @@ -285,7 +285,7 @@ public class Reflector implements Setter { | |||
| } catch (InvocationTargetException e) { | |||
| Throwable t = e.getTargetException(); | |||
| if (t instanceof ExecutionException) { | |||
| throw (ExecutionException)t; | |||
| throw (ExecutionException) t; | |||
| } | |||
| throw new ExecutionException(t); | |||
| } | |||
| @@ -346,7 +346,7 @@ public class Reflector implements Setter { | |||
| AttributeSetter setter) { | |||
| String name = attributeName.toLowerCase(); | |||
| AttributeSetter currentSetter | |||
| = (AttributeSetter)attributeSetters.get(name); | |||
| = (AttributeSetter) attributeSetters.get(name); | |||
| if (currentSetter != null) { | |||
| // there is a setter, is it lower down in the class hierarchy | |||
| int currentDepth = currentSetter.getDepth(); | |||
| @@ -393,7 +393,7 @@ public class Reflector implements Setter { | |||
| if (converters != null && converters.containsKey(type)) { | |||
| // we have a converter to use to convert the String | |||
| // value into something the set method expects. | |||
| Converter converter = (Converter)converters.get(type); | |||
| Converter converter = (Converter) converters.get(type); | |||
| addConvertingSetter(m, depth, propertyName, converter); | |||
| return; | |||
| } | |||
| @@ -416,11 +416,11 @@ public class Reflector implements Setter { | |||
| // desparate by now - try top find a converter which handles a super | |||
| // class of this type and which supports subclass instantiation | |||
| for (Iterator i = converters.keySet().iterator(); i.hasNext();) { | |||
| Class converterType = (Class)i.next(); | |||
| Class converterType = (Class) i.next(); | |||
| if (converterType.isAssignableFrom(type)) { | |||
| // could be a candidate | |||
| Converter converter | |||
| = (Converter)converters.get(converterType); | |||
| = (Converter) converters.get(converterType); | |||
| if (converter.canConvertSubType(type)) { | |||
| addConvertingSetter(m, depth, propertyName, converter); | |||
| return; | |||
| @@ -89,7 +89,7 @@ public class BuildElementHandler extends ModelElementHandler { | |||
| setModelElement(buildElement); | |||
| for (Iterator i = getAttributes(); i.hasNext();) { | |||
| String attributeName = (String)i.next(); | |||
| String attributeName = (String) i.next(); | |||
| buildElement.addAttribute(attributeName, | |||
| getAttribute(attributeName)); | |||
| } | |||
| @@ -123,7 +123,7 @@ public abstract class ElementHandler extends DefaultHandler { | |||
| * snot defined. | |||
| */ | |||
| public String getAttribute(String attributeName) { | |||
| return (String)elementAttributes.get(attributeName); | |||
| return (String) elementAttributes.get(attributeName); | |||
| } | |||
| /** | |||
| @@ -131,7 +131,7 @@ public class ParseContext { | |||
| if (e.getException() != null) { | |||
| Throwable nestedException = e.getException(); | |||
| if (nestedException instanceof AntException) { | |||
| location = ((AntException)nestedException).getLocation(); | |||
| location = ((AntException) nestedException).getLocation(); | |||
| } | |||
| throw new XMLParseException(nestedException, location); | |||
| } else { | |||
| @@ -104,7 +104,7 @@ public class Ant1Converter extends AbstractConverter { | |||
| } else if (EnumeratedAttribute.class.isAssignableFrom(type)) { | |||
| try { | |||
| EnumeratedAttribute ea | |||
| = (EnumeratedAttribute)type.newInstance(); | |||
| = (EnumeratedAttribute) type.newInstance(); | |||
| ea.setValue(value); | |||
| return ea; | |||
| } catch (InstantiationException e) { | |||
| @@ -96,7 +96,7 @@ public class Ant1Factory extends StandardLibFactory { | |||
| project.init(context); | |||
| EventService eventService = | |||
| (EventService)context.getCoreService(EventService.class); | |||
| (EventService) context.getCoreService(EventService.class); | |||
| eventService.addBuildListener(project); | |||
| } | |||
| @@ -130,7 +130,7 @@ public class Ant1Factory extends StandardLibFactory { | |||
| } | |||
| if (component instanceof ProjectComponent) { | |||
| ((ProjectComponent)component).setProject(project); | |||
| ((ProjectComponent) component).setProject(project); | |||
| } | |||
| return component; | |||
| } catch (java.lang.reflect.InvocationTargetException ite) { | |||
| @@ -164,10 +164,10 @@ public class Ant1Factory extends StandardLibFactory { | |||
| try { | |||
| try { | |||
| c = converterClass.getConstructor(new Class[0]); | |||
| converter = (Converter)c.newInstance(new Object[0]); | |||
| converter = (Converter) c.newInstance(new Object[0]); | |||
| } catch (NoSuchMethodException nse) { | |||
| c = converterClass.getConstructor(new Class[]{Project.class}); | |||
| converter = (Converter)c.newInstance(new Object[]{project}); | |||
| converter = (Converter) c.newInstance(new Object[]{project}); | |||
| } | |||
| return converter; | |||
| @@ -193,7 +193,7 @@ public class Ant1Factory extends StandardLibFactory { | |||
| public void registerCreatedElement(Object createdElement) | |||
| throws ExecutionException { | |||
| if (createdElement instanceof ProjectComponent) { | |||
| ProjectComponent component = (ProjectComponent)createdElement; | |||
| ProjectComponent component = (ProjectComponent) createdElement; | |||
| component.setProject(project); | |||
| } | |||
| } | |||
| @@ -260,17 +260,17 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * sensible way. The file separators are then converted to their | |||
| * platform specific versions. | |||
| * | |||
| * @param to_process the path to be converted | |||
| * @param toProcess the path to be converted | |||
| * @return the native version of to_process or an empty string if | |||
| * to_process is null or empty | |||
| */ | |||
| public static String translatePath(String to_process) { | |||
| if (to_process == null || to_process.length() == 0) { | |||
| public static String translatePath(String toProcess) { | |||
| if (toProcess == null || toProcess.length() == 0) { | |||
| return ""; | |||
| } | |||
| StringBuffer path = new StringBuffer(to_process.length() + 50); | |||
| PathTokenizer tokenizer = new PathTokenizer(to_process); | |||
| StringBuffer path = new StringBuffer(toProcess.length() + 50); | |||
| PathTokenizer tokenizer = new PathTokenizer(toProcess); | |||
| while (tokenizer.hasMoreTokens()) { | |||
| String pathComponent = tokenizer.nextToken(); | |||
| pathComponent = pathComponent.replace('/', File.separatorChar); | |||
| @@ -473,7 +473,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| Map properties = dataService.getAllProperties(); | |||
| Hashtable result = new Hashtable(); | |||
| for (Iterator i = properties.keySet().iterator(); i.hasNext();) { | |||
| String name = (String)i.next(); | |||
| String name = (String) i.next(); | |||
| Object value = properties.get(name); | |||
| if (value instanceof String) { | |||
| result.put(name, value); | |||
| @@ -501,7 +501,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| Map properties = dataService.getAllProperties(); | |||
| Hashtable result = new Hashtable(); | |||
| for (Iterator i = properties.keySet().iterator(); i.hasNext();) { | |||
| String name = (String)i.next(); | |||
| String name = (String) i.next(); | |||
| Object value = properties.get(name); | |||
| if (!(value instanceof String)) { | |||
| result.put(name, value); | |||
| @@ -511,6 +511,34 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| return result; | |||
| } | |||
| /** | |||
| * Register a task as the current task for a thread. | |||
| * If the task is null, the thread's entry is removed. | |||
| * | |||
| * @param thread the thread on which the task is registered. | |||
| * @param task the task to be registered. | |||
| * @since 1.102, Ant 1.5 | |||
| */ | |||
| public void registerThreadTask(Thread thread, Task task) { | |||
| // if (task != null) { | |||
| // threadTasks.put(thread, task); | |||
| // } else { | |||
| // threadTasks.remove(thread); | |||
| // } | |||
| } | |||
| /** | |||
| * Get the current task assopciated with a thread, if any | |||
| * | |||
| * @param thread the thread for which the task is required. | |||
| * @return the task which is currently registered for the given thread or | |||
| * null if no task is registered. | |||
| */ | |||
| public Task getThreadTask(Thread thread) { | |||
| return null; | |||
| // return (Task)threadTasks.get(thread); | |||
| } | |||
| /** | |||
| * build started event | |||
| * | |||
| @@ -537,7 +565,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| public void targetStarted(org.apache.ant.common.event.BuildEvent event) { | |||
| Target newTarget = new Target(this); | |||
| org.apache.ant.common.model.Target realTarget = | |||
| (org.apache.ant.common.model.Target)event.getSource(); | |||
| (org.apache.ant.common.model.Target) event.getSource(); | |||
| newTarget.setName(realTarget.getName()); | |||
| targetStack.push(newTarget); | |||
| fireTargetStarted(newTarget); | |||
| @@ -550,8 +578,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| */ | |||
| public void targetFinished(org.apache.ant.common.event.BuildEvent event) { | |||
| org.apache.ant.common.model.Target realTarget = | |||
| (org.apache.ant.common.model.Target)event.getSource(); | |||
| Target currentTarget = (Target)targetStack.pop(); | |||
| (org.apache.ant.common.model.Target) event.getSource(); | |||
| Target currentTarget = (Target) targetStack.pop(); | |||
| fireTargetFinished(currentTarget, event.getCause()); | |||
| currentTarget = null; | |||
| } | |||
| @@ -764,11 +792,11 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| */ | |||
| public void init(AntContext context) throws ExecutionException { | |||
| this.context = context; | |||
| fileService = (FileService)context.getCoreService(FileService.class); | |||
| dataService = (DataService)context.getCoreService(DataService.class); | |||
| execService = (ExecService)context.getCoreService(ExecService.class); | |||
| componentService | |||
| = (ComponentService)context.getCoreService(ComponentService.class); | |||
| fileService = (FileService) context.getCoreService(FileService.class); | |||
| dataService = (DataService) context.getCoreService(DataService.class); | |||
| execService = (ExecService) context.getCoreService(ExecService.class); | |||
| componentService = (ComponentService) | |||
| context.getCoreService(ComponentService.class); | |||
| String defs = "/org/apache/tools/ant/taskdefs/defaults.properties"; | |||
| @@ -783,7 +811,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| Enumeration enum = props.propertyNames(); | |||
| while (enum.hasMoreElements()) { | |||
| String key = (String)enum.nextElement(); | |||
| String key = (String) enum.nextElement(); | |||
| String value = props.getProperty(key); | |||
| try { | |||
| Class taskClass = Class.forName(value); | |||
| @@ -813,7 +841,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| Enumeration enum = props.propertyNames(); | |||
| while (enum.hasMoreElements()) { | |||
| String key = (String)enum.nextElement(); | |||
| String key = (String) enum.nextElement(); | |||
| String value = props.getProperty(key); | |||
| try { | |||
| Class dataClass = Class.forName(value); | |||
| @@ -937,7 +965,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| */ | |||
| public Task createTask(String taskType) throws BuildException { | |||
| Task task = null; | |||
| Class taskClass = (Class)taskClassDefinitions.get(taskType); | |||
| Class taskClass = (Class) taskClassDefinitions.get(taskType); | |||
| if (taskClass == null) { | |||
| return null; | |||
| @@ -947,7 +975,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| Object taskObject = componentService.createComponent(factory, | |||
| context.getClassLoader(), taskClass, false, taskType); | |||
| if (taskObject instanceof Task) { | |||
| task = (Task)taskObject; | |||
| task = (Task) taskObject; | |||
| } else { | |||
| TaskAdapter adapter = new TaskAdapter(); | |||
| adapter.setProxy(taskObject); | |||
| @@ -972,7 +1000,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * instance creation fails. | |||
| */ | |||
| public Object createDataType(String typeName) throws BuildException { | |||
| Class typeClass = (Class)dataClassDefinitions.get(typeName); | |||
| Class typeClass = (Class) dataClassDefinitions.get(typeName); | |||
| if (typeClass == null) { | |||
| return null; | |||
| @@ -991,7 +1019,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| protected void fireBuildStarted() { | |||
| BuildEvent event = new BuildEvent(this); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.buildStarted(event); | |||
| } | |||
| } | |||
| @@ -1005,7 +1033,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| BuildEvent event = new BuildEvent(this); | |||
| event.setException(exception); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.buildFinished(event); | |||
| } | |||
| } | |||
| @@ -1019,7 +1047,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| protected void fireTargetStarted(Target target) { | |||
| BuildEvent event = new BuildEvent(target); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.targetStarted(event); | |||
| } | |||
| } | |||
| @@ -1034,7 +1062,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| BuildEvent event = new BuildEvent(target); | |||
| event.setException(exception); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.targetFinished(event); | |||
| } | |||
| } | |||
| @@ -1049,7 +1077,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| // threadTasks.put(Thread.currentThread(), task); | |||
| BuildEvent event = new BuildEvent(task); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.taskStarted(event); | |||
| } | |||
| } | |||
| @@ -1067,7 +1095,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| BuildEvent event = new BuildEvent(task); | |||
| event.setException(exception); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.taskFinished(event); | |||
| } | |||
| } | |||
| @@ -1122,7 +1150,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| int priority) { | |||
| event.setMessage(message, priority); | |||
| for (int i = 0; i < listeners.size(); i++) { | |||
| BuildListener listener = (BuildListener)listeners.elementAt(i); | |||
| BuildListener listener = (BuildListener) listeners.elementAt(i); | |||
| listener.messageLogged(event); | |||
| } | |||
| } | |||
| @@ -104,7 +104,7 @@ public class ProjectHelper { | |||
| try { | |||
| AntContext context = project.getContext(); | |||
| DataService dataService | |||
| = (DataService)context.getCoreService(DataService.class); | |||
| = (DataService) context.getCoreService(DataService.class); | |||
| return dataService.replacePropertyRefs(value); | |||
| } catch (ExecutionException e) { | |||
| throw new BuildException(e); | |||
| @@ -126,7 +126,7 @@ public class ProjectHelper { | |||
| try { | |||
| AntContext context = project.getContext(); | |||
| DataService dataService | |||
| = (DataService)context.getCoreService(DataService.class); | |||
| = (DataService) context.getCoreService(DataService.class); | |||
| return dataService.replacePropertyRefs(value, keys); | |||
| } catch (ExecutionException e) { | |||
| throw new BuildException(e); | |||
| @@ -168,9 +168,9 @@ public abstract class Task extends ProjectComponent | |||
| throw new BuildException("Can't add tasks to this task"); | |||
| } | |||
| // wrap the Ant2 task in a TaskAdapter | |||
| TaskContainer container = (TaskContainer)this; | |||
| TaskContainer container = (TaskContainer) this; | |||
| if (task instanceof Task) { | |||
| container.addTask((Task)task); | |||
| container.addTask((Task) task); | |||
| } else { | |||
| TaskAdapter adapter = new TaskAdapter(); | |||
| adapter.setProxy(task); | |||
| @@ -223,7 +223,7 @@ public abstract class Task extends ProjectComponent | |||
| try { | |||
| AntContext context = getAntContext(); | |||
| ExecService execService | |||
| = (ExecService)context.getCoreService(ExecService.class); | |||
| = (ExecService) context.getCoreService(ExecService.class); | |||
| execService.executeTask(this); | |||
| } catch (ExecutionException e) { | |||
| throw new BuildException(e); | |||
| @@ -163,7 +163,7 @@ public class Ant extends Task { | |||
| */ | |||
| public void execute() throws BuildException { | |||
| for (Iterator i = properties.iterator(); i.hasNext();) { | |||
| Property property = (Property)i.next(); | |||
| Property property = (Property) i.next(); | |||
| AntBase.Property newProperty = new AntBase.Property(); | |||
| newProperty.setName(property.getName()); | |||
| newProperty.setValue(property.getValue()); | |||
| @@ -209,7 +209,8 @@ public class Ant extends Task { | |||
| */ | |||
| private ComponentService getComponentService() throws ExecutionException { | |||
| AntContext context = getAntContext(); | |||
| return (ComponentService)context.getCoreService(ComponentService.class); | |||
| return (ComponentService) | |||
| context.getCoreService(ComponentService.class); | |||
| } | |||
| } | |||
| @@ -102,7 +102,7 @@ public class CallTarget extends Task { | |||
| try { | |||
| ComponentService componentService = getComponentService(); | |||
| AntLibFactory factory = getProject().getFactory(); | |||
| antCall = (AntCall)componentService.createComponent(factory, | |||
| antCall = (AntCall) componentService.createComponent(factory, | |||
| context.getClassLoader(), AntCall.class, false, "antcall"); | |||
| } catch (ExecutionException e) { | |||
| throw new BuildException(e); | |||
| @@ -112,7 +112,7 @@ public class CallTarget extends Task { | |||
| /** execute the call */ | |||
| public void execute() { | |||
| for (Iterator i = properties.iterator(); i.hasNext();) { | |||
| Property property = (Property)i.next(); | |||
| Property property = (Property) i.next(); | |||
| AntBase.Property newProperty = new AntBase.Property(); | |||
| newProperty.setName(property.getName()); | |||
| newProperty.setValue(property.getValue()); | |||
| @@ -158,7 +158,8 @@ public class CallTarget extends Task { | |||
| */ | |||
| private ComponentService getComponentService() throws ExecutionException { | |||
| AntContext context = getAntContext(); | |||
| return (ComponentService)context.getCoreService(ComponentService.class); | |||
| return | |||
| (ComponentService) context.getCoreService(ComponentService.class); | |||
| } | |||
| } | |||
| @@ -197,7 +197,7 @@ public abstract class DataType extends ProjectComponent | |||
| throw circularReference(); | |||
| } else { | |||
| stk.push(o); | |||
| ((DataType)o).dieOnCircularReference(stk, p); | |||
| ((DataType) o).dieOnCircularReference(stk, p); | |||
| stk.pop(); | |||
| } | |||
| } | |||
| @@ -129,8 +129,8 @@ public class ScriptBase extends AbstractTask implements DeferredTask { | |||
| engine.exec(scriptName, 0, 0, script); | |||
| for (Iterator i = attributes.keySet().iterator(); i.hasNext();) { | |||
| String attributeName = (String)i.next(); | |||
| String value = (String)attributes.get(attributeName); | |||
| String attributeName = (String) i.next(); | |||
| String value = (String) attributes.get(attributeName); | |||
| StringBuffer setter = new StringBuffer(attributeName); | |||
| setter.setCharAt(0, Character.toUpperCase(setter.charAt(0))); | |||
| engine.call(null, "set" + setter, new Object[]{value}); | |||
| @@ -139,7 +139,7 @@ public class ScriptBase extends AbstractTask implements DeferredTask { | |||
| Iterator i = nestedElementNames.iterator(); | |||
| Iterator j = nestedElements.iterator(); | |||
| while (i.hasNext()) { | |||
| String nestedName = (String)i.next(); | |||
| String nestedName = (String) i.next(); | |||
| Object nestedElement = j.next(); | |||
| StringBuffer adder = new StringBuffer(nestedName); | |||
| adder.setCharAt(0, Character.toUpperCase(adder.charAt(0))); | |||
| @@ -152,7 +152,7 @@ public class ScriptBase extends AbstractTask implements DeferredTask { | |||
| Throwable te = e.getTargetException(); | |||
| if (te != null) { | |||
| if (te instanceof ExecutionException) { | |||
| throw (ExecutionException)te; | |||
| throw (ExecutionException) te; | |||
| } else { | |||
| t = te; | |||
| } | |||
| @@ -124,8 +124,8 @@ public class ScriptFactory extends StandardLibFactory { | |||
| */ | |||
| public void init(AntContext context) throws ExecutionException { | |||
| super.init(context); | |||
| componentService | |||
| = (ComponentService)context.getCoreService(ComponentService.class); | |||
| componentService = (ComponentService) | |||
| context.getCoreService(ComponentService.class); | |||
| try { | |||
| Class.forName("com.ibm.bsf.BSFManager"); | |||
| } catch (ClassNotFoundException e) { | |||
| @@ -155,10 +155,10 @@ public class ScriptFactory extends StandardLibFactory { | |||
| Object component = super.createComponent(componentClass, localName); | |||
| if (component instanceof ScriptDef) { | |||
| ScriptDef scriptDef = (ScriptDef)component; | |||
| ScriptDef scriptDef = (ScriptDef) component; | |||
| scriptDef.setFactory(this); | |||
| } else if (component instanceof ScriptBase) { | |||
| ScriptBase scriptBase = (ScriptBase)component; | |||
| ScriptBase scriptBase = (ScriptBase) component; | |||
| scriptBase.setFactory(this); | |||
| scriptBase.setScriptName(localName); | |||
| } | |||
| @@ -172,7 +172,7 @@ public class ScriptFactory extends StandardLibFactory { | |||
| * @return the script language name | |||
| */ | |||
| protected String getScriptLanguage(String scriptName) { | |||
| ScriptInfo scriptInfo = (ScriptInfo)scripts.get(scriptName); | |||
| ScriptInfo scriptInfo = (ScriptInfo) scripts.get(scriptName); | |||
| return scriptInfo.getLanguage(); | |||
| } | |||
| @@ -183,7 +183,7 @@ public class ScriptFactory extends StandardLibFactory { | |||
| * @return the script text | |||
| */ | |||
| protected String getScript(String scriptName) { | |||
| ScriptInfo scriptInfo = (ScriptInfo)scripts.get(scriptName); | |||
| ScriptInfo scriptInfo = (ScriptInfo) scripts.get(scriptName); | |||
| return scriptInfo.getScript(); | |||
| } | |||
| @@ -105,9 +105,10 @@ public class Ant extends AntBase { | |||
| * @exception ExecutionException if the build can't be run | |||
| */ | |||
| public void execute() throws ExecutionException { | |||
| System.out.println("Starting Ant Task"); | |||
| if (baseDir == null) { | |||
| ExecService execService | |||
| = (ExecService)getCoreService(ExecService.class); | |||
| = (ExecService) getCoreService(ExecService.class); | |||
| baseDir = execService.getBaseDir(); | |||
| } | |||
| @@ -125,9 +126,10 @@ public class Ant extends AntBase { | |||
| setProperty(MagicProperties.BASEDIR, baseDir.getAbsolutePath()); | |||
| ExecService execService | |||
| = (ExecService)getCoreService(ExecService.class); | |||
| = (ExecService) getCoreService(ExecService.class); | |||
| execService.runBuild(antFile, getProperties(), getTargets()); | |||
| System.out.println("Ending Ant Task"); | |||
| } | |||
| } | |||
| @@ -260,7 +260,7 @@ public abstract class AntBase extends AbstractTask { | |||
| public void init(AntContext context, String componentType) | |||
| throws ExecutionException { | |||
| super.init(context, componentType); | |||
| dataService = (DataService)getCoreService(DataService.class); | |||
| dataService = (DataService) getCoreService(DataService.class); | |||
| } | |||
| /** | |||
| @@ -70,7 +70,7 @@ public class AntCall extends AntBase { | |||
| */ | |||
| public void execute() throws ExecutionException { | |||
| ExecService execService | |||
| = (ExecService)getCoreService(ExecService.class); | |||
| = (ExecService) getCoreService(ExecService.class); | |||
| setProperty(MagicProperties.BASEDIR, | |||
| execService.getBaseDir().getAbsolutePath()); | |||
| @@ -90,7 +90,7 @@ public class FileConverter extends AbstractConverter { | |||
| public Object convert(String value, Class type) throws ExecutionException { | |||
| try { | |||
| FileService fileService | |||
| = (FileService)getContext().getCoreService(FileService.class); | |||
| = (FileService) getContext().getCoreService(FileService.class); | |||
| return fileService.resolveFile(value); | |||
| } catch (AntException e) { | |||
| throw new ExecutionException("Unable to resolve file: " | |||
| @@ -118,7 +118,7 @@ public class Parallel extends AbstractTask | |||
| try { | |||
| AntContext context = getAntContext(); | |||
| ExecService execService | |||
| = (ExecService)context.getCoreService(ExecService.class); | |||
| = (ExecService) context.getCoreService(ExecService.class); | |||
| execService.executeTask(task); | |||
| } catch (Throwable t) { | |||
| exception = t; | |||
| @@ -150,7 +150,7 @@ public class Parallel extends AbstractTask | |||
| TaskThread[] threads = new TaskThread[nestedTasks.size()]; | |||
| int threadNumber = 0; | |||
| for (Iterator i = nestedTasks.iterator(); i.hasNext(); threadNumber++) { | |||
| Task nestedTask = (Task)i.next(); | |||
| Task nestedTask = (Task) i.next(); | |||
| threads[threadNumber] = new TaskThread(threadNumber, nestedTask); | |||
| } | |||
| @@ -183,7 +183,7 @@ public class Parallel extends AbstractTask | |||
| } | |||
| if (t instanceof ExecutionException && | |||
| firstLocation == Location.UNKNOWN_LOCATION) { | |||
| firstLocation = ((ExecutionException)t).getLocation(); | |||
| firstLocation = ((ExecutionException) t).getLocation(); | |||
| } | |||
| exceptionMessage.append(lSep); | |||
| exceptionMessage.append(t.getMessage()); | |||
| @@ -192,7 +192,7 @@ public class Parallel extends AbstractTask | |||
| if (numExceptions == 1) { | |||
| if (firstException instanceof ExecutionException) { | |||
| throw (ExecutionException)firstException; | |||
| throw (ExecutionException) firstException; | |||
| } else { | |||
| throw new ExecutionException(firstException); | |||
| } | |||
| @@ -100,9 +100,9 @@ public class Sequential extends AbstractTask | |||
| public void execute() throws ExecutionException { | |||
| AntContext context = getAntContext(); | |||
| ExecService execService | |||
| = (ExecService)context.getCoreService(ExecService.class); | |||
| = (ExecService) context.getCoreService(ExecService.class); | |||
| for (Iterator i = nestedTasks.iterator(); i.hasNext();) { | |||
| Task nestedTask = (Task)i.next(); | |||
| Task nestedTask = (Task) i.next(); | |||
| execService.executeTask(nestedTask); | |||
| } | |||
| } | |||
| @@ -169,12 +169,12 @@ public class BuildHelper { | |||
| args[index++] = "-d"; | |||
| args[index++] = dest.getPath(); | |||
| if (classpathRef != null) { | |||
| String path = (String)paths.get(resolve(classpathRef)); | |||
| String path = (String) paths.get(resolve(classpathRef)); | |||
| args[index++] = "-classpath"; | |||
| args[index++] = path; | |||
| } | |||
| for (Iterator i = javaFiles.iterator(); i.hasNext();) { | |||
| args[index++] = ((File)i.next()).getPath(); | |||
| args[index++] = ((File) i.next()).getPath(); | |||
| } | |||
| try { | |||
| @@ -222,7 +222,7 @@ public class BuildHelper { | |||
| * @param fileSetRef the fileset to be copied | |||
| */ | |||
| protected void copyFilesetRef(String fileSetRef, String toDir) { | |||
| FileSetInfo fileset = (FileSetInfo)filesets.get(resolve(fileSetRef)); | |||
| FileSetInfo fileset = (FileSetInfo) filesets.get(resolve(fileSetRef)); | |||
| if (fileset != null) { | |||
| File to = new File(resolve(toDir)); | |||
| copyFileList(fileset.root, fileset.files, to); | |||
| @@ -259,7 +259,7 @@ public class BuildHelper { | |||
| protected void addFileSetToPath(String pathName, String filesetDir, | |||
| String filesetIncludes) { | |||
| File[] files = buildFileSet(filesetDir, filesetIncludes); | |||
| String currentPath = (String)paths.get(pathName); | |||
| String currentPath = (String) paths.get(pathName); | |||
| for (int i = 0; i < files.length; ++i) { | |||
| if (currentPath == null || currentPath.length() == 0) { | |||
| currentPath = files[i].getPath(); | |||
| @@ -279,7 +279,7 @@ public class BuildHelper { | |||
| */ | |||
| protected void addPathElementToPath(String pathName, String location) { | |||
| String pathElement = resolve(location).replace('/', File.separatorChar); | |||
| String currentPath = (String)paths.get(pathName); | |||
| String currentPath = (String) paths.get(pathName); | |||
| if (currentPath == null || currentPath.length() == 0) { | |||
| currentPath = pathElement; | |||
| } else { | |||
| @@ -295,12 +295,12 @@ public class BuildHelper { | |||
| * @param pathNameToAdd the name of the path to be added. | |||
| */ | |||
| protected void addPathToPath(String pathName, String pathNameToAdd) { | |||
| String pathToAdd = (String)paths.get(pathNameToAdd); | |||
| String pathToAdd = (String) paths.get(pathNameToAdd); | |||
| if (pathToAdd == null || pathToAdd.length() == 0) { | |||
| return; | |||
| } | |||
| String currentPath = (String)paths.get(pathName); | |||
| String currentPath = (String) paths.get(pathName); | |||
| if (currentPath == null || currentPath.length() == 0) { | |||
| currentPath = pathToAdd; | |||
| } else { | |||
| @@ -494,7 +494,7 @@ public class BuildHelper { | |||
| int index = newValue.indexOf("${"); | |||
| int endIndex = newValue.indexOf("}", index); | |||
| String propertyName = newValue.substring(index + 2, endIndex); | |||
| String repValue = (String)properties.get(propertyName); | |||
| String repValue = (String) properties.get(propertyName); | |||
| newValue = newValue.substring(0, index) + | |||
| repValue + newValue.substring(endIndex + 1); | |||
| } | |||
| @@ -180,7 +180,7 @@ public class Builder { | |||
| files.remove(new File(TASKDEFS_ROOT, "SendEmail.java")); | |||
| return (File[])files.toArray(new File[0]); | |||
| return (File[]) files.toArray(new File[0]); | |||
| } | |||
| /** | |||
| @@ -161,10 +161,10 @@ public class Commandline { | |||
| execManager.addBuildListener(logger); | |||
| for (Iterator i = listeners.iterator(); i.hasNext();) { | |||
| String className = (String)i.next(); | |||
| String className = (String) i.next(); | |||
| try { | |||
| BuildListener listener = | |||
| (BuildListener)Class.forName(className).newInstance(); | |||
| (BuildListener) Class.forName(className).newInstance(); | |||
| execManager.addBuildListener(listener); | |||
| } catch (ClassCastException e) { | |||
| System.err.println("The specified listener class " | |||
| @@ -226,7 +226,7 @@ public class Commandline { | |||
| + configFile, e); | |||
| } catch (XMLParseException e) { | |||
| if (e.getCause() instanceof FileNotFoundException) { | |||
| throw (FileNotFoundException)e.getCause(); | |||
| throw (FileNotFoundException) e.getCause(); | |||
| } | |||
| throw new ConfigException("Unable to parse config file from " | |||
| @@ -285,7 +285,7 @@ public class Commandline { | |||
| } | |||
| for (Iterator i = configFiles.iterator(); i.hasNext();) { | |||
| File configFile = (File)i.next(); | |||
| File configFile = (File) i.next(); | |||
| AntConfig runConfig = getAntConfigFile(configFile); | |||
| config.merge(runConfig); | |||
| } | |||
| @@ -479,7 +479,7 @@ public class Commandline { | |||
| if (loggerClassname != null) { | |||
| try { | |||
| Class loggerClass = Class.forName(loggerClassname); | |||
| logger = (BuildLogger)(loggerClass.newInstance()); | |||
| logger = (BuildLogger) loggerClass.newInstance(); | |||
| } catch (ClassCastException e) { | |||
| System.err.println("The specified logger class " | |||
| + loggerClassname + | |||
| @@ -162,7 +162,7 @@ public class DefaultLogger implements BuildLogger { | |||
| */ | |||
| public void reportException(Throwable t) { | |||
| if (t instanceof AntException) { | |||
| AntException e = (AntException)t; | |||
| AntException e = (AntException) t; | |||
| Location location = e.getLocation(); | |||
| Throwable cause = e.getCause(); | |||
| if (location != null && location != Location.UNKNOWN_LOCATION) { | |||
| @@ -218,7 +218,7 @@ public class DefaultLogger implements BuildLogger { | |||
| */ | |||
| public void targetStarted(BuildEvent event) { | |||
| if (MessageLevel.MSG_INFO <= messageOutputLevel) { | |||
| Target target = (Target)event.getSource(); | |||
| Target target = (Target) event.getSource(); | |||
| out.println(lSep + target.getName() + ":"); | |||
| } | |||
| } | |||
| @@ -262,11 +262,11 @@ public class DefaultLogger implements BuildLogger { | |||
| String name = null; | |||
| Object source = event.getSource(); | |||
| if (source instanceof Task) { | |||
| name = ((Task)source).getTaskName(); | |||
| name = ((Task) source).getTaskName(); | |||
| } | |||
| if (name == null && source instanceof ExecutionComponent) { | |||
| name = ((ExecutionComponent)source).getComponentType(); | |||
| name = ((ExecutionComponent) source).getComponentType(); | |||
| } | |||
| if (name != null) { | |||
| @@ -106,7 +106,7 @@ public class StandardLibFactory implements AntLibFactory { | |||
| public Converter createConverter(Class converterClass) | |||
| throws InstantiationException, IllegalAccessException, | |||
| ExecutionException { | |||
| return (Converter)converterClass.newInstance(); | |||
| return (Converter) converterClass.newInstance(); | |||
| } | |||
| /** | |||
| @@ -136,7 +136,7 @@ public class BuildElement extends ModelElement { | |||
| * attribute. | |||
| */ | |||
| public String getAttributeValue(String attributeName) { | |||
| return (String)attributes.get(attributeName); | |||
| return (String) attributes.get(attributeName); | |||
| } | |||
| /** | |||
| @@ -114,13 +114,13 @@ public abstract class ModelElement { | |||
| public void setAspects(Map aspects) { | |||
| aspectMaps = new HashMap(); | |||
| for (Iterator i = aspects.keySet().iterator(); i.hasNext();) { | |||
| String aspectName = (String)i.next(); | |||
| String aspectName = (String) i.next(); | |||
| int separator = aspectName.indexOf(":"); | |||
| if (separator != -1) { | |||
| String prefix = aspectName.substring(0, separator); | |||
| String name = aspectName.substring(separator + 1); | |||
| if (prefix.length() != 0 && name.length() != 0) { | |||
| Map prefixMap = (Map)aspectMaps.get(prefix); | |||
| Map prefixMap = (Map) aspectMaps.get(prefix); | |||
| if (prefixMap == null) { | |||
| prefixMap = new HashMap(); | |||
| aspectMaps.put(prefix, prefixMap); | |||
| @@ -176,7 +176,7 @@ public abstract class ModelElement { | |||
| * @return a map of the attribute values for the given aspect. | |||
| */ | |||
| public Map getAspectAttributes(String aspectPrefix) { | |||
| return (Map)aspectMaps.get(aspectPrefix); | |||
| return (Map) aspectMaps.get(aspectPrefix); | |||
| } | |||
| /** | |||
| @@ -191,7 +191,7 @@ public abstract class ModelElement { | |||
| if (aspectAttributes == null) { | |||
| return null; | |||
| } | |||
| return (String)aspectAttributes.get(keyName); | |||
| return (String) aspectAttributes.get(keyName); | |||
| } | |||
| } | |||
| @@ -219,7 +219,7 @@ public class Project extends ModelElement { | |||
| * target. | |||
| */ | |||
| public Target getTarget(String targetName) { | |||
| return (Target)targets.get(targetName); | |||
| return (Target) targets.get(targetName); | |||
| } | |||
| @@ -242,7 +242,7 @@ public class Project extends ModelElement { | |||
| * null if there is no such project. | |||
| */ | |||
| public Project getReferencedProject(String alias) { | |||
| return (Project)referencedProjects.get(alias); | |||
| return (Project) referencedProjects.get(alias); | |||
| } | |||
| @@ -417,7 +417,7 @@ public class Project extends ModelElement { | |||
| } | |||
| checker.visitNode(targetGlobalName); | |||
| for (Iterator i = target.getDependencies(); i.hasNext();) { | |||
| String dependency = (String)i.next(); | |||
| String dependency = (String) i.next(); | |||
| boolean localTarget = (dependency.indexOf(REF_DELIMITER) == -1); | |||
| Target dependencyTarget | |||
| = localTarget ? getTarget(dependency) | |||
| @@ -460,9 +460,9 @@ public class Project extends ModelElement { | |||
| protected void validate(String globalName) throws ModelException { | |||
| Set keys = referencedProjects.keySet(); | |||
| for (Iterator i = keys.iterator(); i.hasNext();) { | |||
| String refName = (String)i.next(); | |||
| String refName = (String) i.next(); | |||
| Project referencedProject | |||
| = (Project)referencedProjects.get(refName); | |||
| = (Project) referencedProjects.get(refName); | |||
| String refGlobalName = refName; | |||
| if (globalName != null) { | |||
| refGlobalName = globalName + REF_DELIMITER + refName; | |||
| @@ -482,7 +482,7 @@ public class Project extends ModelElement { | |||
| List dependencyOrder = new ArrayList(); | |||
| for (Iterator i = getTargets(); i.hasNext();) { | |||
| Target target = (Target)i.next(); | |||
| Target target = (Target) i.next(); | |||
| target.validate(); | |||
| fillinDependencyOrder(globalName, target, dependencyOrder, | |||
| visited, checker); | |||
| @@ -527,7 +527,7 @@ public class Project extends ModelElement { | |||
| + " does not exist"); | |||
| } | |||
| for (Iterator i = target.getDependencies(); i.hasNext();) { | |||
| String localDependencyName = (String)i.next(); | |||
| String localDependencyName = (String) i.next(); | |||
| String fullDependencyName | |||
| = fullProjectName == null ? localDependencyName | |||
| : fullProjectName + REF_DELIMITER + localDependencyName; | |||
| @@ -119,7 +119,7 @@ public class DemuxOutputStream extends OutputStream { | |||
| * @exception IOException if the data cannot be written to the stream | |||
| */ | |||
| public void write(int cc) throws IOException { | |||
| final byte c = (byte)cc; | |||
| final byte c = (byte) cc; | |||
| BufferInfo bufferInfo = getBufferInfo(); | |||
| if ((c == '\n') || (c == '\r')) { | |||
| @@ -179,7 +179,7 @@ public class DemuxOutputStream extends OutputStream { | |||
| */ | |||
| private BufferInfo getBufferInfo() { | |||
| Thread current = Thread.currentThread(); | |||
| BufferInfo bufferInfo = (BufferInfo)buffers.get(current); | |||
| BufferInfo bufferInfo = (BufferInfo) buffers.get(current); | |||
| if (bufferInfo == null) { | |||
| bufferInfo = new BufferInfo(); | |||
| bufferInfo.buffer = new ByteArrayOutputStream(); | |||
| @@ -128,7 +128,7 @@ public class LoaderUtils { | |||
| } | |||
| } | |||
| } | |||
| urls = (URL[])jarList.toArray(new URL[0]); | |||
| urls = (URL[]) jarList.toArray(new URL[0]); | |||
| } catch (IOException e) { | |||
| // use the default location | |||
| if (defaultFile != null) { | |||
| @@ -157,7 +157,7 @@ public class LoaderUtils { | |||
| public static String getClasspath(ClassLoader loader) { | |||
| StringBuffer pathBuffer = null; | |||
| if (loader instanceof URLClassLoader) { | |||
| URLClassLoader urlLoader = (URLClassLoader)loader; | |||
| URLClassLoader urlLoader = (URLClassLoader) loader; | |||
| URL[] urls = urlLoader.getURLs(); | |||
| for (int i = 0; i < urls.length; ++i) { | |||
| if (!urls[i].getProtocol().equals("file")) { | |||
| @@ -194,7 +194,7 @@ public class LoaderUtils { | |||
| */ | |||
| public static void dumpLoader(PrintStream ps, ClassLoader loader) { | |||
| if (loader instanceof URLClassLoader) { | |||
| URLClassLoader urlLoader = (URLClassLoader)loader; | |||
| URLClassLoader urlLoader = (URLClassLoader) loader; | |||
| URL[] urls = urlLoader.getURLs(); | |||
| if (urls.length == 0) { | |||
| ps.println(" No URLs"); | |||