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