You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2003/07/17 16:36:44 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Tar.java
conor 2003/07/17 07:36:44
Modified: src/main/org/apache/tools/ant IntrospectionHelper.java
src/main/org/apache/tools/ant/taskdefs Tar.java
Log:
More style
Revision Changes Path
1.58 +49 -32 ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
Index: IntrospectionHelper.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -w -u -r1.57 -r1.58
--- IntrospectionHelper.java 6 Jul 2003 09:57:34 -0000 1.57
+++ IntrospectionHelper.java 17 Jul 2003 14:36:39 -0000 1.58
@@ -331,6 +331,7 @@
});
} catch (NoSuchMethodException nse) {
+ // ignore
}
} else if (name.startsWith("add")
&& java.lang.Void.TYPE.equals(returnType)
@@ -357,6 +358,7 @@
});
nestedStorers.remove(name);
} catch (NoSuchMethodException nse) {
+ // ignore
}
}
}
@@ -409,6 +411,7 @@
* The method will make sure the helper will be cleaned up at the end of
* the project, and only one instance will be created for each class.
*
+ * @param p the project instance
* @param c The class for which a helper is required.
* Must not be <code>null</code>.
*
@@ -454,9 +457,9 @@
dc.setDynamicAttribute(attributeName, value);
return;
} else {
- String msg = getElementName(p, element) +
- " doesn't support the \"" + attributeName +
- "\" attribute.";
+ String msg = getElementName(p, element)
+ + " doesn't support the \"" + attributeName
+ + "\" attribute.";
throw new BuildException(msg);
}
}
@@ -519,10 +522,17 @@
}
}
+ /**
+ * Utility method to throw a NotSupported exception
+ *
+ * @param project the Project instance.
+ * @param parent the object which doesn't support a requested element
+ * @param elementName the name of the Element which is trying to be created.
+ */
public void throwNotSupported(Project project, Object parent,
String elementName) {
- String msg = project.getElementName(parent) +
- " doesn't support the nested \"" + elementName + "\" element.";
+ String msg = project.getElementName(parent)
+ + " doesn't support the nested \"" + elementName + "\" element.";
throw new BuildException(msg);
}
@@ -603,9 +613,9 @@
* @return true if the given nested element is supported
*/
public boolean supportsNestedElement(String elementName) {
- return nestedCreators.containsKey(elementName) ||
- DynamicConfigurator.class.isAssignableFrom(bean) ||
- addTypeMethods.size() != 0;
+ return nestedCreators.containsKey(elementName)
+ || DynamicConfigurator.class.isAssignableFrom(bean)
+ || addTypeMethods.size() != 0;
}
/**
@@ -670,8 +680,9 @@
throws BuildException {
Class nt = (Class) nestedTypes.get(elementName);
if (nt == null) {
- String msg = "Class " + bean.getName() +
- " doesn't support the nested \"" + elementName + "\" element.";
+ String msg = "Class " + bean.getName()
+ + " doesn't support the nested \"" + elementName
+ + "\" element.";
throw new BuildException(msg);
}
return nt;
@@ -839,13 +850,13 @@
};
// EnumeratedAttributes have their own helper class
- } else if (org.apache.tools.ant.types.EnumeratedAttribute.class.isAssignableFrom(reflectedArg)) {
+ } else if (EnumeratedAttribute.class.isAssignableFrom(reflectedArg)) {
return new AttributeSetter() {
public void set(Project p, Object parent, String value)
throws InvocationTargetException, IllegalAccessException, BuildException {
try {
- org.apache.tools.ant.types.EnumeratedAttribute ea =
- (org.apache.tools.ant.types.EnumeratedAttribute) reflectedArg.newInstance();
+ EnumeratedAttribute ea =
+ (EnumeratedAttribute) reflectedArg.newInstance();
ea.setValue(value);
m.invoke(parent, new EnumeratedAttribute[] {ea});
} catch (InstantiationException ie) {
@@ -880,6 +891,7 @@
};
} catch (NoSuchMethodException nme) {
+ // ignore
}
}
@@ -969,42 +981,48 @@
* Empty implementation to satisfy the BuildListener interface.
* @param event Ignored in this implementation.
*/
- public void buildStarted(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
/**
* Empty implementation to satisfy the BuildListener interface.
*
* @param event Ignored in this implementation.
*/
- public void targetStarted(BuildEvent event) {}
+ public void targetStarted(BuildEvent event) {
+ }
/**
* Empty implementation to satisfy the BuildListener interface.
*
* @param event Ignored in this implementation.
*/
- public void targetFinished(BuildEvent event) {}
+ public void targetFinished(BuildEvent event) {
+ }
/**
* Empty implementation to satisfy the BuildListener interface.
*
* @param event Ignored in this implementation.
*/
- public void taskStarted(BuildEvent event) {}
+ public void taskStarted(BuildEvent event) {
+ }
/**
* Empty implementation to satisfy the BuildListener interface.
*
* @param event Ignored in this implementation.
*/
- public void taskFinished(BuildEvent event) {}
+ public void taskFinished(BuildEvent event) {
+ }
/**
* Empty implementation to satisfy the BuildListener interface.
*
* @param event Ignored in this implementation.
*/
- public void messageLogged(BuildEvent event) {}
+ public void messageLogged(BuildEvent event) {
+ }
/**
* Check if the parent accepts a typed nested element
@@ -1016,8 +1034,7 @@
*/
private Object createAddTypeElement(
- Project project, Object parent, String elementName)
- {
+ Project project, Object parent, String elementName) {
ComponentHelper helper = ComponentHelper.getComponentHelper(project);
Object addedObject = null;
Method addMethod = null;
@@ -1092,10 +1109,10 @@
matchedMethod = method;
} else {
if (! methodClass.isAssignableFrom(matchedClass)) {
- throw new BuildException(
- "ambiguous: types " + matchedClass.getName() +
- " and " + methodClass.getName() +
- " match " + paramClass.getName());
+ throw new BuildException("ambiguous: types "
+ + matchedClass.getName() + " and "
+ + methodClass.getName() + " match "
+ + paramClass.getName());
}
}
}
1.44 +11 -10 ant/src/main/org/apache/tools/ant/taskdefs/Tar.java
Index: Tar.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -w -u -r1.43 -r1.44
--- Tar.java 6 Jul 2003 09:57:36 -0000 1.43
+++ Tar.java 17 Jul 2003 14:36:40 -0000 1.44
@@ -88,7 +88,6 @@
*
* @ant.task category="packaging"
*/
-
public class Tar extends MatchingTask {
/**
@@ -296,8 +295,8 @@
tOut.setDebug(true);
if (longFileMode.isTruncateMode()) {
tOut.setLongFileMode(TarOutputStream.LONGFILE_TRUNCATE);
- } else if (longFileMode.isFailMode() ||
- longFileMode.isOmitMode()) {
+ } else if (longFileMode.isFailMode()
+ || longFileMode.isOmitMode()) {
tOut.setLongFileMode(TarOutputStream.LONGFILE_ERROR);
} else {
// warn or GNU
@@ -329,7 +328,9 @@
try {
// close up
tOut.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ // ignore
+ }
}
}
} finally {
@@ -381,8 +382,8 @@
log("Omitting: " + vPath, Project.MSG_INFO);
return;
} else if (longFileMode.isWarnMode()) {
- log("Entry: " + vPath + " longer than " +
- TarConstants.NAMELEN + " characters.",
+ log("Entry: " + vPath + " longer than "
+ + TarConstants.NAMELEN + " characters.",
Project.MSG_WARN);
if (!longWarningGiven) {
log("Resulting tar file can only be processed "
@@ -391,9 +392,9 @@
longWarningGiven = true;
}
} else if (longFileMode.isFailMode()) {
- throw new BuildException(
- "Entry: " + vPath + " longer than " +
- TarConstants.NAMELEN + "characters.", getLocation());
+ throw new BuildException( "Entry: " + vPath
+ + " longer than " + TarConstants.NAMELEN
+ + "characters.", getLocation());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org