Browse Source

Merge fix for PR 23711 from ANT_16_BRANCH

PR: 23711


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275460 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 21 years ago
parent
commit
33d19ef67e
1 changed files with 16 additions and 10 deletions
  1. +16
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java

+ 16
- 10
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -377,18 +377,24 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
*/
protected String getLabel() {
if (m_Label != null && m_Label.length() > 0) {
if (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 FLAG_LABEL + label;
} else {
return FLAG_LABEL + m_Label;
}
return FLAG_LABEL + getShortLabel();
} else {
return "";
}
}

/**
* return 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;
} else {
return m_Label;
}
}
/**
* Gets the style string. "-Lbuild1"
*
@@ -410,9 +416,9 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
} else if (m_Date != null) {
return FLAG_VERSION_DATE + m_Date;
} else {
// Use getLabel() so labels longer then 30 char are truncated
// Use getShortLabel() so labels longer then 30 char are truncated
// and the user is warned
String label = getLabel();
String label = getShortLabel();
if (!label.equals("") && label != null) {
return FLAG_VERSION_LABEL + label;
}


Loading…
Cancel
Save