Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
* Base class for the VFS Ant tasks. Takes care of creating a FileSystemManager, and for cleaning it up at the end of * the build. Also provides some utility methods. public class VfsTask extends Task { protected FileObject resolveFile(final String uri) throws FileSystemException { if (manager == null) { protected void closeManager() { if (manager != null) { private class CloseListener implements SubBuildListener { public void subBuildStarted(final BuildEvent buildEvent) { public void subBuildFinished(final BuildEvent buildEvent) { public void buildFinished(final BuildEvent event) { public void buildStarted(final BuildEvent event) { public void messageLogged(final BuildEvent event) { public void targetFinished(final BuildEvent event) { public void targetStarted(final BuildEvent event) { public void taskFinished(final BuildEvent event) { public void taskStarted(final BuildEvent event) { private class AntLogger implements Log { public void debug(final Object o) { public void debug(final Object o, final Throwable throwable) { public void error(final Object o) { public void error(final Object o, final Throwable throwable) { public void fatal(final Object o) { public void fatal(final Object o, final Throwable throwable) { public void info(final Object o) { public void info(final Object o, final Throwable throwable) { public void trace(final Object o) { public void trace(final Object o, final Throwable throwable) { public void warn(final Object o) { public void warn(final Object o, final Throwable throwable) { public boolean isDebugEnabled() { public boolean isErrorEnabled() { public boolean isFatalEnabled() { public boolean isInfoEnabled() { public boolean isTraceEnabled() { public boolean isWarnEnabled() {
1
import java.nio.channels.SelectionKey; if (this.contentDecoder != null && (this.session.getEventMask() & SelectionKey.OP_READ) > 0) {
0
@FunctionalInterface
0
* * @param cmd The incoming command type
1
producer.sendResponse(responseChannel, context); responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
0
TestIngest.ingest(c, opts, BWOPTS); VerifyIngest.verifyIngest(c, vopts, SOPTS);
1
public MultiMap(Map<K,List<V>> other) { this(); for ( java.util.Map.Entry<K,List<V>> e : other.entrySet()) { addAll(e.getKey(), e.getValue()); } }
0
methods.add(klass.getMethod("cloneAs", Class.class));
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/converters/SqlTimestampConverter.java,v 1.6 2003/10/09 20:43:16 rdonkin Exp $ * $Revision: 1.6 $ * $Date: 2003/10/09 20:43:16 $ * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * @version $Revision: 1.6 $ $Date: 2003/10/09 20:43:16 $
0
if (algorithmURI != null) { Algorithm algorithm = algorithmsMap.get(algorithmURI); if (algorithm != null) { return algorithm.requiredKey; }
0
public class NestedJarTestCase extends AbstractProviderTestConfig { public static Test suite() throws Exception { public void prepare(final DefaultFileSystemManager manager) throws Exception { public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
1
* @version $Revision$ $Date$
0
package org.apache.commons.codec2.language; import org.apache.commons.codec2.EncoderException; import org.apache.commons.codec2.StringEncoder; import org.apache.commons.codec2.StringEncoderAbstractTest;
0
import org.slf4j.Logger; import org.slf4j.LoggerFactory; private static final Logger LOG = LoggerFactory.getLogger(CertGenerationTest.class);
1
public DOMSignatureProperty(List<? extends XMLStructure> content, String target, String id) this.content = Collections.unmodifiableList( new ArrayList<XMLStructure>(content)); for (int i = 0, size = this.content.size(); i < size; i++) { if (!(this.content.get(i) instanceof XMLStructure)) {
0
private static final Arg<Double> MAX_SCHEDULE_ATTEMPTS_PER_SEC = Arg.create(40D);
0
/* * Copyright (c) 2015, Cloudera, Inc. All Rights Reserved. * * Cloudera, Inc. 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 * * This software 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 com.cloudera.dataflow.spark.streaming; import com.google.cloud.dataflow.sdk.options.PipelineOptions; import com.google.cloud.dataflow.sdk.options.PipelineOptionsRegistrar; import com.google.common.collect.ImmutableList; public class SparkStreamingPipelineOptionsRegistrar implements PipelineOptionsRegistrar { @Override public Iterable<Class<? extends PipelineOptions>> getPipelineOptions() { return ImmutableList.<Class<? extends PipelineOptions>>of(SparkStreamingPipelineOptions .class); } }
0
import org.apache.accumulo.core.trace.TraceUtil; SimpleThriftService.Iface actualHandler = TraceUtil.wrapService(handler);
0
import org.apache.sshd.common.auth.MutableBasicCredentials; MutableBasicCredentials, SimpleClientConfigurator, @Override public String getUsername() { * @param user The (never {@code null}/empty) username @Override public void setUsername(String user) { @Override @Override String username = ValidateUtils.checkNotNullAndNotEmpty(getUsername(), "User must not be empty");
0
package org.apache.commons.dbcp2;
1
private static void copyStreamToFileSystem(FileSystem fs, String jarName, Path path) throws IOException { try (FSDataOutputStream dest = fs.create(path); InputStream stream = ClassLoaderIT.class.getResourceAsStream(jarName)) { IteratorSetting is = new IteratorSetting(10, "TestCombiner", "org.apache.accumulo.test.functional.TestCombiner");
0
* Flag indicating whether this configuration object is statically or * dynamically bound. */ private volatile boolean staticallyBound; /** this.staticallyBound = bundleLocation != null; this.staticallyBound = bundleLocation != null; setAutoProperties( props, staticallyBound ); public void setBundleLocation( String bundleLocation, boolean staticBinding ) if ( staticBinding ) // set binding and mark static and store everything this.bundleLocation = bundleLocation; this.staticallyBound = staticBinding; // 104.15.2.8 The bundle location will be set persistently try { store(); } catch ( IOException ioe ) { configurationManager.log( LogService.LOG_ERROR, "Persisting new bundle location failed", ioe ); } else if ( !staticallyBound ) // dynamic binding, no need to store this.bundleLocation = bundleLocation; setAutoProperties( newProperties, staticallyBound ); // add automatic properties including the bundle location (if // statically bound) setAutoProperties( props, staticallyBound ); else if ( getBundleLocation() != null && staticallyBound )
0
* @version $Id$
0
repeater.clear();
0
/* ==================================================================== * Copyright (c) 2001-2004 The Apache Software Foundation. All rights * @version $Revision: 1.3 $ $Date: 2004/01/14 21:43:09 $
0
import com.google.common.collect.Iterators; import java.util.Iterator; return new Builder().as(PipelineOptions.class); return new Builder().as(klass); return new Builder().fromArgs(args); return new Builder().withValidation(); private Builder() { this(null, false, true); private Builder(String[] args, boolean validation, this.defaultAppName = findCallersClassName(); return new Builder(args, validation, strictParsing); return new Builder(args, true, strictParsing); return new Builder(args, validation, false); * Returns the simple name of the calling class using the current threads stack. private static String findCallersClassName() { Iterator<StackTraceElement> elements = Iterators.forArray(Thread.currentThread().getStackTrace()); // First find the PipelineOptionsFactory/Builder class in the stack trace. while (elements.hasNext()) { StackTraceElement next = elements.next(); if (PIPELINE_OPTIONS_FACTORY_CLASSES.contains(next.getClassName())) { break; } // Then find the first instance after which is not the PipelineOptionsFactory/Builder class. while (elements.hasNext()) { StackTraceElement next = elements.next(); if (!PIPELINE_OPTIONS_FACTORY_CLASSES.contains(next.getClassName())) { try { return Class.forName(next.getClassName()).getSimpleName(); } catch (ClassNotFoundException e) { break; } } } return "unknown"; /** Classes which are used as the boundary in the stack trace to find the callers class name. */ private static final Set<String> PIPELINE_OPTIONS_FACTORY_CLASSES = ImmutableSet.of( PipelineOptionsFactory.class.getName(), Builder.class.getName()); ImmutableMap.builder();
0
public synchronized String toString() {
0
import org.apache.beam.runners.spark.PipelineRule; public final PipelineRule pipelineRule = PipelineRule.batch(); Pipeline p = pipelineRule.createPipeline();
0
/** * If the command fails and is skippable, then this will instruct the * scheduler to skip the command. */ @Column(name = "auto_skip_on_failure", nullable = false) private Integer autoSkipOnFailure = Integer.valueOf(0); /** * Gets whether commands which fail and are retryable are automatically * skipped and marked with {@link HostRoleStatus#SKIPPED_FAILED}. * * @return */ public boolean isFailureAutoSkipped() { return autoSkipOnFailure != 0; } /** * Sets whether commands which fail and are retryable are automatically * skipped and marked with {@link HostRoleStatus#SKIPPED_FAILED}. * * @param skipFailures */ public void setAutoSkipOnFailure(boolean skipFailures) { autoSkipOnFailure = skipFailures ? 1 : 0; }
1
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.apache.accumulo.core.client.impl.BaseIteratorEnvironment; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.IteratorUtil; import org.apache.accumulo.core.iterators.SortedMapIterator; import org.apache.commons.collections.BufferOverflowException; import org.apache.hadoop.io.Text; import org.junit.Test; private static final class DummyIteratorEnv extends BaseIteratorEnvironment {
1
import java.net.InetSocketAddress; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpConnection; import org.apache.hc.core5.http.HttpException; import org.apache.hc.core5.http.HttpHeaders; import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.HttpRequest; import org.apache.hc.core5.http.HttpResponse; import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.ProtocolException; import org.apache.hc.core5.http.entity.EntityUtils; import org.apache.hc.core5.http.entity.StringEntity; import org.apache.hc.core5.http.io.HttpRequestHandler; import org.apache.hc.core5.http.io.UriHttpRequestHandlerMapper; import org.apache.hc.core5.http.message.BasicHeader; import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.http.protocol.HttpCoreContext; final HttpConnection conn = (HttpConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION); final InetSocketAddress socketAddress = (InetSocketAddress) conn.getLocalAddress(); String localhost = socketAddress.getHostName(); final int port = socketAddress.getPort(); this.clientBuilder.setDefaultHeaders(Arrays.asList(new BasicHeader(HttpHeaders.USER_AGENT, "my-test-client"))); final Header header = reqWrapper.getFirstHeader(HttpHeaders.USER_AGENT);
0
import org.apache.cocoon.xml.XMLUtils; import org.w3c.dom.Document; Document expected = load(outputURI); getLogger().error( XMLUtils.serializeNode( expected ) ); Document actual = generate(JX, inputURI, EMPTY_PARAMS); getLogger().error( XMLUtils.serializeNode( actual ) ); assertEqual( expected, actual ); // public void testJXDynamicMacro() throws Exception { // String inputURI = docBase + "jxDynamicMacro.xml"; // String outputURI = docBase + "jxDynamicMacro-output.xml"; // // assertEqual(load(outputURI), generate(JX, inputURI, EMPTY_PARAMS)); // }
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
desiredStateEntity.setHostId(hostEntity.getHostId());
0
final static List<Short> NO_VIOLATIONS = new ArrayList<Short>(); // fast size check if (mutation.numBytes() < maxSize) return NO_VIOLATIONS;
0
/* * $HeadURL$ * $Revision$ * $Date$ * * ==================================================================== * 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * */ package org.apache.http.localserver; import java.io.IOException; import org.apache.http.HttpException; import org.apache.http.HttpResponse; import org.apache.http.HttpResponseInterceptor; import org.apache.http.HttpStatus; import org.apache.http.auth.AUTH; import org.apache.http.protocol.HttpContext; public class ResponseBasicUnauthorized implements HttpResponseInterceptor { public void process( final HttpResponse response, final HttpContext context) throws HttpException, IOException { if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { response.addHeader(AUTH.WWW_AUTH, "Basic realm=\"test realm\""); } } }
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. */ package org.apache.aurora.common.args.constraints; import java.io.File; import java.lang.annotation.Annotation; import org.apache.aurora.common.args.Verifier; import org.apache.aurora.common.args.VerifierFor; import static com.google.common.base.Preconditions.checkArgument; /** * Verifier to ensure that a file is readable. * * @author William Farner */ @VerifierFor(CanRead.class) public class CanReadFileVerifier implements Verifier<File> { @Override public void verify(File value, Annotation annotation) { checkArgument(value.canRead(), "File must be readable"); } @Override public String toString(Class<? extends File> argType, Annotation annotation) { return "file must be readable"; } }
0
timerInternals.cleanupPendingTimer(timer.getNamespace());
0
@Deprecated
0
import org.apache.beam.sdk.util.WindowedValue; * Returns elements that were provided to the {@link TransformEvaluator} as input but were not * processed. */ Iterable<? extends WindowedValue<?>> getUnprocessedElements(); /**
0
private final HttpEntity wrappedEntity;
0
if (log.isTraceEnabled()) { log.trace("createSftpClient(" + session + ") client close failure details", t); } if (log.isTraceEnabled()) { log.trace("createSftpClient(" + session + ") session close failure details", e); } if (log.isTraceEnabled()) { log.trace("createScpClient(" + session + ") session close failure details", t); }
0
if (log.isDebugEnabled()) { if (log.isTraceEnabled()) { port = ((InetSocketAddress) acceptor.getBoundAddresses().iterator().next()).getPort(); log.info("start() listen on auto-allocated port=" + port); port = ((InetSocketAddress) acceptor.getBoundAddresses().iterator().next()).getPort(); log.info("start() listen on auto-allocated port=" + port);
0
import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.xml.IncludeXMLConsumer; import org.apache.cocoon.xml.XMLUtils; import org.apache.excalibur.source.SourceParameters; import org.apache.excalibur.xml.sax.SAXParser; import org.apache.excalibur.xml.sax.XMLizable; import org.apache.excalibur.xml.xpath.NodeListImpl; import org.apache.excalibur.xml.xpath.XPathProcessor; import org.apache.excalibur.xml.xpath.XPathUtil; import org.apache.xpath.XPathAPI; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; * @version CVS $Id: DOMUtil.java,v 1.8 2004/03/01 03:50:58 antonio Exp $
0
import org.apache.accumulo.core.client.AccumuloClient; AccumuloClient c = getAccumuloClient();
0
/** * Create a new JXPathContextFactoryReferenceImpl. */ /** * {@inheritDoc} */ Object contextBean) {
0
/** {@link org.apache.commons.logging} logging facility */ static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog( X509IssuerSerialResolver.class.getName()); log.debug("Can I resolve " + element.getTagName() + "?"); log.debug("I can't"); log.debug("I can't"); log.debug("I can't"); log.debug("I can't"); log.info("", ex); log.debug("Found Certificate Issuer: " log.debug("Found Certificate Serial: " log.debug("Found Element Issuer: " log.debug("Found Element Serial: " log.debug("match !!! "); log.debug("no match..."); log.debug("XMLSecurityException", ex);
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//dbcp/src/java/org/apache/commons/dbcp/DelegatingResultSet.java,v 1.7 2003/03/06 00:11:32 rwaldhoff Exp $ * $Revision: 1.7 $ * $Date: 2003/03/06 00:11:32 $ // Will be commented by the build process on a JDBC 2.0 system
0
if (!shellState.getConnector().tableOperations().exists(tableName)) throw new TableNotFoundException(null, tableName, null); if (tableIterators == null) Shell.log.info("No scan iterators set on table " + tableName); else Shell.log.info("Removed the following scan iterators from table " + tableName + ":" + tableIterators.keySet()); if (options == null) Shell.log.info("No iterator named " + name + " found for table " + tableName); else Shell.log.info("Removed scan iterator " + name + " from table " + tableName);
1
public int compare(final K o1, final K o2) { static boolean isOutOfBoundsIndex(final int bitIndex) { static boolean isEqualBitKey(final int bitIndex) { static boolean isNullBitKey(final int bitIndex) { static boolean isValidBitIndex(final int bitIndex) {
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
boolean hasNext = false; if (hasNext) while (true) { try { return hasNext = true; if (!hasNext && !hasNext()) hasNext = false;
0
import static com.google.cloud.dataflow.sdk.io.SourceTestUtils.assertSplitAtFractionExhaustive; assertSplitAtFractionExhaustive(original, options);
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
* This method can be used to log I/O exception thrown while closing * {@link java.io.Closeable} objects (such as * {@link org.apache.http.HttpConnection}}). * @param ex I/O exception thrown by {@link java.io.Closeable#close()}
0
import static org.apache.aurora.scheduler.base.TaskTestUtil.makeTaskEvent; int startTime = 100; if (status == ScheduleStatus.SANDBOX_DELETED) { return makeTask(status, ImmutableList.of( makeTaskEvent(startTime + 10, ScheduleStatus.FAILED), makeTaskEvent(startTime + 20, ScheduleStatus.SANDBOX_DELETED))); } return makeTask(status, startTime);
0
* {@code --pubsubTopic=projects/PROJECT ID/topics/YOUR_TOPIC_NAME}
0
//If host doesn't belongs to any cluster if (report.getStatus().equals("COMPLETED")) {
0
import java.nio.charset.Charset; String xmlString = FileUtils.readFileToString(file, Charset.defaultCharset());
0
public static Option[] configure() { .prepare( .prepare( .prepare( mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo.handler.transaction").version(asInProject()),
0
public OpenSSHFsyncExtensionImpl(SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
1
import org.apache.ambari.logfeeder.util.S3Util;
0
import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; ComponentSSLConfiguration configuration1 = ComponentSSLConfigurationTest.getConfiguration( "tspath", "tspass", "tstype", false); ComponentSSLConfiguration configuration2 = ComponentSSLConfigurationTest.getConfiguration( "tspath", "tspass", "tstype", true); ComponentSSLConfiguration configuration3 = ComponentSSLConfigurationTest.getConfiguration( "tspath", "tspass", "tstype", false);
0
* @version $Id$
0
* @param responseHandler the response handler <T> T execute(ClassicHttpRequest request, HttpClientResponseHandler<? extends T> responseHandler) throws IOException; * @param responseHandler the response handler <T> T execute( ClassicHttpRequest request, HttpContext context, HttpClientResponseHandler<? extends T> responseHandler) throws IOException; * @param responseHandler the response handler <T> T execute( HttpHost target, ClassicHttpRequest request, HttpClientResponseHandler<? extends T> responseHandler) throws IOException; * @param responseHandler the response handler HttpContext context, HttpClientResponseHandler<? extends T> responseHandler) throws IOException;
0
private final Object statusLock; this.statusLock = new Object(); synchronized (this.statusLock) { if (this.status.compareTo(IOReactorStatus.SHUTDOWN_REQUEST) >= 0) { this.status = IOReactorStatus.SHUT_DOWN; this.statusLock.notifyAll(); return; } if (this.status.compareTo(IOReactorStatus.INACTIVE) != 0) { throw new IllegalStateException("Illegal state: " + this.status); } this.status = IOReactorStatus.ACTIVE; // Start I/O dispatchers for (int i = 0; i < this.dispatchers.length; i++) { BaseIOReactor dispatcher = new BaseIOReactor(this.selectTimeout); dispatcher.setExceptionHandler(exceptionHandler); this.dispatchers[i] = dispatcher; } for (int i = 0; i < this.workerCount; i++) { BaseIOReactor dispatcher = this.dispatchers[i]; this.workers[i] = new Worker(dispatcher, eventDispatch); this.threads[i] = this.threadFactory.newThread(this.workers[i]); } synchronized (this.statusLock) { doShutdown(); this.status = IOReactorStatus.SHUT_DOWN; this.statusLock.notifyAll(); } synchronized (this.statusLock) { this.statusLock.wait(remaining); synchronized (this.statusLock) { if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) { return; } this.status = IOReactorStatus.SHUTDOWN_REQUEST; this.selector.wakeup(); try { awaitShutdown(waitMs); } catch (InterruptedException ignore) { }
0
private static final SecureRandom rand = new SecureRandom(); return new Path(path.getParent(), path.getName() + "_" + System.currentTimeMillis() + "_" + (rand.nextInt(Integer.MAX_VALUE) + 1) + ".bak");
0
import org.junit.Assert;
0
* @param context the context for the request execution
0
import org.apache.beam.sdk.values.WindowingStrategy;
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 java.io.InputStream; import org.apache.commons.fileupload.UploadContext; public class PortletRequestContext implements UploadContext {
0
@Override
0
import org.junit.rules.ExpectedException; import java.io.FileNotFoundException; @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void testErrorOnFileNotFound() throws Exception { expectedException.expect(FileNotFoundException.class); readElems("file-not-found", 0L, 100L, AvroCoder.of(String.class), new ArrayList<Integer>()); } @Test public void testErrorOnMultipleFiles() throws Exception { File file1 = tmpFolder.newFile("foo1.avro"); File file2 = tmpFolder.newFile("foo2.avro"); Channels.newOutputStream(IOChannelUtils.create(file1.getPath(), MimeTypes.BINARY)).close(); Channels.newOutputStream(IOChannelUtils.create(file2.getPath(), MimeTypes.BINARY)).close(); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("more than 1 file matched"); readElems(new File(tmpFolder.getRoot(), "*").getPath(), 0L, 100L, AvroCoder.of(String.class), new ArrayList<Integer>()); }
0
new Resources(0.01, Amount.of(32L, Data.MB), Amount.of(1L, Data.MB), 0);
0
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.apache.beam.runners.core.construction.ModelCoderRegistrar; import org.apache.beam.runners.core.construction.SdkComponents; CloudObject cloudObject = CloudObjects.asCloudObject(coder, /*sdkComponents=*/ null); @Test public void toAndFromCloudObjectWithSdkComponents() throws Exception { SdkComponents sdkComponents = SdkComponents.create(); CloudObject cloudObject = CloudObjects.asCloudObject(coder, sdkComponents); Coder<?> fromCloudObject = CloudObjects.coderFromCloudObject(cloudObject); assertEquals(coder.getClass(), fromCloudObject.getClass()); assertEquals(coder, fromCloudObject); checkPipelineProtoCoderIds(coder, cloudObject, sdkComponents); } private static void checkPipelineProtoCoderIds( Coder<?> coder, CloudObject cloudObject, SdkComponents sdkComponents) throws Exception { if (ModelCoderRegistrar.isKnownCoder(coder)) { assertFalse(cloudObject.containsKey(PropertyNames.PIPELINE_PROTO_CODER_ID)); } else { assertTrue(cloudObject.containsKey(PropertyNames.PIPELINE_PROTO_CODER_ID)); assertEquals( sdkComponents.registerCoder(coder), cloudObject.get(PropertyNames.PIPELINE_PROTO_CODER_ID)); } List<? extends Coder<?>> coderArguments = coder.getCoderArguments(); Object cloudComponentsObject = cloudObject.get(PropertyNames.COMPONENT_ENCODINGS); assertTrue(cloudComponentsObject instanceof List); List<CloudObject> cloudComponents = (List<CloudObject>) cloudComponentsObject; assertEquals(coderArguments.size(), cloudComponents.size()); for (int i = 0; i < coderArguments.size(); i++) { checkPipelineProtoCoderIds(coderArguments.get(i), cloudComponents.get(i), sdkComponents); } }
0
import org.apache.http.util.CharArrayBuffer;
0
package org.apache.accumulo.core.util.shell.commands;
0
final HttpHost target = context.getTargetHost(); flushEntriesInvalidatedByRequest(context.getTargetHost(), request); final HttpHost target = context.getTargetHost(); final HttpHost target = context.getTargetHost(); context.getTargetHost(), conditionalRequest, requestDate, responseDate, tryToUpdateVariantMap(context.getTargetHost(), request, matchingVariant); context.getTargetHost(), request, cacheEntry, final HttpHost target = context.getTargetHost();
0
AmbariMetaInfo ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class); ServiceResourceProviderTest.createServices(controller, requests); ServiceResourceProviderTest.updateServices(controller, sReqs, mapRequestProps, true, false);
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/ArrayLongList.java,v 1.3 2003/08/31 17:21:15 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.3 $ $Date: 2003/08/31 17:21:15 $
0
import org.apache.felix.scr.impl.manager.ScrConfiguration; private final ScrConfiguration m_configuration; public ComponentRegistry( final ScrConfiguration scrConfiguration, final ScrLogger logger ) m_configuration = scrConfiguration; try timer.schedule(new TimerTask() @Override public void run() { synchronized ( changeCountLock ) if ( changeCount == count ) { try { registration.setProperties(getServiceRegistrationProperties()); } catch ( final IllegalStateException ise) { // we ignore this as this might happen on shutdown } timer.cancel(); timer = null; } }, m_configuration.serviceChangecountTimeout()); } catch (Exception e) { m_logger.log(LogService.LOG_WARNING, "Service changecount Timer for {0} had a problem", e, registration.getReference()); }
0
this.requestFactory = requestFactory != null ? requestFactory : DefaultHttpRequestFactory.INSTANCE; protected IOException createConnectionClosedException() { return new ConnectionClosedException("Client closed connection"); } @Override protected HttpRequest createMessage(final CharArrayBuffer buffer) throws IOException, HttpException { final RequestLine requestLine = getLineParser().parseRequestLine(buffer);
0
try { httpclient.getCredentialsProvider().setCredentials( new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials("username", "password")); // Create AuthCache instance AuthCache authCache = new BasicAuthCache(); // Generate BASIC scheme object and add it to the local // auth cache BasicScheme basicAuth = new BasicScheme(); authCache.put(targetHost, basicAuth); // Add AuthCache to the execution context BasicHttpContext localcontext = new BasicHttpContext(); localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache); HttpGet httpget = new HttpGet("/"); System.out.println("executing request: " + httpget.getRequestLine()); System.out.println("to target: " + targetHost); for (int i = 0; i < 3; i++) { HttpResponse response = httpclient.execute(targetHost, httpget, localcontext); HttpEntity entity = response.getEntity(); System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); if (entity != null) { System.out.println("Response content length: " + entity.getContentLength()); } EntityUtils.consume(entity); } finally { // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpclient.getConnectionManager().shutdown(); }
0
* $HeadURL$ * $Revision$ * $Date$ import org.apache.http.conn.params.ConnManagerParams; ConnManagerParams.setMaxTotalConnections(params, 5); ConnManagerParams.setMaxConnectionsPerRoute(params, ConnManagerParams.setMaxTotalConnections(params, 5); ConnManagerParams.setMaxConnectionsPerRoute(params, ConnManagerParams.setMaxTotalConnections(params, 5); ConnManagerParams.setMaxConnectionsPerRoute(params,
0
import java.util.List; private List<JFile> mInclFiles; private List<JRecord> mRecords;
0
import com.fasterxml.jackson.annotation.JsonIgnore; private String relationshipLabel; setRelationshipLabel(getDefaultRelationshipLabel()); public AtlasRelationshipDef(AtlasRelationshipDef other) throws AtlasBaseException { super(other); if (other != null) { setRelationshipCategory(other.getRelationshipCategory()); setRelationshipLabel(other.getRelationshipLabel()); setPropagateTags(other.getPropagateTags()); setEndDef1(other.getEndDef1()); setEndDef2(other.getEndDef2()); } } public void setRelationshipLabel(String relationshipLabel) { this.relationshipLabel = relationshipLabel; } public String getRelationshipLabel() { return relationshipLabel != null ? relationshipLabel : ("r:" + super.getName()); } @JsonIgnore private String getDefaultRelationshipLabel() { String name = super.getName(); return name != null ? ("r:" + name) : null; sb.append(this.relationshipLabel); sb.append(','); if (!Objects.equals(relationshipLabel, that.getRelationshipLabel())) return false; return Objects.hash(super.hashCode(), relationshipCategory, relationshipLabel, propagateTags, endDef1, endDef2);
0
import static java.util.Arrays.asList; import org.junit.Test; .read( ListDataSource.unbounded( asList("0-one 1-two 0-three 1-four 0-five 1-six 0-seven".split(" "))) .withReadDelay(READ_DELAY)) .apply( input -> ReduceByKey.of(input) .keyBy(e -> "") .valueBy(e -> e) .reduceBy(s -> s.collect(Collectors.toSet())) .windowBy(Count.of(3))) .flatMap( (Pair<String, Set<String>> e, Collector<String> c) -> e.getSecond().stream().forEachOrdered(c::collect)) .apply( input -> ReduceByKey.of(input) .keyBy(e -> "") .valueBy(e -> e) .reduceBy(s -> s.collect(Collectors.toSet()))) }
0
import com.google.common.collect.ImmutableMap; public BeamSqlPrimitive evaluate( Row inputRow, BoundedWindow window, ImmutableMap<Integer, Object> correlateEnv) { Collection<Object> collection = opValueEvaluated(0, inputRow, window, correlateEnv);
0
* @version CVS $Id: CopletAdapter.java,v 1.3 2003/05/26 09:52:59 cziegeler Exp $ /** * Initialize the coplet * This method is called immediately after a new instance is created. * For each coplet, this method is only invoked once. * @param coplet The coplet */ /** * Destroy the coplet * This method is invoked when a coplet instance will be destroyed * For each coplet, this method is only invoked once. * @param coplet */ void destroy(CopletInstanceData coplet); /** * Stream the content of the coplet */ /** * User logs in to a coplet * This method is invoked when a user logs in for each coplet instance * of the user */ void login(CopletInstanceData coplet); /** * User logs out from a coplet * This method is invoked when a user logs out for each coplet instance * of this user. */ void logout(CopletInstanceData coplet);
0
import javax.annotation.Nullable; @Nullable @Nullable @Nullable Windowing<IN, W> windowing, @Nullable UnaryFunction<IN, Long> eventTimeAssigner) { @Nullable Windowing<IN, W> windowing, @Nullable UnaryFunction<IN, Long> eventTimeAssigner) {
0
@JsonProperty("statusCommands") private List<StatusCommand> statusCommands = null; public List<StatusCommand> getStatusCommands() { return statusCommands; public void setStatusCommands(List<StatusCommand> statusCommands) { this.statusCommands = statusCommands; @Override public String toString() { return "RegistrationResponse{" + "response=" + response + ", responseId=" + responseId + ", statusCommands=" + statusCommands + '}'; }
1
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.BiMap; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableBiMap; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
0
public static List<PublicKey> resolveAuthorizedKeys( PublicKeyEntryResolver fallbackResolver, Collection<? extends AuthorizedKeyEntry> entries) throws IOException, GeneralSecurityException {
0
protected ConfigurationNodeIteratorBase(final ConfigurationNodePointer<T> parent, final boolean reverse) public boolean setPosition(final int pos) protected void setStartOffset(final int startOffset) protected int positionToIndex(final int pos) protected static String prefixName(final String prefix, final String name) protected static String qualifiedName(final QName name)
0
/** * * @version $Id$ */ private volatile Map imageWriterMap = new HashMap(); synchronized( ImageWriterRegistry.class ){ if ( instance == null ){ instance = new ImageWriterRegistry(); } }
0
/* * Copyright 2000-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. package org.apache.bcel.classfile;
0
import org.apache.beam.sdk.extensions.sql.impl.utils.CalciteUtils; import org.apache.beam.sdk.schemas.Schema.FieldType; FieldType type = field.getType(); if (CalciteUtils.isStringType(type)) { } else if (CalciteUtils.isDateTimeType(type)) { } else if (type.getTypeName().isNumericType() || (rawObj instanceof BigDecimal && type.getTypeName() != TypeName.DECIMAL))) { switch (type.getTypeName()) {
0
import org.apache.http.annotation.Immutable; @Immutable * streamed from cannot be reused until
0
package org.apache.felix.sigil.common.repository;
0