Diff stringlengths 5 2k | FaultInducingLabel int64 0 1 |
|---|---|
ServerMutation m = (ServerMutation) mutation;
if (mv1.charAt(0) != mv2.charAt(0))
throw new IllegalArgumentException("Time types differ " + mv1 + " " + mv2);
if (t1 < t2)
return mv2;
else
return mv1;
if (mv1.charAt(0) != LOGICAL_TIME_ID && mv1.charAt(0) != MILLIS_TIME_ID)
throw new IllegalArgumentException("Invalid time type " + mv1);
| 0 |
import org.apache.commons.vfs.FileSystem;
* @version $Revision: 1.3 $ $Date: 2002/08/22 02:42:46 $ | 0 |
* If {@code coderType} is a subclass of {@link Coder} for a specific type {@code T}, returns
* {@code T.class}. Otherwise, raises IllegalArgumentException.
private <T, CoderT extends Coder> TypeDescriptor<T> getCodedType(
TypeDescriptor<CoderT> coderType) {
TypeDescriptor<? super CoderT> coderSupertype = coderType.getSupertype(Coder.class); | 0 |
* Get the OS Type: RHEL6/CentOS6/... | 0 |
import org.apache.batik.anim.dom.XBLOMContentElement; | 0 |
import org.apache.felix.framework.util.manifestparser.NativeLibraryClause;
s = NativeLibraryClause.normalizeOSName(System.getProperty("os.name"));
s = NativeLibraryClause.normalizeProcessor(System.getProperty("os.arch")); | 0 |
if (provider == null) {
} else {
try {
spi = TransformService.getInstance(c14nalg, "DOM", provider);
} catch (NoSuchAlgorithmException nsae) {
spi = TransformService.getInstance(c14nalg, "DOM");
}
TransformService spi = null;
if (provider == null) {
spi = TransformService.getInstance(c14nalg, "DOM");
} else {
try {
spi = TransformService.getInstance(c14nalg, "DOM", provider);
} catch (NoSuchAlgorithmException nsae) {
spi = TransformService.getInstance(c14nalg, "DOM");
}
}
DOMTransform t = new DOMTransform(spi); | 0 |
* Calculate a modulus <i>Check Digit</i> for a code which does not yet have one.
* @param code The code for which to calculate the Check Digit;
* the check digit should not be included
* @throws CheckDigitException if an error occurs calculating the check digit | 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.accumulo.core.client.mock;
import static com.google.common.base.Preconditions.checkArgument;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.data.Mutation;
/**
* @deprecated since 1.8.0; use MiniAccumuloCluster or a standard mock framework instead.
*/
@Deprecated
public class MockBatchWriter implements BatchWriter {
final String tablename;
final MockAccumulo acu;
MockBatchWriter(MockAccumulo acu, String tablename) {
this.acu = acu;
this.tablename = tablename;
}
@Override
public void addMutation(Mutation m) throws MutationsRejectedException {
checkArgument(m != null, "m is null");
acu.addMutation(tablename, m);
}
@Override
public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException {
checkArgument(iterable != null, "iterable is null");
for (Mutation m : iterable) {
acu.addMutation(tablename, m);
}
}
@Override
public void flush() throws MutationsRejectedException {}
@Override
public void close() throws MutationsRejectedException {}
} | 0 |
// paintedArea = shapePainter.getPaintedArea();
// primitiveBounds = paintedArea.getBounds2D();
primitiveBounds = shapePainter.getPaintedBounds(); | 0 |
@Override
@Override | 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 |
private static final long serialVersionUID = 8012776320318623652L;
* Constructs a new VerificationException with null as its error message string.
*/
VerificationException(){
super();
}
/**
* Constructs a new VerificationException with the specified error message.
*/
VerificationException(String message){
super(message);
}
/**
* Constructs a new VerificationException with the specified error message and exception
*/
VerificationException(String message, Throwable initCause){
super(message, initCause);
} | 0 |
import org.apache.xml.security.test.TestUtils;
Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS); | 0 |
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cocoon.forms.datatype.typeimpl;
/**
* A {@link org.apache.cocoon.forms.datatype.Datatype Datatype} implementation
* for whole numbers.
* @version $Id$
*/
public class LongType extends AbstractDatatype {
public Class getTypeClass() {
return Long.class;
}
public String getDescriptiveName() {
return "long";
}
} | 0 |
import org.apache.log4j.Logger;
private static final Logger log = Logger.getLogger(ZKAuthenticatorTest.class);
log.error(e); | 0 |
* @version $Revision: 1.4 $, $Date: 2004/06/16 18:13:53 $
* @throws ConfigurationException If error reading data source.
* @throws ConfigurationException If error reading data source.
final StringBuffer subhierarchy =
initProperties(child,
}
String attrName =
} | 0 |
import org.apache.accumulo.core.client.mapreduce.RangeInputSplit; | 0 |
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
HttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(schemeRegistry); | 0 |
package org.apache.bcel.generic;
super(org.apache.bcel.Const.DSTORE, org.apache.bcel.Const.DSTORE_0);
super(org.apache.bcel.Const.DSTORE, org.apache.bcel.Const.DSTORE_0, n); | 1 |
cf.addListener(f -> future.setValue(Boolean.TRUE));
session.write(buffer).addListener((IoFutureListener<WriteFuture>) cf -> {
Throwable t = cf.getException();
if (t != null) {
future.setException(t);
} else {
future.setWritten(); | 0 |
import cz.seznam.euphoria.core.annotation.audience.Audience;
@Audience(Audience.Type.INTERNAL) | 0 |
IOSGiInstall findInstall(String id);
IOSGiInstallType findInstallType(String location); | 0 |
final private Map<Long,AtomicInteger> counts = new HashMap<>(); | 1 |
// Allow the special default table IDs
String ALPHA_NUM_REGEX_TABLE_ID = "[!+]?\\w+"; | 0 |
Copyright 2001 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ | 0 |
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
/**
* Parse the version XML into its object representation. This causes the XML to be lazy-loaded
* from storage.
* @return {@code null} if the XSD is not available.
* @throws Exception
*/
public VersionDefinitionXml getRepositoryXml() throws Exception {
if (null == versionXsd) {
return null;
}
return VersionDefinitionXml.load(getVersionXml());
}
| 0 |
* @param path
* @param arguments
* {@link #generateWidget(Widget, Map)}. | 0 |
import static org.apache.ambari.metrics.adservice.prototype.common.StatisticUtils.median;
import static org.apache.ambari.metrics.adservice.prototype.common.StatisticUtils.sdev;
| 0 |
public static final String ACCUMULO_CLASSPATH_VALUE = "$ACCUMULO_HOME/conf,\n" + "$ACCUMULO_HOME/lib/[^.].*.jar,\n"
+ "$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n" + "$HADOOP_PREFIX/[^.].*.jar,\n" + "$HADOOP_CONF_DIR,\n" + "$HADOOP_PREFIX/lib/[^.].*.jar,\n";
// Register the shutdown hook
@Override
@Override
| 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 $Revision: 1.14 $ $Date: 2004/02/28 11:47:52 $ | 0 |
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 0 |
* This mechanism provides isolation for web apps deployed in the same container.
*
* @return The (pseudo-singleton) BeanUtils bean instance
* This mechanism provides isolation for web apps deployed in the same container.
*
* @param newInstance The (pseudo-singleton) BeanUtils bean instance
* @return the cloned bean
* @return Map of property descriptors
* @return The array property value
* @return The indexed property's value, converted to a String
* @return The indexed property's value, converted to a String
* @return The mapped property's value, converted to a String
* @return The mapped property's value, converted to a String
* @return The nested property's value, converted to a String
* @return The property's value, converted to a String
* @return The property's value, converted to a String
*
* @return The ConvertUtils bean instance
*
* @return The ConvertUtils bean instance | 0 |
import org.junit.Test;
@Test
@Test
@Test | 0 |
public boolean isChallenged(
public boolean prepareAuthResponse(
Asserts.notNull(authScheme, "AuthScheme");
public void addAuthResponse(
switch (authState.getState()) {
case HANDSHAKE:
Asserts.notNull(authScheme, "AuthScheme");
break;
default: | 0 |
OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
assertEquals( ListSource.class, OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, list.getClass() ) );
OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
assertEquals( Iterable.class, OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, list.getClass() ) );
OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
assertEquals( IComponent.class, OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, form.getClass() ) ); | 0 |
package org.apache.beam.sdk.coders;
* Coder for {@link BitSet}.
if (value == null) {
throw new CoderException("cannot encode a null BitSet");
}
@Override
public boolean consistentWithEquals() {
return true;
} | 0 |
* Copyright (C) 2015 Google Inc. | 0 |
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
List<XMLSecurityConstants.Action> actions = new ArrayList<>(); | 0 |
* treated as case insensitive - i.e. there is no difference between {@code a=2} and
* {@code A=3} and so you cannot parse uri like {@code http://my-site.org?a=2&A=2}
* otherwise {@link java.lang.IllegalStateException} for duplicated parameter is thrown.
* {@code null} values are also not supported. | 0 |
import org.apache.accumulo.core.trace.TraceUtil;
tsStats.addAll(client.getTabletStats(TraceUtil.traceInfo(), context.rpcCreds(), tableId));
historical = client.getHistoricalStats(TraceUtil.traceInfo(), context.rpcCreds()); | 0 |
/** Advance the processing time to the specified time, firing any timers that should fire. */
public void advanceSynchronizedProcessingTime(Instant newSynchronizedProcessingTime)
throws Exception {
timerInternals.advanceSynchronizedProcessingTime(newSynchronizedProcessingTime);
}
/** Current processing time. */
private Instant synchronizedProcessingTime = null;
public Instant currentSynchronizedProcessingTime() {
return synchronizedProcessingTime;
}
@Override
@Nullable
public void advanceSynchronizedProcessingTime(Instant newSynchronizedProcessingTime)
throws Exception {
checkState(!newSynchronizedProcessingTime.isBefore(synchronizedProcessingTime),
"Cannot move processing time backwards from %s to %s", synchronizedProcessingTime,
newSynchronizedProcessingTime);
WindowTracing.trace("TestTimerInternals.advanceProcessingTime: from {} to {}",
synchronizedProcessingTime, newSynchronizedProcessingTime);
synchronizedProcessingTime = newSynchronizedProcessingTime;
advanceAndFire(newSynchronizedProcessingTime, TimeDomain.SYNCHRONIZED_PROCESSING_TIME);
}
@Override
@Nullable
public Instant currentSynchronizedProcessingTime() {
return timerInternals.currentSynchronizedProcessingTime();
}
@Override
@Nullable
public Instant currentEventTime() {
return timerInternals.currentInputWatermarkTime();
} | 0 |
public class SPNegoSchemeFactory implements AuthSchemeProvider { | 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 |
/**
* Used for retrieving the clientConfiguration which was provided (if any); should not be considered public API.
*/
public final Configuration getClientConfiguration() {
// TODO ACCUMULO-3199
return clientConf; | 0 |
public ComponentContextImpl<?> getComponentContext()
| 0 |
* Copyright (C) 2015 Google Inc. | 0 |
/**
* This constructor is used by the system bundle (i.e., the framework),
* since it needs a constructor that does not throw an exception.
**/
BundleImpl()
{
__m_felix = null;
m_archive = null;
m_state = Bundle.INSTALLED;
m_stale = false;
m_activator = null;
m_context = null;
}
IModule module = createModule();
addModule(module); | 1 |
* 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 java.util.Arrays;
import java.util.Comparator;
". Will follow only the first one. Using " + logFiles[0].getAbsolutePath());
File[] logFiles = searchFile.getParentFile().listFiles(fileFilter);
Arrays.sort(logFiles,
new Comparator<File>() {
@Override
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
return logFiles;
for (int i = logFiles.length - 1; i >= 0; i--) {
File file = logFiles[i];
if (i == 0 || !tail) {
processFile(file, i == 0); | 0 |
package org.apache.http.impl.client;
public class HttpRequestFutureTask<V> extends FutureTask<V> {
private final HttpRequestTaskCallable<V> callable;
public HttpRequestFutureTask(
final HttpRequestTaskCallable<V> httpCallable) {
return callable.getScheduled();
return callable.getStarted();
return callable.getEnded();
| 0 |
public void testScpUploadOverwrite() throws Exception {
SshClient client = SshClient.setUpDefaultClient();
client.start();
ClientSession session = client.connect("test", "localhost", port).await().getSession();
session.addPasswordIdentity("test");
session.auth().verify();
ScpClient scp = session.createScpClient();
String data = "0123456789\n";
File root = new File("target/scp");
Utils.deleteRecursive(root);
root.mkdirs();
new File(root, "local").mkdirs();
assertTrue(root.exists());
new File(root, "remote").mkdirs();
writeFile(new File("target/scp/remote/out.txt"), data + data);
writeFile(new File("target/scp/local/out.txt"), data);
scp.upload("target/scp/local/out.txt", "target/scp/remote/out.txt");
assertFileLength(new File("target/scp/remote/out.txt"), data.length(), 5000);
session.close(false).await();
client.stop();
}
@Test | 0 |
SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(Table.ID.of("tab"), null, null), conf,
SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.majc, source, new KeyExtent(Table.ID.of("tab"), null, null), conf,
SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(Table.ID.of("tab"), null, null), conf,
SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(Table.ID.of("tab"), null, null), conf,
SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(Table.ID.of("tab"), null, null), conf, | 1 |
*
*
package org.apache.commons.vfs2.test;
import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.Selectors; | 1 |
this.requestFactory = requestFactory != null ? requestFactory : DefaultHttpRequestFactory.INSTANCE; | 0 |
"org.apache.commons.configuration2.MockInitialContextFactory"); | 0 |
import org.apache.ambari.server.topology.validators.TopologyValidatorService;
/**
* internal token for topology related async tasks
*/
@Inject
private TopologyValidatorService topologyValidatorService;
SecurityType securityType = null;
Credential credential = null;
securityType = SecurityType.KERBEROS;
topology.getBlueprint().getConfiguration().setParentConfiguration(stack.getConfiguration(topology.getBlueprint().getServices()));
credential = request.getCredentialsMap().get(KDC_ADMIN_CREDENTIAL);
}
topologyValidatorService.validateTopologyConfiguration(topology);
// create resources
ambariContext.createAmbariResources(topology, clusterName, securityType, repoVersion);
if (securityConfiguration != null && securityConfiguration.getDescriptor() != null) {
submitKerberosDescriptorAsArtifact(clusterName, securityConfiguration.getDescriptor());
}
if (credential != null) {
addClusterConfigRequest(topology, new ClusterConfigurationRequest(ambariContext, topology, true,
stackAdvisorBlueprintProcessor, securityType == SecurityType.KERBEROS)); | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/locale/converters/StringLocaleConverter.java,v 1.3 2003/01/15 21:59:44 rdonkin Exp $
* $Revision: 1.3 $
* $Date: 2003/01/15 21:59:44 $
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights | 0 |
import org.apache.hc.core5.net.NamedEndpoint;
final NamedEndpoint remoteEndpoint;
remoteEndpoint = this.addressResolver.resolveRemoteEndpoint(route);
remoteEndpoint, localAddress, route, this.sessionRequestCallback); | 0 |
private static String getRole(ValueConstraint constraint) {
return Iterables.getOnlyElement(constraint.getValues()).split("/")[0];
String dedicatedRole = getRole(valueConstraint);
if (!role.equals(dedicatedRole)) {
throw new ScheduleException(
"Only " + dedicatedRole + " may use hosts dedicated for that role."); | 0 |
LOG.info("BeamSQL>\n" + RelOptUtil.toString(beamRelNode)); | 0 |
import com.google.common.base.Objects;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Event event = (Event) o;
return Objects.equal(newPerson, event.newPerson)
&& Objects.equal(newAuction, event.newAuction)
&& Objects.equal(bid, event.bid);
}
@Override
public int hashCode() {
return Objects.hashCode(newPerson, newAuction, bid);
}
@Override
public Object structuralValue(Event v) {
return v;
} | 0 |
out.setName(op.getName() + "-persisted").persist(storageLevel); | 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
*
* @version $Revision$ $Date$ | 0 |
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @version CVS $Id: BindingException.java,v 1.3 2004/03/05 13:02:26 bdelacretaz Exp $ | 1 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 0 |
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.thrift.tokens.SecurityToken;
* @throws AccumuloSecurityException
public static void setConnectorInfo(JobConf job, String principal, SecurityToken token) throws AccumuloSecurityException {
* @see #setConnectorInfo(JobConf, String, SecurityToken)
* Gets the serialized token class from the configuration.
*
* @param job
* the Hadoop context for the configured job
* @return the user name
* @since 1.5.0
* @see #setConnectorInfo(JobConf, String, SecurityToken)
* @see #setConnectorInfo(JobConf, Path)
*/
protected static String getTokenClass(JobConf job) {
return InputConfigurator.getTokenClass(CLASS, job);
}
/**
String tokenClass = getTokenClass(job);
Connector conn = instance.getConnector(user, CredentialHelper.extractToken(tokenClass, password));
scanner = new OfflineScanner(instance, new Credential(user, tokenClass, ByteBuffer.wrap(password), instance.getInstanceID()), Tables.getTableId(instance, | 1 |
Capability.ATTRIBUTES,
Capability.RANDOM_ACCESS_READ | 0 |
import static org.apache.aurora.scheduler.thrift.SchedulerThriftInterface.NO_CRON_UPDATES;
assertEquals(invalidResponse(NO_CRON_UPDATES), thrift.startJobUpdate(request, SESSION)); | 0 |
volatile InternalConverter converter;
private volatile Class< ? > sourceClass;
private volatile Type[] typeArguments;
return MapDelegate.forDTO(object, sourceClass, this);
return MapDelegate.forBean(object, sourceClass, this);
Set<Class< ? >> interfaces = getInterfaces(sourceClass);
if (interfaces.size() > 0) {
return MapDelegate.forInterface(object,
interfaces.iterator().next(), this);
@SuppressWarnings("synthetic-access")
@Override
InternalConverting ic = converter.convert(object);
ic.sourceAs(sourceAsClass);
if (sourceAsDTO)
ic.sourceAsDTO();
if (sourceAsJavaBean)
ic.sourceAsBean();
final Map m = ic.to(Map.class);
if (val == null) {
if (args != null && args.length == 1) {
val = args[0];
} else {
throw new ConversionException(
"No value for property: "
+ propName);
}
private static Map createMapFromInterface(Object obj,
Class< ? > srcCls) {
for (Class i : getInterfaces(srcCls)) {
// Returns an ordered set
private static Set<Class< ? >> getInterfaces(Class< ? > cls) {
if (cls == null)
return Collections.emptySet();
Set<Class< ? >> classes = new LinkedHashSet<>();
if (cls.isInterface()) {
classes.add(cls);
} else {
classes.addAll(Arrays.asList(cls.getInterfaces()));
}
classes.addAll(getInterfaces(cls.getSuperclass()));
return classes;
}
return createMapFromInterface(obj, sourceClass); | 0 |
* http://www.apache.org/licenses/LICENSE-2.0 | 0 |
import java.util.Objects;
Objects.requireNonNull(sql, "null connectionInitSqls element"); | 0 |
import cz.seznam.euphoria.operator.test.junit.AbstractOperatorTest;
import cz.seznam.euphoria.operator.test.junit.Processing;
import org.junit.Test;
@Processing(Processing.Type.ALL)
public class TopPerKeyTest extends AbstractOperatorTest {
@Test
public void testOnBatch() throws Exception {
execute(new AbstractTestCase<Item, Triple<String, String, Integer>>() {
public void validate(Partitions<Triple<String, String, Integer>> partitions) {
Assert.assertEquals(1, partitions.size());
assertUnorderedEquals(
Triple.of("one", "one-999", 999),
Triple.of("two", "two", 10),
Triple.of("three", "3-three", 2)),
partitions.get(0));
}
@Override
protected Partitions<Item> getInput() {
return Partitions
.add(
new Item("three", "2-three", 0))
.add(
new Item("three", "3-three", 2))
.build();
}); | 0 |
import org.apache.accumulo.core.client.AccumuloClient;
AccumuloClient conn = opts.getConnector(); | 0 |
* or more contributor license agreements. See the NOTICE file
* regarding copyright ownership. The ASF licenses this file
* with the License. You may obtain a copy of the License at
* KIND, either express or implied. See the License for the | 0 |
import org.apache.ambari.server.events.publishers.STOMPUpdatePublisher;
STOMPUpdatePublisher STOMPUpdatePublisher;
STOMPUpdatePublisher.register(src); | 1 |
import org.osgi.framework.wiring.BundleRevisions;
public synchronized boolean hasDependents(Bundle bundle)
List<BundleRevision> revisions = bundle.adapt(BundleRevisions.class).getRevisions();
public synchronized Set<Bundle> getDependentBundles(Bundle bundle)
List<BundleRevision> revisions = bundle.adapt(BundleRevisions.class).getRevisions();
Bundle exporter, BundleCapability exportCap)
for (BundleRevision revision : exporter.adapt(BundleRevisions.class).getRevisions())
public synchronized Set<Bundle> getRequiringBundles(Bundle bundle)
for (BundleRevision revision : bundle.adapt(BundleRevisions.class).getRevisions())
public synchronized void removeDependencies(Bundle bundle)
List<BundleRevision> revs = bundle.adapt(BundleRevisions.class).getRevisions(); | 1 |
public class SslIT extends ConfigurableMacBase { | 0 |
* @version CVS $Id: DefaultLinkRenderer.java,v 1.3 2003/07/18 14:41:45 cziegeler Exp $
String layoutKey = (String)layout.getAspectData("link-layout-key");
String layoutId = (String)layout.getAspectData("link-layout-id");
if ( layoutKey == null && layoutId == null){
// get default values
layoutKey = ((LinkLayout)layout).getLayoutKey();
layoutId = ((LinkLayout)layout).getLayoutId();
}
this.processLayout(service.getComponentManager().getProfileManager().getPortalLayout(layoutKey, layoutId), service, handler); | 0 |
import java.text.AttributedCharacterIterator;
* Factory instance that returns TextSpanLayouts appropriate to
* AttributedCharacterIterator instances.
*
* @param aci The character iterator to be laid out
* @param offset The offset position for the text layout.
* @param frc The font render context to use when creating the text layout.
Point2D offset,
FontRenderContext frc) {
return new GlyphLayout(aci, offset, frc); | 0 |
String filePath = Objects.toString(options.remove(KnownHostsServerKeyVerifier.KNOWN_HOSTS_FILE_OPTION), null);
if (GenericUtils.isEmpty(filePath)) {
current = new DefaultKnownHostsServerKeyVerifier(current);
} else { // if user specifies a different location than default be lenient
current = new DefaultKnownHostsServerKeyVerifier(current, false, Paths.get(filePath));
}
((KnownHostsServerKeyVerifier) current).setModifiedServerKeyAcceptor(new ModifiedServerKeyAcceptor() {
}); | 0 |
import java.util.Set;
import com.google.common.collect.ImmutableSet;
public void testAddErrors() {
Set<String> errors = ImmutableSet.of("one error", "two errors");
QuickLinksConfigurationModule module = new QuickLinksConfigurationModule((File) null);
module.addErrors(errors);
assertEquals(errors, ImmutableSet.copyOf(module.getErrors()));
}
@Test | 0 |
new HashSet<>(Arrays.asList(new String[]{
FEED_NAME_PROPERTY_ID}));
Set<Resource> resources = new HashSet<>();
Map<String, String> properties = new HashMap<>();
Map<String, Object> updateMap = new HashMap<>(); | 1 |
public class XmlMetadataHandler extends MetadataHandler
{
public XmlMetadataHandler(Logger logger)
{
/**
* Called to parse the InputStream and set bundle list and package hash map
*/
public void parse(InputStream istream) throws ParserConfigurationException, IOException, SAXException
{
// Parse the Meta-Data
ContentHandler contenthandler = (ContentHandler) m_handler;
InputSource is = new InputSource(istream);
} | 0 |
* entry, the new response SHOULD be used to processChallenge the header fields | 0 |
* @version $Id$ | 0 |
if (!rowIterator.hasNext())
return false; | 1 |
if (ex.getStackTrace().length<1){
trace = ExceptionUtils.getStackTrace(this);
}else{
trace = ExceptionUtils.getStackTrace(ex);
}
if (this.getMessage()!=null){
response.put("message", this.getMessage());
}else if (this.getCause()!=null){
response.put("message", this.getCause().getMessage());
} | 0 |
import org.apache.beam.harness.test.TestExecutors;
import org.apache.beam.harness.test.TestExecutors.TestExecutorService;
import org.apache.beam.harness.test.TestStreams; | 0 |
LedgerEntry entry = seq.nextElement();
lh.getLastAddConfirmed(), entry.getLength(), entry.getEntry()); | 0 |
* This is the "global" logger used by the implementation for all logging
* not directly related to an extended bundle (and its components)
public class ScrLogger extends LogServiceEnabledLogger
public ScrLogger(final ScrConfiguration config, final BundleContext bundleContext)
super(config, bundleContext);
@Override
InternalLogger getDefaultLogger()
return new StdOutLogger(); | 0 |
* @version $Id: FileUtils.java,v 1.30 2004/04/23 22:47:39 jeremias Exp $
//makes sure it is not the same file
if (source.getCanonicalPath().equals(destination.getCanonicalPath())) {
String message =
"Unable to write file " + source + " on itself.";
throw new IOException(message);
}
| 0 |
import java.util.Optional;
return Optional.ofNullable(jobs.get(jobKey)); | 0 |
* or more contributor license agreements. See the NOTICE file
* regarding copyright ownership. The ASF licenses this file
* with the License. You may obtain a copy of the License at
* KIND, either express or implied. See the License for the | 0 |
* Copyright (c) 2002, 2003 The Apache Software Foundation. All rights | 0 |
import java.util.Locale;
final String normalizedHost = host.toLowerCase(Locale.ROOT);
final String normalizedSubjectAlt = subjectAlt.toLowerCase(Locale.ROOT);
if (matchIdentityStrict(normalizedHost, normalizedSubjectAlt)) {
// RFC 2818, 3.1. Server Identity
// "...Names may contain the wildcard
// character * which is considered to match any single domain name
// component or component fragment..."
// Based on this statement presuming only singular wildcard is legal
final int asteriskIdx = identity.indexOf('*');
if (asteriskIdx != -1) {
final String prefix = identity.substring(0, asteriskIdx);
final String suffix = identity.substring(asteriskIdx + 1);
if (!prefix.isEmpty() && !host.startsWith(prefix)) {
return false;
}
if (!suffix.isEmpty() && !host.endsWith(suffix)) {
return false;
// Additional sanity checks on content selected by wildcard can be done here
if (strict) {
final String remainder = host.substring(
prefix.length(), host.length() - suffix.length());
if (remainder.contains(".")) {
return false;
}
return true; | 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.scrplugin.helper;
public class StringUtils
{
public static String[] split( String value, String sep )
{
return value.split( sep );
}
public static boolean isEmpty( final String string )
{
return string == null || string.length() == 0;
}
public static String leftPad( final String base, final int width, final String pad )
{
StringBuilder builder = new StringBuilder( width );
int missing = width - base.length();
while ( missing > 0 )
{
builder.append( pad );
missing -= pad.length();
}
builder.append( base );
return builder.toString();
}
} | 0 |
* A {@link PTransform} that performs a {@link CoGroupByKey} on a tuple of tables. A {@link
* CoGroupByKey} groups results from all tables by like keys into {@link CoGbkResult}s, from which
* the results for any specific table can be accessed by the {@link
* org.apache.beam.sdk.values.TupleTag} supplied with the initial table.
*
* <p>Example of performing a {@link CoGroupByKey} followed by a {@link ParDo} that consumes the
* results:
* @param <K> the type of the keys in the input and output {@code PCollection}s
public class CoGroupByKey<K>
extends PTransform<KeyedPCollectionTuple<K>, PCollection<KV<K, CoGbkResult>>> {
* @param <K> the type of the keys in the input and output {@code PCollection}s
private CoGroupByKey() {}
public PCollection<KV<K, CoGbkResult>> expand(KeyedPCollectionTuple<K> input) {
throw new IllegalArgumentException("must have at least one input to a KeyedPCollections");
KvCoder<K, RawUnionValue> kVCoder = KvCoder.of(keyCoder, unionCoder);
PCollectionList<KV<K, RawUnionValue>> unionTables = PCollectionList.empty(input.getPipeline());
result.setCoder(KvCoder.of(keyCoder, CoGbkResultCoder.of(tupleTags, unionCoder)));
* Returns the value coder for the given PCollection. Assumes that the value coder is an instance
* of {@code KvCoder<K, V>}.
* Returns a UnionTable for the given input PCollection, using the given union index and the given
* unionTableEncoder.
* A DoFn to construct a UnionTable (i.e., a {@code PCollection<KV<K, RawUnionValue>>} from a
private static class ConstructUnionTableFn<K, V> extends DoFn<KV<K, V>, KV<K, RawUnionValue>> {
/** A DoFn to construct a CoGbkResult from an input grouped union table. */
extends DoFn<KV<K, Iterable<RawUnionValue>>, KV<K, CoGbkResult>> { | 1 |
InputStream in = icon.getInputStream();
if (null == in) { // this is buggy implementations
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
| 0 |
/** The FTPS {@link TrustManager} implementation, default validate only
* {@link TrustManagerUtils#getValidateServerCertificateTrustManager()}.
*/ | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.