id stringlengths 7 14 | text stringlengths 1 106k |
|---|---|
2038852_0 | public static Integer stripAccountIdFromZxtmName(String zxtmName) throws NumberFormatException, ArrayIndexOutOfBoundsException {
return Integer.valueOf(zxtmName.split("_")[0]);
} |
2038852_1 | public static Integer stripLbIdFromZxtmName(String zxtmName) throws NumberFormatException, ArrayIndexOutOfBoundsException {
return Integer.valueOf(zxtmName.split("_")[1]);
} |
2038852_2 | public static Integer stripAccountIdFromZxtmName(String zxtmName) throws NumberFormatException, ArrayIndexOutOfBoundsException {
return Integer.valueOf(zxtmName.split("_")[0]);
} |
2038852_3 | public static Integer stripLbIdFromZxtmName(String zxtmName) throws NumberFormatException, ArrayIndexOutOfBoundsException {
return Integer.valueOf(zxtmName.split("_")[1]);
} |
2038852_4 | public static Integer stripLbIdFromZxtmName(String zxtmName) throws NumberFormatException, ArrayIndexOutOfBoundsException {
return Integer.valueOf(zxtmName.split("_")[1]);
} |
2038852_5 | public static Object deserialize(Class oClass, String xml) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(oClass);
Unmarshaller u = ctx.createUnmarshaller();
return u.unmarshal(new StringReader(xml));
} |
2038852_6 | public static String serialize(Object obj) throws JAXBException {
Class oClass = obj.getClass();
StringWriter sw = new StringWriter(PAGESIZE);
JAXBContext ctx = JAXBContext.newInstance(oClass);
Marshaller m = ctx.createMarshaller();
m.marshal(obj, sw);
return sw.toString();
} |
2038852_7 | public static String getProperty(String key) {
if (props == null)
{
try
{
loadPropertiesFromClasspath();
}
catch (Exception ex)
{
LOG.warn("Unable to load properties file.");
return null;
}
}
return props.getProperty(key);
} |
2038852_8 | public static String getProperty(String key) {
if (props == null)
{
try
{
loadPropertiesFromClasspath();
}
catch (Exception ex)
{
LOG.warn("Unable to load properties file.");
return null;
}
}
return props.getProperty(key);
} |
2038852_9 | public static int getIntProperty(String key) throws Exception {
String property = getProperty(key);
if (property == null) {
LOG.warn("Could not load integer property " + key);
return -1;
}
try {
return Integer.parseInt(property);
}
catch (NumberFormatException nfe) {
LOG.warn("Invalid format for a number ... |
2044534_0 | public void free(ByteBuffer free) {
final ReentrantLock myLock = lock;
myLock.lock();
try {
if (!pool.offer(free)) {
discarded++;
} else {
free.clear();
pooled++;
}
} finally {
myLock.unlock();
}
} |
2044534_1 | @Override
public boolean offer(T value) {
if (size == capacity) {
return false;
}
items[tail] = value;
tail = (tail + 1) % items.length;
size++;
return true;
} |
2044534_2 | @Override
public T poll() {
if (size == 0) {
return null;
}
T item = items[head];
items[head] = null;
size--;
head = (head + 1) % items.length;
return item;
} |
2044534_3 | @Override
public T poll() {
if (size == 0) {
return null;
}
T item = items[head];
items[head] = null;
size--;
head = (head + 1) % items.length;
return item;
} |
2044534_4 | private void grow(int minCapacity) {
if (buffer.capacity() >= minCapacity) {
buffer.limit(minCapacity);
return;
}
// overflow-conscious code
int oldCapacity = buffer.capacity();
int newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0)
newCapacity = minCapaci... |
2044534_5 | private boolean write(ByteBuffer[] buffers) {
try {
long written = handler.getChannel().write(buffers);
if (getLog().isTraceEnabled()) {
getLog().trace(format("%s bytes written", written));
}
if (written < 0) {
close();
return false;
} else... |
2046220_0 | public static void cleanDirectory(File directory) {
boolean success;
if (directory.isDirectory())
{
String[] children = directory.list();
for (int i=0; i<children.length; i++)
{
File child = new File(directory, children[i]);
if (child.isDirectory())
... |
2046220_1 | public static boolean close(ResultSet rs, Logger log) {
boolean b = false;
try {
if(rs!=null)
rs.close();
b = true;
} catch (SQLException e) {
log.error("The resultset could not be closed!", e);
}
return b;
} |
2046220_2 | public String getTableClassName(String tableName)
{
return StringUtils.toString(config.getTableClassPrefix(), "")
+ deriveClassName(tableName)
+ StringUtils.toString(config.getTableClassSuffix(),"");
} |
2046220_3 | public String getAccessorName(DBColumn column)
{
return deriveAccessorName(column.getName(), getJavaType(column));
} |
2046220_4 | public String getMutatorName(DBColumn column)
{
return deriveMutatorName(column.getName(), getJavaType(column));
} |
2046220_5 | public DBDatabase loadDbModel() {
DBDatabase db = new InMemoryDatabase();
try {
con = openJDBCConnection(config);
populateDatabase(db);
}
catch (SQLException e)
{
throw new RuntimeException("Unable to read database metadata: " + e.getMessage(), e);... |
2046220_6 | public static String toString(Object value, String defValue)
{
return ((value!=null) ? value.toString() : defValue);
} |
2046220_7 | public static String valueOf(Object value)
{
return toString(value, "null");
} |
2046220_8 | public static String valueOf(Object value)
{
return toString(value, "null");
} |
2046220_9 | public static String coalesce(String preferred, String alternative)
{
return isNotEmpty(preferred) ? preferred : alternative;
} |
2055952_0 | public String toString()
{
return "X=" + mX + ", Y=" + mY;
} |
2055952_1 | public GraphSerie(String title, ArrayList<Datapoint> serie)
{
if (serie != null)
{
m_serie = serie;
} else
{
m_serie = new ArrayList<Datapoint>();
}
m_title = title;
if (m_serie != null)
{
Log.i(TAG, "Added Serie " + m_title + " with " + m_serie.size() + " entries");
} else
{
Log.i(TAG, "Added Serie w... |
2055952_2 | protected byte[] marshall()
{
//return toJson();
turn serialize();
} |
2058044_0 | public static Value asLiteral(Object o) {
if (o instanceof String) {
return asLiteral((String)o);
} else if (o instanceof URI) {
return asLiteral((URI) o);
} else if (o instanceof Date) {
return asLiteral((Date)o);
} else if (o instanceof Integer) {
return asLiteral((Integer) o);
} else {
return null;
}... |
2058044_1 | public static Value asResource(java.net.URI uri) {
return Values.literal(uri.toString());
} |
2061716_0 | public List<Schema> getSchemas() {
return schemas.schemas;
} |
2061716_1 | @Override
public Node runMapping(final MetadataRecord metadataRecord) throws MappingException {
LOG.trace("Running mapping for record {}", metadataRecord);
SimpleBindings bindings = Utils.bindingsFor(recMapping.getFacts(),
recMapping.getRecDefTree().getRecDef(), metadataRecord.getRootNode(),
rec... |
206320_10 | public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
return (CheckOutScmResult) execute( repository, fileSet, parameters );
} |
206320_11 | public CheckOutScmResult checkout( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
return (CheckOutScmResult) execute( repository, fileSet, parameters );
} |
206320_12 | public StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (StatusScmResult) execute( repository, fileSet, parameters );
} |
206320_13 | public StatusScmResult status( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (StatusScmResult) execute( repository, fileSet, parameters );
} |
206320_14 | public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (TagScmResult) execute( repository, fileSet, parameters );
} |
206320_15 | public TagScmResult tag( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (TagScmResult) execute( repository, fileSet, parameters );
} |
206320_16 | public ChangeLogScmResult changelog( ScmProviderRepository repo, ScmFileSet testFileSet, CommandParameters params )
throws ScmException
{
return (ChangeLogScmResult) execute( repo, testFileSet, params );
} |
206320_17 | public ChangeLogScmResult changelog( ScmProviderRepository repo, ScmFileSet testFileSet, CommandParameters params )
throws ScmException
{
return (ChangeLogScmResult) execute( repo, testFileSet, params );
} |
206320_18 | public ChangeLogScmResult changelog( ScmProviderRepository repo, ScmFileSet testFileSet, CommandParameters params )
throws ScmException
{
return (ChangeLogScmResult) execute( repo, testFileSet, params );
} |
206320_19 | public LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (LoginScmResult) execute( repository, fileSet, parameters );
} |
206320_20 | public LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (LoginScmResult) execute( repository, fileSet, parameters );
} |
206320_21 | public LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (LoginScmResult) execute( repository, fileSet, parameters );
} |
206320_22 | public LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (LoginScmResult) execute( repository, fileSet, parameters );
} |
206320_23 | public LoginScmResult login( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (LoginScmResult) execute( repository, fileSet, parameters );
} |
206320_24 | public ExportScmResult export( ScmProviderRepository repository, ScmFileSet scmFileSet, CommandParameters params )
throws ScmException
{
return (ExportScmResult) execute( repository, scmFileSet, params );
} |
206320_25 | public ExportScmResult export( ScmProviderRepository repository, ScmFileSet scmFileSet, CommandParameters params )
throws ScmException
{
return (ExportScmResult) execute( repository, scmFileSet, params );
} |
206320_26 | public ExportScmResult export( ScmProviderRepository repository, ScmFileSet scmFileSet, CommandParameters params )
throws ScmException
{
return (ExportScmResult) execute( repository, scmFileSet, params );
} |
206320_27 | public ExportScmResult export( ScmProviderRepository repository, ScmFileSet scmFileSet, CommandParameters params )
throws ScmException
{
return (ExportScmResult) execute( repository, scmFileSet, params );
} |
206320_28 | public ExportScmResult export( ScmProviderRepository repository, ScmFileSet scmFileSet, CommandParameters params )
throws ScmException
{
return (ExportScmResult) execute( repository, scmFileSet, params );
} |
206320_29 | public AddScmResult add( ScmProviderRepository repo, ScmFileSet scmFileSet, CommandParameters commandParameters )
throws ScmException
{
return (AddScmResult) execute( repo, scmFileSet, commandParameters );
} |
206320_30 | public AddScmResult add( ScmProviderRepository repo, ScmFileSet scmFileSet, CommandParameters commandParameters )
throws ScmException
{
return (AddScmResult) execute( repo, scmFileSet, commandParameters );
} |
206320_31 | public BlameScmResult blame( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (BlameScmResult) execute( repository, fileSet, parameters );
} |
206320_32 | public UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (UpdateScmResult) execute( repository, fileSet, parameters );
} |
206320_33 | public UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (UpdateScmResult) execute( repository, fileSet, parameters );
} |
206320_34 | public UpdateScmResult update( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
throws ScmException
{
return (UpdateScmResult) execute( repository, fileSet, parameters );
} |
206320_35 | public ScmProviderRepository makeProviderScmRepository( String scmSpecificUrl, char delimiter )
throws ScmRepositoryException
{
List<String> validationMessages = new ArrayList<String>();
String[] tokens = StringUtils.split( scmSpecificUrl, Character.toString( delimiter ) );
// [[user][/pass]@host[:port]... |
206320_36 | public String getScmType()
{
return "accurev";
} |
206320_37 | public String toString()
{
return String.format( "Transaction: %d, %s at %tc by %s -'%s'", this.getId(), this.getTranType(),
this.getWhen(), this.getAuthor(), this.getComment() );
} |
206320_38 | public void consumeLine( String line )
{
Matcher m = filePattern.matcher( line );
if ( m.matches() )
{
int i = 1;
String fileName = null;
while ( fileName == null && i <= m.groupCount() )
{
fileName = m.group( i++ );
}
if ( fileName != null )
... |
206320_39 | public void consumeLine( String line )
{
Matcher m = filePattern.matcher( line );
if ( m.matches() )
{
int i = 1;
String fileName = null;
while ( fileName == null && i <= m.groupCount() )
{
fileName = m.group( i++ );
}
if ( fileName != null )
... |
206320_40 | public void consumeLine( String line )
{
Matcher m = filePattern.matcher( line );
if ( m.matches() )
{
int i = 1;
String fileName = null;
while ( fileName == null && i <= m.groupCount() )
{
fileName = m.group( i++ );
}
if ( fileName != null )
... |
206320_41 | public void consumeLine( String line )
{
Matcher m = filePattern.matcher( line );
if ( m.matches() )
{
int i = 1;
String fileName = null;
while ( fileName == null && i <= m.groupCount() )
{
fileName = m.group( i++ );
}
if ( fileName != null )
... |
206320_42 | public void consumeLine( String line )
{
// first group is the fileName
// second group is the indicator expected "backed","stale","overlap","underlap","no such elem";
Pattern pattern = STAT_PATTERN;
Matcher matcher = pattern.matcher( line );
if ( matcher.matches() )
{
File file = new Fi... |
206320_43 | public List<File> promoteAll( File baseDir, String commitMessage )
throws AccuRevException
{
setWorkingDirectory( baseDir );
String[] promote = { "promote", "-p", "-K", "-c", commitMessage };
List<File> promotedFiles = new ArrayList<File>();
int ret = executeCommandLine( promote, null, new FileConsu... |
206320_44 | public List<File> promote( File basedir, List<File> files, String message )
throws AccuRevException
{
if ( StringUtils.isBlank( message ) )
{
message = AccuRev.DEFAULT_PROMOTE_MESSAGE;
}
List<File> promotedFiles = new ArrayList<File>();
return executeCommandLine( basedir, new String[] { ... |
206320_45 | public boolean login( String user, String password )
throws AccuRevException
{
// TODO Raise bug against plexus commandline - can't set workingdir to null
// and will get an error if the working directory is deleted.
cl.setWorkingDirectory( "." );
authArgs = EMPTY_STRING_ARRAY;
AuthTokenConsumer... |
206320_46 | public List<File> popExternal( File basedir, String versionSpec, String tranSpec, Collection<File> elements )
throws AccuRevException
{
if ( elements == null || elements.isEmpty() )
{
elements = Collections.singletonList( new File( "/./" ) );
}
if ( StringUtils.isBlank( tranSpec ) )
{
... |
206320_47 | public boolean mkws( String basisStream, String workspaceName, File basedir )
throws AccuRevException
{
setWorkingDirectory( basedir );
String[] mkws = { "mkws", "-b", basisStream, "-w", workspaceName, "-l", basedir.getAbsolutePath() };
return executeCommandLine( mkws );
} |
206320_48 | public List<File> update( File baseDir, String transactionId )
throws AccuRevException
{
if ( transactionId == null )
{
transactionId = "highest";
}
String[] update = { "update", "-t", transactionId };
setWorkingDirectory( baseDir );
List<File> updatedFiles = new ArrayList<File>();
... |
206320_49 | public AccuRevInfo info( File basedir )
throws AccuRevException
{
setWorkingDirectory( basedir );
String[] info = { "info" };
AccuRevInfo result = new AccuRevInfo( basedir );
executeCommandLine( info, null, new InfoConsumer( result ) );
return result;
} |
206320_50 | public boolean reactivate( String workSpaceName )
throws AccuRevException
{
String[] reactivate = { "reactivate", "wspace", workSpaceName };
return executeCommandLine( reactivate, null, new CommandOutputConsumer( getLogger(), null ) ) == 0;
} |
206320_51 | public void reset()
{
// TODO find out why Commandline allows executable, args etc to be initialised to
// null, but not allowing them to be reset to null. This results is weird "clear"
// behaviour. It is just safer to start again.
cl = new Commandline();
commandLines = new StringBuilder();
err... |
206320_52 | public List<File> add( File basedir, List<File> elements, String message )
throws AccuRevException
{
if ( StringUtils.isBlank( message ) )
{
message = AccuRev.DEFAULT_ADD_MESSAGE;
}
boolean recursive = false;
if ( elements == null || elements.isEmpty() )
{
elements = Collecti... |
206320_53 | public boolean mksnap( String snapShotName, String basisStream )
throws AccuRevException
{
return executeCommandLine( new String[] { "mksnap", "-s", snapShotName, "-b", basisStream, "-t", "now" } );
} |
206320_54 | public List<File> statTag( String streamName )
throws AccuRevException
{
List<File> taggedFiles = new ArrayList<File>();
String[] stat = new String[] { "stat", "-a", "-ffl", "-s", streamName };
return executeCommandLine( null, stat, null, FileConsumer.STAT_PATTERN, taggedFiles ) ? taggedFiles : null;
} |
206320_55 | public CategorisedElements statBackingStream( File basedir, Collection<File> elements )
throws AccuRevException
{
CategorisedElements catElems = new CategorisedElements();
if ( elements.isEmpty() )
{
return catElems;
}
String[] args = { "stat", "-b", "-ffr" };
boolean ret =
e... |
206320_56 | public List<BlameLine> annotate( File basedir, File file )
throws AccuRevException
{
String[] annotate = { "annotate", "-ftud" };
List<BlameLine> lines = new ArrayList<BlameLine>();
AnnotateConsumer stdout = new AnnotateConsumer( lines, getLogger() );
return executeCommandLine( basedir, annotate, Co... |
206320_57 | public List<FileDifference> diff( String baseStream, String fromTimeSpec, String toTimeSpec )
throws AccuRevException
{
String timeSpec = fromTimeSpec + "-" + toTimeSpec;
String[] diff = { "diff", "-fx", "-a", "-i", "-v", baseStream, "-V", baseStream, "-t", timeSpec };
List<FileDifference> results = new... |
206320_58 | public Stream showStream( String stream )
throws AccuRevException
{
String[] show = { "show", "-s", stream, "-fx", "streams" };
List<Stream> streams = new ArrayList<Stream>();
StreamsConsumer stdout = new StreamsConsumer( getLogger(), streams );
return executeCommandLine( show, null, stdout ) == 0 &... |
206320_59 | public List<BlameLine> getLines()
{
return lines;
} |
206320_60 | public String getClientVersion()
{
return clientVersion;
} |
206320_61 | protected String getRepositoryURL( File path )
throws ScmException
{
// Note: I need to supply just 1 absolute path, but ScmFileSet won't let me without
// a basedir (which isn't used here anyway), so use a dummy file.
SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand();
infoCmd.setLogger( th... |
206320_62 | protected void parseLine( String line )
{
String statusString = line.substring( 0, 1 );
String file = line.substring( 3 ).trim();
//[SCM-368]
if ( file.startsWith( getWorkingDirectory().getAbsolutePath() ) )
{
file = StringUtils.substring( file, getWorkingDirectory().getAbsolutePath().length... |
206320_63 | static Commandline buildCmd( File workingDir, String[] cmdAndArgs )
throws ScmException
{
Commandline cmd = new Commandline();
cmd.setExecutable( HgCommandConstants.EXEC );
cmd.addArguments( cmdAndArgs );
if ( workingDir != null )
{
cmd.setWorkingDirectory( workingDir.getAbsolutePath() )... |
206322_10 | @Override
public File createArchive( final Assembly assembly, final String fullName, final String format,
final AssemblerConfigurationSource configSource, boolean recompressZippedFiles,
String mergeManifestMode )
throws ArchiveCreationException, AssemblyFormatti... |
206322_11 | @Override
public File createArchive( final Assembly assembly, final String fullName, final String format,
final AssemblerConfigurationSource configSource, boolean recompressZippedFiles,
String mergeManifestMode )
throws ArchiveCreationException, AssemblyFormatti... |
206322_12 | protected Archiver createArchiver( final String format, final boolean includeBaseDir, final String finalName,
final AssemblerConfigurationSource configSource,
final List<ContainerDescriptorHandler> containerHandlers,
... |
206322_13 | protected Archiver createArchiver( final String format, final boolean includeBaseDir, final String finalName,
final AssemblerConfigurationSource configSource,
final List<ContainerDescriptorHandler> containerHandlers,
... |
206322_14 | protected Archiver createArchiver( final String format, final boolean includeBaseDir, final String finalName,
final AssemblerConfigurationSource configSource,
final List<ContainerDescriptorHandler> containerHandlers,
... |
206322_15 | protected Archiver createArchiver( final String format, final boolean includeBaseDir, final String finalName,
final AssemblerConfigurationSource configSource,
final List<ContainerDescriptorHandler> containerHandlers,
... |
206322_16 | protected Archiver createWarArchiver()
throws NoSuchArchiverException
{
final WarArchiver warArchiver = (WarArchiver) archiverManager.getArchiver( "war" );
warArchiver.setIgnoreWebxml( false ); // See MNG-1274
return warArchiver;
} |
206322_17 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
206322_18 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
206322_19 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
206322_20 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
206322_21 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
206322_22 | protected Archiver createTarArchiver( final String format, final TarLongFileMode tarLongFileMode )
throws NoSuchArchiverException
{
final TarArchiver tarArchiver = (TarArchiver) archiverManager.getArchiver( "tar" );
final int index = format.indexOf( '.' );
if ( index >= 0 )
{
TarArchiver.Tar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.