Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
* Bridge class for the <rect> element.
* Constructs a new bridge for the <rect> element. | 0 |
return fromProto(
proto.getWindowingStrategy(),
RehydratedComponents.forComponents(proto.getComponents()));
RunnerApi.WindowingStrategy proto, RehydratedComponents components) | 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 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//dbcp/src/java/org/apache/commons/dbcp/datasources/CPDSConnectionFactory.java,v 1.1 2003/08/12 06:09:20 jmcnally Exp $
* $Revision: 1.1 $
* $Date: 2003/08/12 06:09:20 $
package org.apache.commons.dbcp.datasources;
* @version $Id: CPDSConnectionFactory.java,v 1.1 2003/08/12 06:09:20 jmcnally Exp $ | 0 |
return new IfClosure<>(predicate, trueClosure, falseClosure); | 1 |
* Note that automatic registration of any
* {@link com.google.cloud.dataflow.sdk.options.PipelineOptions} requires users
* {@link com.google.auto.service.AutoService} to generate the necessary META-INF
* files automatically. | 0 |
package org.apache.felix.sigil.eclipse.ui.internal.editors.project; | 0 |
"Quartz tried to run a type of job we don't know about: %s",
bundle.getJobDetail().getJobClass()); | 0 |
@Parameter(defaultValue = "${project.build.directory}", alias = "outputDirectory", property = "accumulo.outputDirectory", required = true)
@Parameter(defaultValue = "testInstance", alias = "instanceName", property = "accumulo.instanceName", required = true)
@Parameter(defaultValue = "secret", alias = "rootPassword", property = "accumulo.rootPassword", required = true)
@Parameter(defaultValue = "0", alias = "zooKeeperPort", property = "accumulo.zooKeeperPort", required = true)
private int zooKeeperPort;
if (shouldSkip()) {
return;
}
cfg.setZooKeeperPort(zooKeeperPort);
getLog().info("Starting MiniAccumuloCluster: " + mac.getInstanceName() + " in " + mac.getConfig().getDir()); | 0 |
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import org.apache.beam.sdk.values.TypeDescriptor;
@Test
public void testEncodedTypeDescriptor() throws Exception {
TypeDescriptor<Map<Integer, String>> typeDescriptor =
new TypeDescriptor<Map<Integer, String>>() {};
assertThat(TEST_CODER.getEncodedTypeDescriptor(), equalTo(typeDescriptor));
} | 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: Form.java,v 1.18 2004/03/05 13:02:32 bdelacretaz Exp $ | 1 |
public FileNotFolderException(final Object info0, final Throwable throwable) | 1 |
memoryManager.init(conf); | 0 |
import org.apache.accumulo.core.tabletserver.thrift.TUnloadTabletGoal;
public void unloadTablet(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent extent, TUnloadTabletGoal goal, long requestTime) throws TException {} | 1 |
* Copyright 2016 Seznam.cz, a.s. | 0 |
*
*
*
* @version $Id$
* @since 1.0.0
protected Servlet createEmbeddedServlet(String embeddedServletClassName, ServletConfig servletConfig)
this.classLoader =
| 0 |
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import org.apache.hc.core5.http.NameValuePair;
@Test
public void testMultipartWriteTo() throws Exception {
final List<NameValuePair> parameters = new ArrayList<>();
parameters.add(new BasicNameValuePair(MIME.FIELD_PARAM_NAME, "test"));
parameters.add(new BasicNameValuePair(MIME.FIELD_PARAM_FILENAME, "hello world"));
final MultipartFormEntity entity = MultipartEntityBuilder.create()
.setStrictMode()
.setBoundary("xxxxxxxxxxxxxxxxxxxxxxxx")
.addPart(new FormBodyPartBuilder()
.setName("test")
.setBody(new StringBody("hello world", ContentType.TEXT_PLAIN))
.addField("Content-Disposition", "multipart/form-data", parameters)
.build())
.buildEntity();
final ByteArrayOutputStream out = new ByteArrayOutputStream();
entity.getMultipart().writeTo(out);
out.close();
Assert.assertEquals("--xxxxxxxxxxxxxxxxxxxxxxxx\r\n" +
"Content-Disposition: multipart/form-data; name=\"test\"; filename=\"hello world\"\r\n" +
"Content-Type: text/plain; charset=ISO-8859-1\r\n" +
"Content-Transfer-Encoding: 8bit\r\n" +
"\r\n" +
"hello world\r\n" +
"--xxxxxxxxxxxxxxxxxxxxxxxx--\r\n", out.toString(StandardCharsets.US_ASCII.name()));
}
| 0 |
* Extension of {@link AbstractListTest} for exercising the | 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.sdk.io.aws.options;
import com.google.auto.service.AutoService;
import com.google.common.collect.ImmutableList;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsRegistrar;
/**
* A registrar containing the default AWS options.
*/
@AutoService(PipelineOptionsRegistrar.class)
public class AwsPipelineOptionsRegistrar implements PipelineOptionsRegistrar {
@Override
public Iterable<Class<? extends PipelineOptions>> getPipelineOptions() {
return ImmutableList.<Class<? extends PipelineOptions>>builder()
.add(AwsOptions.class)
.add(S3Options.class)
.build();
}
} | 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.ipojo.runtime.core.components.inherited;
import org.apache.felix.ipojo.runtime.core.services.ChildInterface;
public class ProcessImplementation1 implements ChildInterface {
public void processChild() {
// TODO Auto-generated method stub
}
public void processParent1() {
// TODO Auto-generated method stub
}
public void processParentParent() {
// TODO Auto-generated method stub
}
public void processParent2() {
// TODO Auto-generated method stub
}
} | 0 |
* any, must include the following acknowledgement:
* 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 org.apache.felix.dm.annotation.api.dependency.ServiceDependency; | 0 |
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import com.google.inject.persist.UnitOfWork;
import junit.framework.Assert;
Stage s = new Stage(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
"clusterHostInfo", "commandParamsStage", "hostParamsStage");
Stage s = new Stage(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
"clusterHostInfo", "commandParamsStage", "hostParamsStage");
Stage s = new Stage(requestId, "/a/b", "cluster1", 1L, "action db accessor test",
"", "commandParamsStage", "hostParamsStage"); | 0 |
RepositoryVersionState.INSTALLING); | 0 |
extent.getEndRow(), master.getContext());
| 0 |
public ConfigurationException(final String message)
public ConfigurationException(final Throwable cause)
public ConfigurationException(final String message, final Throwable cause) | 0 |
import com.google.cloud.dataflow.sdk.transforms.windowing.Trigger.MergeResult;
import com.google.cloud.dataflow.sdk.util.ExecutableTrigger;
private ExecutableTrigger<IntervalWindow> executableRepeated;
executableRepeated = tester.getTrigger().subTriggers().get(0);
tester.setTimer(firstWindow, new Instant(11), TimeDomain.EVENT_TIME, executableRepeated);
tester.setTimer(firstWindow, new Instant(12), TimeDomain.EVENT_TIME, executableRepeated);
tester.setTimer(firstWindow, new Instant(13), TimeDomain.EVENT_TIME, executableRepeated);
tester.setTimer(firstWindow, new Instant(14), TimeDomain.EVENT_TIME, executableRepeated);
Mockito.<OnMergeEvent<IntervalWindow>>any())).thenReturn(MergeResult.FIRE_AND_FINISH); | 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 |
import java.util.Collections;
import java.util.List;
this.className = className;
context.append("((");
context.append(")");
}
@Override
public List<GroovyExpression> getChildren() {
return Collections.singletonList(expr);
}
@Override
public GroovyExpression copy(List<GroovyExpression> newChildren) {
assert newChildren.size() == 1;
return new TypeCoersionExpression(newChildren.get(0), className); | 0 |
import org.apache.beam.vendor.grpc.v1.io.grpc.ManagedChannelBuilder;
import org.apache.beam.vendor.grpc.v1.io.grpc.inprocess.InProcessChannelBuilder; | 0 |
protected abstract Object visit(ASTSetAddNode node, Object data);
protected abstract Object visit(ASTSetSubNode node, Object data);
protected abstract Object visit(ASTSetMultNode node, Object data);
protected abstract Object visit(ASTSetDivNode node, Object data);
protected abstract Object visit(ASTSetModNode node, Object data);
protected abstract Object visit(ASTSetAndNode node, Object data);
protected abstract Object visit(ASTSetOrNode node, Object data);
protected abstract Object visit(ASTSetXorNode node, Object data); | 1 |
imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth( null ) ) );
imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight( null ) ) );
imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) );
imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) );
imageElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, String.valueOf( image.getWidth() ) );
imageElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, String.valueOf( image.getHeight() ) ); | 0 |
import java.io.IOException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.server.RequestProcessor;
import org.apache.zookeeper.txn.ErrorTxn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
case OpCode.createSession:
case OpCode.closeSession:
// Don't forward local sessions to the leader.
if (!request.isLocalSession()) {
zks.getFollower().request(request);
}
break;
// Before sending the request, check if the request requires a
// global session and what we have is a local session. If so do
// an upgrade.
Request upgradeRequest = null;
try {
upgradeRequest = zks.checkUpgradeSession(request);
} catch (KeeperException ke) {
if (request.getHdr() != null) {
request.getHdr().setType(OpCode.error);
request.setTxn(new ErrorTxn(ke.code().intValue()));
}
request.setException(ke);
LOG.info("Error creating upgrade request", ke);
} catch (IOException ie) {
LOG.error("Unexpected error in upgrade", ie);
}
if (upgradeRequest != null) {
queuedRequests.add(upgradeRequest);
} | 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.binding;
import org.apache.excalibur.source.Source;
/**
* BindingManager declares the factory method that produces actual Bindings.
* @version $Id$
*/
public interface BindingManager {
/**
* Avalon Role for this service interface.
*/
String ROLE = BindingManager.class.getName();
/**
* Constant matching the namespace used for the Binding config files.
*/
String NAMESPACE = "http://apache.org/cocoon/forms/1.0#binding";
/**
* Creates a binding from the XML config found at source parameter.
* The binding will be cached.
*/
Binding createBinding(Source bindingFile) throws BindingException;
/**
* Creates a binding from the XML config found at bindingURI parameter.
* The binding will be cached.
*/
Binding createBinding(String bindingURI) throws BindingException;
} | 0 |
final byte[] key = toByteArray("10100110", 2);
final ByteArrayKeyAnalyzer ka = new ByteArrayKeyAnalyzer(key.length * 8);
final int length = ka.lengthInBits(key);
final PatriciaTrie<byte[], BigInteger> trie
final Map<byte[], BigInteger> map
final BigInteger value = BigInteger.valueOf(i);
final byte[] key = toByteArray(value);
final BigInteger existing = trie.put(key, value);
for (final byte[] key : map.keySet()) {
final BigInteger expected = new BigInteger(1, key);
final BigInteger value = trie.get(key);
final byte[] prefix = toByteArray("00001010", 2);
final byte[] key1 = toByteArray("11001010", 2);
final byte[] key2 = toByteArray("10101100", 2);
final ByteArrayKeyAnalyzer keyAnalyzer = new ByteArrayKeyAnalyzer(key1.length * 8);
final int prefixLength = keyAnalyzer.lengthInBits(prefix);
private static byte[] toByteArray(final String value, final int radix) {
private static byte[] toByteArray(final long value) {
private static byte[] toByteArray(final BigInteger value) {
final byte[] src = value.toByteArray();
final byte[] dst = new byte[src.length-1]; | 0 |
for (Counter<?> counter : counters) {
} else if (dynamicSplitResult instanceof BasicSerializableSourceFormat.BoundedSourceSplit) {
status.setDynamicSourceSplit(
BasicSerializableSourceFormat.toSourceSplit(
(BasicSerializableSourceFormat.BoundedSourceSplit) dynamicSplitResult, options)); | 0 |
import org.apache.commons.vfs2.provider.AbstractFileName;
public class TarFileProvider extends AbstractLayeredFileProvider implements FileProvider
final AbstractFileName rootName = | 0 |
import org.apache.beam.sdk.transforms.DoFnSchemaInformation;
private final DoFnSchemaInformation doFnSchemaInformation;
Map<TupleTag<?>, Coder<?>> outputCoderMap,
DoFnSchemaInformation doFnSchemaInformation) {
this.doFnSchemaInformation = doFnSchemaInformation;
windowingStrategy,
doFnSchemaInformation); | 0 |
import org.apache.beam.sdk.options.PubsubOptions; | 0 |
package org.apache.hc.core5.http.nio.support.classic; | 0 |
/*
* Copyright (C) 2015 Google Inc.
*
* 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 com.google.cloud.dataflow.examples.common;
import com.google.cloud.dataflow.sdk.options.DataflowPipelineOptions;
import com.google.cloud.dataflow.sdk.options.Default;
import com.google.cloud.dataflow.sdk.options.DefaultValueFactory;
import com.google.cloud.dataflow.sdk.options.Description;
import com.google.cloud.dataflow.sdk.options.PipelineOptions;
/**
* Options which can be used to configure Pub/Sub topic in Dataflow examples.
*/
public interface ExamplePubsubTopicOptions extends DataflowPipelineOptions {
@Description("Pub/Sub topic")
@Default.InstanceFactory(PubsubTopicFactory.class)
String getPubsubTopic();
void setPubsubTopic(String topic);
@Description("Number of workers to use when executing the injector pipeline")
@Default.Integer(1)
int getInjectorNumWorkers();
void setInjectorNumWorkers(int numWorkers);
/**
* Returns a default Pub/Sub topic based on the project and the job names.
*/
static class PubsubTopicFactory implements DefaultValueFactory<String> {
@Override
public String create(PipelineOptions options) {
DataflowPipelineOptions dataflowPipelineOptions =
options.as(DataflowPipelineOptions.class);
return "/topics/" + dataflowPipelineOptions.getProject()
+ "/" + dataflowPipelineOptions.getJobName();
}
}
} | 0 |
// notify the application about successful login
app.userDidLogin(user, loginContext);
// notify the application about accessing | 0 |
Copyright 1999-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 final class ByteConverter implements Converter { | 0 |
private static final long serialVersionUID = 7587687059797903734L; | 0 |
* @since 3.0 | 0 |
Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master, oldName, tableOp);
Namespace.ID namespaceId = ClientServiceHandler.checkNamespaceId(master, namespace,
tableOp);
namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
Table.ID tableId = ClientServiceHandler.checkTableId(master, oldTableName, tableOp);
namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
final Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
namespaceId = Namespaces.getNamespaceId(master, Tables.qualify(tableName).getFirst());
Table.ID tableId = ClientServiceHandler.checkTableId(master, tableName, tableOp);
String tableName = Tables.getTableName(master, tableId); | 0 |
ImmutableList.of(DirectOptions.class, DirectTestOptions.class), | 0 |
* Retrieves {@link Aggregator Aggregators} at each {@link ParDo} and returns a {@link Map} of
* {@link Aggregator} to the {@link PTransform PTransforms} in which it is present.
* Returns a {@link Map} between each {@link Aggregator} in the {@link Pipeline} to the {@link | 0 |
import com.twitter.mesos.States;
default:
throw new IllegalArgumentException("Unsupported status: " + task.getStatus());
States.ACTIVE_FILTER); | 0 |
import junit.framework.Assert;
| 0 |
import org.apache.http.HeaderElement;
boolean mustRevalidate = false;
for(Header h : cacheEntry.getHeaders(HeaderConstants.CACHE_CONTROL)) {
for(HeaderElement elt : h.getElements()) {
if (HeaderConstants.CACHE_CONTROL_MUST_REVALIDATE.equalsIgnoreCase(elt.getName())
|| HeaderConstants.CACHE_CONTROL_PROXY_REVALIDATE.equalsIgnoreCase(elt.getName())) {
mustRevalidate = true;
break;
}
}
}
if (mustRevalidate) {
wrapperRequest.addHeader("Cache-Control","max-age=0");
} | 0 |
@NamedQuery(name = "TopologyLogicalRequestEntity.findRequestIds", query = "SELECT DISTINCT t.topologyLogicalRequestEntity.topologyRequestId from TopologyHostRequestEntity t WHERE t.id IN :ids") | 0 |
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@Override
public List<Set<AuthProperty>> getProperties() {
List<Set<AuthProperty>> toRet = new LinkedList<Set<AuthProperty>>();
Set<AuthProperty> internal = new TreeSet<AuthProperty>();
internal.add(new AuthProperty("password", "the password for the principal"));
toRet.add(internal);
return toRet;
} | 0 |
private long maxLatency = 120000;
* Defaults to 120 seconds.
if (maxLatency == 0)
this.maxLatency = Long.MAX_VALUE;
else
this.maxLatency = timeUnit.toMillis(maxLatency); | 0 |
import static org.junit.Assert.*;
assertEquals(1, groups.size());
assertNotNull(groups.get("lg1"));
assertEquals(2, groups.get("lg1").size());
assertTrue(groups.get("lg1").contains(new ArrayByteSequence("cf1")));
fail();
fail();
assertEquals(bs1, bs2);
assertEquals(ecf, LocalityGroupUtil.encodeColumnFamily(bs2));
assertEquals(in2, out); | 1 |
if (node.getNamespaceURI() == null) {
return SVG_ID_ATTRIBUTE.equals(node.getNodeName());
}
return node.getNodeName().equals(XML_ID_QNAME); | 0 |
import org.jline.utils.AttributedStringBuilder;
import org.jline.utils.AttributedStyle;
AttributedStringBuilder sb = new AttributedStringBuilder();
sb.style(sb.style().foreground(AttributedStyle.RED));
sb.append(e.toString());
sb.style(sb.style().foregroundDefault());
terminal.writer().println(sb.toAnsi(terminal));
terminal.flush(); | 0 |
package org.apache.accumulo.examples.constraints;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.accumulo.core.constraints.Constraint;
import org.apache.accumulo.core.data.ColumnUpdate;
import org.apache.accumulo.core.data.Mutation;
public class NumericValueConstraint implements Constraint {
private static final short NON_NUMERIC_VALUE = 1;
private boolean isNumeric(byte bytes[]){
for (byte b : bytes) {
boolean ok = (b >= '0' && b <= '9');
if(!ok) return false;
}
return true;
}
private List<Short> addViolation(List<Short> violations, short violation) {
if(violations == null){
violations = new ArrayList<Short>();
violations.add(violation);
}else if(!violations.contains(violation)){
violations.add(violation);
}
return violations;
}
@Override
public List<Short> check(Environment env, Mutation mutation) {
List<Short> violations = null;
Collection<ColumnUpdate> updates = mutation.getUpdates();
for (ColumnUpdate columnUpdate : updates) {
if(!isNumeric(columnUpdate.getValue()))
violations = addViolation(violations, NON_NUMERIC_VALUE);
}
return violations;
}
@Override
public String getViolationDescription(short violationCode) {
switch(violationCode){
case NON_NUMERIC_VALUE:
return "Value is not numeric";
}
return null;
}
} | 1 |
* @version $Id$
* @since 2.2 | 0 |
private final Log log = LogFactory.getLog(getClass());
if (this.log.isDebugEnabled()) {
this.log.debug("Connection established " + conn);
} | 0 |
value -> key, | 0 |
AuthenticationStrategyImpl(final int challengeCode, final String headerName) { | 0 |
public static void warn(final Log vfslog, final Log commonslog, final String message, final Throwable t)
public static void warn(final Log vfslog, final Log commonslog, final String message)
public static void debug(final Log vfslog, final Log commonslog, final String message)
public static void debug(final Log vfslog, final Log commonslog, final String message, final Throwable t)
public static void info(final Log vfslog, final Log commonslog, final String message, final Throwable t)
public static void info(final Log vfslog, final Log commonslog, final String message)
public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t)
public static void error(final Log vfslog, final Log commonslog, final String message)
public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t)
public static void fatal(final Log vfslog, final Log commonslog, final String message) | 1 |
* Implementation of PropertyAccessor that provides "property" reference to "next" and "hasNext".
*
public class IteratorPropertyAccessor
extends ObjectPropertyAccessor
public Object getProperty( Map context, Object target, Object name )
throws OgnlException
Object result;
Iterator iterator = (Iterator) target;
if ( name instanceof String )
{
if ( name.equals( "next" ) )
{
}
else
{
if ( name.equals( "hasNext" ) )
{
}
else
{
}
else
{
result = super.getProperty( context, target, name );
public void setProperty( Map context, Object target, Object name, Object value )
throws OgnlException | 0 |
* @version $Id$
public Iterator<String> getKeys() | 0 |
import org.apache.hc.core5.io.CloseMode;
shutdownSession(CloseMode.IMMEDIATE);
requestShutdown(CloseMode.GRACEFUL); | 0 |
* Locate the specified file and load the configuration. This does not
* change the source of the configuration (i.e. the internally maintained file name).
* Use one of the setter methods for this purpose.
* @param fileName the name of the file to be loaded
* @throws ConfigurationException if an error occurs
* Load the configuration from the specified file. This does not change
* the source of the configuration (i.e. the internally maintained file
* name). Use one of the setter methods for this purpose.
* @param file the file to load
* @throws ConfigurationException if an error occurs
* Load the configuration from the specified URL. This does not change the
* source of the configuration (i.e. the internally maintained file name).
* Use on of the setter methods for this purpose.
* @param url the URL of the file to be loaded
* @throws ConfigurationException if an error occurs
* Save the configuration. Before this method can be called a valid file
* name must have been set.
* @throws ConfigurationException if an error occurs or no file name has
* been set yet
if (getFileName() == null)
{
throw new ConfigurationException("No file name has been set!");
}
| 0 |
* @since 3.0
* @since 3.1 | 0 |
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SynchronizerTestImpl;
import org.apache.commons.configuration.SynchronizerTestImpl.Methods;
* Tests whether a load() operation is correctly synchronized.
*/
@Test
public void testLoadSynchronized() throws ConfigurationException
{
PropertiesConfiguration config = new PropertiesConfiguration();
SynchronizerTestImpl sync = new SynchronizerTestImpl();
config.setSynchronizer(sync);
FileHandler handler = new FileHandler(config);
handler.load(ConfigurationAssert.getTestFile("test.properties"));
sync.verifyStart(Methods.BEGIN_WRITE);
sync.verifyEnd(Methods.END_WRITE);
}
/**
* Tests whether a save() operation is correctly synchronized.
*/
@Test
public void testSaveSynchronized() throws ConfigurationException, IOException
{
PropertiesConfiguration config = new PropertiesConfiguration();
config.addProperty("test.synchronized", Boolean.TRUE);
SynchronizerTestImpl sync = new SynchronizerTestImpl();
config.setSynchronizer(sync);
FileHandler handler = new FileHandler(config);
File f = folder.newFile();
handler.save(f);
sync.verify(Methods.BEGIN_WRITE, Methods.END_WRITE);
}
/** | 0 |
private Trigger mockTrigger;
private static Trigger.TriggerContext anyTriggerContext() {
return Mockito.<Trigger.TriggerContext>any();
private static Trigger.OnElementContext anyElementContext() {
return Mockito.<Trigger.OnElementContext>any();
mockTrigger = mock(Trigger.class, withSettings().serializable());
private void triggerShouldFinish(Trigger mockTrigger) throws Exception {
Trigger.TriggerContext context =
(Trigger.TriggerContext) invocation.getArguments()[0]; | 0 |
import org.apache.hc.core5.io.ShutdownType;
} catch (final RuntimeException | IOException ex) {
execRuntime.discardConnection();
throw ex;
} catch (final Error error) {
connManager.shutdown(ShutdownType.IMMEDIATE);
throw error; | 0 |
ArrayList<TabletState> tabletStates = new ArrayList<>(tabletReportsCopy.values()); | 0 |
import static org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.projectPathFromPath;
import java.util.concurrent.TimeoutException;
import org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.ProjectPath;
import org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath;
import org.joda.time.Duration;
import org.joda.time.Seconds;
private List<SubscriptionPath> listSubscriptions(ProjectPath projectPath, TopicPath topicPath)
throws IOException {
return pubsub.listSubscriptions(projectPath, topicPath);
}
/**
* Check if topics exist.
*
* @param project GCP project identifier.
* @param timeoutDuration Joda duration that sets a period of time before checking times out.
*/
public void checkIfAnySubscriptionExists(String project, Duration timeoutDuration)
throws InterruptedException, IllegalArgumentException, IOException, TimeoutException {
if (timeoutDuration.getMillis() <= 0) {
throw new IllegalArgumentException(String.format("timeoutDuration should be greater than 0"));
}
DateTime startTime = new DateTime();
int sizeOfSubscriptionList = 0;
while (sizeOfSubscriptionList == 0
&& Seconds.secondsBetween(new DateTime(), startTime).getSeconds()
< timeoutDuration.toStandardSeconds().getSeconds()) {
// Sleep 1 sec
Thread.sleep(1000);
sizeOfSubscriptionList =
listSubscriptions(projectPathFromPath(String.format("projects/%s", project)), topicPath())
.size();
}
if (sizeOfSubscriptionList > 0) {
return;
} else {
throw new TimeoutException("Timed out when checking if topics exist for " + topicPath());
}
}
| 0 |
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.clientImpl.OfflineScanner;
import org.apache.accumulo.core.clientImpl.ScannerImpl;
import org.apache.accumulo.core.clientImpl.Table;
import org.apache.accumulo.core.clientImpl.Tables;
import org.apache.accumulo.core.clientImpl.TabletLocator;
import org.apache.accumulo.core.dataImpl.KeyExtent; | 0 |
import java.util.HashMap;
import junit.framework.TestCase;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.mock.MockRequest;
* @version CVS $Id$
public class RequestParamActionTestCase extends TestCase {
private Map objectModel = new HashMap();
MockRequest request = new MockRequest();
request.setRequestURI("test.xml?abc=def&ghi=jkl");
request.setQueryString("abc=def&ghi=jkl");
request.setContextPath("servlet");
request.addParameter("abc", "def");
objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
RequestParamAction action = new RequestParamAction();
Map result = action.act(null, null, objectModel, null, parameters); | 0 |
private Long hostId;
setHostId(entry.getHostId());
public Long getHostId() {
return hostId;
public void setHostId(Long hostId) {
if (hostId == null)
throw new RuntimeException("HostId couldn't be null");
this.hostId = hostId;
result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
result = prime * result + ((hostId == null) ? 0 : hostId.hashCode());
if (clusterId != null ? !clusterId.equals(other.clusterId) : other.clusterId != null) return false;
if (createTimestamp != null ? !createTimestamp.equals(other.createTimestamp) : other.createTimestamp != null) return false;
if (hostId != null ? !hostId.equals(other.hostId) : other.hostId != null) return false;
if (type != null ? !type.equals(other.type) : other.type != null) return false;
| 0 |
ensureCapacity(buffer().position() + 1); | 0 |
* @see org.apache.http.entity.mime.MultipartEntityBuilder
* String)} or {@link org.apache.http.entity.mime.MultipartEntityBuilder} | 0 |
Set<String> seenEntries = new HashSet<>(); | 0 |
/**
* Empty Constructor Method Id.
*/
public static final String EMPTY_CONSTRUCTOR_ID = "$init";
/**
* Bundle Context Constructor Method Id.
*/
public static final String BC_CONSTRUCTOR_ID = "$init$org_osgi_framework_BundleContext";
/**
* Constructor Prefix.
*/
public static final String CONSTRUCTOR_PREFIX = "$init"; | 0 |
private int emptyLineCount;
private final MessageConstraints messageConstraints;
* @param messageConstraints Message constraints. If {@code null}
public AbstractMessageParser(final LineParser lineParser, final MessageConstraints messageConstraints) {
this.messageConstraints = messageConstraints != null ? messageConstraints : MessageConstraints.DEFAULT;
this.emptyLineCount = 0;
protected abstract T createMessage(CharArrayBuffer buffer) throws HttpException;
private T parseHeadLine() throws IOException, HttpException {
if (this.lineBuf.length() == 0) {
this.emptyLineCount++;
if (this.emptyLineCount >= this.messageConstraints.getMaxEmptyLineCount()) {
throw new MessageConstraintException("Maximum empty line limit exceeded");
}
return null;
} else {
return createMessage(this.lineBuf);
}
final int maxLineLen = this.messageConstraints.getMaxLineLength();
final int maxLineLen = this.messageConstraints.getMaxLineLength();
this.message = parseHeadLine();
if (this.message != null) {
this.state = READ_HEADERS;
final int maxHeaderCount = this.messageConstraints.getMaxHeaderCount();
this.message.addHeader(this.lineParser.parseHeader(buffer)); | 0 |
package org.apache.felix.sigil.ui.eclipse.ui.util;
import org.apache.felix.sigil.model.osgi.IPackageExport;
import org.apache.felix.sigil.model.osgi.IPackageImport; | 0 |
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.xml.bind.JAXBException;
| 0 |
protected AbstractSerializableListDecorator(final List<E> list) {
private void writeObject(final ObjectOutputStream out) throws IOException {
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { | 0 |
public abstract class DigestManager {
public ChannelBuffer computeDigestAndPackageForSending(long entryId, long lastAddConfirmed, byte[] data) { | 0 |
/*
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/ | 0 |
interface Params {
boolean useBetaDbTaskStore();
Amount<Long, Time> slowQueryLogThreshold();
}
private static Params paramsFromCommandLine() {
return new Params() {
@Override
public boolean useBetaDbTaskStore() {
return USE_DB_TASK_STORE.get();
}
@Override
public Amount<Long, Time> slowQueryLogThreshold() {
return SLOW_QUERY_LOG_THRESHOLD.get();
}
};
}
return paramsFromCommandLine().useBetaDbTaskStore()
bind(new TypeLiteral<Amount<Long, Time>>() { })
.toInstance(paramsFromCommandLine().slowQueryLogThreshold());
@CmdLine(name = "db_row_gc_interval",
help = "Interval on which to scan the database for unused row references.")
private static final Arg<Amount<Long, Time>> DB_ROW_GC_INTERVAL =
Arg.create(Amount.of(2L, Time.HOURS));
interface Params {
Amount<Long, Time> dbRowGcInterval();
}
private final Params params;
public GarbageCollectorModule() {
this.params = new Params() {
@Override
public Amount<Long, Time> dbRowGcInterval() {
return DB_ROW_GC_INTERVAL.get();
}
};
}
params.dbRowGcInterval().getValue(),
params.dbRowGcInterval().getUnit().getTimeUnit())); | 0 |
print("num_alive_connections", stats.getNumAliveClientConnections());
| 0 |
options.setRunner(TestFlinkRunner.class);
FlinkPipelineOptions flinkOptions = PipelineOptionsFactory.as(FlinkPipelineOptions.class); | 0 |
/**
* Copyright 2013 Apache Software Foundation | 0 |
* MapElements.into(TypeDescriptors.integers())
* .via((String word) -> word.length())); | 0 |
assertEquals("Check failed", new Pair<>(true, expected), KeyUtils.checkFingerPrint(test, key)); | 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. | 0 |
import org.apache.sshd.common.cipher.AES128CTR;
import org.apache.sshd.common.cipher.AES256CTR;
import org.apache.sshd.common.cipher.ARCFOUR128;
import org.apache.sshd.common.cipher.ARCFOUR256;
import org.apache.sshd.server.session.DefaultForwardingAcceptorFactory;
avail.add(new AES128CTR.Factory());
avail.add(new AES256CTR.Factory());
avail.add(new ARCFOUR128.Factory());
avail.add(new ARCFOUR256.Factory()); | 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 |
public static final String NAME_PROPERTY = "name",
CREDENTIAL_PROVIDERS_PROPERTY = "credentialProviders";
protected void setWithCredentialProviders(String name, String credentialProviders)
throws IOException {
throw new IOException(
"No password could be extracted from CredentialProvider(s) with " + name);
char[] nameCharArray = properties.get(NAME_PROPERTY),
credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY);
this.setWithCredentialProviders(new String(nameCharArray),
new String(credentialProvidersCharArray));
throw new IllegalArgumentException(
"Expected " + NAME_PROPERTY + " and " + CREDENTIAL_PROVIDERS_PROPERTY + " properties.");
properties
.add(new TokenProperty(NAME_PROPERTY, "Alias to extract from CredentialProvider", false));
properties.add(new TokenProperty(CREDENTIAL_PROVIDERS_PROPERTY,
"Comma separated list of URLs defining CredentialProvider(s)", false)); | 0 |
import org.apache.batik.dom.svg.SVGOMAnimationElement;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.util.ParsedURL;
String href = elt.getHref().getAnimVal();
ParsedURL purl = new ParsedURL(elt.getBaseURI(), href);
SVGOMDocument doc = (SVGOMDocument) elt.getOwnerDocument();
ParsedURL durl = doc.getParsedURL();
if (purl.sameFile(durl)) {
String frag = purl.getRef();
if (frag != null && frag.length() != 0) {
Element refElt = doc.getElementById(frag);
if (refElt instanceof SVGOMAnimationElement) {
SVGOMAnimationElement aelt =
(SVGOMAnimationElement) refElt;
float t = aelt.getHyperlinkBeginTime();
if (Float.isNaN(t)) {
aelt.beginElement();
} else {
doc.getRootElement().setCurrentTime(t);
}
return;
}
}
} | 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 |
* @version $Id$ | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.