Browse Source

add an option to suppress processor warnings. PR 18897.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@720775 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
a0c1be104d
4 changed files with 46 additions and 1 deletions
  1. +5
    -0
      WHATSNEW
  2. +8
    -0
      docs/manual/CoreTasks/style.html
  3. +25
    -0
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  4. +8
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

+ 5
- 0
WHATSNEW View File

@@ -555,6 +555,11 @@ Other changes:
* <xslt> now fails early if a specified stylesheet doesn't exist.
Bugzilla Report 34525.

* <xslt> now has an option to supress transformer warnings. This
option only has an effect for processors that support this feature;
the "trax" processor included with Ant does support it.
Bugzilla Report 18897.

Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================



+ 8
- 0
docs/manual/CoreTasks/style.html View File

@@ -222,6 +222,14 @@ element which is used to perform Entity and URI resolution.</p>
<em>Since Ant 1.7</em>.</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">supressWarnings</td>
<td valign="top">Whether processor warnings shall be suppressed.
This option requires support by the processor, it is supported by
the trax processor bundled with Ant.
<em>Since Ant 1.8.0</em>.</td>
<td valign="top" align="center">No, default is false.</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>



+ 25
- 0
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -169,6 +169,13 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/
public static final String PROCESSOR_TRAX = "trax";

/**
* whether to suppress warnings.
*
* @since Ant 1.8.0
*/
private boolean suppressWarnings = false;

/**
* Creates a new XSLTProcess Task.
*/
@@ -513,6 +520,24 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
this.fileDirParameter = fileDirParameter;
}

/**
* Whether to suppress warning messages of the processor.
*
* @since Ant 1.8.0
*/
public void setSuppressWarnings(boolean b) {
suppressWarnings = b;
}

/**
* Whether to suppress warning messages of the processor.
*
* @since Ant 1.8.0
*/
public boolean getSuppressWarnings() {
return suppressWarnings;
}

/**
* Load processor here instead of in setProcessor - this will be
* called from within execute, so we have access to the latest


+ 8
- 1
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -122,6 +122,9 @@ public class TraXLiaison implements XSLTLiaison3, ErrorListener, XSLTLoggerAware
/** factory attributes */
private Vector attributes = new Vector();

/** whether to suppress warnings */
private boolean suppressWarnings = false;

/**
* Constructor for TraXLiaison.
* @throws Exception never
@@ -497,7 +500,9 @@ public class TraXLiaison implements XSLTLiaison3, ErrorListener, XSLTLoggerAware
* @param e the exception to log.
*/
public void warning(TransformerException e) {
logError(e, "Warning");
if (!suppressWarnings) {
logError(e, "Warning");
}
}

private void logError(TransformerException e, String type) {
@@ -588,5 +593,7 @@ public class TraXLiaison implements XSLTLiaison3, ErrorListener, XSLTLoggerAware
= (XSLTProcess.OutputProperty) props.nextElement();
setOutputProperty(prop.getName(), prop.getValue());
}

suppressWarnings = xsltTask.getSuppressWarnings();
}
}

Loading…
Cancel
Save