Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
public class BaseManagementPlugin
{
protected BaseManagementPlugin()
{
public void setBundleContext( BundleContext bundleContext )
{
public void setLogger( Logger log )
{
protected BundleContext getBundleContext()
{
protected Logger getLog()
{
protected StartLevel getStartLevel()
{
if ( startLevelService == null )
{
startLevelService = new ServiceTracker( getBundleContext(), StartLevel.class.getName(), null );
return ( StartLevel ) startLevelService.getService();
protected PackageAdmin getPackageAdmin()
{
if ( packageAdmin == null )
{
packageAdmin = new ServiceTracker( getBundleContext(), PackageAdmin.class.getName(), null );
return ( PackageAdmin ) packageAdmin.getService(); | 0 |
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.ext.awt.image.rendered.DisplacementMapRed8Bit;
float scaleX = (float)(scale*atScaleX);
float scaleY = (float)(scale*atScaleY);
// if ((scaleX > 255) || (scaleY > 255)) {
// System.out.println("Scales: [" + scaleX + ", " + scaleY + "]");
// }
RenderedImage mapRed = map.createRendering(srcRc);
if (mapRed == null) return null;
if (displacedRed == null) return null;
// Build a Displacement Map Red from the two sources
CachableRed cr = new DisplacementMapRed8Bit
(GraphicsUtil.wrap(displacedRed),
GraphicsUtil.wrap(mapRed),
xChannelSelector, yChannelSelector,
scaleX, scaleY, rh);
if(!resAt.isIdentity()) | 0 |
import org.apache.beam.sdk.util.GcsUtil;
import org.apache.beam.sdk.util.GcsUtil.GcsUtilFactory;
private final GcsUtil gcsUtil;
gcsUtil = new GcsUtilFactory().create(options);
gcsUtil.copy(srcFilenames, destFilenames);
gcsUtil.remove(filenames); | 0 |
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.entity.ContentType;
import org.apache.hc.core5.http.message.BasicNameValuePair;
.setCharset(StandardCharsets.UTF_8)
Assert.assertEquals(StandardCharsets.UTF_8, entity.getMultipart().charset);
.setCharset(StandardCharsets.UTF_8)
Assert.assertEquals("application/xml; boundary=blah-blah; charset=UTF-8", entity.getContentType());
Assert.assertEquals("multipart/form-data; boundary=yada-yada; charset=US-ASCII", entity.getContentType());
Assert.assertEquals(StandardCharsets.US_ASCII, entity.getMultipart().charset);
.setCharset(StandardCharsets.UTF_8)
entity.getContentType()); | 0 |
import org.apache.hc.core5.pool.ConnPoolPolicy;
private ConnPoolPolicy connPoolPolicy;
* Assigns {@link ConnPoolPolicy} instance.
*/
public final H2RequesterBootstrap setConnPoolPolicy(final ConnPoolPolicy connPoolPolicy) {
this.connPoolPolicy = connPoolPolicy;
return this;
}
/**
connPoolPolicy, | 0 |
import java.util.Optional; | 0 |
import org.apache.ambari.server.events.ServiceCredentialStoreUpdateEvent;
@Subscribe
public void onServiceCredentialStoreUpdate(ServiceCredentialStoreUpdateEvent serviceCredentialStoreUpdateEvent) throws AmbariException {
Cluster cluster = m_clusters.get().getCluster(serviceCredentialStoreUpdateEvent.getClusterId());
updateData(ambariManagementController.getClusterMetadataOnServiceCredentialStoreUpdate(cluster, serviceCredentialStoreUpdateEvent.getServiceName()));
} | 0 |
@ManyToMany | 0 |
private static final OptionBuilder instance = new OptionBuilder(); | 0 |
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.util.SideInputReader;
import org.apache.beam.sdk.values.PCollectionView;
| 0 |
package org.apache.batik.svggen;
* @see org.apache.batik.svggen.SVGLinearGradient
* @see org.apache.batik.svggen.SVGTexturePaint
* @see org.apache.batik.svggen.SVGDescriptor | 0 |
* Sets the DomTreeManager this image handler may need to
void setDOMTreeManager(DOMTreeManager domTreeManager);
Element createElement(SVGGeneratorContext generatorContext);
AffineTransform handleImage(Image image, Element imageElement,
AffineTransform handleImage(RenderedImage image, Element imageElement,
AffineTransform handleImage(RenderableImage image, Element imageElement, | 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 |
implements RoleMatcher {
public MultipleRoleMatcher(String roles) {
while (tokenizer.hasMoreTokens()) {
public boolean matches(User user) {
for (int i = 0; i < length; i++) {
if (!user.hasRole(this.roles[i])) {
}
} | 0 |
Response response2 = fileService.getFile(filePath, 0L, null);
Response response = fileService.getFile(filePath, 0L, null);
response = fileService.getFile(filePath, 1L, null);
response = fileService.getFile(filePath, 2L, null);
fileService.getFile(filePath, 3L, null);
Response response = fileService.getFile(filePath, 0L, null);
fileService.getFile("/tmp/notExistentFile", 2L, null);
fileService.getFile(filePath, 0L, null); | 0 |
* @param user the user making the change for audit purposes
* @return <code>true</code> if the config was added, or <code>false</code>
* if the config is already set as the current
public boolean addDesiredConfig(String user, Config config); | 0 |
import org.apache.beam.sdk.extensions.sql.impl.rule.BeamJoinAssociateRule;
import org.apache.beam.sdk.extensions.sql.impl.rule.BeamJoinPushThroughJoinRule;
import org.apache.calcite.rel.rules.JoinCommuteRule;
JoinCommuteRule.INSTANCE,
BeamJoinAssociateRule.INSTANCE,
BeamJoinPushThroughJoinRule.RIGHT,
BeamJoinPushThroughJoinRule.LEFT, | 0 |
solrAliasDao.setupAlias(getSolrClient(), solrAuditLogPropsConfig);
solrSchemaFieldDao.auditCollectionSetUp(); | 0 |
// clear out the data in options in case it's been used before (CLI-71)
for (Iterator it = options.helpOptions().iterator(); it.hasNext();) {
Option opt = (Option) it.next();
opt.clearValues();
}
} | 0 |
* Shows an alert dialog box.
*/
void showAlert(String message);
/**
* Shows a prompt dialog box.
*/
String showPrompt(String message);
/**
* Shows a prompt dialog box.
*/
String showPrompt(String message, String defaultValue);
/**
* Shows a confirm dialog box.
*/
boolean showConfirm(String message);
/** | 0 |
import com.google.inject.assistedinject.Assisted;
| 0 |
private final HashMap parameters = new HashMap();
return this.parameters.get(name);
* @param names array of parameter names
/**
* Is the parameter set?
* <p>
* Uses {@link #getParameter(String)} (which is overrideable) to
* fetch the parameter value, if any.
* <p>
* Also @see {@link #isParameterSetLocally(String)}
*
* @param name parameter name
* @return true if parameter is defined and non-null
*/
/**
* Is the parameter set in this object?
* <p>
* The parameter value is fetched directly.
* <p>
* Also @see {@link #isParameterSet(String)}
*
* @param name parameter name
* @return true if parameter is defined and non-null
*/
return this.parameters.get(name) != null;
this.parameters.clear(); | 0 |
import java.awt.Shape;
import java.lang.ref.SoftReference;
import org.apache.batik.ext.awt.geom.SegmentList;
protected SoftReference bboxShape = null;
protected Rectangle2D bbox = null;
Shape s = node.getOutline();
if ((bboxShape != null) && (s == bboxShape.get())) return bbox;
bboxShape = new SoftReference(s); // don't keep this live.
bbox = null;
if (s == null) return bbox;
// SegmentList.getBounds2D gives tight BBox.
SegmentList sl = new SegmentList(s);
bbox = sl.getBounds2D();
return bbox; | 0 |
private final Set<AbstractSession> sessions = new CopyOnWriteArraySet<>(); | 0 |
private long entrySize;
final long numToSkip = entrySize - entryOffset;
// Use our internal skip to move to the end of the current entry
longSkip(numToSkip);
entrySize = currEntry.getSize();
long remaining = entrySize - entryOffset;
if(remaining > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int) remaining;
numToRead = (int)(entrySize - entryOffset);
public void longSkip(final long numToSkip) throws IOException {
for(long skipped = 0; skipped < numToSkip;) {
if(numToSkip - skipped > Integer.MAX_VALUE) {
skip((int)Integer.MAX_VALUE);
skipped += Integer.MAX_VALUE;
} else {
skip((int)(numToSkip - skipped));
skipped += numToSkip - skipped;
}
}
}
| 0 |
byte[] bytes = text.getBytes("US-ASCII"); | 0 |
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
if (LOG.isDebugEnabled()) { | 0 |
private final boolean chunking;
TestRequestHandler() {
this(false);
}
TestRequestHandler(boolean chunking) {
super();
this.chunking = chunking;
}
entity.setChunked(this.chunking); | 0 |
import org.apache.cocoon.woody.event.ValueChangedListener;
} else if (listenerClass == ValueChangedListener.class) { | 0 |
import java.util.Collections;
import java.util.List;
context.append("=");
@Override
public List<GroovyExpression> getChildren() {
return Collections.singletonList(value);
}
@Override
public GroovyExpression copy(List<GroovyExpression> newChildren) {
assert newChildren.size() == 1;
return new VariableAssignmentExpression(name, newChildren.get(0));
}
| 0 |
* "License"); you may not use this file except in compliance
* distributed under the License is distributed on an "AS IS" BASIS, | 0 |
* @param buffer The request {@link Buffer}
* @throws Exception If failed to process the request | 0 |
private static final Logger log = Logger.getLogger(DefaultSecretKeyEncryptionStrategy.class);
private Map<String,String> context;
public SecretKeyEncryptionStrategyContext encryptSecretKey(SecretKeyEncryptionStrategyContext context) {
Map<String,String> cryptoContext = context.getContext();
SecureRandom random = DefaultCryptoModuleUtils.getSecureRandom(cryptoContext.get(Property.CRYPTO_SECURE_RNG.getKey()),
cryptoContext.get(Property.CRYPTO_SECURE_RNG_PROVIDER.getKey()));
} else {
throw new RuntimeException("Could not find key encryption key file in configured location in HDFS (" + pathToKeyName + ")");
Map<String,String> optsFromFile = new HashMap<String,String>();
cipher.init(encryptionMode, new SecretKeySpec(keyEncryptionKey, optsFromFile.get(Property.CRYPTO_CIPHER_ALGORITHM_NAME.getKey())), new IvParameterSpec(
iv));
cipherStream.flush();
cipherStream.flush();
| 0 |
import org.apache.felix.dm.Dependency;
import org.apache.felix.dm.Service;
import org.apache.felix.dm.ServiceStateListener; | 0 |
import org.apache.hc.core5.net.InetAddressUtils;
import org.slf4j.LoggerFactory;
connLog.debug(LoggingSupport.getId(session) + " TLS session started: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " TLS inbound: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " TLS outbound: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " connected: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " input ready: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " output ready: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " timeout: " + formatSession(session));
connLog.debug(LoggingSupport.getId(session) + " disconnected");
}
}
private static String formatSession(final IOSession session) {
final StringBuilder buffer = new StringBuilder(90);
if (session.isClosed()) {
buffer.append("closed");
} else {
InetAddressUtils.formatAddress(buffer, session.getLocalAddress());
buffer.append("<->");
InetAddressUtils.formatAddress(buffer, session.getRemoteAddress());
return buffer.toString(); | 0 |
import javax.inject.Qualifier;
@Qualifier | 0 |
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.Iterables; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestShortArrayList.java,v 1.3 2002/08/19 21:19:03 pjack Exp $
* $Revision: 1.3 $
* $Date: 2002/08/19 21:19:03 $
* @version $Revision: 1.3 $ $Date: 2002/08/19 21:19:03 $
protected AbstractShortList createList() { | 0 |
import org.apache.http.config.MessageConstraints;
import org.apache.http.params.HttpParamConfig;
MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params); | 0 |
Dataset<IN> positiveOutput = Filter
.named(name + POSITIVE_FILTER_SUFFIX)
.of(input)
.by(predicate)
.output();
Dataset<IN> negativeOutput = Filter
.named(name + NEGATIVE_FILTER_SUFFIX)
.of(input)
.by((UnaryPredicate<IN>) what -> !predicate.apply(what))
.output();
return new Output<>(positiveOutput, negativeOutput); | 0 |
private static final String POST_PROCESS_EXISTING_USERS_SPEC_KEY = "post_process_existing_users";
boolean postProcessExistingUsers = false;
} else if (key.equalsIgnoreCase(POST_PROCESS_EXISTING_USERS_SPEC_KEY)) {
postProcessExistingUsers = "true".equalsIgnoreCase(entry.getValue());
LdapSyncSpecEntity spec = new LdapSyncSpecEntity(principalType, syncType, principalNames, postProcessExistingUsers);
return new LdapSyncRequest(LdapSyncSpecEntity.SyncType.ALL, spec.getPostProcessExistingUsers());
return new LdapSyncRequest(LdapSyncSpecEntity.SyncType.EXISTING, spec.getPostProcessExistingUsers());
request = new LdapSyncRequest(LdapSyncSpecEntity.SyncType.SPECIFIC, principalNames, spec.getPostProcessExistingUsers()); | 0 |
public List<StageEntity> findAll() {
return daoUtils.selectAll(entityManagerProvider.get(), StageEntity.class);
}
@Transactional | 0 |
assertEquals("root", referenceElement.getLocalName()); | 0 |
/**
* UFT-32BE BOM (Big-Endian)
* @since 2.2
*/
/**
* UTF-32LE BOM (Big-Endian)
* @since 2.2
*/ | 0 |
public static CloudObjectTranslator<Coder> javaSerialized() {
return new CloudObjectTranslator<Coder>() {
public CloudObject toCloudObject(Coder target) {
// CustomCoder is used as the "marker" for a java-serialized coder
public Coder fromCloudObject(CloudObject cloudObject) {
return (Coder<?>) | 0 |
private static final SimpleDateFormat format = new SimpleDateFormat | 0 |
public <OUT> SortableOutputBuilder<T, T, OUT> reduceBy(
return new SortableOutputBuilder<>(
name, input, e -> e, reducer, null);
public <OUT> SortableOutputBuilder<T, VALUE, OUT> reduceBy(
name, input, valueExtractor, reducer, windowing, valueComparator); | 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
* 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 |
* @param cmd the command
* @param buffer the packet contents positioned after the command
boolean next(int cmd, Buffer buffer) throws Exception; | 0 |
max = Math.max(max, Integer.parseInt(s)); | 0 |
private final RulesBinderImpl rulesBinder = new RulesBinderImpl();
if (!classLoader.equals(this.rulesBinder.getContextClassLoader())) {
this.rulesBinder.initialize(classLoader);
for (RulesModule rulesModule : rulesModules) {
rulesModule.configure(this.rulesBinder); | 0 |
* @version $Revision: 1.5 $ $Date: 2004/06/01 23:07:12 $
suite.addTest(TestSynchronizedCollection.suite()); | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jxpath/src/java/org/apache/commons/jxpath/PackageFunctions.java,v 1.5 2002/04/26 03:28:36 dmitri Exp $
* $Revision: 1.5 $
* $Date: 2002/04/26 03:28:36 $
* @version $Revision: 1.5 $ $Date: 2002/04/26 03:28:36 $
* <li><b>subpackage.subpackage.Classname.methodname</b>, if looking for a
*
throw new JXPathException("Cannot invoke extension function "
+ (namespace != null ? namespace + ":" + name : name),
ex); | 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. | 0 |
import org.apache.excalibur.xml.xpath.XPathProcessor;
* @version CVS $Id: DefaultContextManager.java,v 1.5 2003/12/18 14:29:03 cziegeler Exp $
/** The xpath processor */
private XPathProcessor xpathProcessor;
this.xpathProcessor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE);
context = new SimpleSessionContext(this.xpathProcessor);
this.manager.release( this.xpathProcessor );
this.xpathProcessor = null;
this.manager = null; | 0 |
import org.apache.felix.webconsole.SimpleWebConsolePlugin;
class UpdateHelper extends BaseUpdateInstallHelper
UpdateHelper( final SimpleWebConsolePlugin plugin, final Bundle bundle, boolean refreshPackages )
this( plugin, bundle, null, refreshPackages );
UpdateHelper( final SimpleWebConsolePlugin plugin, final Bundle bundle, final File bundleFile,
boolean refreshPackages )
super( plugin, "Background Update " + bundle.getSymbolicName() + " (" + bundle.getBundleId() + ")",
bundleFile, refreshPackages ); | 0 |
import com.google.inject.Inject;
import org.apache.atlas.web.service.ServiceState;
private ServiceState serviceState;
@Inject
public AdminResource(ServiceState serviceState) {
this.serviceState = serviceState;
}
@GET
@Path("status")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getStatus() {
JSONObject responseData = new JSONObject();
try {
responseData.put("Status", serviceState.getState().toString());
Response response = Response.ok(responseData).build();
return response;
} catch (JSONException e) {
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
} | 0 |
public void setTimer(TimerData timerData) {
timerUpdateBuilder.setTimer(timerData); | 0 |
import java.util.concurrent.ForkJoinPool;
m_threadPool = new ForkJoinPool(Math.max(cores, DEPENDENCIES + 3 /* start/stop/configure */));
if (! m_parallel && m_threadPool != null) {
m_threadPool.shutdown();
m_threadPool.awaitTermination(60, TimeUnit.SECONDS);
m_threadPool.awaitQuiescence(5000, TimeUnit.MILLISECONDS);
m_threadPool.execute(task); | 0 |
import org.apache.accumulo.server.AccumuloServerContext;
private final AccumuloServerContext context;
public FileManager(AccumuloServerContext context, VolumeManager fs, int maxOpen, BlockCache dataCache, BlockCache indexCache) {
this.context = context;
this.maxIdleTime = context.getConfiguration().getTimeInMillis(Property.TSERV_MAX_IDLE);
SimpleTimer.getInstance(context.getConfiguration()).schedule(new IdleFileCloser(), maxIdleTime, maxIdleTime / 2);
// log.debug("Opening "+file + " path " + path);
FileSKVIterator reader = FileOperations.getInstance().openReader(path.toString(), false, ns, ns.getConf(),
context.getServerConfigurationFactory().getTableConfiguration(tablet), dataCache, indexCache);
ProblemReports.getInstance(context).report(new ProblemReport(tablet.toString(), ProblemType.FILE_READ, file, e));
continueOnFailure = context.getServerConfigurationFactory().getTableConfiguration(tablet).getBoolean(Property.TABLE_FAILURES_IGNORE);
iter = new ProblemReportingIterator(context, tablet.getTableId().toString(), filename, continueOnFailure, ssi);
iter = new ProblemReportingIterator(context, tablet.getTableId().toString(), filename, continueOnFailure, reader); | 1 |
throw new RuntimeException(" !!! Not implemented."); | 0 |
public class TableNamespacesIT { | 0 |
if ( target == null )
String result;
Method m;
context.setCurrentAccessor( | 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.beam.sdk.testutils.metrics;
import org.apache.beam.sdk.metrics.Counter;
import org.apache.beam.sdk.metrics.Metrics;
import org.apache.beam.sdk.transforms.DoFn;
/**
* Monitor that records number of elements flowing through a pipeline
*
* <p>To use: apply a monitor in a desired place in the pipeline. This will capture how many
* elements * flew through this DoFn. Such information can be then collected and written out and
* queried using * {@link org.apache.beam.sdk.testutils.metrics.MetricsReader}.
*/
public class CountMonitor<T> extends DoFn<T, T> {
private Counter counter;
public CountMonitor(String namespace, String name) {
this.counter = Metrics.counter(namespace, name);
}
@ProcessElement
public void processElement(ProcessContext context) {
counter.inc();
context.output(context.element());
}
} | 0 |
XMLUtils.circumventBug2650(doc); | 0 |
// New connection is needed
int maxPerRoute = getMaxPerRoute(route);
// Shrink the pool prior to allocating a new connection
int excess = Math.max(0, pool.getAllocatedCount() + 1 - maxPerRoute);
if (excess > 0) {
for (int i = 0; i < excess; i++) {
E lastUsed = pool.getLastUsed();
if (lastUsed == null) {
break;
}
closeEntry(lastUsed);
this.available.remove(lastUsed);
pool.remove(lastUsed);
}
}
if (pool.getAllocatedCount() < maxPerRoute) {
if (!this.available.isEmpty()) {
E lastUsed = this.available.removeFirst();
closeEntry(lastUsed);
RouteSpecificPool<T, C, E> otherpool = getPool(lastUsed.getRoute());
otherpool.remove(lastUsed);
} | 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.atlas.hive.rewrite;
import org.antlr.runtime.TokenRewriteStream;
import org.apache.hadoop.hive.ql.parse.ASTNode;
public class RewriteContext {
private String origQuery;
private TokenRewriteStream rewriteStream;
private ASTNode origin;
RewriteContext(String origQuery, ASTNode origin, TokenRewriteStream rewriteStream) {
this.origin = origin;
this.rewriteStream = rewriteStream;
}
public TokenRewriteStream getTokenRewriteStream() {
return rewriteStream;
}
public ASTNode getOriginNode() {
return origin;
}
public String getOriginalQuery() {
return origQuery;
}
} | 0 |
serviceThemes.add(serviceInfo.getThemesMap().get(themeFileName)); | 0 |
package org.apache.beam.sdk.extensions.euphoria.core.translate;
import static org.apache.beam.sdk.extensions.euphoria.core.translate.TestUtils.defaultOptions;
import org.apache.beam.sdk.extensions.euphoria.core.translate.io.KryoCoder;
import org.apache.beam.sdk.values.TypeDescriptors;
/**
* Tests getting coder from functions and type aware functions.
*/
private final TranslationContext translationContext =
new TranslationContext(
final Coder<String> coder = translationContext.getCoder(unaryFunction);
translationContext.getCoder(
TypeAwareUnaryFunction.of(unaryFunction, TypeDescriptors.strings()));
final Coder<Integer> coder3 = translationContext.getCoder(binaryFunctor);
translationContext
.getCoder(TypeAwareBinaryFunctor.of(binaryFunctor, TypeDescriptors.integers()));
final Coder<Pair<Integer, String>> coder5 = translationContext.getCoder(reduceFunctor);
final Coder<Pair<String, String>> coder6 = translationContext.getCoder(pairUnaryFunction);
translationContext.getCoder(
reduceFunctor, TypeHint.pairs(NotSerializableClass.class, String.class)));
assertEquals(String.class, translationContext.getLambdaReturnType(unaryFunction));
assertEquals(Pair.class, translationContext.getLambdaReturnType(unaryFunction2));
translationContext.getLambdaReturnType(
private class NotSerializableClass {
} | 0 |
return session.getStringProperty(KB_INTERACTIVE_NAME_PROP, DEFAULT_KB_INTERACTIVE_NAME);
return session.getStringProperty(KB_INTERACTIVE_INSTRUCTION_PROP, DEFAULT_KB_INTERACTIVE_INSTRUCTION);
return session.getStringProperty(KB_INTERACTIVE_LANG_PROP, DEFAULT_KB_INTERACTIVE_LANG);
return session.getStringProperty(KB_INTERACTIVE_PROMPT_PROP, DEFAULT_KB_INTERACTIVE_PROMPT);
return session.getBooleanProperty(KB_INTERACTIVE_ECHO_PROMPT_PROP, DEFAULT_KB_INTERACTIVE_ECHO_PROMPT); | 0 |
* Copyright 2001-2004 The Apache Software Foundation.
* 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 |
import java.io.FileInputStream;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
checkXmlSignatureSoftwareStack(false);
}
public void testCheckXmlSignatureSoftwareStackWithCert() throws Exception {
checkXmlSignatureSoftwareStack(true);
}
private void checkXmlSignatureSoftwareStack(boolean cert) throws Exception {
PrivateKey privateKey = null;
PublicKey publicKey = null;
X509Certificate signingCert = null;
if (cert) {
// get key & self-signed certificate from keystore
String fs = System.getProperty("file.separator");
FileInputStream fis = new FileInputStream
(System.getProperty("basedir") + fs + "data" + fs + "test.jks");
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(fis, "changeit".toCharArray());
signingCert = (X509Certificate) ks.getCertificate("mullan");
publicKey = signingCert.getPublicKey();
privateKey = (PrivateKey) ks.getKey("mullan", "changeit".toCharArray());
} else {
KeyPair keyPair = KeyPairGenerator.getInstance("DSA").generateKeyPair();
publicKey = keyPair.getPublic();
privateKey = keyPair.getPrivate();
}
XMLSignature.ALGO_ID_SIGNATURE_DSA,
if (cert) {
signature.addKeyInfo(signingCert);
} else {
signature.addKeyInfo(publicKey);
} | 0 |
* @author John Keyes (john at integralsource.com) | 0 |
String nameService = m_configHelper.getValueFromDesiredConfigurations(cluster, ConfigHelper.HDFS_SITE, "dfs.internal.nameservices"); | 0 |
import org.apache.beam.vendor.grpc.v1p13p1.io.netty.channel.unix.DomainSocketAddress; | 0 |
package org.apache.batik.svggen; | 0 |
if (localHistory.canGoBack()) {
localHistory.back();
}
if (localHistory.canGoForward()) {
localHistory.forward();
} | 0 |
ClusterInformation clusterInformation = new ClusterInformation("cluster", false, null, null, null); | 0 |
if (key instanceof DSAPublicKey) { | 0 |
import java.util.Collections;
if (proplist == null)
{
proplist = Collections.emptyList();
} | 0 |
return ConnectionConfiguration.create( | 0 |
if (source.hasNext())
source.doNextPreCheck();
if (nextEntries.length < MAX_READ_AHEAD_ENTRIES)
nextEntries = new Entry[Math.min(nextEntries.length * 2, MAX_READ_AHEAD_ENTRIES)];
if (amountRead > READ_AHEAD_BYTES)
break;
if (iter.hasNext())
entry = iter.next();
else
entry = null;
if (entry == null)
throw new IllegalStateException();
if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get())
throw new IterationInterruptedException();
} else
entry = null;
if (interruptFlag != null && interruptFlag.get())
throw new IterationInterruptedException();
} else
entry = null; | 1 |
* By definition, these methods are safe to call without impacting the state of FATE. They should
* also be safe to call without impacting the state of system components. | 0 |
if (userName != null ?
!userName.equals(that.userName) : that.userName != null) {
return false;
}
return true; | 0 |
* @since 2.0 | 1 |
return Query.isJobScoped(query)
&& (query.getStatusesSize() == 0)
&& (query.getTaskIdsSize() == 0); | 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.scr.integration.components.activatesignature;
import org.osgi.service.component.ComponentContext;
public class Signature_Package_ComponentContext extends AbstractActivateSignatureTestComponent
{
void activate( @SuppressWarnings("unused") ComponentContext context )
{
setMethodCalled( context );
}
} | 0 |
import org.apache.accumulo.fate.util.LoggingRunnable; | 1 |
private static final int[] TOKENS = new int[] { TokenTypes.METHOD_DEF };
@Override
public int[] getAcceptableTokens() {
return TOKENS;
}
return TOKENS;
}
@Override
public int[] getRequiredTokens() {
return TOKENS; | 0 |
builder.delegate(CombineFnWithContext.this); | 0 |
executorClock.advance(Amount.of(2L, Time.MILLISECONDS)); | 0 |
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.refimpl.script.jacl;
import org.apache.batik.script.Interpreter;
import org.apache.batik.script.InterpreterFactory;
/**
* Allows to create instances of <code>JaclInterpreterFactory</code>.
* @author <a href="mailto:[email protected]">Christophe Jolif</a>
* @version $Id$
*/
public class JaclInterpreterFactory implements InterpreterFactory {
/**
* Builds a <code>JaclInterpreterFactory</code>.
*/
public JaclInterpreterFactory() {
}
/**
* Creates an instance of <code>JaclInterpreter</code> class.
*/
public Interpreter createInterpreter() {
return new JaclInterpreter();
}
} | 0 |
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
@Nullable
void restartTasks(Set<String> taskIds) throws RestartException;
@Override
public boolean equals(Object o) {
if (!(o instanceof TwitterTask)) {
return false;
}
TwitterTask other = (TwitterTask) o;
return new EqualsBuilder()
.append(taskId, other.taskId)
.append(slaveId, other.slaveId)
.append(taskName, other.taskName)
.append(resources, other.resources)
.append(task, other.task)
.isEquals();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append(taskId)
.append(slaveId)
.append(taskName)
.append(resources)
.append(task)
.toString();
} | 0 |
package org.apache.felix.sigil.repository;
import org.apache.felix.sigil.model.IModelElement; | 0 |
import org.apache.accumulo.server.cli.ClientOpts;
import com.beust.jcommander.Parameter;
static class Opts extends ClientOpts {
@Parameter(names={"-t", "--tableId"}, description="table id", required=true)
String tableId;
@Parameter(names={"-e", "--endRow"}, description="end row")
String endRow;
@Parameter(names={"-t", "--time"}, description="time, in milliseconds", required=true)
long time;
}
Opts opts = new Opts();
opts.parseArgs(PrintEvents.class.getName(), args);
Connector conn = opts.getConnector();
printEvents(conn, opts.tableId, opts.endRow, opts.time); | 1 |
import org.apache.beam.sdk.PipelineRunner; | 0 |
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
* @version CVS $Id: FlowNode.java,v 1.5 2004/06/08 13:09:27 cziegeler Exp $
implements Composable, Contextualizable, Disposable {
ComponentSelector interpreterSelector;
this.interpreterSelector = (ComponentSelector)manager.lookup(Interpreter.ROLE);
this.interpreter = (Interpreter)this.interpreterSelector.select(language);
} catch (ComponentException ce) {
throw ce;
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
if ( this.manager != null ) {
if ( this.interpreterSelector != null ) {
this.interpreterSelector.release( (Component)this.interpreter );
this.interpreter = null;
this.manager.release( this.interpreterSelector );
this.interpreterSelector = null;
}
this.manager = null;
}
}
| 0 |
((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
(String) ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
+ ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
result = ((BundleRevisionImpl)
extBundle.adapt(BundleRevision.class)).getResourceLocal(path); | 0 |
package org.apache.accumulo.core.clientImpl;
import org.apache.accumulo.core.clientImpl.TabletLocatorImpl.TabletServerLockChecker;
import org.apache.accumulo.core.dataImpl.KeyExtent; | 0 |
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.
*/
* @version CVS $Id: SimpleCache.java,v 1.2 2004/03/05 10:07:25 bdelacretaz Exp $ | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.