Author: peterreilly
Date: Mon Aug 20 01:29:12 2007
New Revision: 567593
URL: http://svn.apache.org/viewvc?rev=567593&view=rev
Log:
reduce size of big method
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Redirector.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Redirector.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Redirector.java?rev=567593&r1=567592&r2=567593&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Redirector.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Redirector.java Mon
Aug 20 01:29:12 2007
@@ -458,56 +458,8 @@
* configuration options.
*/
public synchronized void createStreams() {
- if (out != null && out.length > 0) {
- String logHead = new StringBuffer("Output ").append(
- ((append) ? "appended" : "redirected")).append(
- " to ").toString();
- outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE);
- }
- if (outputProperty != null) {
- if (baos == null) {
- baos = new PropertyOutputStream(outputProperty);
- managingTask.log("Output redirected to property: "
- + outputProperty, Project.MSG_VERBOSE);
- }
- //shield it from being closed by a filtering StreamPumper
- OutputStream keepAliveOutput = new KeepAliveOutputStream(baos);
- outputStream = (outputStream == null) ? keepAliveOutput
- : new TeeOutputStream(outputStream, keepAliveOutput);
- } else {
- baos = null;
- }
-
- if (error != null && error.length > 0) {
- String logHead = new StringBuffer("Error ").append(
- ((append) ? "appended" : "redirected")).append(
- " to ").toString();
- errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE);
- } else if (!(logError || outputStream == null)) {
- long funnelTimeout = 0L;
- OutputStreamFunneler funneler
- = new OutputStreamFunneler(outputStream, funnelTimeout);
- try {
- outputStream = funneler.getFunnelInstance();
- errorStream = funneler.getFunnelInstance();
- } catch (IOException eyeOhEx) {
- throw new BuildException(
- "error splitting output/error streams", eyeOhEx);
- }
- }
- if (errorProperty != null) {
- if (errorBaos == null) {
- errorBaos = new PropertyOutputStream(errorProperty);
- managingTask.log("Error redirected to property: " +
errorProperty,
- Project.MSG_VERBOSE);
- }
- //shield it from being closed by a filtering StreamPumper
- OutputStream keepAliveError = new KeepAliveOutputStream(errorBaos);
- errorStream = (error == null || error.length == 0) ? keepAliveError
- : new TeeOutputStream(errorStream, keepAliveError);
- } else {
- errorBaos = null;
- }
+ outStreams();
+ errorStreams();
if (alwaysLog || outputStream == null) {
OutputStream outputLog
= new LogOutputStream(managingTask, Project.MSG_INFO);
@@ -617,6 +569,62 @@
helper.setFilterChains(inputFilterChains);
inputStream = new ReaderInputStream(
helper.getAssembledReader(), inputEncoding);
+ }
+ }
+
+ /** outStreams */
+ private void outStreams() {
+ if (out != null && out.length > 0) {
+ String logHead = new StringBuffer("Output ").append(
+ ((append) ? "appended" : "redirected")).append(
+ " to ").toString();
+ outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE);
+ }
+ if (outputProperty != null) {
+ if (baos == null) {
+ baos = new PropertyOutputStream(outputProperty);
+ managingTask.log("Output redirected to property: "
+ + outputProperty, Project.MSG_VERBOSE);
+ }
+ //shield it from being closed by a filtering StreamPumper
+ OutputStream keepAliveOutput = new KeepAliveOutputStream(baos);
+ outputStream = (outputStream == null) ? keepAliveOutput
+ : new TeeOutputStream(outputStream, keepAliveOutput);
+ } else {
+ baos = null;
+ }
+ }
+
+ private void errorStreams() {
+ if (error != null && error.length > 0) {
+ String logHead = new StringBuffer("Error ").append(
+ ((append) ? "appended" : "redirected")).append(
+ " to ").toString();
+ errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE);
+ } else if (!(logError || outputStream == null)) {
+ long funnelTimeout = 0L;
+ OutputStreamFunneler funneler
+ = new OutputStreamFunneler(outputStream, funnelTimeout);
+ try {
+ outputStream = funneler.getFunnelInstance();
+ errorStream = funneler.getFunnelInstance();
+ } catch (IOException eyeOhEx) {
+ throw new BuildException(
+ "error splitting output/error streams", eyeOhEx);
+ }
+ }
+ if (errorProperty != null) {
+ if (errorBaos == null) {
+ errorBaos = new PropertyOutputStream(errorProperty);
+ managingTask.log("Error redirected to property: " +
errorProperty,
+ Project.MSG_VERBOSE);
+ }
+ //shield it from being closed by a filtering StreamPumper
+ OutputStream keepAliveError = new KeepAliveOutputStream(errorBaos);
+ errorStream = (error == null || error.length == 0) ? keepAliveError
+ : new TeeOutputStream(errorStream, keepAliveError);
+ } else {
+ errorBaos = null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]