Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.2
-
Fix Version/s: 1.3
-
Labels:None
-
Environment:Windows
-
Number of attachments :
Description
Despite many common-sense reasons not to do so, some users have used the ampersand characters in workfile names.
The following code snippet seems to resolve this:
>cvs diff ChangeLogEntry.java
Index: ChangeLogEntry.java
===================================================================
RCS file: /home/cvspublic/maven/src/plugins-build/changelog/src/main/org/apache/
maven/changelog/ChangeLogEntry.java,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 ChangeLogEntry.java
74a75,85
> /** Escaped <code><</code> entity */
> public static final String LESS_THAN_ENTITY = "<";
> /** Escaped <code>></code> entity */
> public static final String GREATER_THAN_ENTITY = ">";
> /** Escaped <code>&</code> entity */
> public static final String AMPERSAND_ENTITY = "&";
> /** Escaped <code>'</code> entity */
> public static final String APOSTROPHE_ENTITY = "'";
> /** Escaped <code>"</code> entity */
> public static final String QUOTE_ENTITY = """;
>
179c190
< .append(file.getName())
—
> .append(escapeValue(file.getName()))
281a293,335
>
> /**
> * <p>Escape the <code>toString</code> of the given object.
> * For use in an attribute value.</p>
> *
> * swiped from jakarta-commons/betwixt – XMLUtils.java
> *
> * @param value escape <code>value.toString()</code>
> * @return text with characters restricted (for use in attributes) escaped
> */
> public static final String escapeValue(Object value) {
> StringBuffer buffer = new StringBuffer(value.toString());
> for (int i=0, size = buffer.length(); i <size; i++) {
> switch (buffer.charAt
)
> }
> return buffer.toString();
> }
Applied today