Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
String user = getViewParameterValue(PROPERTY_SLIDER_USER); boolean securityEnabled = Boolean.valueOf(getViewParameterValue(PROPERTY_SLIDER_SECURITY_ENABLED)); String viewPrincipal = getViewParameterValue(PROPERTY_VIEW_PRINCIPAL); String viewPrincipalKeytab = getViewParameterValue(PROPERTY_VIEW_PRINCIPAL_KEYTAB); private String getViewParameterValue(String parameterName) { String value = viewContext.getProperties().get(parameterName); if ("null".equals(value)) { return null; } return value; } String hdfsPath = getViewParameterValue(PROPERTY_HDFS_ADDRESS); String rmAddress = getViewParameterValue(PROPERTY_YARN_RM_ADDRESS); String rmSchedulerAddress = getViewParameterValue(PROPERTY_YARN_RM_SCHEDULER_ADDRESS); String zkQuorum = getViewParameterValue(PROPERTY_ZK_QUOROM); boolean securedCluster = Boolean.valueOf(getViewParameterValue(PROPERTY_SLIDER_SECURITY_ENABLED)); String rmHAHosts = getViewParameterValue(PROPERTY_YARN_RM_HA_HOSTS); String rmStoreClass = getViewParameterValue(PROPERTY_YARN_RM_STORE_CLASS); String rmHAAutoFailoverPath = getViewParameterValue(PROPERTY_YARN_RM_HA_AUTO_FAILOVER_ZKPATH); String rmPrincipal = getViewParameterValue(PROPERTY_YARN_RM_PRINCIPAL); String nnPrincipal = getViewParameterValue(PROPERTY_HDFS_NN_PRINCIPAL); String hdfsPath = getViewParameterValue(PROPERTY_HDFS_ADDRESS); String rmAddress = getViewParameterValue(PROPERTY_YARN_RM_ADDRESS); String rmSchedulerAddress = getViewParameterValue(PROPERTY_YARN_RM_SCHEDULER_ADDRESS); String zkQuorum = getViewParameterValue(PROPERTY_ZK_QUOROM);
0
FileSKVIterator reader = FileOperations.getInstance().newReaderBuilder().forFile(path.toString(), ns, ns.getConf()) .withTableConfiguration(conf).seekToBeginning().build();
0
package org.apache.hc.core5.http.integration; import org.apache.hc.core5.http.impl.nio.BasicAsyncRequestConsumer; import org.apache.hc.core5.http.nio.HttpAsyncExchange; import org.apache.hc.core5.http.nio.HttpAsyncRequestConsumer; import org.apache.hc.core5.http.nio.HttpAsyncRequestHandler; import org.apache.hc.core5.http.nio.HttpAsyncResponseProducer; import org.apache.hc.core5.http.testserver.nio.HttpCoreNIOTestBase;
1
* @version CVS $Id: DefaultTreeBuilder.java,v 1.6 2004/02/06 15:39:57 sylvain Exp $ RoleManager roles = new DefaultRoleManager(this.parentRoleManager);
0
ServerSocket socket = getServerSocket(); schedulerThriftServer.start( socket, new AuroraAdmin.Processor<>(schedulerThriftInterface)); return LocalService.primaryService(socket.getLocalPort(), shutdown);
0
import java.util.HashSet; if(clusterConfigs == null || !clusterConfigs.getProperties().containsKey(property.getName())) { if (property.getValue() == null || property.getPropertyTypes().contains(PropertyInfo.PropertyType.DONT_ADD_ON_UPGRADE)) { continue; } LOG.info("Config " + property.getName() + " from " + configType + " from xml configurations" + " is not found on the cluster. Adding it..."); if(!newProperties.containsKey(configType)) { newProperties.put(configType, new HashSet<String>()); } newProperties.get(configType).add(property.getName()); }
0
this(new MemCacheEntryFactory());
0
public static List<HostConfigEntry> findMatchingEntries(String host, HostConfigEntry... entries) { public static List<Pair<Pattern, Boolean>> parsePatterns(CharSequence... patterns) {
0
package org.apache.beam.sdk.transforms; import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.coders.Coder.Context; import org.apache.beam.sdk.coders.CoderException; import org.apache.beam.sdk.coders.CoderRegistry; import org.apache.beam.sdk.coders.KvCoder; import org.apache.beam.sdk.coders.SerializableCoder; import org.apache.beam.sdk.transforms.Combine.CombineFn; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection;
0
this(null, null, type, null); Bound(String name, String filepattern, Class<T> type, Schema schema) { return new Bound<>(name, filepattern, type, schema); return new Bound<>(name, filepattern, type, ReflectData.get().getSchema(type)); return new Bound<>(name, filepattern, GenericRecord.class, schema); .withLabel("Input File Pattern"));
0
public void encodeImage(BufferedImage buf, File imageFile) throws SVGGraphics2DIOException { try{ OutputStream os = new FileOutputStream(imageFile); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os); JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(buf); param.setQuality(1, false); encoder.encode(buf, param); os.flush(); os.close(); } catch(IOException e) { throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName()); } }
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
* Copyright 1999-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. */ * @version CVS $Id: LayoutFactory.java,v 1.5 2004/03/05 13:02:13 bdelacretaz Exp $
1
import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.CommonCookieAttributeHandler; AbstractCookieAttributeHandler implements CommonCookieAttributeHandler { @Override public String getAttributeName() { return ClientCookie.VERSION_ATTR; }
0
public static MessageDigest getDigest(final String algorithm, final MessageDigest defaultMessageDigest) { public static boolean isAvailable(final String messageDigestAlgorithm) { public DigestUtils(final MessageDigest digest) { public DigestUtils(final String name) {
0
import org.apache.felix.dm.service.Service; mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.1.0"),
0
* Returns the receiver as a URI String for public display, like, without a * password. * * @return A URI String without a password, never {@code null}. */ String getPublicURIString(); /**
0
log.warn("Could not deserialize protobuf for: " + input.getKey());
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.generic;
0
* @since 2.0
0
* * * * @version CVS $Id$
0
if (collectionState != null) { List<String> shards = new ArrayList<>(collectionState.getSlicesMap().keySet()); Collections.sort(shards); this.shards = shards; }
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
package org.apache.accumulo.core.clientImpl;
0
package com.twitter.mesos.scheduler.filter; import com.twitter.mesos.scheduler.Query; import com.twitter.mesos.scheduler.configuration.Resources; import static com.twitter.mesos.scheduler.filter.SchedulingFilterImpl.ResourceVector.CPU; import static com.twitter.mesos.scheduler.filter.SchedulingFilterImpl.ResourceVector.DISK; import static com.twitter.mesos.scheduler.filter.SchedulingFilterImpl.ResourceVector.PORTS; import static com.twitter.mesos.scheduler.filter.SchedulingFilterImpl.ResourceVector.RAM;
0
import org.apache.cocoon.components.ComponentInfo; super(new ComponentInfo(), logger);
0
@SuppressWarnings("serial")
0
* @param lineParser the line parser. If <code>null</code> * {@link org.apache.http.message.BasicLineParser#INSTANCE} will be used
0
/* * Copyright (c) OSGi Alliance (2011). All Rights Reserved. * * 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.osgi.service.component.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Identify the annotated method as the {@code modified} method of a Service * Component. * * <p> * The annotated method is the modified method of the Component. * * <p> * This annotation is not processed at runtime by a Service Component Runtime * implementation. It must be processed by tools and used to add a Component * Description to the bundle. * * @see "The modified attribute of the component element of a Component Description." * @version $Id$ */ @Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) public @interface Modified { // marker annotation }
0
query -> query.get().getSlaveHosts().isEmpty() ? Optional.absent() : Optional.of(query.get().getSlaveHosts()); if (query.get().getTaskIds().isEmpty()) { } else { taskQueriesById.incrementAndGet(); from = Optional.of(fromIdIndex(query.get().getTaskIds()));
0
import org.apache.beam.runners.fnexecution.control.BundleProgressHandler; private transient BundleProgressHandler progressHandler; progressHandler = BundleProgressHandler.unsupported(); new ReceiverFactory(collector, outputMap), stateRequestHandler, progressHandler)) {
0
* A very basic {@link ConnFactory} implementation that creates * {@link HttpClientConnection} instances given a {@link HttpHost} instance. * * @see HttpHost
0
private final Map<String, Map<String, String>> queries = new HashMap<>();
0
* @version CVS $Id$ // Nothing to do
0
* @version $Id: TestConfigurationFactory.java,v 1.14 2004/08/20 15:49:27 ebourg Exp $ assertNotNull(config.getProperty("element2.subelement.subsubelement")); assertEquals("value", config.getProperty("element3")); assertEquals("foo", config.getProperty("element3[@name]"));
0
import static com.google.common.base.Charsets.UTF_8; transport.write("stat\n".getBytes(UTF_8), 0, 5); response.append(new String(buffer, 0, n, UTF_8));
0
package org.apache.felix.ipojo.test.scenarios.component; import foo.RGB; import foo.ipojo.IPOJOFoo; import org.apache.felix.ipojo.annotations.Component; @Component @IPOJOFoo(bar="bar", rgb = RGB.RED, colors = {RGB.BLUE, RGB.RED}) public class CustomAnnotationWithEnum { }
0
/** * We effectively maintain the set of completely processed service event tracking counts. This method waits for all events prior * to the parameter tracking count to complete, then returns. See further documentation in EdgeInfo. * @param trackingCount */ m_activated = false; AtomicInteger trackingCount = new AtomicInteger(); dm.unregisterServiceListener( trackingCount );
0
final FTPClient client1 = new FTPClient(); final FTPClient client2 = new FTPClient();
1
import java.lang.reflect.InvocationTargetException; import java.util.function.Supplier; private String sslContextSupplierClassProperty = getConfigPrefix() + "context.supplier.class"; public String getSslContextSupplierClassProperty() { return sslContextSupplierClassProperty; } @SuppressWarnings("unchecked") final String supplierContextClassName = config.getProperty(sslContextSupplierClassProperty); if (supplierContextClassName != null) { if (LOG.isDebugEnabled()) { LOG.debug("Loading SSLContext supplier from property '{}'", sslContextSupplierClassProperty); } try { Class<?> sslContextClass = Class.forName(supplierContextClassName); Supplier<SSLContext> sslContextSupplier = (Supplier<SSLContext>) sslContextClass.getConstructor().newInstance(); return new SSLContextAndOptions(this, config, sslContextSupplier.get()); } catch (ClassNotFoundException | ClassCastException | NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new SSLContextException("Could not retrieve the SSLContext from supplier source '" + supplierContextClassName + "' provided in the property '" + sslContextSupplierClassProperty + "'", e); } } else { return createSSLContextAndOptionsFromConfig(config); } } public SSLContextAndOptions createSSLContextAndOptionsFromConfig(ZKConfig config) throws SSLContextException {
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
* Implements the <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">K&ouml;lner Phonetik</a> * (Cologne Phonetic) algorithm issued by Hans Joachim Postel in 1969. * <p> * The <i>K&ouml;lner Phonetik</i> is a phonetic algorithm which is optimized for the German language. * It is related to the well-known soundex algorithm.
0
import org.apache.http.client.cache.HttpCacheContext; private HttpCacheContext context; private ClientExecChain impl; context = HttpCacheContext.create(); impl = createCachingExecChain(mockBackend, cache, config); } protected ClientExecChain createCachingExecChain( final ClientExecChain backend, final HttpCache cache, final CacheConfig config) { return new CachingExec(backend, cache, config); final HttpResponse response = impl.execute(route, HttpRequestWrapper.wrap(post), context, null); final HttpResponse result = impl.execute(route, HttpRequestWrapper.wrap(post), context, null); impl.execute(route, HttpRequestWrapper.wrap(options), context, null); final HttpResponse result = impl.execute(route, HttpRequestWrapper.wrap(request), context, null); final HttpResponse result = impl.execute(route, HttpRequestWrapper.wrap(request), context, null); final HttpResponse result = impl.execute(route, HttpRequestWrapper.wrap(request), context, null); final HttpResponse result = impl.execute(route, HttpRequestWrapper.wrap(request), context, null);
0
// they are regularly captured within OldDoFn's.
0
varExpr = JXTExpression.compileExpr(var, "set: \"var\":", locator); valueExpr = JXTExpression.compileExpr(value, "set: \"value\":", locator);
0
private static final Set<String> PROPERTY_IDS = new HashSet<>(); private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<>(); new HashSet<>(Arrays.asList(new String[]{ CONFIGURATION_CLUSTER_NAME_PROPERTY_ID, CONFIGURATION_CONFIG_TYPE_PROPERTY_ID})); Map<String, String> configMap = new HashMap<>(); configAttributesMap = new HashMap<>(); attributesMap = new HashMap<>(); final Set<ConfigurationRequest> requests = new HashSet<>(); Set<Resource> resources = new HashSet<>(); Set<String> unsupportedProperties = new HashSet<>();
0
String propertyValue = resource.getPropertyValue(getPropertyId()); return propertyValue == null ? false : getValue().compareTo(resource.getPropertyValue(getPropertyId())) < 0;
0
if ( factoryPid != null && ( pid == null || pid.equals( PLACEHOLDER_PID ) ) )
0
public interface Repository extends java.io.Serializable {
0
package org.apache.commons.exec.launcher; import java.io.File; import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.CommandLineImpl; import org.apache.commons.exec.environment.Environment; /** * A command launcher that uses an auxiliary script to launch commands in * directories other than the current working directory. */ public class ScriptCommandLauncher extends CommandLauncherProxy { public ScriptCommandLauncher(final String script, final CommandLauncher launcher) { super(launcher); this.script = script; } /** * Launches the given command in a new process, in the given working * directory. */ public Process exec(final CommandLine cmd, final Environment env, final File workingDir) throws IOException { if (workingDir == null) { return exec(cmd, env); } // Locate the auxiliary script String scriptDir = System.getProperty("org.apache.commons.exec.home", ""); File scriptFile = new File(scriptDir + File.separator + script); if (scriptFile.exists()) { throw new IOException("Cannot locate auxiliary script at " + scriptFile.getAbsolutePath()); } // Build the command CommandLine newCmd = new CommandLineImpl(); newCmd.setExecutable(scriptFile.getPath()); newCmd.addArgument(workingDir.getAbsolutePath()); newCmd.addArguments(cmd.getCommandline()); return exec(newCmd, env); } private String script; }
1
* 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: CacheableProcessingComponent.java,v 1.3 2004/03/05 13:02:45 bdelacretaz Exp $
1
* <p> * It allows querying of a boolean {@link #hasOption(String opt)}, * for options requiring arguments. * <p> * Additionally, any left-over or unrecognized arguments, * are available for further processing. * @version $Id$
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/set/TestUnmodifiableSortedSet.java,v 1.4 2003/12/03 11:19:10 scolebourne Exp $ import org.apache.commons.collections.BulkTest; * @version $Revision: 1.4 $ $Date: 2003/12/03 11:19:10 $ return BulkTest.makeSuite(TestUnmodifiableSortedSet.class);
0
package org.apache.commons.ognl.enhance; * http://www.apache.org/licenses/LICENSE-2.0
0
LOG.debug(event);
0
import org.apache.beam.sdk.coders.Coder; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.util.WindowedValue.FullWindowedValueCoder; import org.apache.beam.sdk.util.WindowedValue.WindowedValueCoder; PCollection<InputT> input = context.getInput(); Coder<InputT> inputCoder = input.getCoder(); WindowedValueCoder<InputT> wvInputCoder = FullWindowedValueCoder.of(inputCoder, input.getWindowingStrategy().getWindowFn().windowCoder()); output.getWindowingStrategy(), sideInputs, wvInputCoder);
0
* $Id: DelegatingCallableStatement.java,v 1.7 2003/03/06 00:04:58 rwaldhoff Exp $ * $Revision: 1.7 $ * $Date: 2003/03/06 00:04:58 $ * @version $Revision: 1.7 $ $Date: 2003/03/06 00:04:58 $ /* JDBC_3_ANT_KEY_BEGIN */ /* JDBC_3_ANT_KEY_END */
0
import static org.apache.beam.sdk.testing.PCollectionViewTesting.materializeValuesFor; import org.apache.beam.sdk.coders.KvCoder; import org.apache.beam.sdk.coders.VoidCoder; PCollectionViewWriter<?, Iterable<Integer>> viewWriter = IterableCoder.of(KvCoder.of(VoidCoder.of(), VarIntCoder.of()))), ImmutableList.Builder<WindowedValue<?>> valuesBuilder = ImmutableList.builder(); for (Object materializedValue : materializeValuesFor(View.asIterable(), 1)) { valuesBuilder.add(WindowedValue.of( materializedValue, new Instant(1222), window, PaneInfo.ON_TIME_AND_ONLY_FIRING)); } for (Object materializedValue : materializeValuesFor(View.asIterable(), 2)) { valuesBuilder.add(WindowedValue.of( materializedValue, new Instant(8766L), second, PaneInfo.createPane(true, false, Timing.ON_TIME, 0, 0))); } viewWriter.add((Iterable) valuesBuilder.build()); ImmutableList.Builder<WindowedValue<?>> overwrittenValuesBuilder = ImmutableList.builder(); for (Object materializedValue : materializeValuesFor(View.asIterable(), 4444)) { overwrittenValuesBuilder.add(WindowedValue.of( materializedValue, new Instant(8677L), second, PaneInfo.createPane(false, true, Timing.LATE, 1, 1))); } viewWriter.add((Iterable) overwrittenValuesBuilder.build());
0
final JavaClass jc = Repository.lookupClass(class_name); } catch (final ClassNotFoundException e) { final JavaClass jc = Repository.lookupClass(class_name); } catch (final ClassNotFoundException e) { final JavaClass jc = Repository.lookupClass(class_name); final JavaClass jc = Repository.lookupClass(class_name); final JavaClass jc = Repository.lookupClass(class_name); final JavaClass acc = Repository.lookupClass(accessor.class_name);
1
package org.apache.beam.sdk.options; import org.apache.beam.sdk.options.GoogleApiDebugOptions.GoogleApiTracer; import org.apache.beam.sdk.util.TestCredential; import org.apache.beam.sdk.util.Transport;
0
package org.apache.commons.digester3.examples.api.addressbook;
0
import static org.junit.Assert.*; import java.io.File; import java.util.List; import org.apache.commons.fileupload2.disk.DiskFileItem; /** Proposed test for FILEUPLOAD-293. As of yet, doesn't reproduce the problem. */ @Test public void testMoveFile() throws Exception { DiskFileUpload myUpload = new DiskFileUpload(); myUpload.setSizeThreshold(0); final String content = "-----1234\r\n" + "Content-Disposition: form-data; name=\"file\";" + "filename=\"foo.tab\"\r\n" + "Content-Type: text/whatever\r\n" + "\r\n" + "This is the content of the file\n" + "\r\n" + "-----1234--\r\n"; final byte[] contentBytes = content.getBytes("US-ASCII"); final HttpServletRequest request = new MockHttpServletRequest(contentBytes, Constants.CONTENT_TYPE); final List<FileItem> items = myUpload.parseRequest(request); assertNotNull(items); assertFalse(items.isEmpty()); final DiskFileItem dfi = (DiskFileItem) items.get(0); final File out = new File("target/unit-tests/DiskFileUpload/out.file"); if (out.isFile()) { out.delete(); } final File outDir = out.getParentFile(); if (!outDir.isDirectory()) { outDir.mkdirs(); } dfi.write(out); }
0
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.isA; import static org.junit.internal.matchers.ThrowableCauseMatcher.hasCause; import static org.junit.internal.matchers.ThrowableMessageMatcher.hasMessage; import org.apache.kafka.common.KafkaException; if (config.get("inject.error.at.eof") != null) { consumer.setException(new KafkaException("Injected error in consumer.poll()")); } public void testUnboundedSourceWithExceptionInKafkaFetch() { // Similar testUnboundedSource, but with an injected exception inside Kafk Consumer poll. // The reader should throw an IOException: thrown.expectCause(isA(IOException.class)); thrown.expectCause(hasMessage(containsString("Exception while reading from Kafka"))); // The original exception is from MockConsumer.poll(): thrown.expectCause(hasCause(isA(KafkaException.class))); thrown.expectCause(hasCause(hasMessage(containsString("Injected error in consumer.poll()")))); int numElements = 1000; String topic = "my_topic"; KafkaIO.Read<Integer, Long> reader = KafkaIO.<Integer, Long>read() .withBootstrapServers("none") .withTopic("my_topic") .withConsumerFactoryFn( new ConsumerFactoryFn( ImmutableList.of(topic), 10, numElements, OffsetResetStrategy.EARLIEST)) .withMaxNumRecords(2 * numElements) // Try to read more messages than available. .updateConsumerProperties(ImmutableMap.of("inject.error.at.eof", true)) .withKeyDeserializer(IntegerDeserializer.class) .withValueDeserializer(LongDeserializer.class); PCollection<Long> input = p.apply(reader.withoutMetadata()).apply(Values.create()); addCountingAsserts(input, numElements); p.run(); } @Test
0
for (Module m : m_modules) // Remove the module from the resolver state. getFramework().getResolver().removeModule(m); // Set fragments to null, which will remove the module from all // of its dependent fragment modules. try { ((ModuleImpl) m).attachFragments(null); } catch (Exception ex) { getFramework().getLogger().log( m.getBundle(), Logger.LOG_ERROR, "Error detaching fragments.", ex); } // Set wires to null, which will remove the module from all // of its dependent modules. ((ModuleImpl) m).setWires(null); // Close the module's content. ((ModuleImpl) m).close(); getFramework().getResolver().removeModule(m); getFramework().getResolver().addModule(module);
0
import java.util.Enumeration; import java.util.Locale; import java.util.Map; import java.util.StringTokenizer; import javax.servlet.http.Cookie; import javax.servlet.http.HttpSession; import org.apache.avalon.framework.parameters.Parameters; HttpSession session = request.getSession(false); HttpSession session = request.getSession(createSession);
0
value = ElementValue.readElementValue(file, constant_pool);
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; import java.util.HashSet; import java.util.Set; /** * Represents a user maintenance request. */ public class UserRequest { private String userName; private String password; private String oldPassword; private Set<String> roles = new HashSet<String>(); public UserRequest(String name) { this.userName = name; } public String getUsername() { return userName; } public Set<String> getRoles() { return roles; } public void setRoles(Set<String> userRoles) { roles = userRoles; } public String getPassword() { return password; } public void setPassword(String userPass) { password = userPass; } public String getOldPassword() { return oldPassword; } public void setOldPassword(String oldUserPass) { oldPassword = oldUserPass; } }
0
package aQute.libg.filters; public final class NotFilter extends Filter { private final Filter child; public NotFilter(Filter child) { this.child = child; } @Override public void append(StringBuilder builder) { builder.append("(!"); child.append(builder); builder.append(")"); } }
0
import java.util.Optional;
0
cm.setMaxTotal(50);
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.commons.bcel6.generic; /** * Get the type associated with an instruction, int for ILOAD, or the type * of the field of a PUTFIELD instruction, e.g.. * * @version $Id$ * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A> */ public interface TypedInstruction { Type getType( ConstantPoolGen cpg ); }
1
import org.apache.http.client.cache.Resource; return new HttpCacheEntry(requestDate, new HeapResource(body), return new HttpCacheEntry(requestDate, new HeapResource(body), Resource orig = entry.getResource(); if (orig instanceof HeapResource) { body = ((HeapResource) orig).getByteArray(); IOUtils.copyAndClose(orig.getInputStream(), outstream); return new HttpCacheEntry( new HeapResource(body),
0
long replicateLog(ClientContext context, String tableName, WalEdits data) long replicateKeyValues(ClientContext context, String tableName, KeyValues kvs)
0
* Interface to be implemented by Widgets which contain other widgets. So all * widgets together form a widget tree, with its root being the {@link Form} * widget, the {@link ContainerWidget}s being the branches/forks, and the * {@link Widget}s with values being the leaves. * @version $Id: ContainerWidget.java,v 1.4 2004/04/23 23:34:56 joerg Exp $
0
package cz.seznam.euphoria.core.client.dataset; import cz.seznam.euphoria.core.client.flow.Flow; import cz.seznam.euphoria.core.client.operator.Operator; import java.util.Collection; /** * A dataset registered in flow. */ public abstract class FlowAwareDataset<T> implements Dataset<T> { private final Flow flow; public FlowAwareDataset(Flow flow) { this.flow = flow; } @Override public Flow getFlow() { return flow; } @Override public Collection<Operator<?, ?, ?>> getConsumers() { return flow.getConsumersOf(this); } }
0
@Override @Override @Override
1
import org.apache.accumulo.core.data.TableId; TableId testId = TableId.of("TEST");
0
Collection<SftpClient.OpenMode> modes = EnumSet.noneOf(SftpClient.OpenMode.class); } else if (option == StandardOpenOption.SPARSE) { /* * As per the Javadoc: * * The option is ignored when the file system does not * support the creation of sparse files */ continue; throw new IllegalArgumentException("newFileChannel(" + path + ") unsupported open option: " + option); return new SftpFileChannel(toSftpPath(path), modes); if (GenericUtils.length(modes) > 0) { for (AccessMode mode : modes) { switch (mode) { case READ: break; case WRITE: w = true; break; case EXECUTE: x = true; break; default: throw new UnsupportedOperationException("Unsupported mode: " + mode); } if ((attrs == null) && !(p.isAbsolute() && p.getNameCount() == 0)) { throw new NoSuchFileException(path.toString()); if (x || (w && p.getFileSystem().isReadOnly())) { throw new AccessDeniedException(path.toString());
0
* http://www.apache.org/licenses/LICENSE-2.0
0
} catch (Throwable t) { UserCodeException innermostUserCodeException = null; Throwable current = t; for (; current.getCause() != null; current = current.getCause()) { if (current instanceof UserCodeException) { innermostUserCodeException = ((UserCodeException) current); if (innermostUserCodeException != null) { current = innermostUserCodeException.getCause(); } if (current instanceof AssertionError) { throw (AssertionError) current; } throw new PipelineExecutionException(current);
0
import java.util.Iterator; public AgentCommand dequeue(String hostname, String commandId) { Queue<AgentCommand> q = getQueue(hostname); if (q == null) { return null; } synchronized (q) { if (q.isEmpty()) { return null; } else { AgentCommand c = null; for (Iterator it = q.iterator(); it.hasNext();) { AgentCommand ac = (AgentCommand) it.next(); if (ac instanceof ExecutionCommand && ((ExecutionCommand) ac) .getCommandId().equals(commandId)) { c = ac; it.remove(); break; } } return c; } } }
0
public int size(){
0
import org.apache.accumulo.core.security.tokens.SecurityToken; public OfflineIterator(ScannerOptions options, Instance instance, SecurityToken credentials, Authorizations authorizations, Text table, Range range) { private SecurityToken credentials; public OfflineScanner(Instance instance, SecurityToken credentials, String tableId, Authorizations authorizations) {
0
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; connector = getInstance().getConnector(getUserName(), getToken()); String username = getUserName(); AuthenticationToken password = getToken(); return CredentialHelper.createSquelchError(username, password, getInstance().getInstanceID()); } public String getUserName() { return props.getProperty("USERNAME"); } public AuthenticationToken getToken() { return new PasswordToken(props.getProperty("PASSWORD"));
0
import org.apache.hc.core5.io.CloseMode; this.conn.close(CloseMode.IMMEDIATE);
0
public static int size(Map<?, ?> map) {
0
new Function<HostStatus, MaintenanceMode>() { @Override public MaintenanceMode apply(HostStatus status) { return status.getMode(); } };
0
mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION), // TODO this test is broken, it assumes that the order in which listeners are added to the BundleContext will also // be the order in which they're invoked (which from a spec point of view is not true) // TODO the test will fail somewhere here most of the time
0
* serialVersionUID format is YYYYMMDD for the date of the last binary change.
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.sshd.common.io; import org.apache.sshd.common.util.Readable; /** */ public interface IoHandler { void sessionCreated(IoSession session) throws Exception; void sessionClosed(IoSession session) throws Exception; void exceptionCaught(IoSession ioSession, Throwable cause) throws Exception; void messageReceived(IoSession session, Readable message) throws Exception; }
1
import java.util.Iterator; import org.apache.hc.core5.annotation.Immutable; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpEntity; import org.apache.hc.core5.http.HttpResponse; import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.StatusLine; import org.apache.hc.core5.http.message.AbstractHttpMessage; import org.apache.hc.core5.http.message.BasicStatusLine; public int getCode() { return statusLine.getStatusCode(); } @Override return super.containsHeader(name); return super.getHeaders(name); return super.getFirstHeader(name); return super.getLastHeader(name); return super.getAllHeaders(); public void addHeader(final String name, final Object value) { public void setHeader(final String name, final Object value) { public Iterator<Header> headerIterator() { return super.headerIterator(); public Iterator<Header> headerIterator(final String name) { return super.headerIterator(name);
0
public void encode(T value, OutputStream outStream, Context context) throws CoderException, IOException { encode(value, outStream); } public T decode(InputStream inStream, Context context) throws CoderException, IOException { return decode(inStream); }
0
Copyright 2001-2005 The Apache Software Foundation Node n = CSSEngine.getCSSParentNode(elt); while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { n = CSSEngine.getCSSParentNode(elt); } return (Element) n; URIResolver resolver = ctx.createURIResolver(svgDoc, loader);
1
SelectionListBuilder builder = null; // listType can be null, meaning we will use the default selection list String listType = selectionListElement.getAttribute("type"); if ("".equals(listType)) { listType = null; } builder = (SelectionListBuilder)builderSelector.select(listType); if (builder != null) { builderSelector.release(builder); } } else { }
0
protected String getStatMetricName() { return "output.kafka.write_logs"; } @Override protected String getWriteBytesMetricName() { return "output.kafka.write_bytes"; } @Override LOG.error("Kafka is down. messageNumber=" + kafkaCallBack.thisMessageNumber + ". Going to sleep for " + FAILED_RETRY_INTERVAL + " seconds"); LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error sending message to Kafka during retry. message=" + (kafkaCallBack == null ? null : kafkaCallBack.message), t, LOG, Level.ERROR); LOG.warn("Kafka is still catching up from previous failed messages. outstanding messages=" + failedMessages.size() + " Going to sleep for " + CATCHUP_RETRY_INTERVAL + " seconds"); producer.send(new ProducerRecord<String, String>(topic, block), new KafkaCallBack(this, block, inputMarker, ++messageCount)); statMetric.value++; writeBytesMetric.value += block.length(); LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "InterruptedException-Error sending message to Kafka", e, LOG, Level.ERROR); LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "ExecutionException-Error sending message to Kafka", e, LOG, Level.ERROR); LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "GenericException-Error sending message to Kafka", t, LOG, Level.ERROR); output.writeBytesMetric.value += message.length(); LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "Error sending message to Kafka. Async Callback", exception, LOG, Level.ERROR); public void copyFile(File inputFile, InputMarker inputMarker) throws UnsupportedOperationException { throw new UnsupportedOperationException("copyFile method is not yet supported for output=kafka");
0
import org.apache.cocoon.el.ExpressionFactory;
0
* This is a glue object, to convert short file references to long references. The metadata may contain old relative file references. This class keeps track of * the short file reference, so it can be removed properly from the metadata tables. return compareTo((FileRef) obj) == 0;
0
* The InspectableAwareCachingSourceFactory inherits from {@link CachingSourceFactory} and only * adds support for wrapped sources of type {@link InspectableSource}. *
0
package org.apache.beam.examples.complete.game; import org.apache.beam.examples.common.DataflowExampleOptions; import org.apache.beam.examples.common.DataflowExampleUtils; import org.apache.beam.examples.complete.game.utils.WriteToBigQuery; import org.apache.beam.examples.complete.game.utils.WriteWindowedToBigQuery; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.PipelineResult; import org.apache.beam.sdk.io.PubsubIO; import org.apache.beam.sdk.options.Default; import org.apache.beam.sdk.options.Description; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.options.Validation; import org.apache.beam.sdk.runners.DataflowPipelineRunner; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.transforms.windowing.AfterProcessingTime; import org.apache.beam.sdk.transforms.windowing.AfterWatermark; import org.apache.beam.sdk.transforms.windowing.FixedWindows; import org.apache.beam.sdk.transforms.windowing.GlobalWindows; import org.apache.beam.sdk.transforms.windowing.IntervalWindow; import org.apache.beam.sdk.transforms.windowing.Repeatedly; import org.apache.beam.sdk.transforms.windowing.Window; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection;
0
import org.apache.accumulo.core.util.FastFormat;
0