ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam StarTeamLabel.java StarTeamTask.java TreeBasedTask.java
Date Tue, 28 Oct 2003 09:56:26 GMT
antoine     2003/10/28 01:56:26

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/starteam
                        StarTeamLabel.java StarTeamTask.java
                        TreeBasedTask.java
  Log:
  Solution for the Starteam disconnect bug
  PR: 24110
  Submitted by: Steve Cohen (scohen at apache dot org)
  
  Revision  Changes    Path
  1.19      +24 -16    ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamLabel.java
  
  Index: StarTeamLabel.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamLabel.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StarTeamLabel.java	2 Oct 2003 10:14:23 -0000	1.18
  +++ StarTeamLabel.java	28 Oct 2003 09:56:26 -0000	1.19
  @@ -76,6 +76,7 @@
    *
    * @author Christopher Charlier, ThoughtWorks, Inc. 2001
    * @author <a href="mailto:jcyip@thoughtworks.com">Jason Yip</a>
  + * @author <a href="mailto:scohen@apache.org">Steve Cohen</a>
    * @see <A HREF="http://www.starbase.com/">StarBase Web Site</A>
    *
    * @ant.task name="stlabel" category="scm"
  @@ -179,25 +180,32 @@
                   + "both specified.  A revision label cannot be a build label.");
           }
   
  -        View snapshot = openView();
  +        try {
  +            View snapshot = openView();
   
  -        // Create the new label and update the repository
  +            // Create the new label and update the repository
   
  -        if (this.revisionlabel) {
  -            new Label(snapshot, this.labelName, this.description).update();
  -            log("Created Revision Label " + this.labelName);
  -        } else if (null != lastBuild) {
  -            new Label(snapshot, this.labelName, this.description, this.lastBuild,
  -                      this.buildlabel).update();
  -            log("Created View Label ("
  -                + (this.buildlabel ? "" : "non-") + "build) " + this.labelName
  -                + " as of " + this.lastBuild.toString());
  -        } else {
  -            new Label(snapshot, this.labelName, this.description,
  -                      this.buildlabel).update();
  -            log("Created View Label ("
  -                + (this.buildlabel ? "" : "non-") + "build) " + this.labelName);
  +            if (this.revisionlabel) {
  +                new Label(snapshot, this.labelName, this.description).update();
  +                log("Created Revision Label " + this.labelName);
  +            } else if (null != lastBuild) {
  +                new Label(snapshot, this.labelName, this.description, this.lastBuild,
  +                          this.buildlabel).update();
  +                log("Created View Label ("
  +                    + (this.buildlabel ? "" : "non-") + "build) " + this.labelName
  +                    + " as of " + this.lastBuild.toString());
  +            } else {
  +                new Label(snapshot, this.labelName, this.description,
  +                          this.buildlabel).update();
  +                log("Created View Label ("
  +                    + (this.buildlabel ? "" : "non-") + "build) " + this.labelName);
  +            }
  +        } catch (Exception e) {
  +            throw new BuildException(e);
  +        } finally {
  +            disconnectFromServer();
           }
  +
       }
   
       /**
  
  
  
  1.12      +15 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamTask.java
  
  Index: StarTeamTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/StarTeamTask.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- StarTeamTask.java	9 Jul 2003 14:44:16 -0000	1.11
  +++ StarTeamTask.java	28 Oct 2003 09:56:26 -0000	1.12
  @@ -117,7 +117,7 @@
   
       private void logStarteamVersion() {
           log("StarTeam version: "
  -            + BuildNumber.getDisplayString(), Project.MSG_DEBUG);
  +            + BuildNumber.getDisplayString(), Project.MSG_VERBOSE);
       }
   
   
  @@ -318,6 +318,18 @@
       }
   
       /**
  +     * disconnects from the StarTeam server.  Should be called from the 
  +     * finally clause of every StarTeamTask-based execute method.
  +     */
  +    protected final void disconnectFromServer() {
  +        if (null != this.server) {
  +            this.server.disconnect();
  +            log("successful disconnect from StarTeam Server " + servername,
  +                Project.MSG_VERBOSE);
  +        }
  +    }
  +
  +    /**
        * returns a list of TypeNames known to the server.
        *
        * @return a reference to the server's TypeNames
  @@ -362,6 +374,8 @@
           }
   
           View snapshot = createSnapshotView(view);
  +        log("Connected to StarTeam view " + getURL(),
  +            Project.MSG_VERBOSE);
           this.server = snapshot.getServer();
           return snapshot;
       }
  
  
  
  1.21      +3 -1      ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java
  
  Index: TreeBasedTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/starteam/TreeBasedTask.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TreeBasedTask.java	16 Sep 2003 10:38:14 -0000	1.20
  +++ TreeBasedTask.java	28 Oct 2003 09:56:26 -0000	1.21
  @@ -723,6 +723,8 @@
   
           } catch (Exception e) {
               throw new BuildException(e);
  +        } finally {
  +            disconnectFromServer();
           }
       }
   
  @@ -735,7 +737,7 @@
                   if (!stLabel.isRevisionLabel() && !stLabel.isViewLabel()) {
                       throw new BuildException("Unexpected label type.");
                   }
  -                log("using label " + stLabel.getName(), Project.MSG_DEBUG);
  +                log("using label " + stLabel.getName(), Project.MSG_VERBOSE);
                   this.labelInUse = stLabel;
                   return;
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message