/** {@inheritDoc} */ public boolean isErrorEnabled() { for ( ScmLogger logger : listeners ) { if ( logger.isErrorEnabled() ) { return true; } } return false; }
/** {@inheritDoc} */ public boolean isErrorEnabled() { for ( ScmLogger logger : listeners ) { if ( logger.isErrorEnabled() ) { return true; } } return false; }
boolean isVersionOk( float min ) { Matcher matcher = VERSION_PATTERN.matcher( versionStr ); if ( matcher.find() ) { String subStr = versionStr.substring( matcher.start(), matcher.end() ); try { version = Float.valueOf( subStr ).floatValue(); } catch ( NumberFormatException e ) { //Print diagnostics and continue (this is not a major error) if ( getLogger().isErrorEnabled() ) { getLogger().error( "Regexp for version did not result in a number: " + subStr, e ); } } } return min <= version; } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( logger.isErrorEnabled() ) { logger.error( error ); logger.error( "Working directory: " + workingDirectory ); logger.error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
if ( getLogger().isErrorEnabled() )
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( getLogger().isErrorEnabled() ) { getLogger().error( error ); getLogger().error( "Working directory: " + workingDirectory ); getLogger().error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
private void processDirectory( String line, int pos ) { String dirPath = line.substring( pos + DIR_MARKER.length(), line.length() - 1 ).replace( '\\', '/' ); try { this.currentDir = StarteamCommandLineUtils.getRelativeChildDirectory( this.workingDirectory, dirPath ); } catch ( IllegalStateException e ) { String error = "Working and checkout directories are not on the same tree"; if ( getLogger().isErrorEnabled() ) { getLogger().error( error ); getLogger().error( "Working directory: " + workingDirectory ); getLogger().error( "Checked out directory: " + dirPath ); } throw new IllegalStateException( error ); } }
/** {@inheritDoc} */ public void consumeLine( String line ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Consume: " + line ); } StringTokenizer tokenizer = new StringTokenizer( line.trim(), SynergyUtil.SEPARATOR ); if ( tokenizer.countTokens() == 2 ) { ChangeFile f = new ChangeFile( tokenizer.nextToken() ); f.setRevision( tokenizer.nextToken() ); entries.add( f ); } else { if ( getLogger().isErrorEnabled() ) { getLogger().error( "Invalid token count in SynergyGetTaskObjects [" + tokenizer.countTokens() + "]" ); } } }
/** {@inheritDoc} */ public void consumeLine( String line ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Consume: " + line ); } StringTokenizer tokenizer = new StringTokenizer( line.trim(), SynergyUtil.SEPARATOR ); if ( tokenizer.countTokens() == 2 ) { ChangeFile f = new ChangeFile( tokenizer.nextToken() ); f.setRevision( tokenizer.nextToken() ); entries.add( f ); } else { if ( getLogger().isErrorEnabled() ) { getLogger().error( "Invalid token count in SynergyGetTaskObjects [" + tokenizer.countTokens() + "]" ); } } }
/** {@inheritDoc} */ protected ScmResult executeAddCommand( ScmProviderRepository repo, ScmFileSet files, String message, boolean binary ) throws ScmException { Commandline cl = createCommandLine( (PerforceScmProviderRepository) repo, files.getBasedir(), files ); PerforceAddConsumer consumer = new PerforceAddConsumer(); try { 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() ); } } catch ( CommandLineException e ) { if ( getLogger().isErrorEnabled() ) { getLogger().error( "CommandLineException " + e.getMessage(), e ); } } return new AddScmResult( cl.toString(), consumer.getAdditions() ); }
private void syncLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer consumer ) { Commandline cl = createLabelsyncCommandLine( (PerforceScmProviderRepository) repo, files.getBasedir(), files, tag ); try { if ( getLogger().isDebugEnabled() ) { getLogger().debug( PerforceScmProvider.clean( "Executing: " + cl.toString() ) ); } 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() ); } } catch ( CommandLineException e ) { if ( getLogger().isErrorEnabled() ) { getLogger().error( "CommandLineException " + e.getMessage(), e ); } } }
private void syncLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer consumer ) { Commandline cl = createLabelsyncCommandLine( (PerforceScmProviderRepository) repo, files.getBasedir(), files, tag ); try { if ( getLogger().isDebugEnabled() ) { getLogger().debug( PerforceScmProvider.clean( "Executing: " + cl.toString() ) ); } 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() ); } } catch ( CommandLineException e ) { if ( getLogger().isErrorEnabled() ) { getLogger().error( "CommandLineException " + e.getMessage(), e ); } } }
private static synchronized PerforceInfoCommand getSingleton( ScmLogger logger, PerforceScmProviderRepository repo ) { if ( singleton == null ) { PerforceInfoCommand pic = new PerforceInfoCommand(); if ( logger != null ) { pic.setLogger( logger ); } try { pic.executeCommand( repo, null, null ); singleton = pic; } catch ( ScmException e ) { if ( pic.getLogger().isErrorEnabled() ) { pic.getLogger().error( "ScmException " + e.getMessage(), e ); } } } return singleton; }
private static synchronized PerforceInfoCommand getSingleton( ScmLogger logger, PerforceScmProviderRepository repo ) { if ( singleton == null ) { PerforceInfoCommand pic = new PerforceInfoCommand(); if ( logger != null ) { pic.setLogger( logger ); } try { pic.executeCommand( repo, null, null ); singleton = pic; } catch ( ScmException e ) { if ( pic.getLogger().isErrorEnabled() ) { pic.getLogger().error( "ScmException " + e.getMessage(), e ); } } } return singleton; }
private Commandline readOpened( PerforceScmProviderRepository prepo, ScmFileSet files, PerforceStatusConsumer consumer ) { Commandline cl = createOpenedCommandLine( prepo, files.getBasedir(), actualLocation ); try { if ( getLogger().isDebugEnabled() ) { getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() ) ); } 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() ); } } catch ( CommandLineException e ) { if ( getLogger().isErrorEnabled() ) { getLogger().error( "CommandLineException " + e.getMessage(), e ); } } return cl; }