Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
import org.apache.commons.dbcp.SQLNestedException;
throw new SQLNestedException("RegisterPool failed", e);
throw new SQLNestedException(
"Could not retrieve connection info from pool", e); | 0 |
private final boolean exactMatchOverride;
this(true);
}
public UriPatternMatcher(final boolean exactMatchOverride) {
this.exactMatchOverride = exactMatchOverride;
T obj = exactMatchOverride ? this.map.get(path) : null; | 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.funtest.server.api.user;
import org.apache.ambari.funtest.server.AmbariHttpWebRequest;
import org.apache.ambari.funtest.server.ConnectionParams;
/**
* Deletes the specified user.
*/
public class DeleteUserWebRequest extends AmbariHttpWebRequest {
private final String userName;
private static String pathFormat = "/api/v1/users/%s";
/**
* Deletes a user
*
* @param params - Ambari server connection information
* @param userName - User to be deleted.
*/
public DeleteUserWebRequest(ConnectionParams params, String userName) {
super(params);
this.userName = userName;
}
@Override
public String getHttpMethod() {
return "DELETE";
}
/**
* Get REST API path fragment for construction full URI.
*
* @return - REST API path
*/
@Override
protected String getApiPath() {
return String.format(pathFormat, userName);
}
} | 0 |
@Override
public void open(Configuration parameters) throws Exception {
this.doFn.startBundle(context);
}
@Override
public void close() throws Exception {
this.doFn.finishBundle(context);
if (this.context == null) {
this.context = new DoFnProcessContext(doFn, out);
} | 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 |
LOG.info("Consumer property: auto.commit.enable: {}", consumerProperties.getProperty("auto.commit.enable")); | 0 |
/** Classes providing graph representation. */ | 0 |
hostAttributes.put("os_release_version", "6.4");
hostAttributes.put("os_release_version", "6.4"); | 0 |
final HttpResponse response = new BasicHttpResponse(200, "OK"); | 0 |
import java.util.List;
import org.apache.commons.jelly.Script;
/**
* Create an instance.
*/
/**
* Trim the body of the script.
* In this case, trim the whitespace from the start of the first element
* and from the end of the last element.
*/
public void trimWhitespace() {
List list = getScriptList();
int size = list.size();
if ( size > 0 ) {
Script script = (Script) list.get(0);
if ( script instanceof TextScript ) {
TextScript textScript = (TextScript) script;
textScript.trimStartWhitespace();
}
if ( size > 1 ) {
script = (Script) list.get(size - 1);
if ( script instanceof TextScript ) {
TextScript textScript = (TextScript) script;
textScript.trimEndWhitespace();
}
}
}
}
| 0 |
import org.apache.accumulo.core.client.Accumulo;
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) { | 0 |
List<ServiceTestInvocation> listInvocations = new ArrayList<>(); | 0 |
@Nullable Lock lock,
@AuthorizingParam @Nullable JobKey job,
@Nullable Set<Integer> instances) throws TException; | 0 |
* The base bridge class for SVG graphics node. By default, the namespace URI is
* the SVG namespace. Override the <tt>getNamespaceURI</tt> if you want to add
* custom <tt>GraphicsNode</tt> with a custom namespace.
public abstract class AbstractGraphicsNodeBridge extends AbstractSVGBridge
implements GraphicsNodeBridge, ErrorConstants { | 0 |
@Override
public FTPClientConfig getDefaultConfiguration() { | 0 |
}
if (i != -1) {
mi.setToolTipText(uri); | 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 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestUnsignedIntArrayList.java,v 1.5 2002/10/12 22:36:21 scolebourne Exp $
* $Revision: 1.5 $
* $Date: 2002/10/12 22:36:21 $
* @version $Revision: 1.5 $ $Date: 2002/10/12 22:36:21 $ | 0 |
import org.apache.batik.dom.events.NodeEventTarget;
* Implements {@link
* org.apache.batik.dom.events.NodeEventTarget#getParentNodeEventTarget()}.
*/
public NodeEventTarget getParentNodeEventTarget() {
return (NodeEventTarget)
HiddenChildElementSupport.getParentElement(this);
}
/** | 0 |
private final ReaderRegistry registry;
private ConcatReaderFactory(ReaderRegistry registry) {
* {@link ReaderRegistry} to create sub-{@link NativeReader} instances.
return withRegistry(ReaderRegistry.defaultRegistry());
* {@link ReaderRegistry} to create sub-{@link NativeReader} instances.
public static ConcatReaderFactory withRegistry(ReaderRegistry registry) { | 0 |
import java.util.concurrent.TimeUnit;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
sleepUninterruptibly(5, TimeUnit.MILLISECONDS); | 1 |
//
// A service can be deleted if all it's components
// can be removed, irrespective of the state of
// the service itself.
// | 0 |
import com.google.common.collect.ImmutableMap;
import java.util.Map;
private final Map<TupleTag<?>, BroadcastHelper<?>> sideInputs;
this(fn, ImmutableMap.<TupleTag<?>, BroadcastHelper<?>>of());
}
public DoFnFunction(DoFn<I, O> fn, Map<TupleTag<?>, BroadcastHelper<?>> sideInputs) {
this.sideInputs = sideInputs;
// A no-op if we don't know about it ahead of time
public <T> T sideInput(TupleTag<T> tag) {
BroadcastHelper<T> bh = (BroadcastHelper<T>) sideInputs.get(tag);
return bh == null ? null : bh.getValue();
throw new UnsupportedOperationException(); | 0 |
import org.apache.cocoon.ProcessingException;
//not yet implemented
public boolean setVersioned(final String uri, final boolean versioned) {
try {
if(!versioned) // FIXME: Implement this via delete and create
throw new UnsupportedOperationException();
else
return WebDAVUtil.getWebdavResource(this.repo.getAbsoluteURI(uri)).versionControlMethod(this.repo.getAbsoluteURI(uri));
} catch (HttpException he) {
this.getLogger().error("HTTP Error while versioncontrol " + uri, he);
} catch (IOException ioe) {
this.getLogger().error("IO Error while versioncontrol " + uri, ioe);
}
return false;
| 0 |
import org.w3c.dom.Element;
/**
* Notifies the UserAgent that the input element
* has been found in the document. This is sometimes
* called, for example, to handle <a> or
* <title> elements in a UserAgent-dependant
* way.
*/
public void handleElement(Element elt, Object data){
} | 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;
avail.add(new AES128CTR.Factory());
avail.add(new AES256CTR.Factory());
avail.add(new ARCFOUR128.Factory());
avail.add(new ARCFOUR256.Factory()); | 0 |
/*
* Copyright 2000-2004 The Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.bcel.util;
| 0 |
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableList; | 0 |
import org.apache.http.client.protocol.HttpClientContext;
final HttpRoute route = (HttpRoute) context.getAttribute(HttpClientContext.HTTP_ROUTE); | 0 |
* @return The results of a query | 0 |
int index = bitIndex / LENGTH;
int bit = bitIndex % LENGTH; | 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 $Revision: 1.16 $ $Date: 2004/02/29 14:17:38 $ | 0 |
this.iterator = new ListIteratorWrapper<>(iterator); | 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 |
* {@link org.apache.commons.net.tftp.TFTPClient} class
* {@link org.apache.commons.net.tftp.TFTPClient#receiveFile receiveFile()}
* {@link org.apache.commons.net.tftp.TFTPClient#sendFile sendFile()}
* the {@link org.apache.commons.net.tftp.TFTPClient} | 0 |
import org.apache.accumulo.test.randomwalk.Environment;
public void visit(State state, Environment env, Properties props) throws Exception {} | 0 |
private boolean calledFinish = false;
this.outputIterator = getOutputIterator();
if (outputIterator.hasNext()) {
} else if (inputIterator.hasNext()) {
// no more input to consume, but finishBundle can produce more output
if (!calledFinish) {
clearOutput();
try {
calledFinish = true;
doFn.finishBundle(SparkProcessContext.this);
} catch (Exception e) {
throw new IllegalStateException(e);
}
outputIterator = getOutputIterator();
continue; // try to consume outputIterator from start of loop | 0 |
new ThreadLocal<Supplier<Boolean>>() {
@Override
@Override
@VisibleForTesting ByteString encodeKey(StateNamespace namespace, StateTag<?> address) {
try {
// Use a StringBuilder rather than concatenation and String.format. We build these keys
// a lot, and this leads to better performance results. See associated benchmarks.
StringBuilder output = new StringBuilder();
// We only need the prefix if we aren't using state families
if (!useStateFamilies) {
output.append(prefix);
}
namespace.appendTo(output);
output.append('+');
address.appendTo(output);
return ByteString.copyFromUtf8(output.toString());
} catch (IOException e) {
throw new RuntimeException(
"Unable to encode state key for " + namespace + ", " + address, e); | 0 |
@JsonProperty("componentStatus")
public List<ComponentStatus> getComponentStatus() {
return componentStatus;
}
@JsonProperty("componentStatus")
public void setComponentStatus(List<ComponentStatus> componentStatus) {
this.componentStatus = componentStatus;
}
@Override
public String toString() {
return "HeartBeat{" +
"responseId=" + responseId +
", timestamp=" + timestamp +
", hostname='" + hostname + '\'' +
", reports=" + reports +
", componentStatus=" + componentStatus +
", nodeStatus=" + nodeStatus +
'}';
} | 1 |
/* ====================================================================
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights
* @version $Revision: 1.5 $ $Date: 2004/01/14 21:34:25 $ | 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.
*/ | 0 |
* @version $Id$ | 0 |
* @version $Revision: 1.10 $ $Date: 2003/11/03 17:58:57 $
this.getRandom().nextBytes(data);
byte[] data = new byte[this.getRandom().nextInt(10000)+1];
this.getRandom().nextBytes(data);
/**
* @return Returns the _random.
*/
public Random getRandom() {
return this._random;
}
| 0 |
*
* <p>More precisely, suppose:
* <p><b>This class is NOT thread safe.</b>
* <p><b> For better performance, it uses the input array provided (not a copy).
* <p>It works with the input array,
*
* <p>Note that the specified long is treated like a uint64, e.g.
*
* <p>Note that the specified long is treated like an int64, i.e.
*
* <p>It stores the input array in the store,
*
* <p><b> NOTE: This method returns OrederedCode's internal array (not a | 0 |
/** A {@link OldDoFn} that publishes non-empty lines to Google Cloud PubSub. */ | 0 |
port = Utils.getFreePort(); | 0 |
throw new StreamClosedException();
throw new StreamClosedException(); | 0 |
rest = (rest == null ? null : rest.next)) | 0 |
import java.io.Serializable;
public interface ResourceId extends Serializable { | 0 |
package com.twitter.mesos.scheduler.app;
import com.twitter.mesos.scheduler.DriverFactory;
import com.twitter.mesos.scheduler.MesosTaskFactory.ExecutorConfig; | 0 |
* <p>
synchronized (initializationStateLock) {
if (isFinished()) {
LOG.warn("Iterator is in the Finished state, returning null stop position.");
synchronized (sourceIteratorLock) {
if (readerIterator == null) {
LOG.warn("Iterator has not been initialized, returning null stop position.");
return null;
}
return readerIterator.updateStopPosition(proposedStopPosition);
} | 0 |
/** Minimum number of characters around exception location. */
private static final int MIN_EXCHARLOC = 5;
/** Maximum number of characters around exception location. */
private static final int MAX_EXCHARLOC = 10;
int end = begin + MIN_EXCHARLOC;
begin -= MIN_EXCHARLOC;
end += MIN_EXCHARLOC;
if (length < MAX_EXCHARLOC) {
int end = begin + MIN_EXCHARLOC;
begin -= MIN_EXCHARLOC;
end += MIN_EXCHARLOC;
if (length < MAX_EXCHARLOC) { | 0 |
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.ByteBufferUtil;
Connector conn = new MockConnector(user, acu);
conn.securityOperations().createUser(user, pass, new Authorizations());
return conn;
return getConnector(user, ByteBufferUtil.toBytes(pass)); | 0 |
Collection<Text> actualSplits = getConnector().tableOperations().listSplits("foo");
actualSplits = getConnector().tableOperations().listSplits("foo"); | 0 |
Pipeline pipeline = pipelineRule.createPipeline();
PCollection<String> pCollection = pipeline.apply(Create.of("foo"));
pipeline.run(); | 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.
*/
assertTrue(ByteArraySet.fromStrings("a", "b", "c").contains("a".getBytes()));
| 0 |
import org.apache.hc.core5.http2.HttpVersionPolicy;
.setVersionPolicy(HttpVersionPolicy.FORCE_HTTP_2)
HttpHost target = new HttpHost("nghttp2.org");
String[] requestUris = new String[] {"/httpbin/ip", "/httpbin/user-agent", "/httpbin/headers"}; | 0 |
import org.apache.felix.upnp.basedriver.controller.DevicesInfo;
import org.apache.felix.upnp.basedriver.controller.DriverController; | 0 |
import static java.util.Map.Entry;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty; | 0 |
manager.add(createComponent() | 0 |
/*
* Copyright 1999-2005 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.cocoon.forms.binding.JXPathBindingManager.Assistant;
import org.apache.cocoon.forms.binding.library.Library;
import org.apache.cocoon.forms.binding.library.LibraryException;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
/**
* Handles binding library imports
*
* @version $Id$
*/
public class ImportJXPathBindingBuilder extends JXPathBindingBuilderBase {
/* (non-Javadoc)
* @see org.apache.cocoon.forms.binding.JXPathBindingBuilderBase#buildBinding(org.w3c.dom.Element, org.apache.cocoon.forms.binding.JXPathBindingManager.Assistant)
*/
public JXPathBindingBase buildBinding(Element bindingElm,
Assistant assistant) throws BindingException {
Library lib = assistant.getContext().getLocalLibrary();
String prefix = DomHelper.getAttribute(bindingElm, "prefix", null);
String uri = DomHelper.getAttribute(bindingElm, "uri", null);
if(prefix==null || uri==null)
throw new BindingException("Import needs to specify both @uri and @prefix! (at "+DomHelper.getLocation(bindingElm)+")");
try {
lib.includeAs(prefix,uri);
} catch(LibraryException e) {
throw new BindingException("Could not import library !(at "+DomHelper.getLocation(bindingElm)+")",e);
}
return new ImportJXPathBinding();
}
} | 0 |
* Demonstration of the use of protocol interceptors to transparently
* In this particular case HTTP client is made capable of transparent content
* protocol interceptors makes content compression completely transparent to
final HttpRequest request,
final HttpResponse response,
new GzipDecompressingEntity(response.getEntity()));
HttpGet httpget = new HttpGet("http://www.apache.org/");
// When HttpClient instance is no longer needed,
httpclient.getConnectionManager().shutdown();
}
| 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 |
Optional.absent())) | 0 |
config.setSocketTimeoutMillis(Integer.parseInt(t)); | 0 |
implements Serviceable, Contextualizable, ConfigurableInterpreter, | 0 |
import org.apache.accumulo.core.client.AccumuloClient;
InstanceOperations iops = getAccumuloClient().instanceOperations();
InstanceOperations iops = getAccumuloClient().instanceOperations();
final AccumuloClient c = getAccumuloClient();
private int countFiles(AccumuloClient c) throws Exception { | 0 |
import org.apache.beam.runners.dataflow.DataflowRunner.GroupByKeyAndSortValuesOnly;
DataflowRunner runner,
* with the {@link DataflowRunner}, including reading and writing the
private final DataflowRunner runner;
public Translator(Pipeline pipeline, DataflowRunner runner) { | 0 |
@Override
public Command create() {
return new SftpSubsystem(getExecutorService(), isShutdownOnExit(), getUnsupportedAttributePolicy()) {
@Override
protected SpaceAvailableExtensionInfo doSpaceAvailable(int id, String path) throws IOException {
if (!queryPath.equals(path)) {
throw new StreamCorruptedException("Mismatched query paths: expected=" + queryPath + ", actual=" + path);
return expected;
}
};
}
}));
try (SshClient client = SshClient.setUpDefaultClient()) {
try (SftpClient sftp = session.createSftpClient()) { | 1 |
* @see org.apache.commons.vfs2.provider.AbstractFileSystem#createFile(org.apache.commons.vfs2.provider.AbstractFileName) | 0 |
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.WritableRaster;
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.ext.awt.image.rendered.FormatRed;
dr.setBounds(new Rectangle2D.Double
(0, 0, cr.getWidth(), cr.getHeight()));
cr = new FormatRed(cr, GraphicsUtil.sRGB_Unpre);
WritableRaster wr = (WritableRaster)cr.getData();
ColorModel cm = cr.getColorModel();
BufferedImage image;
image = new BufferedImage
(cm, wr, cm.isAlphaPremultiplied(), null);
cr = GraphicsUtil.wrap(image); | 0 |
* takes any custom properties that a view wants to be included into the config
* @param context
* @param customViewProperties
* @return
* @throws HdfsApiException
*/
public static synchronized HdfsApi connectToHDFSApi(ViewContext context, Map<String, String> customViewProperties)
throws HdfsApiException {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(HdfsUtil.class.getClassLoader());
try {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(context, customViewProperties);
return getHdfsApi(context, configurationBuilder);
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
}
}
/**
Thread.currentThread().setContextClassLoader(HdfsUtil.class.getClassLoader());
return getHdfsApi(context, configurationBuilder);
} finally {
private static HdfsApi getHdfsApi(ViewContext context, ConfigurationBuilder configurationBuilder) throws HdfsApiException {
HdfsApi api = null;
AuthConfigurationBuilder authConfigurationBuilder = new AuthConfigurationBuilder(context);
Map<String, String> authParams = authConfigurationBuilder.build();
configurationBuilder.setAuthParams(authParams);
try {
api = new HdfsApi(configurationBuilder, getHdfsUsername(context));
LOG.info("HdfsApi connected OK");
} catch (IOException e) {
LOG.error("exception occurred while creating hdfsApi objcet : {}", e.getMessage(), e);
String message = "HDFS040 Couldn't open connection to HDFS";
LOG.error(message);
throw new HdfsApiException(message, e);
} catch (InterruptedException e) {
LOG.error("exception occurred while creating hdfsApi objcet : {}", e.getMessage(), e);
String message = "HDFS041 Couldn't open connection to HDFS";
LOG.error(message);
throw new HdfsApiException(message, e);
}
return api;
}
| 0 |
return new IfTransformer<>(predicate, trueTransformer, falseTransformer);
return new IfTransformer<>(predicate, trueTransformer, NOPTransformer.<T>nopTransformer()); | 1 |
import java.util.HashMap;
import org.apache.http.util.Args;
Args.check(status >= 100 && status < 700, "Unknown category for status code " + status); | 0 |
spds.setDefaultMaxWaitMillis(-1);
spds.setDefaultMaxIdle(10);
spds.setDefaultTimeBetweenEvictionRunsMillis(10000);
spds.setDefaultNumTestsPerEvictionRun(-1);
spds.setDefaultTestWhileIdle(true);
spds.setDefaultTestOnBorrow(true);
spds.setDefaultTestOnReturn(false); | 0 |
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.ext.awt.image.spi;
import java.io.InputStream;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
import java.awt.Color;
import org.apache.batik.ext.awt.image.renderable.Filter;
import org.apache.batik.ext.awt.image.renderable.RedRable;
import org.apache.batik.ext.awt.image.renderable.DeferRable;
import org.apache.batik.ext.awt.image.codec.PNGRed;
import org.apache.batik.ext.awt.image.GraphicsUtil;
public class PNGRegistryEntry
extends MagicNumberRegistryEntry {
static final byte [] signature = {(byte)0x89, 80, 78, 71, 13, 10, 26, 10};
public PNGRegistryEntry() {
super("PNG", "png", 0, signature);
}
public Filter handleStream(InputStream inIS) {
final DeferRable dr = new DeferRable();
final InputStream is = inIS;
Thread t = new Thread() {
public void run() {
Filter filt;
try {
filt = new RedRable(new PNGRed(is));
} catch (IOException ioe) {
filt = getBrokenLinkImage();
}
dr.setSource(filt);
}
};
t.start();
return dr;
}
} | 0 |
CombiningValueState<Instant, Instant> delayUntilState = c.state().access(DELAYED_UNTIL_TAG);
c.timers().setTimer(delayUntil, TimeDomain.EVENT_TIME);
if (c.trigger().finishedInAnyMergingWindow()) {
c.state().accessAcrossMergingWindows(DELAYED_UNTIL_TAG);
c.timers().setTimer(earliestTimer, TimeDomain.EVENT_TIME);
c.state().access(DELAYED_UNTIL_TAG).clear();
c.timers().deleteTimer(TimeDomain.EVENT_TIME);
c.timers().setTimer(computeTargetTimestamp(c.window().maxTimestamp()), TimeDomain.EVENT_TIME);
for (W finishedWindow : c.trigger().getFinishedMergingWindows()) {
c.timers().setTimer(computeTargetTimestamp(c.window().maxTimestamp()), TimeDomain.EVENT_TIME);
c.timers().deleteTimer(TimeDomain.EVENT_TIME); | 0 |
import java.net.URISyntaxException;
Assert.fail("URISyntaxException expected");
} catch (final URISyntaxException expected) {
Assert.fail("URISyntaxException expected");
} catch (final URISyntaxException expected) { | 0 |
import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
import org.apache.commons.configuration.builder.combined.CombinedConfigurationBuilder;
CombinedConfigurationBuilder builder =
new CombinedConfigurationBuilder();
builder.configure(new FileBasedBuilderParametersImpl()
.setFile(ConfigurationAssert.getTestFile(TEST_FILE)));
Configuration config = builder.getConfiguration(); | 0 |
} else if ("init".equals(invocation.getMethod().getName())) {
// The embedded servlet is initialized by this factory bean, ignore other containers
return null;
} else if ("destroy".equals(invocation.getMethod().getName())) {
// The embedded servlet is destroyed up by this factory bean, ignore other containers
return null; | 0 |
* Copyright (C) 2015 Google Inc. | 0 |
public abstract static class Write<T> extends PTransform<PCollection<T>, WriteResult> {
public WriteResult expand(PCollection<T> input) { | 0 |
* http://www.apache.org/licenses/LICENSE-2.0 | 0 |
if (clazzName == null)
clazzName = DefaultLoadBalancer.class.getName();
if (tops == null)
try {
tops = HdfsZooInstance.getInstance().getConnector(SecurityConstants.getSystemCredentials()).tableOperations();
} catch (AccumuloException e) {
log.error("Unable to access table operations from within table balancer", e);
} catch (AccumuloSecurityException e) {
log.error("Unable to access table operations from within table balancer", e);
}
if (t == null)
return minBalanceTime;
if (tableBalanceTime < minBalanceTime)
minBalanceTime = tableBalanceTime; | 1 |
import org.apache.ambari.server.state.Cluster;
| 0 |
* Copyright (c) 2002 The Apache Software Foundation. All rights | 0 |
import org.apache.beam.sdk.values.TypeDescriptor;
class UnionTranslator<InputT> implements OperatorTranslator<InputT, InputT, Union<InputT>> {
public PCollection<InputT> translate(Union<InputT> operator, PCollectionList<InputT> inputs) {
final TypeDescriptor<InputT> outputType = operator.getOutputType().orElse(null);
return operator
.getName()
.map(name -> inputs.apply(name, Flatten.pCollections()).setTypeDescriptor(outputType))
.orElseGet(() -> inputs.apply(Flatten.pCollections()).setTypeDescriptor(outputType)); | 0 |
*
public class FileNotFolderException extends FileSystemException {
public FileNotFolderException(final Object info0) {
public FileNotFolderException(final Object info0, final Throwable throwable) { | 1 |
supportedSchemes.register(new Scheme("http",
supportedSchemes.register(new Scheme("https",
HttpRequest connect = new BasicHttpRequest("CONNECT", authority, | 0 |
if (key.getColumnFamily()
.equals(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME)) {
} else if (MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN
.hasColumns(key)) {
System.out.println(
"Average " + average + " count " + hostCount.getKey() + ": " + hostCount.getValue()); | 0 |
package org.apache.aurora.scheduler.config.validators;
import com.beust.jcommander.IValueValidator;
import com.beust.jcommander.ParameterException;
public class PositiveNumber implements IValueValidator<Number> {
public void validate(String name, Number value) throws ParameterException {
if (value.longValue() <= 0) {
throw new ParameterException(String.format("%s must be positive", 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
*
* 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 |
* A composite {@link Trigger} that fires once after at least one of its sub-triggers have fired. | 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger log = LoggerFactory.getLogger(AccumuloReloadingVFSClassLoader.class); | 0 |
import org.apache.felix.service.command.CommandSession; | 0 |
public int[] getPorts() {
public String getCommentURL() {
public boolean isPersistent() {
public boolean isExpired(final Date date) { | 0 |
List<Object> newContent = new ArrayList<Object>();
newContent.add(unmarshalX509Certificate(childElem));
newContent.add(new DOMX509IssuerSerial(childElem));
newContent.add(childElem.getFirstChild().getNodeValue());
newContent.add(Base64.decode(childElem));
newContent.add(unmarshalX509CRL(childElem));
newContent.add(new javax.xml.crypto.dom.DOMStructure(childElem));
this.content = Collections.unmodifiableList(newContent); | 0 |
Collections.unmodifiableList(
Arrays.<NamedFactory<Channel>>asList(
ChannelAgentForwardingFactory.OPENSSH,
ChannelAgentForwardingFactory.IETF)); | 0 |
* A data transmitter using a Java {@link Socket} and traditional IO.
* | 0 |
@Override
public String toString() {
return "PrivilegeEntity{" +
"id=" + id +
", permission=" + permission +
", resource=" + resource +
", principal=" + principal +
'}';
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.