Submitted by: dion@multitask.com.au via "Vincent Massol" <vmassol@octo.com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272158 13f79535-47bb-0310-9956-ffa450edef68master
@@ -14,12 +14,12 @@ import java.io.IOException; | |||||
import java.io.OutputStreamWriter; | import java.io.OutputStreamWriter; | ||||
import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
import java.text.SimpleDateFormat; | |||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.util.Enumeration; | import java.util.Enumeration; | ||||
import java.util.Properties; | import java.util.Properties; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.text.SimpleDateFormat; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
@@ -28,7 +28,6 @@ import org.apache.myrmidon.api.TaskException; | |||||
import org.apache.myrmidon.framework.Execute; | import org.apache.myrmidon.framework.Execute; | ||||
import org.apache.myrmidon.framework.FileSet; | import org.apache.myrmidon.framework.FileSet; | ||||
import org.apache.tools.todo.types.Commandline; | import org.apache.tools.todo.types.Commandline; | ||||
import org.apache.tools.todo.types.DirectoryScanner; | |||||
/** | /** | ||||
* Change log task. | * Change log task. | ||||
@@ -220,7 +219,7 @@ public class ChangeLog | |||||
} | } | ||||
*/ | */ | ||||
final ChangeLogParser parser = new ChangeLogParser( userList ); | |||||
final ChangeLogParser parser = new ChangeLogParser( userList, getContext() ); | |||||
final Execute exe = new Execute(); | final Execute exe = new Execute(); | ||||
exe.setWorkingDirectory( m_dir ); | exe.setWorkingDirectory( m_dir ); | ||||
exe.setCommandline( command ); | exe.setCommandline( command ); | ||||
@@ -297,7 +296,7 @@ public class ChangeLog | |||||
final ArrayList results = new ArrayList(); | final ArrayList results = new ArrayList(); | ||||
for( int i = 0; i < entrySet.length; i++ ) | for( int i = 0; i < entrySet.length; i++ ) | ||||
{ | { | ||||
final CVSEntry cvsEntry = entrySet[i ]; | |||||
final CVSEntry cvsEntry = entrySet[ i ]; | |||||
final Date date = cvsEntry.getDate(); | final Date date = cvsEntry.getDate(); | ||||
if( null != m_start && m_start.after( date ) ) | if( null != m_start && m_start.after( date ) ) | ||||
{ | { | ||||
@@ -312,7 +311,7 @@ public class ChangeLog | |||||
results.add( cvsEntry ); | results.add( cvsEntry ); | ||||
} | } | ||||
return (CVSEntry[])results.toArray( new CVSEntry[results.size() ] ); | |||||
return (CVSEntry[])results.toArray( new CVSEntry[ results.size() ] ); | |||||
} | } | ||||
/** | /** | ||||
@@ -12,9 +12,10 @@ import java.text.SimpleDateFormat; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Hashtable; | import java.util.Hashtable; | ||||
import java.util.Properties; | import java.util.Properties; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.myrmidon.api.TaskContext; | |||||
/** | /** | ||||
* A class used to parse the output of the CVS log command. | * A class used to parse the output of the CVS log command. | ||||
@@ -48,6 +49,8 @@ class ChangeLogParser | |||||
private int m_status = GET_FILE; | private int m_status = GET_FILE; | ||||
private final TaskContext m_context; | |||||
/** rcs entries */ | /** rcs entries */ | ||||
private final Hashtable m_entries = new Hashtable(); | private final Hashtable m_entries = new Hashtable(); | ||||
@@ -58,9 +61,11 @@ class ChangeLogParser | |||||
* | * | ||||
* @param userList the userlist | * @param userList the userlist | ||||
*/ | */ | ||||
public ChangeLogParser( Properties userList ) | |||||
ChangeLogParser( final Properties userList, | |||||
final TaskContext context ) | |||||
{ | { | ||||
m_userList = userList; | m_userList = userList; | ||||
m_context = context; | |||||
} | } | ||||
/** | /** | ||||
@@ -80,7 +85,7 @@ class ChangeLogParser | |||||
*/ | */ | ||||
public void stderr( String line ) | public void stderr( String line ) | ||||
{ | { | ||||
//ignore | |||||
m_context.error( line ); | |||||
} | } | ||||
/** | /** | ||||
@@ -280,6 +280,12 @@ public class ChangeLogTask | |||||
throw new BuildException( ioe.toString() ); | throw new BuildException( ioe.toString() ); | ||||
} | } | ||||
final String errors = handler.getErrors(); | |||||
if( null != errors ) | |||||
{ | |||||
log( errors, Project.MSG_ERR ); | |||||
} | |||||
final CVSEntry[] entrySet = parser.getEntrySetAsArray(); | final CVSEntry[] entrySet = parser.getEntrySetAsArray(); | ||||
final CVSEntry[] filteredEntrySet = filterEntrySet( entrySet ); | final CVSEntry[] filteredEntrySet = filterEntrySet( entrySet ); | ||||
writeChangeLog( filteredEntrySet ); | writeChangeLog( filteredEntrySet ); | ||||
@@ -72,12 +72,25 @@ class RedirectingStreamHandler | |||||
private final ChangeLogParser m_parser; | private final ChangeLogParser m_parser; | ||||
private BufferedReader m_reader; | private BufferedReader m_reader; | ||||
private InputStreamReader m_error; | private InputStreamReader m_error; | ||||
private final StringBuffer m_errors = new StringBuffer(); | |||||
public RedirectingStreamHandler( final ChangeLogParser parser ) | |||||
RedirectingStreamHandler( final ChangeLogParser parser ) | |||||
{ | { | ||||
m_parser = parser; | m_parser = parser; | ||||
} | } | ||||
String getErrors() | |||||
{ | |||||
if( 0 == m_errors.length() ) | |||||
{ | |||||
return null; | |||||
} | |||||
else | |||||
{ | |||||
return m_errors.toString(); | |||||
} | |||||
} | |||||
/** | /** | ||||
* Install a handler for the input stream of the subprocess. | * Install a handler for the input stream of the subprocess. | ||||
* | * | ||||
@@ -127,7 +140,11 @@ class RedirectingStreamHandler | |||||
//http://developer.java.sun.com/developer/bugParade/bugs/4329985.html) | //http://developer.java.sun.com/developer/bugParade/bugs/4329985.html) | ||||
while( m_error.ready() ) | while( m_error.ready() ) | ||||
{ | { | ||||
m_error.read(); | |||||
final int value = m_error.read(); | |||||
if( -1 != value ) | |||||
{ | |||||
m_errors.append( (char)value ); | |||||
} | |||||
} | } | ||||
} | } | ||||