dion 2003/07/30 22:27:58
Modified: src/java/org/apache/maven/jelly/tags/maven PomTag.java
Exists.java DisplayTag.java ReactorTag.java
PluginPropertyTag.java SnapshotSignature.java
Log:
Use checkAttribute where possible
Revision Changes Path
1.13 +4 -11 maven/src/java/org/apache/maven/jelly/tags/maven/PomTag.java
Index: PomTag.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/PomTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PomTag.java 28 Jul 2003 04:19:47 -0000 1.12
+++ PomTag.java 31 Jul 2003 05:27:58 -0000 1.13
@@ -105,19 +105,12 @@
* another error occurs
*/
public void doTag( XMLOutput output )
- throws JellyTagException
+ throws MissingAttributeException, JellyTagException
{
// Check to make sure that we have a valid POM
// before processing.
- if ( projectDescriptor == null )
- {
- throw new MissingAttributeException( "projectDescriptor" );
- }
-
- if ( var == null )
- {
- throw new MissingAttributeException( "var" );
- }
+ checkAttribute( projectDescriptor, "projectDescriptor" );
+ checkAttribute( var, "var" );
try
{
1.4 +3 -6 maven/src/java/org/apache/maven/jelly/tags/maven/Exists.java
Index: Exists.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/Exists.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Exists.java 28 Jul 2003 23:52:00 -0000 1.3
+++ Exists.java 31 Jul 2003 05:27:58 -0000 1.4
@@ -87,12 +87,9 @@
* @throws JellyTagException If the file attribute is missing or there is an
error invoking the body
*/
public void doTag( XMLOutput output )
- throws JellyTagException
+ throws MissingAttributeException, JellyTagException
{
- if ( file == null )
- {
- throw new MissingAttributeException( "file" );
- }
+ checkAttribute(file, "file");
File f = new File( file );
1.4 +3 -6 maven/src/java/org/apache/maven/jelly/tags/maven/DisplayTag.java
Index: DisplayTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/DisplayTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DisplayTag.java 28 Jul 2003 23:51:34 -0000 1.3
+++ DisplayTag.java 31 Jul 2003 05:27:58 -0000 1.4
@@ -74,12 +74,9 @@
private String var;
public void doTag( XMLOutput output )
- throws JellyTagException
+ throws MissingAttributeException, JellyTagException
{
- if ( getVar() == null )
- {
- throw new MissingAttributeException( "var must be specified" );
- }
+ checkAttribute( getVar(), "var");
Object value = getMavenContext().getVariable( var );
1.34 +4 -7 maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java
Index: ReactorTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/ReactorTag.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ReactorTag.java 28 Jul 2003 04:24:22 -0000 1.33
+++ ReactorTag.java 31 Jul 2003 05:27:58 -0000 1.34
@@ -280,12 +280,9 @@
* @throws JellyTagException If an error occurs while processing the tag.
*/
public void doTag( XMLOutput output )
- throws JellyTagException
+ throws MissingAttributeException, JellyTagException
{
- if ( getBasedir() == null )
- {
- throw new MissingAttributeException( "basedir" );
- }
+ checkAttribute( getBasedir(), "basedir" );
if ( getGlob() == null && getIncludes() == null )
{
1.2 +5 -16
maven/src/java/org/apache/maven/jelly/tags/maven/PluginPropertyTag.java
Index: PluginPropertyTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/PluginPropertyTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PluginPropertyTag.java 31 Jul 2003 02:56:18 -0000 1.1
+++ PluginPropertyTag.java 31 Jul 2003 05:27:58 -0000 1.2
@@ -93,22 +93,11 @@
* @throws JellyTagException when anything goes wrong. FIXME
*/
public void doTag( XMLOutput output )
- throws JellyTagException
+ throws MissingAttributeException, JellyTagException
{
- if ( getPlugin() == null )
- {
- throw new MissingAttributeException( "plugin must be specified" );
- }
-
- if ( getVar() == null )
- {
- throw new MissingAttributeException( "var" );
- }
-
- if ( getValue() == null )
- {
- throw new MissingAttributeException( "value" );
- }
+ checkAttribute( getPlugin(), "plugin" );
+ checkAttribute( getVar(), "var" );
+ checkAttribute( getValue(), "value" );
// We need access to any of the plugins that are being used by this project
// so that we can diddle its properties.
1.8 +4 -8
maven/src/java/org/apache/maven/jelly/tags/maven/SnapshotSignature.java
Index: SnapshotSignature.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/SnapshotSignature.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SnapshotSignature.java 12 Apr 2003 00:02:02 -0000 1.7
+++ SnapshotSignature.java 31 Jul 2003 05:27:58 -0000 1.8
@@ -57,8 +57,8 @@
*/
import org.apache.commons.jelly.MissingAttributeException;
-import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.maven.jelly.tags.BaseTagSupport;
import org.apache.maven.project.Project;
import java.text.SimpleDateFormat;
@@ -71,7 +71,7 @@
* @version $Id$
*/
public class SnapshotSignature
- extends TagSupport
+ extends BaseTagSupport
{
/** Maven project */
private Project project;
@@ -105,11 +105,7 @@
*/
public void doTag( XMLOutput output ) throws MissingAttributeException
{
-
- if ( project == null )
- {
- throw new MissingAttributeException( "project" );
- }
+ checkAttribute( project, "project" );
Date now = new Date();
SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]