Commits

Anonymous committed d149a73

fix clone()
CVS: ----------------------------------------------------------------------
CVS: Issue number:
CVS: If this change addresses one or more issues,
CVS: then enter the issue number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to the project by someone else; i.e.,
CVS: they sent us a patch or a set of diffs, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.

git-svn-id: http://svn.opensymphony.com/svn/quartz/branches/b_quartz_1-5-x@32769f7d36a-ea1c-0410-88ea-9fd03e4c9665

  • Participants
  • Parent commits d554527
  • Branches b_quartz_1-5-x

Comments (0)

Files changed (2)

File src/java/org/quartz/CronExpression.java

  * @author Contributions from Mads Henderson
  * @author Refactoring from CronTrigger to CronExpression by Aaron Craven
  */
-public class CronExpression implements Serializable {
+public class CronExpression implements Serializable, Cloneable {
 
 	private static final long serialVersionUID = 12423409423L;
 	
         } catch (Exception ignore) {
         } // never happens
     }    
+    
+    public Object clone() {
+    	CronExpression copy = null;
+        try {
+        	copy = new CronExpression(getCronExpression());
+        	copy.setTimeZone(getTimeZone());
+        } catch (ParseException ex) { // never happens since the source is valid...
+            throw new IncompatibleClassChangeError("Not Cloneable.");
+        }
+        return copy;
+    }        
 }
 
 class ValueSet {

File src/java/org/quartz/CronTrigger.java

      * 
      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      */
-
+    
+    public Object clone() {
+    	CronTrigger copy = (CronTrigger) super.clone();
+        copy.setCronExpression((CronExpression)cronEx.clone());
+        return copy;
+    }
 
     public void setCronExpression(String cronExpression) throws ParseException {
         this.cronEx = new CronExpression(cronExpression);