Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
/**
* Returns the request line of this request.
* @return the request line.
*/
//TODO add a setter for request line?
| 0 |
public static void main( String[] argv ) { | 0 |
import org.apache.sshd.common.subsystem.sftp.extensions.ParserUtils;
import org.apache.sshd.common.util.buffer.BufferUtils;
return "info";
}
@Override
public boolean executeCommand(String args, BufferedReader stdin, PrintStream stdout, PrintStream stderr) throws Exception {
ValidateUtils.checkTrue(GenericUtils.isEmpty(args), "Unexpected arguments: %s", args);
SftpClient sftp = getClient();
Map<String,byte[]> extensions = sftp.getServerExtensions();
Map<String,?> parsed = ParserUtils.parse(null);
for (Map.Entry<String,byte[]> ee : extensions.entrySet()) {
String name = ee.getKey();
byte[] value = ee.getValue();
Object info = parsed.get(name);
stdout.append('\t').append(name).append(": ");
if (info == null) {
stdout.println(BufferUtils.printHex(value));
} else {
stdout.println(info);
}
}
return false;
}
},
new CommandExecutor() {
@Override
public String getName() { | 0 |
BCFile.Writer _cbw = new BCFile.Writer(dos, null, "gz", CachedConfiguration.getInstance(),
aconf); | 0 |
BufferInfo bufferinfo = buffer; | 0 |
* to use the standard providers and components. To use this manager:
* <li>Set the logger using {@link #setLogger} (optional).
* <li>Add custom providers and components.
* @version $Revision: 1.5 $ $Date: 2002/11/17 03:37:28 $ | 0 |
return Base64.encodeBase64URLSafeString(rawValue); | 0 |
return JSON_VALUE_PARSERS.get(fieldType.getTypeName()).apply((String) jsonBQValue); | 0 |
public static LDAPExpr apply(LDAPExpr e)
if (e == null)
throw new NullPointerException("cannot apply Not to a null expression");
if (e.equals(Expressions.T))
if (e.equals(Expressions.F))
return new Not(e);
private Not(LDAPExpr child)
this.children = new LDAPExpr[] { child };
public boolean eval(Map<String, ?> map)
return !children[0].eval(map);
public void setChild(LDAPExpr child)
this.children = new LDAPExpr[] { child };
public boolean equals(Object other)
if (other instanceof Not)
Not that = (Not) other;
return children[0].equals(that.children[0]);
StringBuffer buf = new StringBuffer(256);
buf.append("(!");
buf.append(" ").append(children[0]).append(" ");
buf.append(")"); | 0 |
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.accumulo.core.data.thrift.TColumn;
import org.junit.BeforeClass;
import org.junit.Test;
public class ColumnTest {
static Column col[];
@BeforeClass
public static void setup() {
col = new Column[5];
col[0] = new Column("colfam".getBytes(), "colq".getBytes(), "colv".getBytes());
col[1] = new Column("colfam".getBytes(), "colq".getBytes(), "colv".getBytes());
col[2] = new Column(new byte[0], new byte[0], new byte[0]);
col[3] = new Column(null, null, null);
col[4] = new Column("colfam".getBytes(), "cq".getBytes(), "cv".getBytes());
}
@Test
@Test
assertEquals(0, col[i].compareTo(col[j]));
assertNotEquals(0, col[i].compareTo(col[j]));
@Test
assertEquals(col[i].equals(col[j]), col[i].compareTo(col[j]) == 0);
@Test
public void testWriteReadFields() throws IOException {
for (Column c : col) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
c.write(new DataOutputStream(baos));
Column other = new Column();
other.readFields(new DataInputStream(new ByteArrayInputStream(baos.toByteArray())));
assertEquals(c, other);
}
}
@Test
public void testThriftRoundTrip() {
for (Column c : col) {
TColumn tc = c.toThrift();
assertEquals(c, new Column(tc));
} | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/converters/LongConverter.java,v 1.6 2003/10/05 13:34:53 rdonkin Exp $
* $Revision: 1.6 $
* $Date: 2003/10/05 13:34:53 $
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* notice, this list of conditions and the following disclaimer.
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgement:
* "This product includes software developed by the
* 4. The names "Apache", "The Jakarta Project", "Commons", and "Apache Software
* from this software without prior written permission. For written
* 5. Products derived from this software may not be called "Apache",
* "Apache" nor may "Apache" appear in their names without prior
* written permission of the Apache Software Foundation.
*/
* @version $Revision: 1.6 $ $Date: 2003/10/05 13:34:53 $ | 0 |
public long prepQueueStartTime= -1;
| 0 |
import org.apache.accumulo.core.security.Credentials;
stopTabletServer(instance, new Credentials(principal, token), stopOpts.args, opts.force);
stopServer(instance, new Credentials(principal, token), everything);
private static void stopServer(final Instance instance, final Credentials credentials, final boolean tabletServersToo) throws AccumuloException,
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
client.shutdown(Tracer.traceInfo(), credentials.toThrift(instance), tabletServersToo);
private static void stopTabletServer(final Instance instance, final Credentials creds, List<String> servers, final boolean force) throws AccumuloException,
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
client.shutdownTabletServer(Tracer.traceInfo(), creds.toThrift(instance), finalServer, force); | 0 |
* @return An {@link IoWriteFuture} that can be used to wait for packet write
* completion - {@code null} if the registered {@link ReservedSessionMessagesHandler}
* decided to handle the command internally
if (handler.handleUnimplementedMessage(this, cmd, buffer)) {
return null;
}
| 0 |
new MarkerShorthandFactory(p)); | 0 |
* RFile metadata is stored at the end of the file. Inorder to read an RFile, its length must be
* known. This provides a way to pass an InputStream and length for reading an RFile. | 0 |
public void testMixedCaseHostname() {
final AuthScope authscope = new AuthScope("SomeHost", 80);
Assert.assertEquals(null, authscope.getScheme());
Assert.assertEquals("somehost", authscope.getHost());
Assert.assertEquals(80, authscope.getPort());
Assert.assertEquals(null, authscope.getRealm());
Assert.assertEquals("<any realm>@somehost:80", authscope.toString());
}
public void testByOriginMixedCaseHostname() throws Exception {
final HttpHost host = new HttpHost("SomeHost", 8080, "http");
final AuthScope authscope = new AuthScope(host);
Assert.assertEquals("somehost", authscope.getHost());
Assert.assertEquals(host, authscope.getOrigin());
}
@Test | 0 |
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 0 |
log.error("Encountered InterruptedException while waiting for the threadPool to terminate.", e);
log.error("Encountered InterruptedException while waiting for the thread pool to terminate.", e);
log.error("Encountered unknown exception in assignMapFiles.", t); | 0 |
package org.apache.accumulo.core.util.shell.commands;
import java.io.IOException;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
import org.apache.commons.cli.CommandLine;
public class TablePermissionsCommand extends Command {
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws IOException {
for (String p : TablePermission.printableValues())
shellState.getReader().printString(p + "\n");
return 0;
}
@Override
public String description() {
return "displays a list of valid table permissions";
}
@Override
public int numArgs() {
return 0;
}
} | 1 |
@SuppressWarnings("unused") | 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.ipojo.composite.service.provides;
/**
* Exception occurs when a composition error occurs.
*
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
public class CompositionException extends Exception {
//TODO consider removing this class to use configuration exception.
/**
* serialVersionUID.
*/
private static final long serialVersionUID = -3063353267573738105L;
/**
* Constructor.
* @param message : a message.
*/
public CompositionException(String message) {
super(message);
}
} | 0 |
ProtectionDomain rhinoProtectionDomain
| 0 |
return openWriter(file, fs, conf, acuconf, acuconf.get(Property.TABLE_FILE_COMPRESSION_TYPE));
}
FileSKVWriter openWriter(String file, FileSystem fs, Configuration conf, AccumuloConfiguration acuconf, String compression) throws IOException { | 0 |
@Override
public String[] getUnboundParameters() {
return frame.getUnboundParameters();
}
| 0 |
private static VisibilityInterpreter interpreter = null;
public static VisibilityInterpreter create() {
if (interpreter == null) {
throw new IllegalStateException("ColumnVisibilityInterpreterFactory is not configured: Interpreter is null");
return interpreter.create();
}
public static VisibilityInterpreter create(ColumnVisibility cv, Authorizations authorizations) {
if (interpreter == null) {
throw new IllegalStateException("ColumnVisibilityInterpreterFactory is not configured: Interpreter is null");
return interpreter.create(cv, authorizations);
}
public static void setInterpreter(VisibilityInterpreter interpreter) {
VisibilityInterpreterFactory.interpreter = interpreter;
} | 1 |
* When a particular component is not explicitly set this class will | 0 |
* @version $Revision: 1.3 $ $Date: 2004/06/13 05:35:44 $
int count = cos.resetCount();
assertEquals("CountingOutputStream.resetCount()", count, 35);
for(int i = 0; i < 10; i++) {
cos.write(i);
}
assertByteArrayEquals("CountingOutputStream.write(int)", baos.toByteArray(), 35, 45);
assertEquals("CountingOutputStream.getCount()", cos.getCount(), 10);
assertEquals(msg+": array[" + i + "] mismatch", array[i], i-start); | 0 |
import org.apache.hc.core5.http.Supplier; | 0 |
import org.apache.beam.sdk.metrics.MetricsSink;
import org.apache.beam.sdk.util.InstanceBuilder;
period = pipelineOptions.getMetricsPushPeriod();
// calls the constructor of MetricsSink implementation specified in
// pipelineOptions.getMetricsSink() passing the pipelineOptions
metricsSink =
InstanceBuilder.ofType(MetricsSink.class)
.fromClass(pipelineOptions.getMetricsSink())
.withArg(PipelineOptions.class, pipelineOptions)
.build(); | 0 |
package org.apache.commons.digester3.examples.api.catalog;
| 0 |
* serialVersionUID format is YYYYMMDD for the date of the last binary change. | 0 |
&& !ver.lessEquals(HttpVersion.HTTP_1_0)) { | 0 |
import org.apache.xml.security.stax.impl.util.UnsynchronizedBufferedOutputStream;
xmlEventWriter = XMLSecurityConstants.xmlOutputFactory.createXMLEventWriter(new UnsynchronizedBufferedOutputStream(cipherOutputStream, 8192), "UTF-8");
int size = charactersBuffer.size();
int i = 0;
while (i < size) {
XMLSecCharacters xmlSecCharacters = charactersBuffer.remove(i++);
outputAsEvent(subOutputProcessorChain, xmlSecCharacters); | 0 |
* </p>
* </p> | 0 |
* Close the queue. The given callback will be executed once the queue is empty.
*
* @param shutdownTask The task to execute once the queue is empty
public void close(final HandlerTask shutdownTask); | 0 |
*
*
package org.apache.commons.vfs2.provider.tar.test;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
import org.apache.commons.vfs2.provider.tar.TarFileProvider;
import org.apache.commons.vfs2.test.AbstractProviderTestConfig;
import org.apache.commons.vfs2.test.ProviderTestConfig;
import org.apache.commons.vfs2.test.ProviderTestSuite; | 1 |
* Implementation of the {@link ContentOutputBuffer} interface that can be
* Please note this class is thread safe only when used though
* the {@link ContentOutputBuffer} interface.
}
this.mutex.notifyAll();
| 0 |
* Copyright (C) 2015 Google Inc. | 0 |
public class QuoteUtil
{
public static String[] split( String str )
{
ArrayList<String> split = new ArrayList<String>();
boolean quote = false;
StringBuffer buf = new StringBuffer( str.length() );
for ( int i = 0; i < str.length(); i++ )
{
char c = str.charAt( i );
switch ( c )
{
case '"':
quote = !quote;
break;
case ',':
if ( !quote )
{
split.add( buf.toString().trim() );
buf.setLength( 0 );
break;
}
// else fall through on purpose
default:
buf.append( c );
}
}
if ( buf.length() > 0 )
{
split.add( buf.toString().trim() );
}
return split.toArray( new String[split.size()] );
} | 0 |
package org.apache.batik.ext.awt.image.rendered;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
public class TileCache {
private static LRUCache cache = new LRUCache(50);
public static void setSize(int sz) { cache.setSize(sz); }
public static TileStore getTileGrid(int minTileX, int minTileY,
int xSz, int ySz, TileGenerator src) {
return new TileGrid(minTileX, minTileY, xSz, ySz, src, cache);
}
public static TileStore getTileGrid(RenderedImage img, TileGenerator src) {
return new TileGrid(img.getMinTileX(), img.getMinTileY(),
img.getNumXTiles(), img.getNumYTiles(),
src, cache);
}
public static TileStore getTileMap(TileGenerator src) {
return new TileMap(src, cache);
}
} | 0 |
import java.util.AbstractMap.SimpleImmutableEntry;
Map.Entry<Path, Boolean> result;
p = result.getKey();
Boolean status = result.getValue();
sendPath(BufferUtils.clear(buffer), id, result.getKey(), attrs);
protected SimpleImmutableEntry<Path, Boolean> doRealPathV6(
protected SimpleImmutableEntry<Path, Boolean> doRealPathV345(int id, String path, Path p, LinkOption... options) throws IOException {
* @return A {@link SimpleImmutableEntry} whose key is the <U>absolute <B>normalized</B></U>
* {@link Path} and value is a {@link Boolean} indicating its status
protected SimpleImmutableEntry<Path, Boolean> validateRealPath(int id, String path, Path f, LinkOption... options) throws IOException {
return new SimpleImmutableEntry<>(p, status); | 0 |
import static org.junit.Assert.fail;
import org.apache.accumulo.core.client.AccumuloSecurityException;
try {
assertNull(args.getPrincipal());
fail("Expected to receive exception fetching non-existent principal");
} catch (AccumuloSecurityException e) {
// Pass -- no explicit principal and no token to infer a principal from
}
assertNull(args.getSecurePassword());
assertEquals("bar", args.getPrincipal());
assertNull(args.getSecurePassword());
assertEquals(KerberosToken.CLASS_NAME, args.getTokenClassName()); | 0 |
* Register the given rule builder and returns it.
* @param <R> The Digester rule type
* @param <RB> The Digester rule builder type
* @param ruleBuilder The input rule builder instance.
* Returns the first instance of {@link RuleProvider} assignable to the input type.
* This method is useful for rules that requires be unique in the pattern,
* like {@link org.apache.commons.digester3.SetPropertiesRule}
* and {@link org.apache.commons.digester3.SetNestedPropertiesRule}.
*
* @param <R> The Digester rule type
* @param <RB> The Digester rule builder type
* @param keyPattern the rule pattern
* @param namespaceURI the namespace URI (can be null)
* @param type the rule builder type the client is looking for
* @return the rule builder of input type, if any
for ( AbstractBackToLinkedRuleBuilder<? extends Rule> provider : providers )
{ | 0 |
} catch (ThreadDeath td) {
debuggerClass = null;
clearAllBreakpoints = null;
scriptGo = null;
setExitAction = null;
throw td;
} catch (Exception ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace(); | 0 |
public ExportedPackageFinder(ISigilProjectModel sigil, IAccumulator<? super IPackageExport> accumulator)
public IStatus run(final IProgressMonitor monitor)
final List<IPackageExport> exports = new ArrayList<IPackageExport>(
ResourcesDialogHelper.UPDATE_BATCH_SIZE);
public boolean visit(IModelElement element)
if (element instanceof IPackageExport)
IPackageExport pkgExport = (IPackageExport) element;
exports.add(pkgExport);
if (exports.size() >= ResourcesDialogHelper.UPDATE_BATCH_SIZE)
accumulator.addElements(exports);
SigilCore.getRepositoryManager(sigil).visit(walker);
if (exports.size() > 0)
accumulator.addElements(exports); | 0 |
/**
* Copyright 2016 Seznam.cz, a.s.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cz.seznam.euphoria.flink.streaming.windowing;
import cz.seznam.euphoria.core.client.dataset.windowing.Window;
import cz.seznam.euphoria.core.client.dataset.windowing.Windowing;
import cz.seznam.euphoria.core.client.functional.CombinableReduceFunction;
import cz.seznam.euphoria.core.client.functional.StateFactory;
import cz.seznam.euphoria.core.client.operator.state.State;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
/**
* A {@link cz.seznam.euphoria.flink.streaming.windowing.AbstractWindowOperator}
* expecting the input elements to be already of type {@link KeyedMultiWindowedElement}.
*/
public class KeyedMultiWindowedElementWindowOperator<KEY, WID extends Window>
extends AbstractWindowOperator<KeyedMultiWindowedElement<WID, KEY, ?>, KEY, WID> {
public KeyedMultiWindowedElementWindowOperator(
Windowing<?, WID> windowing,
StateFactory<?, State> stateFactory,
CombinableReduceFunction<State> stateCombiner,
boolean localMode) {
super(windowing, stateFactory, stateCombiner, localMode);
}
@Override
protected KeyedMultiWindowedElement<WID, KEY, ?>
recordValue(StreamRecord<KeyedMultiWindowedElement<WID, KEY, ?>> record) {
return record.getValue();
}
} | 0 |
* @author <A HREF="mailto:[email protected]">M. Dahm</A> | 0 |
* The kerberos-env property name declaring whether the Hadoop auth_to_local rules should be included for all components of an installed service even if the component itself is not installed
*/
String INCLUDE_ALL_COMPONENTS_IN_AUTH_TO_LOCAL_RULES = "include_all_components_in_auth_to_local_rules";
/** | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/AbstractCollectionDecorator.java,v 1.2 2003/05/07 11:20:21 scolebourne Exp $
* @version $Revision: 1.2 $ $Date: 2003/05/07 11:20:21 $
private final Collection collection;
/**
* Gets the collection being decorated.
*
* @return the decorated collection
*/
protected Collection getCollection() {
return collection;
}
//----------------------------------------------------------------------- | 0 |
private final Collection<CreditCardType> cardTypes = new ArrayList<CreditCardType>(); | 0 |
public static class Factory
{
public ServiceConsumer createServiceConsumer()
{
public ServiceProvider createServiceProvider()
{
public ServiceProvider2 createServiceProvider2()
{
public interface ServiceInterface
{
@Service(factory = Factory.class, factoryMethod = "createServiceConsumer")
@ServiceDependency(filter = "(test=multiple)")
@Service(properties = { @Param(name = "foo", value = "bar") }, factory = Factory.class, factoryMethod = "createServiceProvider")
@ServiceDependency(filter = "(test=multiple)")
@ServiceDependency(removed = "unbind")
@Service(provide = { ServiceProvider2.class }, factory = Factory.class, factoryMethod = "createServiceProvider2")
@ServiceDependency(required = false, filter = "(foo=bar)")
@ServiceDependency(service = Sequencer.class, filter = "(test=multiple)") | 0 |
import com.google.common.collect.Sets;
import static org.junit.Assert.*; | 0 |
import org.apache.beam.dsls.sql.interpreter.operator.BeamSqlCastExpression;
case "CAST":
ret = new BeamSqlCastExpression(subExps, node.type.getSqlTypeName());
break; | 0 |
import org.apache.accumulo.core.security.tokens.AuthenticationToken;
@Deprecated
this.acu.users.put(user, new MockUser(user, new PasswordToken(password), authorizations));
public void createUser(String user, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
@Override
@Deprecated
return authenticateUser(name, new PasswordToken(password));
public boolean authenticateUser(String name, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
public void changeLoginInfo(String name, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
@Deprecated
changeLoginInfo(name, new PasswordToken(password)); | 1 |
* This class is not thread safe. | 0 |
TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context,
loc.tablet_location); | 0 |
import org.apache.accumulo.core.util.MetadataTable;
Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
scanner.fetchColumnFamily(MetadataTable.LAST_LOCATION_COLUMN_FAMILY);
scanner.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
scanner.fetchColumnFamily(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY);
if (key.getColumnFamily().equals(MetadataTable.LAST_LOCATION_COLUMN_FAMILY)) {
if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
|| key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) { | 0 |
import org.apache.sshd.client.subsystem.sftp.SftpException; | 0 |
assertEquals("1-foo-2" + System.lineSeparator(), replacements.get(0).find);
assertEquals("3-foo-4" + System.lineSeparator(), replacements.get(1).find); | 0 |
Map<String, PropertyInfo> componentMetricMap =
getComponentMetrics().get(getComponentName(resource));
if (!componentMetricMap.containsKey(id)) {
updateComponentMetricMap(componentMetricMap, id);
}
| 0 |
connState.close();
public void close() {
try {
this.inbuffer.close();
} catch (IOException ignore) {
}
try {
this.outbuffer.close();
} catch (IOException ignore) {
}
this.inputState = SHUTDOWN;
this.outputState = SHUTDOWN;
}
| 0 |
import org.apache.zookeeper.WatchedEvent; | 0 |
* Executes HTTP request using the default context.
* Executes HTTP request using the given context.
* Executes HTTP request using the default context.
* Executes HTTP request using the given context.
* Executes HTTP request using the default context and processes the
* Executes HTTP request using the given context and processes the
* Executes HTTP request to the target using the default context and
* Executes HTTP request to the target using the given context and | 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger log = LoggerFactory.getLogger(PreferredVolumeChooser.class); | 0 |
PCollection<ElemT>, PCollection<ElemT>,
PCollection<ElemT>, PCollection<ElemT>,
PTransform<PCollection<ElemT>, PCollection<ElemT>>>
transform) { | 1 |
* @version CVS $Id: DefaultAuthenticationManager.java,v 1.17 2003/09/24 21:22:33 cziegeler Exp $
this.manager.release( contextManager);
manager.release( contextManager); | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/IntListList.java,v 1.7 2003/08/31 17:21:17 scolebourne Exp $
* any, must include the following acknowledgement:
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
* @version $Revision: 1.7 $ $Date: 2003/08/31 17:21:17 $ | 0 |
import org.apache.cocoon.portal.coplet.CopletInstance;
final CopletInstance coplet = this.adapter.getCurrentCopletInstanceData();
final CopletInstance coplet = this.adapter.getCurrentCopletInstanceData(); | 0 |
import javax.inject.Singleton;
@Singleton | 0 |
return body(new ByteArrayEntity(b, null));
return body(new ByteArrayEntity(b, off, len, null)); | 0 |
public CaseInsensitiveMap(final Map<? extends K, ? extends V> map) { | 0 |
properties.put("file_key", base64FileKey); | 0 |
private KeyPair pairRsaBad;
public SinglePublicKeyAuthTest() {
SimpleGeneratorHostKeyProvider provider = new SimpleGeneratorHostKeyProvider();
provider.setAlgorithm("RSA");
pairRsaBad = provider.loadKey(KeyPairProvider.SSH_RSA);
}
| 0 |
* @version CVS $Id: Web3.java,v 1.2 2003/03/16 17:49:09 vgritsenko Exp $ | 0 |
final File dynamicFile = (new VerifyingFileFactory.Builder(LOG)
.warnForRelativePath()
.failForNonExistingPath()
.build()).create(dynamicFileStr);
.concat(dynamicFile.getCanonicalPath()) | 0 |
} else if (xIncludeLevel > 0 && fallbackLevel > 0) {
fallbackLevel++;
} | 0 |
put(Type.Cluster, HOST_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID);
put(Type.Host, HOST_STACK_VERSION_HOST_NAME_PROPERTY_ID);
put(Type.HostStackVersion, HOST_STACK_VERSION_ID_PROPERTY_ID);
put(Type.Stack, HOST_STACK_VERSION_STACK_PROPERTY_ID);
put(Type.StackVersion, HOST_STACK_VERSION_VERSION_PROPERTY_ID);
put(Type.RepositoryVersion, STACK_VERSION_REPO_VERSION_PROPERTY_ID);
final String clusterName = propertyMap.get(HOST_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID).toString();
List<HostVersionEntity> requestedEntities = new ArrayList<HostVersionEntity>();
addRequestedEntities(resources, requestedEntities, requestedIds, clusterName);
return resources;
}
/**
* Adds requested entities to resources
* @param resources a list of resources to add to
* @param requestedEntities requested entities
* @param requestedIds
* @param clusterName name of cluster or null if no any
*/
public void addRequestedEntities(Set<Resource> resources,
List<HostVersionEntity> requestedEntities,
Set<String> requestedIds,
String clusterName) {
StackId stackId = new StackId(entity.getStack());
RepositoryVersionEntity repoVerEntity = repositoryVersionDAO.findByStackAndVersion(stackId.getStackId(), entity.getVersion());
setResourceProperty(resource, HOST_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID, clusterName, requestedIds);
setResourceProperty(resource, HOST_STACK_VERSION_STACK_PROPERTY_ID, stackId.getStackName(), requestedIds);
setResourceProperty(resource, HOST_STACK_VERSION_VERSION_PROPERTY_ID, stackId.getStackVersion(), requestedIds);
if (repoVerEntity!=null) {
Long repoVersionId = repoVerEntity.getId();
setResourceProperty(resource, STACK_VERSION_REPO_VERSION_PROPERTY_ID, repoVersionId, requestedIds);
}
| 0 |
Method updateHostComponentLastStateTable = UpgradeCatalog300.class.getDeclaredMethod("updateHostComponentLastStateTable");
.addMockedMethod(updateHostComponentLastStateTable)
upgradeCatalog300.updateHostComponentLastStateTable();
Capture<DBAccessor.DBColumnInfo> lastValidColumn = newCapture();
dbAccessor.addColumn(eq(UpgradeCatalog300.COMPONENT_LAST_STATE_COLUMN), capture(lastValidColumn));
DBAccessor.DBColumnInfo capturedLastValidColumn = lastValidColumn.getValue();
Assert.assertEquals(UpgradeCatalog300.HRC_OPS_DISPLAY_NAME_COLUMN, capturedLastValidColumn.getName());
Assert.assertEquals(null, capturedLastValidColumn.getDefaultValue());
Assert.assertEquals(String.class, capturedLastValidColumn.getType());
| 0 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.catalog.query;
import org.apache.atlas.catalog.definition.ResourceDefinition;
import org.apache.lucene.sandbox.queries.regex.RegexQuery;
import java.util.regex.Pattern;
/**
* Query expression which evaluates a property against a regular expression.
*/
public class RegexQueryExpression extends BaseQueryExpression {
public RegexQueryExpression(RegexQuery query, ResourceDefinition resourceDefinition) {
super(query.getField(), query.getTerm().text(), resourceDefinition);
}
@Override
public boolean evaluate(Object value) {
Pattern p = Pattern.compile(getExpectedValue());
return value != null && p.matcher(String.valueOf(value)).matches();
}
} | 0 |
import org.apache.commons.lang.StringUtils;
return s.replaceAll("\\\\\"", "\"");
s = s.replaceAll("\\s", ""); | 0 |
m.put("org.foo.bar.warp", "eeej");
assertEquals(327L, dto.width);
@Test
public void testPrefixInterface() {
Map<String, String> m = new HashMap<>();
m.put("org.foo.bar.width", "327");
m.put("org.foo.bar.warp", "eeej");
m.put("length", "12");
PrefixInterface i = converter.convert(m).to(PrefixInterface.class);
assertEquals(327L, i.width());
try {
i.length();
fail("Should have thrown an exception");
} catch (ConversionException ce) {
// good
}
PrefixInterface i2 = new PrefixInterface() {
@Override
public long width() {
return Long.MAX_VALUE;
}
@Override
public int length() {
return Integer.MIN_VALUE;
}
};
Map<String, String> m2 = converter.convert(i2).to(new TypeReference<Map<String,String>>() {});
Map<String, String> expected = new HashMap<>();
expected.put("org.foo.bar.width", "" + Long.MAX_VALUE);
expected.put("org.foo.bar.length", "" + Integer.MIN_VALUE);
assertEquals(expected, m2);
}
@Test
public void testAnnotationInterface() {
Map<String, String> m = new HashMap<>();
m.put("org.foo.bar.width", "327");
m.put("org.foo.bar.warp", "eeej");
m.put("length", "12");
PrefixAnnotation pa = converter.convert(m).to(PrefixAnnotation.class);
assertEquals(327L, pa.width());
assertEquals(51, pa.length());
Map<String, String> m2 = converter.convert(pa).to(new TypeReference<Map<String,String>>() {});
Map<String, String> expected = new HashMap<>();
expected.put("org.foo.bar.width", "327");
expected.put("org.foo.bar.length", "51");
assertEquals(expected, m2);
}
| 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/src/java/org/apache/commons/jelly/Jelly.java,v 1.14 2002/08/09 19:11:56 jstrachan Exp $
* $Revision: 1.14 $
* $Date: 2002/08/09 19:11:56 $
* $Id: Jelly.java,v 1.14 2002/08/09 19:11:56 jstrachan Exp $
* @version $Revision: 1.14 $
final Writer writer = ( args.length > 1 )
// now lets wait for all threads to close
Runtime.getRuntime().addShutdownHook(
new Thread() {
public void run() {
try {
writer.close();
}
catch (Exception e) {
// ignore errors
}
}
}
); | 0 |
/**
* Copyright 2016 Seznam a.s.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestLRUMap.java,v 1.18 2002/05/08 16:07:05 morgand Exp $
* $Revision: 1.18 $
* $Date: 2002/05/08 16:07:05 $
import java.util.Iterator;
* @version $Id: TestLRUMap.java,v 1.18 2002/05/08 16:07:05 morgand Exp $
public void testGetPromotion() {
LRUMap map = new LRUMap(3);
map.put("1","1");
map.put("2","2");
map.put("3","3");
// LRU is now 1 (then 2 then 3)
// promote 1 to top
// eviction order is now 2,3,1
map.get("1");
// add another value, forcing a remove
// 2 should be evicted (then 3,1,4)
map.put("4","4");
Iterator keyIterator = map.keySet().iterator();
Object[] keys = new Object[3];
for (int i = 0; keyIterator.hasNext() ; ++i) {
keys[i] = keyIterator.next();
}
assertTrue("first evicted should be 3, was " + keys[0], keys[0].equals("3"));
assertTrue("second evicted should be 1, was " + keys[1], keys[1].equals("1"));
assertTrue("third evicted should be 4, was " + keys[2], keys[2].equals("4"));
}
| 0 |
public void consume(final ByteBuffer src) throws IOException { | 0 |
return withNaming(fn(namingFn)); | 0 |
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.controller.spi.Predicate; | 0 |
/**
*
* @since 4.0
*/ | 0 |
throw new RuntimeException( "foo" ); | 0 |
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.http.concurrent.FutureCallback;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
/**
* Basic non-blocking {@link IOSession} pool.
* <p>
* The following parameters can be used to customize the behavior of this
* class:
* <ul>
* <li>{@link org.apache.http.params.CoreConnectionPNames#CONNECTION_TIMEOUT}</li>
* </ul>
*
* @since 4.2
*/
private final HttpParams params;
public BasicNIOConnPool(final ConnectingIOReactor ioreactor, final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
this.params = params;
@Override
public Future<BasicNIOPoolEntry> lease(
final HttpHost route,
final Object state,
final FutureCallback<BasicNIOPoolEntry> callback) {
int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, callback);
}
@Override
public Future<BasicNIOPoolEntry> lease(final HttpHost route, final Object state) {
int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, null);
}
| 0 |
Map<String, Object> getAttributes() throws FileSystemException; | 0 |
/**
* Returns the {@link ConfigurationImpl} with the given PID if
* available in the internal cache or from any persistence manager.
* Otherwise <code>null</code> is returned.
*
* @param pid The PID for which to return the configuration
* @return The configuration or <code>null</code> if non exists
* @throws IOException If an error occurrs reading from a persistence
* manager.
*/
ConfigurationImpl getConfiguration( String pid ) throws IOException
/**
* Creates a regular (non-factory) configuration for the given PID
* setting the bundle location accordingly.
* <p>
* This method assumes the configuration to not exist yet and will
* create it without further checking.
*
* @param pid The PID of the new configuration
* @param bundleLocation The location to set on the new configuration.
* This may be <code>null</code> to not bind the configuration
* yet.
* @return The new configuration persisted in the first persistence
* manager.
* @throws IOException If an error occurrs writing the configuration
* to the persistence.
*/
ConfigurationImpl createConfiguration( String pid, String bundleLocation ) throws IOException
ConfigurationImpl config = getConfiguration( pid );
config = getConfiguration( pid );
cfg = getConfiguration( pid ); | 0 |
* $HeadURL$
* $Revision$
* $Date$ | 0 |
AuditedSecurityOperation.getInstance(iid, true).initializeSecurity(SecurityConstants.getSystemCredentials(), opts.rootuser, opts.rootpass); | 0 |
* @version CVS $Id: JavaScriptJXPathBindingBuilder.java,v 1.3 2003/12/18 07:57:21 mpo Exp $
CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(element);
if (commonAtts.loadEnabled) {
if (commonAtts.saveEnabled) {
return new JavaScriptJXPathBinding(commonAtts, id, path, loadScript, saveScript); | 0 |
/** Factory to create a {@link JobInvocation} instances. */
/** Start running a job, abstracting its state as a {@link JobInvocation} instance. */
JobInvocation invoke(RunnerApi.Pipeline pipeline, Struct options, @Nullable String retrievalToken) | 0 |
import javax.ws.rs.*;
* Handles: GET /clusters/{clusterID}
return handleRequest(headers, ui, Request.Type.GET, createResourceDefinition(clusterName));
* Handles: GET /clusters
return handleRequest(headers, ui, Request.Type.GET, createResourceDefinition(null));
}
/**
* Handles: PUT /clusters/{clusterID}
* Create a specific cluster.
*
* @param headers http headers
* @param ui uri info
* @param clusterName cluster id
* @return information regarding the created cluster
*/
@PUT
@Produces("text/plain")
public Response createCluster(@Context HttpHeaders headers, @Context UriInfo ui,
@PathParam("clusterName") String clusterName) {
return handleRequest(headers, ui, Request.Type.PUT, createResourceDefinition(clusterName));
}
/**
* Handles: POST /clusters/{clusterID}
* Update a specific cluster.
*
* @param headers http headers
* @param ui uri info
* @param clusterName cluster id
* @return information regarding the updated cluster
*/
@POST
@Produces("text/plain")
public Response updateCluster(@Context HttpHeaders headers, @Context UriInfo ui,
@PathParam("clusterName") String clusterName) {
return handleRequest(headers, ui, Request.Type.POST, createResourceDefinition(clusterName));
}
/**
* Handles: DELETE /clusters/{clusterID}
* Delete a specific cluster.
*
* @param headers http headers
* @param ui uri info
* @param clusterName cluster id
* @return information regarding the deleted cluster
*/
@DELETE
@Produces("text/plain")
public Response deleteCluster(@Context HttpHeaders headers, @Context UriInfo ui,
@PathParam("clusterName") String clusterName) {
return handleRequest(headers, ui, Request.Type.DELETE, createResourceDefinition(clusterName)); | 1 |
import org.apache.sshd.server.global.OpenSshHostKeysHandler;
CancelTcpipForwardHandler.INSTANCE,
OpenSshHostKeysHandler.INSTANCE | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.