Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
public class ExposedByteArrayInputStream extends ByteArrayInputStream {
/** Read all remaining bytes. */ | 1 |
private final Class clazz;
private final Schema schema; | 0 |
import java.util.Date;
if (job.isSetCronSchedule()) {
CrontabEntry crontabEntry = CrontabEntry.parse(job.getCronSchedule());
Optional<Date> nextRun = cronPredictor.predictNextRun(crontabEntry);
return nextRun.transform(date -> summary.setNextCronRunMs(date.getTime())).or(summary);
} else {
return summary;
} | 0 |
* @since 1.8.0
* @since 1.8.0 | 0 |
import cz.seznam.euphoria.shaded.guava.com.google.common.io.Closeables;
import org.apache.commons.io.IOUtils;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
return this::iter;
}
private Iterator<T> iter() {
FileInputStream finput;
if (serializedElements == null) {
finput = null;
input = null;
} else {
finput = new FileInputStream(serializedElements);
input = new Input(IOUtils.toBufferedInputStream(finput));
}
return new Iterator<T>() {
boolean n = input != null && !input.eof() || dataIterator.hasNext();
if (!n && input != null) {
input.close();
Closeables.closeQuietly(finput);
}
return n;
if (dataIterator.hasNext()) {
}
if (input != null) {
input.close();
Closeables.closeQuietly(finput);
} | 0 |
endTime, null, null, true); | 0 |
final Charset charset = (contentType != null ? contentType : ContentType.DEFAULT_TEXT).getCharset();
final byte[] bytes = body.getBytes(charset != null ? charset : StandardCharsets.US_ASCII);
return new SimpleBody(bytes, null, contentType); | 0 |
protected static final String KAFKA_BROKER_CONFIG = "kafka-broker";
updateKAFKAConfigs();
protected void updateKAFKAConfigs() throws AmbariException {
AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
Clusters clusters = ambariManagementController.getClusters();
Map<String, Cluster> clusterMap = getCheckedClusterMap(clusters);
for (final Cluster cluster : clusterMap.values()) {
Set<String> installedServices = cluster.getServices().keySet();
if (installedServices.contains("KAFKA") && cluster.getSecurityType() == SecurityType.KERBEROS) {
Config kafkaBroker = cluster.getDesiredConfigByType(KAFKA_BROKER_CONFIG);
if (kafkaBroker != null) {
String listenersPropertyValue = kafkaBroker.getProperties().get("listeners");
if (StringUtils.isNotEmpty(listenersPropertyValue)) {
String newListenersPropertyValue = listenersPropertyValue.replaceAll("PLAINTEXT", "PLAINTEXTSASL");
updateConfigurationProperties(KAFKA_BROKER_CONFIG, Collections.singletonMap("listeners", newListenersPropertyValue), true, false);
}
}
}
}
}
| 0 |
* @version $Revision: 1.13 $ $Date: 2004/05/01 12:52:23 $
protected Exception failure;
checkFailure();
checkFailure();
protected void checkFailure() throws SQLException {
if (failure != null) {
throw new SQLNestedException("TesterConnection failure", failure);
}
}
public void setFailure(Exception failure) {
this.failure = failure;
}
| 0 |
* /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/fmt/src/java/org/apache/commons/jelly/tags/fmt/BundleTag.java,v 1.1 2003/01/16 16:21:46 jstrachan Exp
import org.apache.commons.jelly.JellyTagException;
public void doTag(XMLOutput output) throws JellyTagException { | 0 |
import org.apache.commons.pool2.impl.WhenExhaustedAction;
if (maxActive <= 0) {
pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
pool.setMaxActive(Integer.MAX_VALUE);
}
if (maxWait == 0) {
pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
}
| 0 |
@SuppressWarnings("all") public class ThriftTableOperationException extends Exception implements org.apache.thrift.TBase<ThriftTableOperationException, ThriftTableOperationException._Fields>, java.io.Serializable, Cloneable { | 0 |
import java.io.Serializable; | 0 |
import com.google.common.base.Preconditions;
import com.google.common.collect.AbstractIterator;
/** Time sliding windowing. */
public final class TimeSliding<T> implements Windowing<T, TimeInterval> {
public static <T> TimeSliding<T> of(Duration duration, Duration step) {
return new TimeSliding<>(duration.toMillis(), step.toMillis());
}
/**
* Helper method to extract window label from context.
*
* @param context the execution context
* @return the {@link TimeInterval} window of this execution
* @throws ClassCastException if the context is not part of a time-sliding execution
*/
public static TimeInterval getLabel(Collector<?> context) {
return (TimeInterval) context.getWindow();
}
return "TimeSliding{" + "duration=" + duration + ", slide=" + slide + '}';
/** Calculates window boundaries lazily during the iteration. */ | 0 |
// See AvroSinkFactory#create for an explanation of this logic.
if (coder instanceof ValueOnlyWindowedValueCoder
&& ((ValueOnlyWindowedValueCoder) coder).getValueCoder() instanceof AvroCoder) { | 0 |
* performance is not an issue during initialization (and there is not
* Has this configuration been initialized.
final List<Object> list = (List<Object>) current;
final List<String> values = (List<String>) value;
* Combines an existing ExtendedProperties object with this one.
* Get the list of the keys contained in the configuration repository.
final List<String> entry = (List<String>) value;
* Get an array of strings associated with the given configuration key.
final List<String> list = (List<String>) value;
* Get a Vector of strings associated with the given configuration key.
final List<String> list = (List<String>) value;
final List<String> list = (List<String>) value;
final Enumeration<String> e = (Enumeration<String>) props.propertyNames();
final Map<String, Object> mapso = (Map<String,Object>) map; | 0 |
Array.set(obj, ((Integer) key).intValue(), value);
list.set(((Integer) key).intValue(), value); | 0 |
* @param value the value | 0 |
protected String displayName = null;
protected String description = null;
protected ConnectorType connectorType = null;
protected Endpoint endpoint = null; | 0 |
*
*
*
* @version $Revision: 1.4 $ | 1 |
import org.apache.ambari.server.configuration.AmbariServerConfigurationCategory;
import org.apache.ambari.server.configuration.AmbariServerConfigurationKey;
* @param category the name of the category
* @param propertyName the name of the property
* exists; {@code null} otherwise
* @throws IllegalStateException if there is no property found with the given name
return getConfigurationPropertyType(AmbariServerConfigurationCategory.translate(category), propertyName);
* @param category the category
* @param propertyName the name of the property
* @return the type of the given category/property if such category/property
* exists; {@code null} otherwise
* @throws IllegalStateException if there is no property found with the given name
*/
public static ConfigurationPropertyType getConfigurationPropertyType(AmbariServerConfigurationCategory category, String propertyName) {
return AmbariServerConfigurationKey.translate(category, propertyName).getConfigurationPropertyType();
}
/**
* @param category the name of the category
* @param propertyName the name of the property
* exists; {@code null} otherwise * @throws IllegalStateException if
* there is no property found with the given name
* <p>
* {@link ConfigurationPropertyType#PASSWORD}
* @param category the name of the category
* @param propertyName the name of the property
* {@link ConfigurationPropertyType#PASSWORD}; {@code false} otherwise
* @throws IllegalStateException if there is no property found with the given name | 0 |
* <li>{@link AccumuloInputFormat#setTableQueryConfigs(JobConf, org.apache.accumulo.core.conf.TableQueryConfig...)}</li> | 0 |
public abstract class RestrictionTracker<RestrictionT, PositionT> {
interface ClaimObserver<PositionT> {
void onClaimed(PositionT position);
void onClaimFailed(PositionT position);
}
private ClaimObserver<PositionT> claimObserver;
void setClaimObserver(ClaimObserver<PositionT> claimObserver) {
this.claimObserver = claimObserver;
}
public final boolean tryClaim(PositionT position) {
if (tryClaimImpl(position)) {
if (claimObserver != null) {
claimObserver.onClaimed(position);
}
return true;
} else {
if (claimObserver != null) {
claimObserver.onClaimFailed(position);
}
return false;
}
}
protected abstract boolean tryClaimImpl(PositionT position);
public abstract RestrictionT currentRestriction();
public abstract RestrictionT checkpoint();
public abstract void checkDone() throws IllegalStateException; | 0 |
Client client =
factory.getClient(new TCompactProtocol(ugiTransport), new TCompactProtocol(ugiTransport));
ByteBuffer login = client.login(rootUser.getPrincipal(), Collections.<String,String>emptyMap());
Collections.<ColumnUpdate>singletonList(update));
Collections.<ColumnUpdate>singletonList(update));
UserGroupInformation ugi =
UserGroupInformation.loginUserFromKeytabAndReturnUGI(user, keytab.getAbsolutePath());
Client client =
factory.getClient(new TCompactProtocol(ugiTransport), new TCompactProtocol(ugiTransport));
client.login(kdc.qualifyUser(user), Collections.<String,String>emptyMap());
UserGroupInformation ugi =
UserGroupInformation.loginUserFromKeytabAndReturnUGI(user, keytab.getAbsolutePath());
Client client =
factory.getClient(new TCompactProtocol(ugiTransport), new TCompactProtocol(ugiTransport));
client.login(rootUser.getPrincipal(), Collections.<String,String>emptyMap());
final UserGroupInformation proxyUser1 =
UserGroupInformation.createProxyUser(userWithoutCredentials1, realUgi);
final UserGroupInformation proxyUser2 =
UserGroupInformation.createProxyUser(userWithoutCredentials2, realUgi);
final UserGroupInformation proxyUser3 =
UserGroupInformation.createProxyUser(userWithoutCredentials3, realUgi);
int numSecurityExceptionsSeen =
Iterables.size(Iterables.filter(Throwables.getCausalChain(e),
Connector conn =
inst.getConnector(userWithoutCredentials1, new KerberosToken(userWithoutCredentials1));
Connector conn =
inst.getConnector(userWithoutCredentials2, new KerberosToken(userWithoutCredentials3));
int numSecurityExceptionsSeen =
Iterables.size(Iterables.filter(Throwables.getCausalChain(e), | 0 |
@Column(name = "current_mpack_id")
private Long currentMpackId;
public Long getCurrentMpackId() {
return currentMpackId;
}
public void setCurrentMpackId(Long currentMpackId) {
this.currentMpackId = currentMpackId;
}
buffer.append(", current_mpack_id=").append(currentMpackId); | 0 |
public void setPrevKey(Key pk) {
this.prevKey = pk;
}
| 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.extensions.sql.impl.udf;
import com.google.common.annotations.VisibleForTesting;
import org.apache.beam.sdk.extensions.sql.BeamSqlUdf;
/**
* IS_INF(X)
*
* <p>Returns TRUE if the value is positive or negative infinity. Returns NULL for NULL inputs.
* input: Float, Double
*
* <p>Output: Boolean
*/
public class IsInf implements BeamSqlUdf {
public static final String FUNCTION_NAME = "IS_INF";
@VisibleForTesting
static final String ERROR_MSG = FUNCTION_NAME + " only accepts FLOAT or DOUBLE type.";
public static boolean eval(Object value) throws Exception {
if (value instanceof Float) {
return Float.isInfinite((Float) value);
} else if (value instanceof Double) {
return Double.isInfinite((Double) value);
}
throw new Exception(ERROR_MSG);
}
} | 0 |
private Map<Rule, Integer> order = new HashMap<Rule, Integer>();
order.put(rule, counter);
public List<Rule> match(String namespace, String pattern) {
List<Rule> universalList = new ArrayList<Rule>(counter);
List<Rule> tempList = this.cache.get("!*");
tempList = this.cache.get("!" + parentPattern + "/?");
List<Rule> rulesList = this.cache.get(pattern);
rulesList = this.cache.get(parentPattern + "/?");
for (String key : this.cache.keySet()) {
tempList = this.cache.get("!" + key);
rulesList = this.cache.get(key);
rulesList = this.cache.get("*");
Iterator<Rule> it = universalList.iterator();
Rule rule = it.next();
new Comparator<Rule>() {
public int compare(Rule r1, Rule r2) throws ClassCastException {
Integer i1 = order.get(r1);
Integer i2 = order.get(r2);
private List<Rule> findExactAncesterMatch(String parentPattern) {
List<Rule> matchingRules = null;
matchingRules = this.cache.get(parentPattern.substring(0, lastIndex) + "/*"); | 0 |
import org.osgi.framework.wiring.BundleWiring;
return this.bundle.adapt(BundleWiring.class).getClassLoader(); | 0 |
/**
* A rate limiter which doesn't actually limit rates at all.
*/ | 0 |
public static volatile SingularAttribute<AlertDefinitionEntity, String> helpURL; | 0 |
import org.apache.beam.portability.v1.Endpoints;
private static final Endpoints.ApiServiceDescriptor DESCRIPTOR =
Endpoints.ApiServiceDescriptor.newBuilder().setUrl("test").build(); | 0 |
import org.apache.accumulo.core.security.tokens.SecurityToken; | 0 |
/*
* Copyright 2001-2004 The Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @version $Revision: 1.3 $ $Date: 2004/02/18 01:20:40 $ | 0 |
import org.apache.cocoon.environment.impl.AbstractSession;
public class MockSession extends AbstractSession { | 0 |
Set<String> unsupportedProperties =
return !unsupportedProperties.isEmpty() || hasSubResourcePredicate(); | 0 |
errors.checkArgument(params.length == 3, "Must have exactly 3 arguments");
TypeDescriptor<?> receiverT = fnT.resolveType(params[2]);
"Third argument must be %s, but is %s", | 0 |
AtlasGraph getAtlasGraph() { return atlasGraph; }
AtlasVertex findTypeVertexByName(String typeName) {
AtlasVertex findTypeVertexByNameAndCategory(String typeName, TypeCategory category) {
AtlasVertex findTypeVertexByGuid(String typeGuid) {
AtlasVertex findTypeVertexByGuidAndCategory(String typeGuid, TypeCategory category) {
Iterator<AtlasVertex> findTypeVerticesByCategory(TypeCategory category) {
AtlasVertex createTypeVertex(AtlasBaseTypeDef typeDef) {
void updateTypeVertex(AtlasBaseTypeDef typeDef, AtlasVertex vertex) {
void deleteTypeVertexOutEdges(AtlasVertex vertex) throws AtlasBaseException {
void deleteTypeVertex(AtlasVertex vertex) throws AtlasBaseException {
void vertexToTypeDef(AtlasVertex vertex, AtlasBaseTypeDef typeDef) {
boolean isTypeVertex(AtlasVertex vertex) {
boolean isTypeVertex(AtlasVertex vertex, TypeCategory category) {
boolean isTypeVertex(AtlasVertex vertex, TypeCategory[] categories) {
AtlasEdge getOrCreateEdge(AtlasVertex outVertex, AtlasVertex inVertex, String edgeLabel) {
AtlasEdge addEdge(AtlasVertex outVertex, AtlasVertex inVertex, String edgeLabel) {
void createSuperTypeEdges(AtlasVertex vertex, Set<String> superTypes, TypeCategory typeCategory)
Set<String> getSuperTypeNames(AtlasVertex vertex) {
TypeCategory getTypeCategory(AtlasBaseTypeDef typeDef) { | 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: JavaScriptWidgetListenerBuilder.java,v 1.6 2004/03/05 13:02:31 bdelacretaz Exp $ | 1 |
group2ServiceComponents.put("service2", Arrays.asList("component3", "component4")); | 0 |
/**
* Pauses animations in the document.
*/
void pauseAnimations();
/**
* Unpauses animations in the document.
*/
void unpauseAnimations();
/**
* Returns whether animations are currently paused.
*/
boolean animationsPaused();
/**
* Returns the current document time.
*/
float getCurrentTime();
/**
* Sets the current document time.
*/
void setCurrentTime(float t);
} | 0 |
import org.apache.http.nio.impl.SessionInputBuffer;
super(new SessionInputBuffer(buffersize, linebuffersize));
super(new SessionInputBuffer(buffersize, linebuffersize));
protected int waitForData() throws IOException {
return getBuffer().fill(this.channel); | 0 |
Map<String,Table.ID> tableNameToId = Tables.getNameToIdMap(Monitor.getContext()); | 0 |
import org.apache.ambari.server.controller.spi.Resource; | 0 |
protected transient WeakReference offsetReference;
return SVG_STOP_TAG;
result = new SVGOMAnimatedNumber(this, null, SVG_OFFSET_ATTRIBUTE, null); | 0 |
import org.apache.beam.sdk.loadtests.metrics.ByteMonitor;
import org.apache.beam.sdk.loadtests.metrics.TimeMonitor;
.apply(
"Collect start time metric",
ParDo.of(new TimeMonitor<>(METRICS_NAMESPACE, "runtime")))
.apply(
"Collect metrics",
ParDo.of(new ByteMonitor(METRICS_NAMESPACE, "totalBytes.count")));
.apply(format("Convert to Long: %d", i), MapElements.via(new ByteValueToLong()))
.apply(format("Combine: %d", i), getPerKeyCombiner(options.getPerKeyCombinerType()))
.apply(
"Collect end time metric",
ParDo.of(new TimeMonitor<byte[], Object>(METRICS_NAMESPACE, "runtime")));
private PTransform<PCollection<KV<byte[], Long>>, ? extends PCollection> getPerKeyCombiner(
CombinerType combinerType) { | 0 |
* http://www.apache.org/licenses/LICENSE-2.0 | 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.components.cron;
import java.util.Date;
/**
* Interface for classes holding scheduled job entries.
*
* @version $Id$
*/
public interface JobSchedulerEntry {
/**
* The name of the role/class of the job
*
* @return Name of the role/class of this job
*/
String getJobName();
/**
* Return name of entry.
*
* @return the name of the entry
*/
String getName();
/**
* Retrieve time when this job should run next.
*
* @return the time in milliseconds when job should run
*/
Date getNextTime();
/**
* Is this job currently running?
*
* @return whether this job is currently running?
*/
boolean isRunning();
/**
* Get a human readable representation of the schedule of this entry. Is up to an implementation how it presents
* the schedule for this entry
*
* @return the human readable representation of the schedule of this entry
*/
String getSchedule();
} | 0 |
@Override | 0 |
getManagementController().retrieveHostRepositories(cl, addedHost),
recoveryConfigHelper.getRecoveryConfig(cl.getClusterName(),
addedHost.getHostName())
)); | 0 |
*/
public FNEG() {
super(org.apache.bcel.Constants.FNEG);
}
/**
* Call corresponding visitor method(s). The order is:
* Call visitor methods of implemented interfaces first, then
* call methods according to the class hierarchy in descending order,
* i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
public void accept( Visitor v ) {
v.visitTypedInstruction(this);
v.visitStackProducer(this);
v.visitStackConsumer(this);
v.visitArithmeticInstruction(this);
v.visitFNEG(this);
} | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/DynaProperty.java,v 1.10 2003/10/05 13:35:37 rdonkin Exp $
* $Revision: 1.10 $
* $Date: 2003/10/05 13:35:37 $
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* notice, this list of conditions and the following disclaimer.
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgement:
* "This product includes software developed by the
* 4. The names "Apache", "The Jakarta Project", "Commons", and "Apache Software
* from this software without prior written permission. For written
* 5. Products derived from this software may not be called "Apache",
* "Apache" nor may "Apache" appear in their names without prior
* written permission of the Apache Software Foundation.
*/
* @version $Revision: 1.10 $ $Date: 2003/10/05 13:35:37 $ | 0 |
@Deprecated | 1 |
final class SetPropertyRule
extends AbstractXmlRule
{
public SetPropertyRule( RulesBinder targetRulesBinder, PatternStack patternStack )
{
super( targetRulesBinder, patternStack );
protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
throws Exception
{
String name = attributes.getValue( "name" );
String value = attributes.getValue( "value" );
linkedRuleBuilder.setProperty( name ).extractingValueFromAttribute( value ); | 0 |
private TopologyManager topologyManager;
topologyManager = injector.getInstance(TopologyManager.class); | 0 |
RPC_SSL_CIPHER_SUITES("rpc.ssl.cipher.suites", "", PropertyType.STRING, "Comma separated list of cipher suites that can be used by accepted connections"),
| 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 |
return m_felix.getExportedPackages(name); | 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.http.client.impl; | 0 |
hdfsSite.put("fs.default.name", "hdfs://localhost:50070"); | 0 |
*
retval += String.format(",%s/%s.jar", libdir.getAbsolutePath(), jar);
| 0 |
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.mockito.Mockito;
MetricsContainer c1 = Mockito.mock(MetricsContainer.class);
MetricsContainer c2 = Mockito.mock(MetricsContainer.class);
Counter counter1 = Mockito.mock(Counter.class);
Counter counter2 = Mockito.mock(Counter.class);
when(c1.getCounter(MetricName.named("ns", "name"))).thenReturn(counter1);
when(c2.getCounter(MetricName.named("ns", "name"))).thenReturn(counter2);
verify(counter1).inc(1L);
verify(counter2).inc(-1L);
verifyNoMoreInteractions(counter1, counter2); | 0 |
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.parser.StringParser;
public String getMethodCallSyntax(String obj, String m, String... args) {
sb.append(obj);
sb.append(m);
public String getOutputStatement(String toDisplay) {
if (toDisplay == null) {
return "print(null)";
} else {
return "print("+StringParser.escapeString(toDisplay)+")";
}
public String getProgram(String... statements) {
for(String statement : statements){
sb.append(JexlEngine.cleanExpression(statement));
if (!statement.endsWith(";")){ | 0 |
/*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.hc.core5.util;
import java.io.Closeable;
import java.io.IOException;
/**
* Closes resources.
*/
public class Closer {
/**
* Closes the given closeable quietly even in the event of an exception.
*
* @param closeable
* what to close.
*/
public static void closeQuietly(final Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (final IOException e) {
// Quietly ignore
}
}
}
} | 0 |
public class TestTreeList<E> extends AbstractTestList<E> {
public static void benchmark(List<? super Integer> l) {
java.util.Iterator<? super Integer> it = l.iterator();
public TreeList<E> makeObject() {
return new TreeList<E>();
@SuppressWarnings("unchecked")
List<E> l = makeObject();
l.add((E) "hugo");
l.add((E) "erna");
l.add((E) "daniel");
l.add((E) "andres");
l.add((E) "harald");
@SuppressWarnings("unchecked")
List<E> l = makeObject();
l.add((E) "hugo");
l.add((E) "erna");
l.add((E) "daniel");
l.add((E) "andres");
l.add((E) "harald");
@SuppressWarnings("unchecked")
List<E> l = makeObject();
l.add((E) "erna");
l.add(0, (E) "hugo");
@SuppressWarnings("unchecked")
List<E> l = makeObject();
l.add((E) "0");
l.add((E) "1");
l.add((E) "2");
l.add((E) "3");
l.add((E) "4");
l.add((E) "5");
l.add((E) "6");
l.set(1, (E) "0");
l.set(3, (E) "3");
l.set(2, (E) "3");
l.set(1, (E) "3");
l.set(0, (E) "3");
List<Integer> treelist = new TreeList<Integer>();
ListIterator<Integer> li = treelist.listIterator(); | 0 |
/**
* the default default date format.
*/
public static final String DEFAULT_SDF = UnixFTPEntryParser.DEFAULT_DATE_FORMAT;
/**
* the default recent date format.
*/
public static final String DEFAULT_RECENT_SDF = UnixFTPEntryParser.DEFAULT_RECENT_DATE_FORMAT;
/**
* Parses the supplied datestamp parameter. This parameter typically would
* have been pulled from a longer FTP listing via the regular expression
* mechanism
* @param timestampStr - the timestamp portion of the FTP directory listing
* to be parsed
* @return a <code>java.util.Calendar</code> object initialized to the date
* parsed by the parser
* @throws ParseException if none of the parser mechanisms belonging to
* the implementor can parse the input.
*/
public Calendar parseTimestamp(String timestampStr) throws ParseException;
| 0 |
import org.apache.beam.model.pipeline.v1.RunnerApi; | 0 |
package examples.ftp; | 0 |
* $Id: RepositoryImpl.java 44 2007-07-13 20:49:41Z [email protected] $
* Copyright (c) OSGi Alliance (2002, 2006, 2007). 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.
import org.osgi.service.obr.*;
* @version $Revision: 44 $
VersionRange v = new VersionRange("0");
sb.append(v= new VersionRange(version));
capability.addProperty("version", new VersionRange(
resource.setVersion(new VersionRange(value)); | 0 |
@Override
@Override | 0 |
import org.apache.sshd.server.command.CommandLifecycle; | 0 |
import org.slf4j.LoggerFactory;
audit.warn("operation: failed; user: {}; {}; exception: {}", credentials.getPrincipal(), String.format(template, args), ex.toString());
audit
.info("operation: {}; user: {}; client: {}; {}", prefix, credentials.getPrincipal(), TServerUtils.clientAddress.get(), String.format(template, args)); | 0 |
import com.google.common.collect.Lists;
List<BigtableWriteException> suppressed = Lists.newArrayList();
suppressed.add(exc);
IOException exception = new IOException(message);
for (BigtableWriteException e : suppressed) {
exception.addSuppressed(e);
}
throw exception; | 0 |
public Command(String user, String[] cmd) {
| 0 |
package aQute.lib.properties;
public interface IDocument {
int getNumberOfLines();
IRegion getLineInformation(int lineNum) throws BadLocationException;
String get();
String get(int offset, int length) throws BadLocationException;
String getLineDelimiter(int line) throws BadLocationException;
int getLength();
void replace(int offset, int length, String data) throws BadLocationException;
char getChar(int offset) throws BadLocationException;
} | 0 |
* Copyright 2016-2017 Seznam.cz, a.s. | 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.topology.addservice;
import java.util.Map;
import java.util.Set;
/**
* A strategy that chooses another strategy based on cluster size.
*/
public class AutoHostgroupStrategy implements HostGroupStrategy {
private final int largeClusterThreshold;
public AutoHostgroupStrategy() {
this(10);
}
public AutoHostgroupStrategy(int largeClusterThreshold) {
this.largeClusterThreshold = largeClusterThreshold;
}
@Override
public Map<String, Set<String>> calculateHostGroups(Map<String, Set<String>> hostComponentMap) {
HostGroupStrategy strategy =
hostComponentMap.size() <= largeClusterThreshold ? new HostGroupForEachHostStrategy() : new GroupByComponentsStrategy();
return strategy.calculateHostGroups(hostComponentMap);
}
public int getLargeClusterThreshold() {
return largeClusterThreshold;
}
} | 0 |
* Copyright 2016-2017 Seznam.cz, a.s. | 0 |
* @param <I> the input type
* @param <O> the output type | 0 |
switch (type) {
case NON_ROLLING:
list = getDowngradeGroupsForNonrolling();
break;
case HOST_ORDERED:
case ROLLING:
default:
list = getDowngradeGroupsForRolling();
break;
// !!! Testing exposed groups.size() == 1 issue. Normally there's no precedent for
// a one-group upgrade pack, so take it into account anyway.
if (groups.size() == 1) {
return groups;
}
| 0 |
provides, | 0 |
import org.apache.batik.ext.awt.image.codec.ImageDecodeParam;
import org.apache.batik.ext.awt.image.codec.ImageDecoderImpl;
import org.apache.batik.ext.awt.image.codec.SeekableStream;
| 0 |
@Test(timeout = 2L * 60L * 1000L) | 0 |
if (hDependencies == null) {
}
if (depend != null && depend.length() > 0) {
}
if (lMethodParams == null) {
}
if (value != null && value.length() > 0) {
}
if (hDependencies != null) {
} else {
} | 0 |
public class KnownHostsServerKeyVerifier
extends ModifiableFileWatcher
implements ServerKeyVerifier, ModifiedServerKeyAcceptor {
/**
* Standard option used to indicate whether to use strict host key checking or not.
* Values may be "yes/no", "true/false" or "on/off"
*/
public static final String STRICT_CHECKING_OPTION = "StrictHostKeyChecking";
/**
* Standard option used to indicate alternative known hosts file location
*/
public static final String KNOWN_HOSTS_FILE_OPTION = "UserKnownHostsFile";
try {
if (!acceptModifiedServerKey(clientSession, remoteAddress, entry, expected, serverKey)) {
return false;
}
} catch (Throwable t) {
log.warn("acceptKnownHostEntries({})[{}] failed ({}) to accept modified server key: {}",
clientSession, remoteAddress, t.getClass().getSimpleName(), t.getMessage());
if (log.isDebugEnabled()) {
log.debug("acceptKnownHostEntries(" + clientSession + ")[" + remoteAddress + "]"
+ " modified server key acceptance failure details", t);
}
* {@link #acceptModifiedServerKey(ClientSession, SocketAddress, KnownHostEntry, PublicKey, PublicKey)}
@Override
public boolean acceptModifiedServerKey(ClientSession clientSession, SocketAddress remoteAddress,
KnownHostEntry entry, PublicKey expected, PublicKey actual)
throws Exception {
clientSession, remoteAddress, entry,
KeyUtils.getKeyType(expected), KeyUtils.getFingerPrint(expected),
KeyUtils.getKeyType(actual), KeyUtils.getFingerPrint(actual)); | 0 |
implements Serviceable, Disposable, ThreadSafe, Initializable { | 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 $Id: AbstractContainerWidget.java,v 1.6 2004/03/05 13:02:31 bdelacretaz Exp $ | 1 |
Map<String, String> blocks = DeploymentUtil.deployBlockArtifacts(this.getWorkdir(servletContext)
.getAbsolutePath()); | 0 |
public ModuleEvent(IModule module)
super(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 |
return new ByteArrayInputStream(buf.toByteArray()); | 0 |
import org.apache.commons.configuration.convert.DefaultListDelimiterHandler; | 0 |
BigQueryHelpers.parseTableSpec("project:dataset.table"), mockClient)) {
BigQueryHelpers.parseTableSpec("project:dataset.table"),
BigQueryHelpers.parseTableSpec("project:dataset.table"),
BigQueryHelpers.parseTableSpec("project:dataset.table"),
BigQueryHelpers.parseTableSpec("project:dataset.table"),
TableReference ref = BigQueryHelpers | 0 |
* @since 3.0 | 0 |
return new LessEqualsPredicate<>(propertyId, getValue()); | 1 |
public class HttpFileNameParser extends URLFileNameParser {
public HttpFileNameParser() {
public static FileNameParser getInstance() { | 1 |
* 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.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:44:27 $ | 0 |
if (this.domain != null && !this.domain.isEmpty()) { | 0 |
/* $Id$
* | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.