Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
* Copyright 1999-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
public void consume(final ByteBuffer src) throws IOException {
0
import org.apache.batik.util.XMLResourceDescriptor; return XMLResourceDescriptor.getXMLParserClassName();
0
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Lists.newArrayList; import static java.util.concurrent.Executors.newSingleThreadExecutor; import static org.assertj.core.api.Assertions.assertThat; import com.amazonaws.regions.Regions; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit;
0
private ClassPath _path = null; private final Map<String, SoftReference<JavaClass>> _loadedClasses = new HashMap<>(); // CLASSNAME X JAVACLASS this._path = path; _loadedClasses.put(clazz.getClassName(), new SoftReference<>(clazz)); _loadedClasses.remove(clazz.getClassName()); final SoftReference<JavaClass> ref = _loadedClasses.get(className); return loadClass(_path.getInputStream(className), className); return _path; _loadedClasses.clear();
0
private String description = null; * @return the description */ public String getDescription() { return description; } /** * @param description * the description to set */ public void setDescription(String description) { this.description = description; } /** if (description == null) { if (other.description != null) { return false; } } else if (!description.equals(other.description)) { return false; }
0
import org.apache.hc.core5.http.config.Http1Config; * @param http1Config the message http1Config. If {@code null} * {@link Http1Config#DEFAULT} will be used. final Http1Config http1Config) { super(lineParser, http1Config); public DefaultHttpResponseParser(final Http1Config http1Config) { this(null, null, http1Config); this(Http1Config.DEFAULT);
0
import org.apache.hc.core5.net.InetAddressUtils; @Override public String toString() { final StringBuilder buffer = new StringBuilder(); InetAddressUtils.formatAddress(buffer, getRemoteAddress()); buffer.append("->"); InetAddressUtils.formatAddress(buffer, getLocalAddress()); return buffer.toString(); }
0
double tracePercent = localConf.getFraction(Property.REPLICATION_TRACE_PERCENT); ProbabilitySampler sampler = TraceUtil.probabilitySampler(tracePercent); try (TraceScope replicaSpan = Trace.startSpan("AccumuloReplicaSystem", sampler)) { span.getSpan().addKVAnnotation("file", p.toString()); span.getSpan().addKVAnnotation("Batch size (bytes)", Long.toString(sizeLimit)); span.getSpan().addKVAnnotation("File", p.toString()); span.getSpan().addKVAnnotation("Peer instance name", peerContext.getInstanceName()); span.getSpan().addKVAnnotation("Peer tserver", peerTserver.toString()); span.getSpan().addKVAnnotation("Remote table ID", remoteTableId); span.getSpan().addKVAnnotation("file", p.toString());
0
AccumuloInputFormat.setClientProperties(job, getClientProperties()); AccumuloInputFormat.setClientProperties(job, getClientProperties());
0
if(value.contains(".") && (value.contains("e") || value.contains("E"))){ }else{ }
0
if (!f.isDirectory()) { return false; } else { File[] files = f.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith("site.xml"); } }); return files != null && files.length > 0; }
0
* @since 2.0
0
query = "SELECT kph FROM KerberosPrincipalHostEntity kph WHERE kph.hostId=:hostId") @Column(name = "host_id", insertable = true, updatable = false, nullable = false) private Long hostId; @JoinColumn(name = "host_id", referencedColumnName = "host_id", nullable = false, insertable = false, updatable = false) * @param hostId a Long indicating the KerberosPrincipalHostEntity's host id public KerberosPrincipalHostEntity(String principalName, Long hostId) { setHostId(hostId); return hostEntity != null ? hostEntity.getHostName() : null; * Gets the host id for this KerberosHostHostEntity * @return a Long indicating this KerberosHostHostEntity's host id public Long getHostId() { return hostId; } /** * Sets the host id for this KerberosHostHostEntity * * @param hostId a Long indicating this KerberosHostHostEntity's host id */ public void setHostId(Long hostId) { this.hostId = hostId;
0
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; * An in-memory copy of type categories vs types for convenience. private Multimap<DataTypes.TypeCategory, String> typeCategoriesToTypeNamesMap; typeCategoriesToTypeNamesMap = ArrayListMultimap.create(DataTypes.TypeCategory.values().length, 10); public ImmutableList<String> getTypeNamesByCategory(DataTypes.TypeCategory typeCategory) { return ImmutableList.copyOf(typeCategoriesToTypeNamesMap.get(typeCategory)); typeCategoriesToTypeNamesMap.putAll(DataTypes.TypeCategory.PRIMITIVE, types.keySet()); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.ARRAY, dT.getName()); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.MAP, dT.getName()); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.ENUM, eDef.name); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.CLASS, structDef.typeName); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.TRAIT, traitType.getName()); typeCategoriesToTypeNamesMap.put(DataTypes.TypeCategory.CLASS, classType.getName());
0
import com.google.common.collect.Lists; import com.twitter.mesos.gen.JobConfiguration; import com.twitter.mesos.scheduler.httphandlers.SchedulerzHome.Role; import com.twitter.mesos.scheduler.httphandlers.SchedulerzRole.Job; public static final Comparator<Role> SORT_USERS_BY_NAME = new Comparator<Role>() { @Override public int compare(Role roleA, Role roleB) { return roleA.role.compareTo(roleB.role);
0
import org.apache.sshd.server.session.ServerSession;
0
* <p>Two transcoding hints (<code>KEY_WIDTH</code> and * <code>KEY_HEIGHT</code>) can be used to respectively specify the image * <p>The <code>KEY_BACKGROUND_COLOR</code> defines the background color * <p>The <code>KEY_AOI</code> represents the area of interest to paint * <p><code>KEY_LANGUAGE</code> to set the default language to use (may be * <code>KEY_USER_STYLESHEET_URI</code> to fix the URI of a user * stylesheet, and <code>KEY_MM_PER_PIXEL</code> to specify the number of * Constructs a new <code>ImageTranscoder</code>.
0
import java.util.Optional;
0
import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.service.ServiceManager; import org.apache.cocoon.components.ContextHelper; import org.apache.cocoon.environment.Redirector; * @version CVS $Id: AO_FOM_Cocoon.java,v 1.5 2004/02/20 18:48:23 sylvain Exp $ private Redirector redirector; private ServiceManager componentManager; private Context avalonContext; Redirector redirector, Context avalonContext, ServiceManager manager, this.redirector = redirector; this.avalonContext = avalonContext; this.redirector = null; bizData, fom_wk, redirector); (OutputStream)unwrap(outputStream)); redirector.redirect(false, uri); this.componentManager.release( unwrap(component) ); Script script = interpreter.compileScript( cx, filename ); if (redirector == null) { request = new FOM_Request(ContextHelper.getRequest(avalonContext)); if (redirector == null) { response = new FOM_Response(ContextHelper.getResponse(avalonContext)); Map objectModel = ContextHelper.getObjectModel(avalonContext); if (redirector == null) { session = new FOM_Session(ContextHelper.getRequest(avalonContext).getSession(true)); return ContextHelper.getObjectModel(avalonContext); redirector); interpreter.handleContinuation(kontId, list, redirector);
0
public OpenFuture open(int recipient, int rwSize, int packetSize, Buffer buffer) { this.remoteWindow.init(rwSize, packetSize, session.getFactoryManager().getProperties()); public void handleOpenSuccess(int recipient, int rwSize, int packetSize, Buffer buffer) throws IOException { throw new UnsupportedOperationException("handleOpenSuccess(" + recipient + "," + rwSize + "," + packetSize + ") N/A"); throw new UnsupportedOperationException("handleOpenFailure() N/A");
0
private final CommandRepositoryFeature feature = new CommandRepositoryFeature();
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jxpath/src/test/org/apache/commons/jxpath/ri/model/BeanModelTestCase.java,v 1.4 2002/11/29 07:22:01 dmitri Exp $ * $Revision: 1.4 $ * $Date: 2002/11/29 07:22:01 $ * @version $Revision: 1.4 $ $Date: 2002/11/29 07:22:01 $ } public void testCoreFunctions(){ Boolean.TRUE); assertXPathValue(context, "boolean(boolean = false())", Boolean.TRUE); assertXPathValueIterator( context, "beans[1]/strings[string-length() = 8]", list("String 1", "String 2", "String 3"));
0
* @param pmdKnownBroken Oracle drivers don't support * {@link java.sql.ParameterMetaData.ParameterMetaData#getParameterType(int) };
0
public abstract class AbstractAsyncPushHandler<T> implements AsyncPushConsumer { private final AsyncResponseConsumer<T> responseConsumer; public AbstractAsyncPushHandler(final AsyncResponseConsumer<T> responseConsumer) { protected abstract void handleResponse( final HttpRequest promise, final T responseMessage) throws IOException, HttpException; responseConsumer.consumeResponse(response, entityDetails, new FutureCallback<T>() { public void completed(final T result) {
0
/* * Copyright 2002,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.commons.jelly.core; /** Tests for basic memory leaking in core tags. Runs a few test scripts many times. * @author Hans Gilde * */ public class TestCoreMemoryLeak extends BaseMemoryLeakTest { /** The JUnit constructor. * @param name */ public TestCoreMemoryLeak(String name) { super(name); } public void testBasicScriptForLeak() throws Exception { assertTrue(runScriptManyTimes("c.jelly", 10000) < 200000); } }
0
* Copyright 2000-2009 The Apache Software Foundation
0
import org.springframework.security.core.context.SecurityContextHolder; JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(managementControllerMock); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule providerModule = new JMXHostProviderModule(controller); JMXHostProviderModule(AmbariManagementController ambariManagementController) { super(); managementController = ambariManagementController; }
0
// * thread 1 creates and initializes byte array // thread 1 set the volatile,
0
IdResolver.registerElementById(this._constructionElement, Id);
0
import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.Converter; WeakReference<ClassLoader> ref = new WeakReference<ClassLoader>(componentLoader); WeakReference<ClassLoader> weakRefToComponent1 = new WeakReference<ClassLoader>(componentLoader1); Class<?> newFloatConverterClass = componentLoader.reload(FloatConverter.class); WeakReference<ClassLoader> weakRefToComponent = new WeakReference<ClassLoader>(componentLoader); private void forceGarbageCollection(WeakReference<?> target) { @SuppressWarnings("unused") byte[] b = new byte[bytes];
0
private TransformResult<T> finishBundle( TransformResult<T> result = evaluator.finishBundle()
0
.setInstructionId("1L") .setProcessBundle(BeamFnApi.ProcessBundleRequest.getDefaultInstance()) .build(); .setInstructionId("1L") .setProcessBundle(BeamFnApi.ProcessBundleResponse.getDefaultInstance()) .build(); BeamFnApi.InstructionRequest.newBuilder() .setInstructionId("2L") .build(); .setInstructionId("2L") .setError("Unknown InstructionRequest type " + BeamFnApi.InstructionRequest.RequestCase.REQUEST_NOT_SET) .build(); .setInstructionId("3L") .setRegister(BeamFnApi.RegisterRequest.getDefaultInstance()) .build(); .setInstructionId("3L") .setError(getStackTraceAsString(FAILURE)) .build(); .withOnCompleted(() -> clientClosedStream.set(true)).build(); Server server = InProcessServerBuilder.forName(apiServiceDescriptor.getUrl()) .addService(new BeamFnControlGrpc.BeamFnControlImplBase() { @Override public StreamObserver<BeamFnApi.InstructionResponse> control( StreamObserver<BeamFnApi.InstructionRequest> outboundObserver) { Uninterruptibles.putUninterruptibly(outboundServerObservers, outboundObserver); return inboundServerObserver; } }) .build(); EnumMap<BeamFnApi.InstructionRequest.RequestCase, ThrowingFunction<BeamFnApi.InstructionRequest, BeamFnApi.InstructionResponse.Builder>> handlers = new EnumMap<>(BeamFnApi.InstructionRequest.RequestCase.class); BeamFnControlClient client = new BeamFnControlClient( apiServiceDescriptor, (Endpoints.ApiServiceDescriptor descriptor) -> channel, this::createStreamForTest, handlers);
0
if (data == null) {
0
@Override
0
* @param lang the value of the language.
0
static String quoteMailboxName(String input) {
0
c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10000");
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
1
private void makeConfig(Cluster cluster, String type, String tag, Map<String, String> values, Map<String, Map<String, String>> attributes) {
0
static Map<URI,Templates> cache = new ConcurrentHashMap<URI,Templates>(); Templates templates = cache.get(xslt.toURI()); cache.put(xslt.toURI(), templates);
0
import org.apache.felix.dm.Component.ServiceScope; default B scope(ServiceScope scope) { andThenBuild(compBuilder -> compBuilder.scope(scope)); return (B) this; }
0
public FileChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException { Collection<SftpClient.OpenMode> modes = SftpClient.OpenMode.fromOpenOptions(options); modes = EnumSet.of(SftpClient.OpenMode.Read, SftpClient.OpenMode.Write); // TODO: process file attributes return new SftpFileSystemChannel(toSftpPath(path), modes);
0
.putInputs("timer", "timer.pc") .putOutputs("timer", "timer.pc") PCollection timer = PCollection.newBuilder().setUniqueName("timer.pc").build(); .putPcollections("timer.pc", timer) TimerReference.of(transformNode, "timer", PipelineNode.pCollection("timer.pc", timer));
0
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableMap;
0
private final OrderedMapIterator<K, V> iterator; public static <K, V> OrderedMapIterator<K, V> unmodifiableOrderedMapIterator(final OrderedMapIterator<K, V> iterator) { private UnmodifiableOrderedMapIterator(final OrderedMapIterator<K, V> iterator) { public V setValue(final V value) {
0
@Override @Override @Override
0
import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; import com.google.common.io.Resources; private void assertResponseStatus( String path, Status expectedStatus, Optional<URL> responseResource) throws IOException { if (responseResource.isPresent()) { assertEquals( Resources.toString(responseResource.get(), StandardCharsets.UTF_8), response.getEntity(String.class)); } private void leaderRedirectSmokeTest(Status expectedStatus, Optional<URL> responseResource) throws IOException { assertResponseStatus("/scheduler", expectedStatus, responseResource); assertResponseStatus("/scheduler/", expectedStatus, responseResource); assertResponseStatus("/scheduler/role", expectedStatus, responseResource); assertResponseStatus("/scheduler/role/env", expectedStatus, responseResource); assertResponseStatus("/scheduler/role/env/job", expectedStatus, responseResource); assertResponseStatus("/updates", expectedStatus, responseResource); assertResponseStatus("/updates/", expectedStatus, responseResource); assertResponseStatus("/", Status.OK, Optional.absent()); // If there's no leader, we should send service unavailable and an error page. unsetLeadingSchduler(); leaderRedirectSmokeTest( Status.SERVICE_UNAVAILABLE, Optional.of( Resources.getResource( LeaderRedirectFilter.class, LeaderRedirectFilter.NO_LEADER_PAGE))); leaderRedirectSmokeTest(Status.OK, Optional.absent()); leaderRedirectSmokeTest(Status.TEMPORARY_REDIRECT, Optional.absent()); assertResponseStatus("/", Status.OK, Optional.absent());
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; import java.util.Dictionary; public interface MutatingService { void updateProperties(Dictionary changes); }
0
import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NameClassPair; import javax.naming.NamingEnumeration; import javax.naming.NamingException; * @version $Id: JNDIConfiguration.java,v 1.11 2004/04/28 22:58:58 epugh Exp $ private void recursiveGetKeys(List keys, Context parentContext, String key) throws NamingException NamingEnumeration enum = parentContext.list(""); Object o = enum.next(); NameClassPair nameClassPair = (NameClassPair) o; newKey.append(nameClassPair.getName()); if (parentContext.lookup(nameClassPair.getName()) instanceof Context) Context context = (Context) parentContext.lookup(nameClassPair.getName()); recursiveGetKeys(keys, context, newKey.toString()); context = getStartingContextPoint(keys, getContext(),getContext().list("")); recursiveGetKeys(keys, context, key); private Context getStartingContextPoint(List keys, Context parentContext, NamingEnumeration enum) throws NamingException { NameClassPair nameClassPair = (NameClassPair) enum.next(); Object o = parentContext.lookup(nameClassPair.getName()); + nameClassPair.getName() + parentContext.lookup(nameClassPair.getName()) + nameClassPair.getClassName()); if (o instanceof Context && nameClassPair.getName().equals(keyToSearchFor)) Context c = (Context) o; return getStartingContextPoint(keys,c, c.list("")); NamingEnumeration enum = getContext().list(""); ne.printStackTrace();
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. * ==================================================================== * * 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.impl.io; import org.junit.Assert; import org.junit.Test; public class TestSocketInputBuffer { @Test public void testInvalidConstruction() throws Exception { try { SocketInputBuffer.create(null, 0); Assert.fail("IllegalArgumentException expected"); } catch (IllegalArgumentException ex) { } } }
0
import java.util.Collection; import java.util.TreeSet; import org.apache.felix.http.base.internal.runtime.dto.state.FailureFilterState; import org.apache.felix.http.base.internal.runtime.dto.state.FailureServletState; import org.apache.felix.http.base.internal.runtime.dto.state.FilterState; import org.apache.felix.http.base.internal.runtime.dto.state.ServletState; public ContextRuntime getRuntime() final Collection<FilterState> filterRuntimes = new TreeSet<FilterState>(FilterState.COMPARATOR); final Collection<FailureFilterState> failureFilterRuntimes = new TreeSet<FailureFilterState>(FailureFilterState.COMPARATOR); this.filterRegistry.getRuntimeInfo(filterRuntimes, failureFilterRuntimes); final Collection<ServletState> errorPageRuntimes = new TreeSet<ServletState>(ServletState.COMPARATOR); final Collection<FailureServletState> failureErrorPageRuntimes = new TreeSet<FailureServletState>(FailureServletState.COMPARATOR); this.errorPageRegistry.getRuntimeInfo(errorPageRuntimes, failureErrorPageRuntimes); return new ContextRuntime(filterRuntimes, errorPageRuntimes, null, failureFilterRuntimes, failureErrorPageRuntimes, null);
0
ACTION_EXECUTION_FINISHED, /** * The cluster was renamed. */ CLUSTER_RENAME; /** * {@inheritDoc} */ @Override public String toString() { StringBuilder buffer = new StringBuilder(getClass().getSimpleName()); buffer.append("{eventType=").append(m_eventType); buffer.append("}"); return buffer.toString(); }
0
import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; return this.wrap.getPartitions().stream().map(WrapPartition::new).collect(toList());
0
import org.apache.hc.core5.function.Supplier; public MessageExchangeHandler(final Supplier<AsyncEntityConsumer<T>> dataConsumerSupplier) { this(new BasicRequestConsumer<>(dataConsumerSupplier)); }
0
import org.apache.beam.vendor.grpc.v1p13p1.com.google.protobuf.TextFormat;
0
import com.google.common.base.Charsets; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern;
0
/** Transforms for reading and writing using HCatalog. */
1
DEFAULT.verify("foo.co.jp", x509); DEFAULT.verify("\u82b1\u5b50.co.jp", x509); checkMatching(bhv, "a.gov.uk", cns, alt, false); // OK checkMatching(bhv, "s.a.gov.uk", cns, alt, false); // OK checkMatching(bhv, "a.gov.uk", cns, alt, false); // OK
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/ArrayUnsignedByteList.java,v 1.5 2003/11/07 17:24:13 rwaldhoff Exp $ * @version $Revision: 1.5 $ $Date: 2003/11/07 17:24:13 $ * @deprecated This code has been moved to Jakarta Commons Primitives (http://jakarta.apache.org/commons/primitives/) *
0
import java.io.IOException; import java.io.InterruptedIOException; // TODO once JDK 8+ becomes the minimum for this project, make it a static method in the Closeable interface public static void close(Closeable closeable) throws IOException { if (closeable == null) { return; } if ((!closeable.isClosed()) && (!closeable.isClosing())) { CloseFuture future=closeable.close(true); try { future.await(); } catch(InterruptedException e) { throw new InterruptedIOException(e.getClass().getSimpleName() + " while await future closure: " + e.getMessage()); } } } public static abstract class IoBaseCloseable implements Closeable { // TODO once JDK 8+ becomes the minimum for this project, make it a default method instead of this class public void close() throws IOException { CloseableUtils.close(this); } } private static class SimpleCloseable extends IoBaseCloseable { private final Iterable<? extends Closeable> closeables; public static abstract class AbstractCloseable extends IoBaseCloseable {
0
if (servletName == null) throw new RuntimeException("Could not find connection named '" + servletReference + "'. Did you forgot to declare it in servlet bean configuration?");
0
Copyright 2001,2003 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
public synchronized Service setServiceProperties(Dictionary serviceProperties) { return this; protected void ensureNotActive() {
0
* Represents information required to run and collection of alerts. private Source source = null; /** * @return the service name */ /** * @param name the service name */ /** * @return the component name */ /** * * @param name the component name */ * @return the interval * @return {@code true} if enabled public Source getSource() { return source; }
0
* @version $Revision$ $Date$
0
* $Revision: 1.3 $ * $Date: 2003/10/09 21:03:57 $ * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * permission of the Apache Software Foundation.
0
import java.util.ArrayList; @Transactional public List<HostComponentConfigMappingEntity> findByHostComponentAndType( long clusterId, String serviceName, String componentName, String hostname, Collection<String> configTypes) { if (configTypes.isEmpty()) { return new ArrayList<HostComponentConfigMappingEntity>(); } TypedQuery<HostComponentConfigMappingEntity> query = entityManagerProvider.get().createQuery( "SELECT config FROM HostComponentConfigMappingEntity config" + " WHERE " + " config.clusterId = ?1" + " AND config.serviceName = ?2" + " AND config.componentName = ?3" + " AND config.hostName = ?4" + " AND config.configType IN ?5", HostComponentConfigMappingEntity.class); return daoUtils.selectList(query, clusterId, serviceName, componentName, hostname, configTypes); }
1
import static java.util.stream.Collectors.toList; import static org.apache.beam.sdk.values.reflect.ReflectionUtils.getPublicGetters; return ImmutableList.of( new GeneratedGetterFactory(), new ReflectionGetterFactory(), clazz -> getPublicGetters(clazz).stream().map(ReflectionGetter::new).collect(toList()));
0
OptionBuilder.hasArg(type != null); OptionBuilder.isRequired(required); OptionBuilder.withType(type); options.addOption(OptionBuilder.create(opt)); OptionBuilder.hasArg(type != null); OptionBuilder.isRequired(required); OptionBuilder.withType(type); options.addOption(OptionBuilder.create(opt));
0
import org.apache.commons.io.IOUtils; { /* ignore - will use defaults */ IOUtils.closeQuietly( ins ); /** * Retrieves the shared instance * * @return the singleton instance of the object */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getBrandName() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getProductName() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getProductURL() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getProductImage() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getVendorName() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getVendorURL() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getVendorImage() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getFavIcon() */ /** * @see org.apache.felix.webconsole.BrandingPlugin#getMainStyleSheet() */
0
s_upgradeHelper.updateDesiredRepositoriesAndConfigs(upgradeContext); StackId configurationPackSourceStackId = upgradeContext.getSourceVersions().values().iterator().next().getStackId();
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.ambari.server.events; public class CommandEvent implements AmbariUpdateEvent { @Override public String getDestination() { return "/command"; } }
1
import static org.apache.accumulo.core.util.ByteBufferUtil.toBytes; return appendPrintableString(ba, offset, len, maxLen, new StringBuilder()).toString(); } public static StringBuilder appendPrintableString(byte ba[], int offset, int len, int maxLen, StringBuilder sb) { return sb; } private StringBuilder rowColumnStringBuilder() { StringBuilder sb = new StringBuilder(); appendPrintableString(row, 0, row.length, Constants.MAX_DATA_TO_PRINT, sb); sb.append(" "); appendPrintableString(colFamily, 0, colFamily.length, Constants.MAX_DATA_TO_PRINT, sb); sb.append(":"); appendPrintableString(colQualifier, 0, colQualifier.length, Constants.MAX_DATA_TO_PRINT, sb); sb.append(" ["); appendPrintableString(colVisibility, 0, colVisibility.length, Constants.MAX_DATA_TO_PRINT, sb); sb.append("]"); return sb; StringBuilder sb = rowColumnStringBuilder(); sb.append(" "); sb.append(Long.toString(timestamp)); sb.append(" "); sb.append(deleted); return sb.toString(); return rowColumnStringBuilder().toString();
0
* url = * urls = * * }
1
import org.apache.http.conn.SchemePortResolver; context.getAttribute(HttpClientContext.SOCKET_FACTORY_REGISTRY);
0
transfer.toKey, mask(transfer, valueToCopy))); configType, transfer.toKey, mask(transfer, transfer.defaultValue))); mask(keyValuePair, value))); private static String mask(ConfigureTask.Masked mask, String value) { if (mask.mask) { return StringUtils.repeat("*", value.length()); } return value; }
0
import org.apache.batik.gvt.TextNode; import org.apache.batik.gvt.text.GVTAttributedCharacterIterator; this.offset = adjustOffset(offset); public void draw(Graphics2D g2d) { layout.draw(g2d, (float) offset.getX(), (float) offset.getY()); } /** * Returns the current text position at the beginning * of glyph layout, before the application of explicit * glyph positioning attributes. */ public Point2D getOffset() { return offset; } /** * Sets the text position used for the implicit origin * of glyph layout. Ignored if multiple explicit glyph * positioning attributes are present in ACI * (e.g. if the aci has multiple X or Y values). */ public void setOffset(Point2D offset) { this.offset = offset; public Shape getOutline() { AffineTransform nt = AffineTransform.getTranslateInstance( offset.getX(), offset.getY()); public Shape getDecorationOutline(int decorationType) { AffineTransform nt = AffineTransform.getTranslateInstance( offset.getX(), offset.getY()); bounds.getWidth(), DECORATION_UNDERLINE|DECORATION_OVERLINE|DECORATION_STRIKETHROUGH ).getBounds2D(); TextHitInfo hit = layout.hitTestChar(x-(float) offset.getX(), // private private Point2D adjustOffset(Point2D p) { aci.first(); Float X = (Float) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.X); Float Y = (Float) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.Y); if ((X == null) || (X.isNaN())) { X = new Float((float) p.getX()); } if ((Y == null) || (Y.isNaN())) { Y = new Float((float) p.getY()); } return new Point2D.Float(X.floatValue(), Y.floatValue()); }
0
log.info("Existing splits on metadata table. Saving them, and applying" + " single original split of '~'");
0
Method updateKAFKAConfigs = UpgradeCatalog251.class.getDeclaredMethod("updateKAFKAConfigs"); Method updateSTORMConfigs = UpgradeCatalog251.class.getDeclaredMethod("updateSTORMConfigs"); .addMockedMethod(addNewConfigurationsFromXml) .addMockedMethod(updateKAFKAConfigs) .addMockedMethod(updateSTORMConfigs) .createMock(); upgradeCatalog251.updateSTORMConfigs(); expectLastCall().once();
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.repository.graphdb.titan.query.expr; import java.util.Collection; import org.apache.atlas.repository.graphdb.titan.query.NativeTitanGraphQuery; /** * Query predicate that checks whether the value of a given property is within the * provided set of allowed values. */ public class InPredicate implements QueryPredicate { private String propertyName_; private Collection<? extends Object> values_; public InPredicate(String propertyName, Collection<? extends Object> values) { super(); propertyName_ = propertyName; values_ = values; } @Override public void addTo(NativeTitanGraphQuery query) { query.in(propertyName_, values_); } @Override public String toString() { return "InPredicate [propertyName_=" + propertyName_ + ", values_=" + values_ + "]"; } }
0
assertEquals(6, steps.size()); Step addNullKeyStep = steps.get(1); assertEquals("ParallelDo", addNullKeyStep.getKind()); Step groupByKeyStep = steps.get(2); assertEquals("GroupByKey", groupByKeyStep.getKind()); Step combineGroupedValuesStep = steps.get(3); assertEquals("ParallelDo", combineGroupedValuesStep.getKind()); Step dropKeysStep = steps.get(4); assertEquals("ParallelDo", dropKeysStep.getKind()); Step collectionToSingletonStep = steps.get(5);
0
package com.twitter.aurora.scheduler.storage; import com.twitter.aurora.gen.JobConfiguration; import com.twitter.aurora.gen.JobKey;
1
return "JEXL.out.print("+StringParser.escapeString(toDisplay, '\'')+")";
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
import org.apache.accumulo.tserver.replication.ReplicationWorker; private ReplicationWorker replWorker = null; this.replWorker = new ReplicationWorker(instance, fs, aconf); ThreadPoolExecutor replicationThreadPool = new SimpleThreadPool(getSystemConfiguration().getCount(Property.REPLICATION_WORKER_THREADS), "replication task"); replWorker.setExecutor(replicationThreadPool); replWorker.run();
1
import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.atomic.AtomicBoolean; private final Collection<FnApiControlClient> vendedClients = new ArrayList<>(); private AtomicBoolean closed = new AtomicBoolean(); // Add the client to the pool of vended clients before making it available - we should close // the client when we close even if no one has picked it up yet. vendedClients.add(newClient); public void close() { if (!closed.getAndSet(true)) { for (FnApiControlClient vended : vendedClients) { vended.close(); } }
0
Map<TreeSet<String>,Long> diskUsage = TableDiskUsage.getDiskUsage(context.getServerConfigurationFactory().getConfiguration(), tableIds, fs, context.getConnector());
0
import java.nio.file.LinkOption; Path linkPath = lclSftp.resolve("link-" + sourcePath.getFileName()); String remLinkPath = "/" + Utils.resolveRelativeRemotePath(parentPath, linkPath); LinkOption[] options = IoUtils.getLinkOptions(false); if (Files.exists(linkPath, options)) { Files.delete(linkPath); } assertFalse("Target link exists before linking: " + linkPath, Files.exists(linkPath, options)); assertTrue("Symlink not created: " + linkPath, Files.exists(linkPath, 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 * * 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
* * <b>Deprecation note:</b> due to the way this class modifies a response body * without changing the response headers to reflect the entity changes, it cannot * be used as the &quot;backend&quot; for a {@link CachingHttpClient} and still * have uncompressed responses be cached. Users are encouraged to use the * {@link CompressionDecorator} instead of this class, which can be wired in * either before or after caching, depending on whether you want to cache * responses in compressed or uncompressed form. @Deprecated
0
* {@code org.apache.commons.configuration.PropertiesConfiguration} class in
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
import org.apache.log4j.Logger; @SuppressWarnings("deprecation") private static final Logger log = Logger.getLogger(ArbitraryTablePropertiesIT.class); @Override
0
new Object[] { value, getPropertyName() }); "invalid.lexical.unit", new Object[] { new Integer(lu.getLexicalUnitType()), getPropertyName() }); protected class NumberFactory extends AbstractValueFactory { new Object[] { new Integer(lu.getLexicalUnitType()), StrokeDasharrayFactory.this.getPropertyName() }); new Object[] { new Integer(unitType), StrokeDasharrayFactory.this.getPropertyName() });
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.ambari.server.controller.spi; /** * The predicate is used to filter the resources returned from the cluster * controller. The predicate can examine a resource object and determine * whether or not it should be included in the returned results. */ public interface Predicate { /** * Evaluate the predicate for the given resource. * * @param resource the resource to evaluate the predicate against * @return the result of applying the predicate to the given resource */ public boolean evaluate(Resource resource); }
1
throws SAXException { throws SAXException {
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//validator/src/test/org/apache/commons/validator/ValidatorTestSuite.java,v 1.13 2004/01/11 23:30:21 dgraham Exp $ * $Revision: 1.13 $ * $Date: 2004/01/11 23:30:21 $ * Copyright (c) 2000-2004 The Apache Software Foundation. All rights */
0
if (in != null) { in.close(); } } in.close(); }
0
import org.apache.http.util.Args; this.name = Args.notNull(name, "Name");
0