StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
msg.append( '\n' );
msg.append( "Command line was:" + cmdLine );
throw new CommandLineException( msg.toString() );
}
}
catch ( CommandLineException e )
{
if ( getLogger().isErrorEnabled() )
{
getLogger().error( "CommandLineException " + e.getMessage(), e );
}
}
boolean clientspecExists = consumer.isSuccess();
// Perform the actual checkout using that clientspec
try
{
if ( clientspecExists )
{
try
{
getLastChangelist( prepo, workingDirectory, specname );
cl = createCommandLine( prepo, workingDirectory, version, specname );
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Executing: " + PerforceScmProvider.clean( cl.toString() ) );
}
Process proc = cl.execute();
BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream() ) );
String line;
while ( ( line = br.readLine() ) != null )
{
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Consuming: " + line );
}
consumer.consumeLine( line );
}
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );
if ( exitCode != 0 )
{
String cmdLine = CommandLineUtils.toString( cl.getCommandline() );
StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
msg.append( '\n' );
msg.append( "Command line was:" + cmdLine );
throw new CommandLineException( msg.toString() );
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Perforce sync complete." );
}