@@ -48,61 +48,60 @@ import org.apache.tools.ant.types.Commandline;
*/
public abstract class MSVSS extends Task implements MSVSSConstants {
private String m_SS Dir = null;
private String m_ vssLogin = null;
private String m_ vssPath = null;
private String m_ serverPath = null;
private String ss Dir = null;
private String vssLogin = null;
private String vssPath = null;
private String serverPath = null;
/** Version */
private String m_V ersion = null;
private String v ersion = null;
/** Date */
private String m_D ate = null;
private String d ate = null;
/** Label */
private String m_L abel = null;
private String l abel = null;
/** Auto response */
private String m_A utoResponse = null;
private String a utoResponse = null;
/** Local path */
private String m_L ocalPath = null;
private String l ocalPath = null;
/** Comment */
private String m_C omment = null;
private String c omment = null;
/** From label */
private String m_F romLabel = null;
private String f romLabel = null;
/** To label */
private String m_T oLabel = null;
private String t oLabel = null;
/** Output file name */
private String m_O utputFileName = null;
private String o utputFileName = null;
/** User */
private String m_U ser = null;
private String u ser = null;
/** From date */
private String m_F romDate = null;
private String f romDate = null;
/** To date */
private String m_T oDate = null;
private String t oDate = null;
/** History style */
private String m_S tyle = null;
private String s tyle = null;
/** Quiet defaults to false */
private boolean m_Q uiet = false;
private boolean q uiet = false;
/** Recursive defaults to false */
private boolean m_R ecursive = false;
private boolean r ecursive = false;
/** Writable defaults to false */
private boolean m_W ritable = false;
private boolean w ritable = false;
/** Fail on error defaults to true */
private boolean m_F ailOnError = true;
private boolean f ailOnError = true;
/** Get local copy for checkout defaults to true */
private boolean m_ getLocalCopy = true;
private boolean getLocalCopy = true;
/** Number of days offset for History */
private int m_N umDays = Integer.MIN_VALUE;
private int n umDays = Integer.MIN_VALUE;
/** Date format for History */
private DateFormat m_D ateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
private DateFormat d ateFormat = DateFormat.getDateInstance(DateFormat.SHORT);
/** Timestamp for retreived files */
private CurrentModUpdated m_ timestamp = null;
private CurrentModUpdated timestamp = null;
/** Behaviour for writable files */
private WritableFiles m_writablef iles = null;
private WritableFiles writableF iles = null;
/**
* Each sub-class must implemnt this method and return the constructed
* command line to be executed. It is up to the sub-task to determine the
* required attrubutes and their order.
*
* @return The Constructed command line.
*/
abstract Commandline buildCmdLine();
@@ -110,11 +109,10 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
/**
* Directory where <code>ss.exe</code> resides.
* By default the task expects it to be in the PATH.
*
* @param dir The directory containing ss.exe.
*/
public final void setSsdir(String dir) {
m_SS Dir = Project.translatePath(dir);
this.ss Dir = Project.translatePath(dir);
}
/**
@@ -122,11 +120,10 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* <p>
* You can omit the password if your database is not password protected.
* If you have a password and omit it, Ant will hang.
*
* @param login The login string to use.
* @param vssLogin The login string to use.
*/
public final void setLogin(String l ogin) {
m_vssLogin = l ogin;
public final void setLogin(final String vssL ogin) {
this.vssLogin = vssL ogin;
}
/**
@@ -134,42 +131,38 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* the action on.
* <p>
* A prefix of 'vss://' will be removed if specified.
*
* @param vssPath The VSS project path.
*
* @ant.attribute group="required"
*/
public final void setVsspath(String vssPath) {
String projectPath;
if (vssPath.startsWith("vss://")) {
if (vssPath.startsWith("vss://")) { //$NON-NLS-1$
projectPath = vssPath.substring(5);
} else {
projectPath = vssPath;
}
if (projectPath.startsWith(PROJECT_PREFIX)) {
m_ vssPath = projectPath;
vssPath = projectPath;
} else {
m_ vssPath = PROJECT_PREFIX + projectPath;
vssPath = PROJECT_PREFIX + projectPath;
}
}
/**
* Directory where <code>srssafe.ini</code> resides.
*
* @param serverPath The path to the VSS server.
*/
public final void setServerpath(String serverPath) {
m_ serverPath = serverPath;
public final void setServerpath(final String serverPath) {
this. serverPath = serverPath;
}
/**
* Indicates if the build should fail if the Sourcesafe command does. Defaults to true.
*
* @param failOnError True if task should fail on any error.
*/
public final void setFailOnError ( boolean failOnError) {
m_F ailOnError = failOnError;
public final void setFailOnError(final boolean failOnError) {
this.f ailOnError = failOnError;
}
/**
@@ -191,256 +184,244 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
// Special setters for the sub-classes
protected void setInternalComment(String tex t) {
m_Comment = tex t;
protected void setInternalComment(final String commen t) {
this.comment = commen t;
}
protected void setInternalAutoResponse(String text ) {
m_AutoResponse = text ;
protected void setInternalAutoResponse(final String autoResponse ) {
this.autoResponse = autoResponse ;
}
protected void setInternalDate(String text ) {
m_Date = text ;
protected void setInternalDate(final String da te) {
this.date = date ;
}
protected void setInternalDateFormat(DateFormat date) {
m_DateFormat = date ;
protected void setInternalDateFormat(final DateFormat dateFormat ) {
this.dateFormat = dateFormat ;
}
protected void setInternalFailOnError(boolean fail) {
m_FailOnError = fail ;
protected void setInternalFailOnError(final boolean failOnError ) {
this.failOnError = failOnError ;
}
protected void setInternalFromDate(String text ) {
m_FromDate = text ;
protected void setInternalFromDate(final String fromDa te) {
this.fromDate = fromDate ;
}
protected void setInternalFromLabel(String text ) {
m_FromLabel = text ;
protected void setInternalFromLabel(final String fromLabel ) {
this.fromLabel = fromLabel ;
}
protected void setInternalLabel(String text ) {
m_Label = text ;
protected void setInternalLabel(final String label ) {
this.label = label ;
}
protected void setInternalLocalPath(String text ) {
m_LocalPath = text ;
protected void setInternalLocalPath(final String localPath ) {
this.localPath = localPath ;
}
protected void setInternalNumDays(int d ays) {
m_NumDays = d ays;
protected void setInternalNumDays(final int numD ays) {
this.numDays = numD ays;
}
protected void setInternalOutputFilename(String text ) {
m_OutputFileName = text ;
protected void setInternalOutputFilename(final String outputFileName ) {
this.outputFileName = outputFileName ;
}
protected void setInternalQuiet(boolean quiet) {
m_Q uiet = quiet;
protected void setInternalQuiet(final boolean quiet) {
this.q uiet = quiet;
}
protected void setInternalRecursive(boolean recursive) {
m_R ecursive = recursive;
protected void setInternalRecursive(final boolean recursive) {
this.r ecursive = recursive;
}
protected void setInternalStyle(String style) {
m_S tyle = style;
protected void setInternalStyle(final String style) {
this.s tyle = style;
}
protected void setInternalToDate(String text ) {
m_ToDate = text ;
protected void setInternalToDate(final String toDate ) {
this.toDate = toDate ;
}
protected void setInternalToLabel(String text ) {
m_ToLabel = text ;
protected void setInternalToLabel(final String toLabel ) {
this.toLabel = toLabel ;
}
protected void setInternalUser(String user) {
m_U ser = user;
protected void setInternalUser(final String user) {
this.u ser = user;
}
protected void setInternalVersion(String text ) {
m_Version = text ;
protected void setInternalVersion(final String version ) {
this.version = version ;
}
protected void setInternalWritable(boolean writable) {
m_W ritable = writable;
protected void setInternalWritable(final boolean writable) {
this.w ritable = writable;
}
protected void setInternalFileTimeStamp(CurrentModUpdated timestamp) {
m_ timestamp = timestamp;
protected void setInternalFileTimeStamp(final CurrentModUpdated timestamp) {
this. timestamp = timestamp;
}
protected void setInternalWritableFiles(WritableFiles f iles) {
m_writablefiles = f iles;
protected void setInternalWritableFiles(final WritableFiles writableF iles) {
this.writableFiles = writableF iles;
}
protected void setInternalGetLocalCopy(boolean get) {
m_getLocalCopy = get ;
protected void setInternalGetLocalCopy(final boolean getLocalCopy ) {
this.getLocalCopy = getLocalCopy ;
}
/**
* Gets the sscommand string. "ss" or "c:\path\to\ss"
*
* @return The path to ss.exe or just ss if sscommand is not set.
*/
protected String getSSCommand() {
if (m_SS Dir == null) {
if (ss Dir == null) {
return SS_EXE;
}
return m_SSDir.endsWith(File.separator) ? m_SSDir + SS_EXE : m_SS Dir
return ssDir.endsWith(File.separator) ? ssDir + SS_EXE : ss Dir
+ File.separator + SS_EXE;
}
/**
* Gets the vssserverpath string.
*
* @return null if vssserverpath is not set.
*/
protected String getVsspath() {
return m_ vssPath;
return vssPath;
}
/**
* Gets the quiet string. -O-
*
* @return An empty string if quiet is not set or is false.
* Gets the quiet string. -O-
* @return An empty string if quiet is not set or is false.
*/
protected String getQuiet() {
return m_Q uiet ? FLAG_QUIET : "";
return q uiet ? FLAG_QUIET : "";
}
/**
* Gets the recursive string. "-R"
*
* @return An empty string if recursive is not set or is false.
* Gets the recursive string. "-R"
* @return An empty string if recursive is not set or is false.
*/
protected String getRecursive() {
return m_R ecursive ? FLAG_RECURSION : "";
return r ecursive ? FLAG_RECURSION : "";
}
/**
* Gets the writable string. "-W"
*
* @return An empty string if writable is not set or is false.
* Gets the writable string. "-W"
* @return An empty string if writable is not set or is false.
*/
protected String getWritable() {
return m_W ritable ? FLAG_WRITABLE : "";
return w ritable ? FLAG_WRITABLE : "";
}
/**
* Gets the label string. "-Lbuild1"
*
* Max label length is 32 chars
*
* @return An empty string if label is not set.
* Gets the label string. "-Lbuild1"
* Max label length is 32 chars
* @return An empty string if label is not set.
*/
protected String getLabel() {
if (m_Label != null && m_Label.length() > 0) {
return FLAG_LABEL + getShortLabel();
} else {
return "";
}
String shortLabel="";
if (label != null && label.length() > 0) {
shortLabel = FLAG_LABEL + getShortLabel();
}
return shortLabel;
}
/**
* r eturn at most the 30 first chars of the label, logging a warning message about the truncation
* R eturn at most the 30 first chars of the label, logging a warning message about the truncation
* @return at most the 30 first chars of the label
*/
private String getShortLabel() {
if (m_Label != null && m_Label.length() > 31) {
String label = m_Label.substring(0, 30);
log("Label is longer than 31 characters, truncated to: " + label, Project.MSG_WARN );
return label ;
String shortLabel;
if (label != null && label.length() > 31) {
shortLabel = this.label.substring(0, 30 );
log("Label is longer than 31 characters, truncated to: " + shortLabel, Project.MSG_WARN) ;
} else {
return m_L abel;
shortLabel = l abel;
}
return shortLabel;
}
/**
* Gets the style string. "-Lbuild1"
*
* @return An empty string if label is not set.
* Gets the style string. "-Lbuild1"
* @return An empty string if label is not set.
*/
protected String getStyle() {
return m_Style != null ? m_S tyle : "";
return style != null ? s tyle : "";
}
/**
* Gets the version string. Returns the first specified of version "-V1.0",
* date "-Vd01.01.01", label "-Vlbuild1".
*
* @return An empty string if a version, date and label are not set.
* Gets the version string. Returns the first specified of version "-V1.0",
* date "-Vd01.01.01", label "-Vlbuild1".
* @return An empty string if a version, date and label are not set.
*/
protected String getVersionDateLabel() {
if (m_Version != null) {
return FLAG_VERSION + m_Version;
} else if (m_Date != null) {
return FLAG_VERSION_DATE + m_Date;
String versionDateLabel = "";
if (version != null) {
versionDateLabel = FLAG_VERSION + version;
} else if (date != null) {
versionDateLabel = FLAG_VERSION_DATE + date;
} else {
// Use getShortLabel() so labels longer then 30 char are truncated
// and the user is warned
String l abel = getShortLabel();
if (label != null && !l abel.equals("")) {
return FLAG_VERSION_LABEL + l abel;
String shortL abel = getShortLabel();
if (shortLabel != null && !shortL abel.equals("")) {
versionDateLabel = FLAG_VERSION_LABEL + shortL abel;
}
}
return "" ;
return versionDateLabel ;
}
/**
* Gets the version string.
*
* @return An empty string if a version is not set.
* Gets the version string.
* @return An empty string if a version is not set.
*/
protected String getVersion() {
return m_Version != null ? FLAG_VERSION + m_V ersion : "";
return version != null ? FLAG_VERSION + v ersion : "";
}
/**
* Gets the localpath string. "-GLc:\source" <p>
*
* The localpath is created if it didn't exist.
*
* @return An empty string if localpath is not set.
* Gets the localpath string. "-GLc:\source" <p>
* The localpath is created if it didn't exist.
* @return An empty string if localpath is not set.
*/
protected String getLocalpath() {
if (m_LocalPath == null) {
return "";
} else {
// make sure m_LocalDir exists, create it if it doesn't
File dir = getProject().resolveFile(m_LocalPath);
String lclPath = ""; //set to empty str if no local path return
if (localPath != null) {
//make sure m_LocalDir exists, create it if it doesn't
File dir = getProject().resolveFile(localPath);
if (!dir.exists()) {
boolean done = dir.mkdirs();
if (!done) {
String msg = "Directory " + m_L ocalPath + " creation was not "
String msg = "Directory " + l ocalPath + " creation was not "
+ "successful for an unknown reason";
throw new BuildException(msg, getLocation());
}
getProject().log("Created dir: " + dir.getAbsolutePath());
}
return FLAG_OVERRIDE_WORKING_DIR + m_LocalPath;
}
lclPath = FLAG_OVERRIDE_WORKING_DIR + localPath;
}
return lclPath;
}
/**
* Gets the comment string. "-Ccomment text"
*
* @return A comment of "-" if comment is not set.
* Gets the comment string. "-Ccomment text"
* @return A comment of "-" if comment is not set.
*/
protected String getComment() {
return m_Comment != null ? FLAG_COMMENT + m_C omment : FLAG_COMMENT + "-";
return comment != null ? FLAG_COMMENT + c omment : FLAG_COMMENT + "-";
}
/**
* Gets the auto response string. This can be Y "-I-Y" or N "-I-N".
*
* @return The default value "-I-" if autoresponse is not set.
* Gets the auto response string. This can be Y "-I-Y" or N "-I-N".
* @return The default value "-I-" if autoresponse is not set.
*/
protected String getAutoresponse() {
if (m_A utoResponse == null) {
if (a utoResponse == null) {
return FLAG_AUTORESPONSE_DEF;
} else if (m_A utoResponse.equalsIgnoreCase("Y")) {
} else if (a utoResponse.equalsIgnoreCase("Y")) {
return FLAG_AUTORESPONSE_YES;
} else if (m_A utoResponse.equalsIgnoreCase("N")) {
} else if (a utoResponse.equalsIgnoreCase("N")) {
return FLAG_AUTORESPONSE_NO;
} else {
return FLAG_AUTORESPONSE_DEF;
@@ -448,69 +429,65 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
}
/**
* Gets the login string. This can be user and password, "-Yuser,password"
* or just user "-Yuser".
*
* @return An empty string if login is not set.
* Gets the login string. This can be user and password, "-Yuser,password"
* or just user "-Yuser".
* @return An empty string if login is not set.
*/
protected String getLogin() {
return m_ vssLogin != null ? FLAG_LOGIN + m_ vssLogin : "";
return vssLogin != null ? FLAG_LOGIN + vssLogin : "";
}
/**
* Gets the output file string. "-Ooutput.file"
*
* @return An empty string if user is not set.
* Gets the output file string. "-Ooutput.file"
* @return An empty string if user is not set.
*/
protected String getOutput() {
return m_OutputFileName != null ? FLAG_OUTPUT + m_O utputFileName : "";
return outputFileName != null ? FLAG_OUTPUT + o utputFileName : "";
}
/**
* Gets the user string. "-Uusername"
*
* @return An empty string if user is not set.
* Gets the user string. "-Uusername"
* @return An empty string if user is not set.
*/
protected String getUser() {
return m_User != null ? FLAG_USER + m_U ser : "";
return user != null ? FLAG_USER + u ser : "";
}
/**
* Gets the version string. This can be to-from "-VLbuild2~Lbuild1", from
* "~Lbuild1" or to "-VLbuild2".
*
* @return An empty string if neither tolabel or fromlabel are set.
* Gets the version string. This can be to-from "-VLbuild2~Lbuild1", from
* "~Lbuild1" or to "-VLbuild2".
* @return An empty string if neither tolabel or fromlabel are set.
*/
protected String getVersionLabel() {
if (m_FromLabel == null && m_T oLabel == null) {
if (fromLabel == null && t oLabel == null) {
return "";
}
if (m_FromLabel != null && m_T oLabel != null) {
if (m_F romLabel.length() > 31) {
m_FromLabel = m_F romLabel.substring(0, 30);
if (fromLabel != null && t oLabel != null) {
if (f romLabel.length() > 31) {
fromLabel = f romLabel.substring(0, 30);
log("FromLabel is longer than 31 characters, truncated to: "
+ m_F romLabel, Project.MSG_WARN);
+ f romLabel, Project.MSG_WARN);
}
if (m_T oLabel.length() > 31) {
m_ToLabel = m_T oLabel.substring(0, 30);
if (t oLabel.length() > 31) {
toLabel = t oLabel.substring(0, 30);
log("ToLabel is longer than 31 characters, truncated to: "
+ m_T oLabel, Project.MSG_WARN);
+ t oLabel, Project.MSG_WARN);
}
return FLAG_VERSION_LABEL + m_ToLabel + VALUE_FROMLABEL + m_F romLabel;
} else if (m_F romLabel != null) {
if (m_F romLabel.length() > 31) {
m_FromLabel = m_F romLabel.substring(0, 30);
return FLAG_VERSION_LABEL + toLabel + VALUE_FROMLABEL + f romLabel;
} else if (f romLabel != null) {
if (f romLabel.length() > 31) {
fromLabel = f romLabel.substring(0, 30);
log("FromLabel is longer than 31 characters, truncated to: "
+ m_F romLabel, Project.MSG_WARN);
+ f romLabel, Project.MSG_WARN);
}
return FLAG_VERSION + VALUE_FROMLABEL + m_F romLabel;
return FLAG_VERSION + VALUE_FROMLABEL + f romLabel;
} else {
if (m_T oLabel.length() > 31) {
m_ToLabel = m_T oLabel.substring(0, 30);
if (t oLabel.length() > 31) {
toLabel = t oLabel.substring(0, 30);
log("ToLabel is longer than 31 characters, truncated to: "
+ m_T oLabel, Project.MSG_WARN);
+ t oLabel, Project.MSG_WARN);
}
return FLAG_VERSION_LABEL + m_T oLabel;
return FLAG_VERSION_LABEL + t oLabel;
}
}
@@ -520,50 +497,48 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* @throws BuildException
*/
protected String getVersionDate() throws BuildException {
if (m_FromDate == null && m_T oDate == null
&& m_N umDays == Integer.MIN_VALUE) {
if (fromDate == null && t oDate == null
&& n umDays == Integer.MIN_VALUE) {
return "";
}
if (m_FromDate != null && m_T oDate != null) {
return FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + m_F romDate;
} else if (m_ToDate != null && m_N umDays != Integer.MIN_VALUE) {
if (fromDate != null && t oDate != null) {
return FLAG_VERSION_DATE + toDate + VALUE_FROMDATE + f romDate;
} else if (toDate != null && n umDays != Integer.MIN_VALUE) {
try {
return FLAG_VERSION_DATE + m_T oDate + VALUE_FROMDATE
+ calcDate(m_ToDate, m_N umDays);
return FLAG_VERSION_DATE + t oDate + VALUE_FROMDATE
+ calcDate(toDate, n umDays);
} catch (ParseException ex) {
String msg = "Error parsing date: " + m_T oDate;
String msg = "Error parsing date: " + t oDate;
throw new BuildException(msg, getLocation());
}
} else if (m_FromDate != null && m_N umDays != Integer.MIN_VALUE) {
} else if (fromDate != null && n umDays != Integer.MIN_VALUE) {
try {
return FLAG_VERSION_DATE + calcDate(m_FromDate, m_N umDays)
+ VALUE_FROMDATE + m_F romDate;
return FLAG_VERSION_DATE + calcDate(fromDate, n umDays)
+ VALUE_FROMDATE + f romDate;
} catch (ParseException ex) {
String msg = "Error parsing date: " + m_F romDate;
String msg = "Error parsing date: " + f romDate;
throw new BuildException(msg, getLocation());
}
} else {
return m_F romDate != null ? FLAG_VERSION + VALUE_FROMDATE
+ m_FromDate : FLAG_VERSION_DATE + m_T oDate;
return f romDate != null ? FLAG_VERSION + VALUE_FROMDATE
+ fromDate : FLAG_VERSION_DATE + t oDate;
}
}
/**
* Builds and returns the -G- flag if required.
*
* @return An empty string if get local copy is true.
*/
protected String getGetLocalCopy() {
return (!m_ getLocalCopy) ? FLAG_NO_GET : "";
return (!getLocalCopy) ? FLAG_NO_GET : "";
}
/**
* Gets the value of the fail on error flag.
*
* @return True if the FailOnError flag has been set or if 'writablefiles=skip'.
*/
private boolean getFailOnError() {
return getWritableFiles().equals(WRITABLE_SKIP) ? false : m_F ailOnError;
return getWritableFiles().equals(WRITABLE_SKIP) ? false : f ailOnError;
}
@@ -577,11 +552,11 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* @return The default file time flag, if not set.
*/
public String getFileTimeStamp() {
if (m_ timestamp == null) {
if (timestamp == null) {
return "";
} else if (m_ timestamp.getValue().equals(TIME_MODIFIED)) {
} else if (timestamp.getValue().equals(TIME_MODIFIED)) {
return FLAG_FILETIME_MODIFIED;
} else if (m_ timestamp.getValue().equals(TIME_UPDATED)) {
} else if (timestamp.getValue().equals(TIME_UPDATED)) {
return FLAG_FILETIME_UPDATED;
} else {
return FLAG_FILETIME_DEF;
@@ -594,14 +569,14 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* @return An empty String, if not set.
*/
public String getWritableFiles() {
if (m_writablef iles == null) {
if (writableF iles == null) {
return "";
} else if (m_writablef iles.getValue().equals(WRITABLE_REPLACE)) {
} else if (writableF iles.getValue().equals(WRITABLE_REPLACE)) {
return FLAG_REPLACE_WRITABLE;
} else if (m_writablef iles.getValue().equals(WRITABLE_SKIP)) {
} else if (writableF iles.getValue().equals(WRITABLE_SKIP)) {
// ss.exe exits with '100', when files have been skipped
// so we have to ignore the failure
m_F ailOnError = false;
f ailOnError = false;
return FLAG_SKIP_WRITABLE;
} else {
return "";
@@ -622,7 +597,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
// If location of ss.ini is specified we need to set the
// environment-variable SSDIR to this value
if (m_ serverPath != null) {
if (serverPath != null) {
String[] env = exe.getEnvironment();
if (env == null) {
env = new String[0];
@@ -631,7 +606,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
for (int i = 0; i < env.length; i++) {
newEnv[i] = env[i];
}
newEnv[env.length] = "SSDIR=" + m_ serverPath;
newEnv[env.length] = "SSDIR=" + serverPath;
exe.setEnvironment(newEnv);
}
@@ -651,20 +626,18 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
* Calculates the start date for version comparison.
* <p>
* Calculates the date numDay days earlier than startdate.
* @param from Date The start date.
* @param numDays The number of days to add.
* @param start Date The start date.
* @param daysToAdd The number of days to add.
* @return The calculated date.
* @throws ParseException
*/
private String calcDate(String fromDate, int numDays) throws ParseException {
String toDate = null;
Date currdate = new Date();
Calendar calend = new GregorianCalendar();
currdate = m_DateFormat.parse(fromDate);
calend.setTime(currdate);
calend.add(Calendar.DATE, numDays);
toDate = m_DateFormat.format(calend.getTime());
return toDate;
private String calcDate(String startDate, int daysToAdd) throws ParseException {
Date currentDate = new Date();
Calendar calendar = new GregorianCalendar();
currentDate = dateFormat.parse(startDate);
calendar.setTime(currentDate);
calendar.add(Calendar.DATE, daysToAdd);
return dateFormat.format(calendar.getTime());
}
/**