Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
import java.util.Optional; | 0 |
try (Writer out = new OutputStreamWriter(new FileOutputStream(file), charsetUTF8);
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(origin), charsetUTF8))) {
} finally{
try (final BufferedOutputStream output =
new BufferedOutputStream(new FileOutputStream(file))) {
try (FileWriter writer = new FileWriter(file, true)) {
try (FileWriter writer = new FileWriter(file, true)) { | 0 |
public class EventAwareCacheImpl extends CacheImpl implements EventAware { | 0 |
public static final Integer WRITING_MODE_LTR = 0x1;
public static final Integer WRITING_MODE_RTL = 0x2;
public static final Integer WRITING_MODE_TTB = 0x3;
public static final Integer ORIENTATION_ANGLE = 0x1;
public static final Integer ORIENTATION_AUTO = 0x2;
public static final Integer SMALL_CAPS = 0x10;
0x0;
0x01;
public static final Integer ARABIC_NONE = 0x0;
public static final Integer ARABIC_ISOLATED = 0x1;
public static final Integer ARABIC_TERMINAL = 0x2;
public static final Integer ARABIC_INITIAL = 0x3;
public static final Integer ARABIC_MEDIAL = 0x4; | 0 |
Copyright 2000-2001,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 |
/**
* @see org.apache.accumulo.core.volume.VolumeConfiguration#getVolumeUris(AccumuloConfiguration)
*/
*
*
* @param fs
* A FileSystem to write to
* @return A Volume instance writing to the given FileSystem in the default path
| 0 |
final InterpolatorSpecification spec)
public void registerLookup(final String prefix, final Lookup lookup)
public void registerLookups(final Map<String, ? extends Lookup> lookups)
public boolean deregisterLookup(final String prefix)
public void addDefaultLookup(final Lookup defaultLookup)
public void addDefaultLookups(final Collection<? extends Lookup> lookups)
public boolean removeDefaultLookup(final Lookup lookup)
final ConfigurationInterpolator parentInterpolator)
public void setEnableSubstitutionInVariables(final boolean f)
public Object interpolate(final Object value)
final String strValue = (String) value;
final Object resolvedValue = resolveSingleVariable(strValue);
public Object resolve(final String var)
final int prefixPos = var.indexOf(PREFIX_SEPARATOR);
final String prefix = var.substring(0, prefixPos);
final String name = var.substring(prefixPos + 1);
final Object value = fetchLookupForPrefix(prefix).lookup(name);
for (final Lookup lookup : defaultLookups)
final Object value = lookup.lookup(var);
final ConfigurationInterpolator parent = getParentInterpolator();
protected Lookup fetchLookupForPrefix(final String prefix)
public String lookup(final String key)
final Object result = resolve(key);
private Object resolveSingleVariable(final String strValue)
private static boolean looksLikeSingleVariable(final String strValue)
private static String extractVariableName(final String strValue)
final InterpolatorSpecification spec)
final ConfigurationInterpolator ci = new ConfigurationInterpolator();
final Map<String, Lookup> lookups = new HashMap<>();
for (final DefaultLookups l : DefaultLookups.values()) | 0 |
final int maxHeaderCount,
final int maxLineLen,
final int maxHeaderCount,
final int maxLineLen, | 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.txt file.
*
* @author <a href="mailto:[email protected]">Adam Murdoch</a>
* @version $Revision: 1.6 $ $Date: 2002/07/05 04:08:17 $
*/
package org.apache.commons.vfs;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
/**
* An enumeration that represents a file's type.
*/
public final class FileType
{
private static final Resources REZ =
ResourceManager.getPackageResources( FileType.class );
/**
* A folder, which can contain other files, but does not have any data
* content.
*/
public static final FileType FOLDER = new FileType( REZ.getString( "folder.name" ) );
/**
* A regular file, which has data content, but cannot contain other files.
*/
public static final FileType FILE = new FileType( REZ.getString( "file.name" ) );
private final String m_name;
private FileType( final String name )
{
m_name = name;
}
/** Returns the name of the type. */
public String toString()
{
return m_name;
}
/** Returns the name of the type. */
public String getName()
{
return m_name;
}
} | 0 |
* http://www.apache.org/licenses/LICENSE-2.0 | 0 |
final Header[] headers = new Header[]{
final Header[] headers = new Header[]{
final Header[] headers = new Header[]{
} catch (final IllegalArgumentException iax) {
} catch (final NoSuchElementException nsx) {
final Header[] headers = new Header[]{
} catch (final UnsupportedOperationException uox) { | 0 |
@Category({ category.KerberosTest.class}) | 0 |
* An interface used with the Java {@link ServiceLoader} to auto-discover classes executable with a
* convenient keyword on the command-line.
* All implementing classes who have an entry in
* META-INF/services/{@link org.apache.accumulo.start.spi.KeywordExecutable} on the classpath will
* be constructed by the {@link ServiceLoader}, so they should be lightweight and quickly
* constructible with a mandatory no-argument constructor. Because of this, implementing classes
* could simply be factories which execute a different class, if that class is expensive to
* construct or cannot have a no-argument constructor.
* One way to easily create META-INF/services files is to use the
* <a href="https://github.com/google/auto/tree/master/service">AutoService</a> annotation.
* If the implementing class also wishes to have a redundant main method, it may be useful to simply
* implement main as:<br> | 0 |
in.apply("Values", MapElements.via(new SimpleFunction<KV<?, V>, V>() {
@Override
public V apply(KV<?, V> kv) {
return kv.getValue(); | 0 |
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.common.util.buffer.Buffer;
import org.apache.sshd.common.util.buffer.BufferUtils;
import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
@Override
sshd.getProperties().put(FactoryManager.WINDOW_SIZE, "1024");
client.getProperties().put(FactoryManager.WINDOW_SIZE, "1024");
channel.getAsyncIn().write(new ByteArrayBuffer(message))
@Override
channel.getAsyncIn().write(new ByteArrayBuffer(message)).addListener(this);
channel.getAsyncOut().read(new ByteArrayBuffer())
@Override
channel.getAsyncErr().read(new ByteArrayBuffer())
@Override
assertEquals(ClientChannel.CLOSED, channel.waitFor(ClientChannel.CLOSED, 0) & ClientChannel.CLOSED);
@Override
@Override
@Override
@Override
@Override
@Override
@Override
@Override | 0 |
import java.util.ArrayList;
List<String> fieldNames = new ArrayList<>();
List<Integer> fieldTypes = new ArrayList<>();
fieldNames.add(inputRecordType.getFieldsName().get(i));
fieldTypes.add(inputRecordType.getFieldsType().get(i));
return BeamSqlRecordType.create(fieldNames, fieldTypes);
List<String> fieldNames = new ArrayList<>();
List<Integer> fieldTypes = new ArrayList<>();
fieldNames.add(ac.name);
fieldTypes.add(CalciteUtils.toJavaType(ac.type.getSqlTypeName()));
return BeamSqlRecordType.create(fieldNames, fieldTypes); | 0 |
import java.util.stream.Collectors;
private Map<String, Operator> operators = new HashMap<>();
private Map<String, Function> functions = new HashMap<>();
private Map<String, Object> constants = new HashMap<>();
List<BigDecimal> numericParameters = parameters.stream()
.map(o -> toBigDecimal(variables, o))
.collect(Collectors.toList());
List<Token> outputQueue = new ArrayList<>();
Stack<Token> stack = new Stack<>();
return eval(new HashMap<>());
Stack<Object> stack = new Stack<>();
List<Object> p = new ArrayList<>(f.getNumParams()); | 0 |
for (String requiredScheme : requiredSchemes)
for (String requiredClass : requiredClasses) | 0 |
final UnaryFunction valueExtractor;
(Pair p) -> CompositeKey.of(
p.getFirst(),
reduceKeyExtractor.apply(p.getSecond()));
UnaryFunction vfn = reduceStateByKey.getValueExtractor();
valueExtractor = (UnaryFunction<Pair, Object>)
(Pair p) -> vfn.apply(p.getSecond());
valueExtractor = reduceStateByKey.getValueExtractor(); | 0 |
serviceName, null, null, null, null);
serviceName, null, null, null, null); | 0 |
// making sure setdata works on /
zk.setData("/", "some".getBytes(), -1); | 0 |
/*
* $Id$
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/ | 0 |
import java.io.FileInputStream;
Document doc = XMLUtils.read(new FileInputStream(new File(dir, file)), false, false); | 0 |
import org.apache.beam.sdk.values.BeamRecord;
@Override public BeamSqlPrimitive evaluate(BeamRecord inputRow) { | 0 |
import com.google.cloud.dataflow.sdk.transforms.windowing.PaneInfo;
import com.google.cloud.dataflow.sdk.util.TimerInternals;
import com.google.cloud.dataflow.sdk.util.state.StateInternals;
public PaneInfo pane() {
return PaneInfo.DEFAULT;
}
@Override
extends BoundedWindow> windows, PaneInfo paneInfo) {
public StateInternals stateInternals() {
"WindowingInternals#stateInternals() is not yet supported.");
public TimerInternals timerInternals() {
"WindowingInternals#timerInternals() is not yet supported.");
public PaneInfo pane() {
return PaneInfo.DEFAULT; | 0 |
throw new SQLNestedException("Cannot close connection pool", e); | 0 |
package org.apache.commons.ognl.test.objects; | 0 |
package org.apache.commons.ognl.test.objects; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/iterators/ArrayIterator.java,v 1.5 2003/08/31 17:25:49 scolebourne Exp $
* any, must include the following acknowledgement:
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
* @version $Revision: 1.5 $ $Date: 2003/08/31 17:25:49 $ | 0 |
* or more contributor license agreements. See the NOTICE file
* regarding copyright ownership. The ASF licenses this file
* with the License. You may obtain a copy of the License at
* KIND, either express or implied. See the License for the | 0 |
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
* Authorizations in column visibility expression are in escaped form. Column visibility parsing does not unescape. This class wraps an AuthorizationContainer
* and unescapes auths before checking the wrapped container.
*/
private static class UnescapingAuthorizationContainer implements AuthorizationContainer {
private AuthorizationContainer wrapped;
UnescapingAuthorizationContainer(AuthorizationContainer wrapee) {
this.wrapped = wrapee;
}
@Override
public boolean contains(ByteSequence auth) {
return wrapped.contains(unescape(auth));
}
}
static ByteSequence unescape(ByteSequence auth) {
int escapeCharCount = 0;
for (int i = 0; i < auth.length(); i++) {
byte b = auth.byteAt(i);
if (b == '"' || b == '\\') {
escapeCharCount++;
}
}
if (escapeCharCount > 0) {
if (escapeCharCount % 2 == 1) {
throw new IllegalArgumentException("Illegal escape sequence in auth : " + auth);
}
byte[] unescapedCopy = new byte[auth.length() - escapeCharCount / 2];
int pos = 0;
for (int i = 0; i < auth.length(); i++) {
byte b = auth.byteAt(i);
if (b == '\\') {
i++;
b = auth.byteAt(i);
if (b != '"' && b != '\\') {
throw new IllegalArgumentException("Illegal escape sequence in auth : " + auth);
}
} else if (b == '"') {
// should only see quote after a slash
throw new IllegalArgumentException("Illegal escape sequence in auth : " + auth);
}
unescapedCopy[pos++] = b;
}
return new ArrayByteSequence(unescapedCopy);
} else {
return auth;
}
}
/**
this.auths = new UnescapingAuthorizationContainer(env.getAuthorizationsContainer());
this.auths = escape(authorizations); | 0 |
* limitations under the License. | 0 |
package org.apache.beam.runners.core.triggers;
* <p>The time at which to fire the timer can be adjusted via the methods in {@link
* AfterDelayFromFirstElementStateMachine}, such as {@link
* AfterDelayFromFirstElementStateMachine#plusDelayOf} or {@link
* AfterDelayFromFirstElementStateMachine#alignedTo}.
public class AfterProcessingTimeStateMachine extends AfterDelayFromFirstElementStateMachine {
public Instant getCurrentTime(TriggerStateMachine.TriggerContext context) {
private AfterProcessingTimeStateMachine(List<SerializableFunction<Instant, Instant>> transforms) {
public static AfterProcessingTimeStateMachine pastFirstElementInPane() {
return new AfterProcessingTimeStateMachine(IDENTITY);
protected AfterProcessingTimeStateMachine newWith(
return new AfterProcessingTimeStateMachine(transforms);
if (!(obj instanceof AfterProcessingTimeStateMachine)) {
AfterProcessingTimeStateMachine that = (AfterProcessingTimeStateMachine) obj; | 0 |
import org.apache.sshd.server.SshServer; | 0 |
.setExtendedErrorInfo(false)
abstract boolean getExtendedErrorInfo();
abstract Builder<T> setExtendedErrorInfo(boolean extendedErrorInfo);
/**
* Enables extended error information by enabling {@link WriteResult#getFailedInsertsWithErr()}
*
* <p>ATM this only works if using {@link Method#STREAMING_INSERTS}.
* See {@link Write#withMethod(Method)}.
*
* <p>Disclaimer: Enabling this may cause your job not to be able to update
* (you may need to drain it before)
*/
public Write<T> withExtendedErrorInfo() {
return toBuilder().setExtendedErrorInfo(true).build();
}
.withTestServices((getBigQueryServices()))
.withExtendedErrorInfo(getExtendedErrorInfo()); | 0 |
if ("team".equals(keyname)) { | 0 |
} else { | 0 |
import org.apache.ambari.view.commons.hdfs.UserService;
/**
* Checks connection to User HomeDirectory
* @param context View Context
*/
public static void userhomeSmokeTest(ViewContext context) {
try {
UserService userservice = new UserService(context);
userservice.homeDir();
} catch (WebApplicationException ex) {
throw ex;
} catch (Exception ex) {
throw new ServiceFormattedException(ex.getMessage(), ex);
}
}
| 0 |
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
private int statusCode;
private Map headers;
/**
* format definied by RFC 822, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
*/
final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US);
headers = new HashMap();
//this class does not support multivalue headers
setDateHeader(name, date);
//this class does not support multivalue headers
setHeader(name, value);
//this class does not support multivalue headers
setIntHeader(name, value);
return headers.containsKey(name);
setHeader(name, dateFormat.format(new Date(date)));
}
/* (non-Javadoc)
* @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String)
*/
public long getDateHeader(String name) {
String header = getHeader(name);
if (header == null) return -1;
try {
return dateFormat.parse(header).getTime();
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
headers.put(name, value);
}
public String getHeader(String name) {
return (String)headers.get(name);
setHeader(name, String.valueOf(value));
}
/* (non-Javadoc)
* @see javax.servlet.http.HttpServletRequest#getIntHeader(java.lang.String)
*/
public int getIntHeader(String name) {
String header = getHeader(name);
if (header == null) return -1;
return Integer.parseInt(header);
this.statusCode = sc;
}
public int getStatus() {
return this.statusCode;
throw new UnsupportedOperationException("This method has been deprecated"); | 0 |
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
static DateTime str2DateTime(String dateStr) {
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC();
return format.parseDateTime(dateStr); | 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.
*/
/**
* Internal implementation of the Beam runner for Apache Flink.
*/
package org.apache.beam.runners.flink.translation.utils; | 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 |
import org.apache.accumulo.core.clientImpl.BaseIteratorEnvironment; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//digester/src/java/org/apache/commons/digester/ExtendedBaseRules.java,v 1.3 2002/07/10 18:12:33 rdonkin Exp $
* $Revision: 1.3 $
* $Date: 2002/07/10 18:12:33 $
* @version $Revision: 1.3 $ $Date: 2002/07/10 18:12:33 $
return (pattern.equals(key.substring(2)) ||
pattern.endsWith(key.substring(1))); | 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.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; | 0 |
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [email protected].
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
* @version $Revision: 1.2 $ $Date: 2003/07/27 17:11:38 $
* @param suffix the suffix to allow, must not be null | 0 |
import java.util.ArrayList;
import java.util.Arrays;
plotData(sb, title, points, new ArrayList<String>(), data);
}
private static void plotData(StringBuilder sb, String title, boolean points, List<String> labels, @SuppressWarnings("rawtypes") List... series) {
for (int i = 0; i < series.length; i++) {
List<Pair<Long,? extends Number>> data = series[i];
sb.append(" var d" + i + " = [");
String sep = "";
for (Pair<Long,? extends Number> point : data) {
if (point.getSecond() == null)
continue;
String y;
if (point.getSecond() instanceof Double)
y = String.format("%1.2f", point.getSecond());
else
y = point.getSecond().toString();
sb.append(sep);
sep = ",";
sb.append("[" + point.getFirst() + "," + y + "]");
}
sb.append(" ];\n");
sb.append(" $.plot($(\"#" + id + "\"),");
String sep = "";
String colors[] = new String[] {"red", "blue", "green", "black"};
sb.append("[");
for (int i = 0; i < series.length; i++) {
sb.append(sep);
sep = ",";
sb.append("{ ");
if (labels.size() > 0) {
sb.append("label: \"" + labels.get(i) + "\", ");
}
sb.append("data: d" + i + ", " + opts + ", color:\"" + colors[i] + "\" }");
}
sb.append("], ");
sb.append("{yaxis:{}, xaxis:{mode:\"time\",minTickSize: [1, \"minute\"],timeformat: \"%H:%M\", ticks:3}});");
plotData(sb, "Scan (Entries/s)", false, Arrays.asList("Read", "Returned"), Monitor.getScanRateOverTime(), Monitor.getQueryRateOverTime());
plotData(sb, "Seeks", Monitor.getLookupsOverTime(), false); | 1 |
log.error(MultiTableBatchWriterImpl.class.getSimpleName() + " internal error.", mre); | 0 |
pi.close(); | 0 |
Repartition.of(dataset) | 0 |
import com.google.common.collect.ImmutableMap;
.evaluate(BeamSqlFnExecutorTestBase.row, null, ImmutableMap.of()) | 0 |
import java.nio.channels.ReadableByteChannel;
void write(ByteBuffer src);
void write(ReadableByteChannel src)
throws IOException;
void writeLine(String s)
throws IOException; | 0 |
context.getContextRuntime(),
context.getListeners());
private ServletContextDTO createContextDTO(final ServletContextHelperRuntime context,
final ContextRuntime contextRuntime,
final Collection<ServiceReference<?>> listenerRuntimes)
final long servletContextId = context.getContextInfo().getServiceId();
Collection<ServletDTO> servletDTOs = ServletDTOBuilder.create().build(contextRuntime.getServletRuntimes(), servletContextId);
Collection<ResourceDTO> resourceDTOs = ResourceDTOBuilder.create().build(contextRuntime.getServletRuntimes(), servletContextId);
Collection<FilterDTO> filterDTOs = FilterDTOBuilder.create().build(contextRuntime.getFilterRuntimes(), servletContextId);
Collection<ErrorPageDTO> errorDTOs = ErrorPageDTOBuilder.create().build(contextRuntime.getServletRuntimes(), servletContextId); | 0 |
* Constructs a new <code>ImageTranscoder</code>. | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/ArrayStack.java,v 1.6 2002/07/03 02:09:06 mas Exp $
* $Revision: 1.6 $
* $Date: 2002/07/03 02:09:06 $
* The removal order of an <Code>ArrayStack</Code> is based on insertion
* order: The most recently added element is removed first. The iteration
* order is <I>not</I> the same as the removal order. The iterator returns
* elements from the bottom up, whereas the {@link remove()} method removes
* them from the top down.
*
* @version $Revision: 1.6 $ $Date: 2002/07/03 02:09:06 $
public class ArrayStack extends ArrayList implements Buffer {
final private static long serialVersionUID = 2130079159931574599L;
//, local class serialVersionUID = -3491241305852305742
/**
* Returns the element on the top of the stack.
*
* @return the element on the top of the stack
* @throws BufferUnderflowException if the stack is empty
*/
public Object get() {
int size = size();
if (size == 0) throw new BufferUnderflowException();
return get(size - 1);
}
/**
* Removes the element on the top of the stack.
*
* @return the removed element
* @throws BufferUnderflowException if the stack is empty
*/
public Object remove() {
int size = size();
if (size == 0) throw new BufferUnderflowException();
return remove(size - 1);
}
| 0 |
import org.junit.Before;
import org.junit.Test;
public class Santuario191Test extends org.junit.Assert {
@Before | 0 |
if (name.length() == 0) return false; // must not be empty, reported by <[email protected]>, thanks!
| 0 |
* data distribution using approximate {@code N}-tiles (e.g. quartiles,
* percentiles, etc.), either globally or per-key.
private ApproximateQuantiles() {
// do not instantiate
} | 0 |
import net.jcip.annotations.NotThreadSafe;
@NotThreadSafe | 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.configuration2.beanutils;
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.configuration2.XMLConfiguration;
/**
* An additional test class for ConfigurationDynaBean. This test class performs
* the same tests as the default test class, but uses a XMLConfiguration as
* underlying configuration object.
*
* @author <a
* href="http://commons.apache.org/configuration/team-list.html">Commons
* Configuration team</a>
* @version $Id$
*/
public class TestConfigurationDynaBeanXMLConfig extends
TestConfigurationDynaBean
{
/**
* Creates the underlying configuration object. This implementation will
* create a XMLConfiguration.
* @return the underlying configuration
*/
@Override
protected Configuration createConfiguration()
{
return new XMLConfiguration();
}
} | 1 |
// Hint to GC to collect bundle; not sure why this
// is necessary, but it appears to help.
bundles[i] = null;
} | 0 |
import org.apache.beam.dsls.sql.schema.BeamSqlRow;
@Override public BeamSqlPrimitive evaluate(BeamSqlRow inputRecord) { | 0 |
if (tableId == null)
throw new TableNotFoundException(tableId, tableName, null);
if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
throw new TableOfflineException(instance, tableId); | 1 |
if (options.getAutoscalingAlgorithm() != null
&& !options.getAutoscalingAlgorithm().equals(AutoscalingAlgorithmType.NONE)) { | 0 |
return ClientConfiguration.create().with(ClientProperty.INSTANCE_ZK_HOST, "firstZkHosts").with(ClientProperty.INSTANCE_NAME, "secondInstanceName")
.with(ClientProperty.INSTANCE_ZK_TIMEOUT, "123s"); | 0 |
return FileSystemException.requireNonNull(fileReplicator, "vfs.impl/no-replicator.error");
return FileSystemException.requireNonNull(tempFileStore, "vfs.impl/no-temp-file-store.error");
FileSystemException.requireNonNull(base, "Invalid base FileName.");
FileSystemException.requireNonNull(name, "Invalid name FileName.");
return FileSystemException.requireNonNull(localFileProvider, "vfs.impl/no-local-file-provider.error"); | 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 |
if (extension == null || extension.isEmpty())
extension = RFile.EXTENSION;
if (conf.getBoolean(INSTANCE_HAS_BEEN_SET, false))
throw new IllegalStateException("Instance info can only be set once per job"); | 1 |
import javax.validation.constraints.NotNull;
@NotNull
public LSServerMapDate() {}
| 0 |
/* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v 1.14 2003/04/09 02:39:16 dgraham Exp $
* $Revision: 1.14 $
* $Date: 2003/04/09 02:39:16 $
* @version $Revision: 1.14 $ $Date: 2003/04/09 02:39:16 $
this.logWriter.println("DBCP DataSource configured without a 'username'");
this.logWriter.println("DBCP DataSource configured without a 'password'");
| 0 |
*
*
*
"iso-ir-148",
"latin5",
"l5",
"ISO_8859-9",
"ISO_8859-9:1989",
"csISOLatin5",
"iso8859_9", | 0 |
@Override
@Override
@Override
@Override | 0 |
* Gets the privilege service
*/
@Path("{clusterName}/privileges")
public PrivilegeService getPrivilegeService(@PathParam ("clusterName") String clusterName) {
return new ClusterPrivilegeService(clusterName);
}
/** | 0 |
/*
* The following two tests assert that no exception is thrown after calling hashCode or equals on a Mutation. These guard against the condition noted in
* ACCUMULO-3718.
m.put("cf", "cq", "v");
} catch (IllegalStateException e) {
m.put("cf", "cq", "v");
m2.put("cf", "cq", "v");
} catch (IllegalStateException e) { | 0 |
addDependency(Role.ZOOKEEPER_SERVICE_CHECK, RoleCommand.EXECUTE,
Role.ZOOKEEPER_SERVER, RoleCommand.START);
addDependency(Role.ZOOKEEPER_QUORUM_SERVICE_CHECK, RoleCommand.EXECUTE,
Role.ZOOKEEPER_SERVER, RoleCommand.START); | 0 |
import org.apache.xml.security.utils.XMLUtils;
Document doc = XMLUtils.createDocumentBuilder(false).newDocument(); | 0 |
rands[i] = (r.nextLong() & 0x7fffffffffffffffL) % 10000000000L; | 0 |
package org.apache.commons.vfs2.provider.mime;
import org.apache.commons.vfs2.FileContentInfoFactory;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.NameScope;
import org.apache.commons.vfs2.provider.AbstractFileObject;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.apache.commons.vfs2.provider.UriParser;
import org.apache.commons.vfs2.util.FileObjectUtils;
* returns {@link org.apache.commons.vfs2.FileType#FOLDER}.
} | 1 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.zookeeper.server.jersey.jaxb;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Represents an ERROR using JAXB.
*/
@XmlRootElement(name="error")
public class ZError {
public String request;
public String message;
public ZError(){
// needed by jersey
}
public ZError(String request, String message) {
this.request = request;
this.message = message;
}
} | 0 |
import org.apache.http.mockup.SimpleEventListener; | 0 |
assertTrue(e.getMessage().contains("Could not access base url"));
assertTrue(exceptionMsg.contains("Could not access base url")); | 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.client5.http.osgi.impl; | 0 |
* @version $Revision: 155419 $ $Date$
/**
* Provide a String representaion of this file filter.
*
* @return a String representaion
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(super.toString());
buffer.append("(");
if (wildcards != null) {
for (int i = 0; i < wildcards.length; i++) {
if (i > 0) {
buffer.append(",");
}
buffer.append(wildcards[i]);
}
}
buffer.append(")");
return buffer.toString();
}
| 0 |
Assert.assertEquals("HDP-0.2", resp.getDesiredStackId());
Assert.assertEquals("HDP-0.2", svc.getDesiredStackId());
Assert.assertEquals(s1.getCluster().getClusterName(), resp1.getClusterName());
Assert.assertEquals("HDP-0.1", s1.getDesiredStackId().getStackId());
Assert.assertEquals(s1.getDesiredStackId().getStackId(), resp1.getDesiredStackId());
Assert.assertEquals("HDP-0.2", resp.getDesiredStackId());
sch1.getServiceComponent().getDesiredStackId()); | 0 |
@Override
public ServiceInstance apply(HostAndPort endpoint) {
@Override
public LocalService launch() { | 0 |
import org.mockito.Matchers;
Matchers.eq(this.request), Matchers.eq(this.response), Matchers.eq(this.context)); | 0 |
private String serviceName; // GET/CREATE/UPDATE/DELETE
private String componentName; // GET/CREATE/UPDATE/DELETE
// Config type -> version mapping
private Map<String, String> configVersions; // CREATE/UPDATE
private String desiredState; // CREATE/UPDATE
String serviceName, String componentName,
Map<String, String> configVersions, String desiredState) {
this.serviceName = serviceName;
this.componentName = componentName;
this.configVersions = configVersions;
this.desiredState = desiredState;
/**
* @return the serviceName
*/
public String getServiceName() {
return serviceName;
* @param serviceName the serviceName to set
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
* @return the componentName
public String getComponentName() {
return componentName;
}
/**
* @param componentName the componentName to set
*/
public void setComponentName(String componentName) {
this.componentName = componentName;
}
/**
* @return the configVersions
*/
public Map<String, String> getConfigVersions() {
return configVersions;
}
/**
* @param configVersions the configVersions to set
*/
public void setConfigVersions(Map<String, String> configVersions) {
this.configVersions = configVersions;
* @return the desiredState
public String getDesiredState() {
return desiredState;
* @param desiredState the desiredState to set
public void setDesiredState(String desiredState) {
this.desiredState = desiredState;
/**
* @return the clusterName
*/
public String getClusterName() {
return clusterName;
}
/**
* @param clusterName the clusterName to set
*/
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
} | 1 |
import java.util.Objects;
Objects.requireNonNull(userHomeDir, "No home dir")); | 0 |
import java.util.Map;
import org.apache.cocoon.webapps.authentication.context.AuthenticationContext;
import org.apache.cocoon.webapps.authentication.user.RequestState;
import org.apache.cocoon.webapps.authentication.user.UserHandler;
* @version CVS $Id: ConfigurationGenerator.java,v 1.2 2003/05/04 20:19:42 cziegeler Exp $
RequestState state = RequestState.getState();
if ( state != null ) {
try {
UserHandler userhandler = state.getHandler();
Configuration conf = state.getModuleConfiguration("single-role-user-management");
state.getApplicationName());
this.showConfiguration(this.xmlConsumer, this.source, handler, userhandler.getContext());
} catch (ConfigurationException ex) {
throw new ProcessingException("ConfigurationException: " + ex, ex);
AuthenticationContext context)
Map pars = context.getContextInfo();
id = (String) pars.get("ID");
role = (String) pars.get("role");
Map pars = context.getContextInfo();
id = (String) pars.get("ID");
role = (String) pars.get("role");
Map pars = context.getContextInfo();
id = (String) pars.get("ID");
role = (String) pars.get("role"); | 0 |
* This spring factory bean adds the configuration info to the bean factory.
public class ConfigurationInfoFactoryBean
implements FactoryBean {
protected ConfigurationInfo info;
return this.info;
public ConfigurationInfo getInfo() {
return info;
public void setInfo(ConfigurationInfo info) {
this.info = info; | 0 |
(new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI(), 1);
("DOM", new org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI()); | 0 |
@XmlAttribute(required = true)
protected boolean markForDeletionWhenInAttic = false;
/**
* @return the markForDeletionWhenInAttic
*/
public boolean isMarkForDeletionWhenInAttic() {
return markForDeletionWhenInAttic;
}
/**
* @param markForDeletionWhenInAttic the markForDeletionWhenInAttic to set
*/
public void setMarkForDeletionWhenInAttic(boolean markForDeletionWhenInAttic) {
this.markForDeletionWhenInAttic = markForDeletionWhenInAttic;
} | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//codec/src/java/org/apache/commons/codec/binary/Base64.java,v 1.5 2003/07/25 22:40:36 ggregory Exp $
* $Revision: 1.5 $
* $Date: 2003/07/25 22:40:36 $
result = decodeBase64(pArray); | 0 |
BigQueryTableInserter inserter = new BigQueryTableInserter(mockClient);
inserter.getOrCreateTable(ref, BigQueryIO.Write.WriteDisposition.WRITE_APPEND,
BigQueryTableInserter inserter = new BigQueryTableInserter(mockClient);
inserter.getOrCreateTable(ref, BigQueryIO.Write.WriteDisposition.WRITE_EMPTY,
BigQueryTableInserter inserter = new BigQueryTableInserter(mockClient);
inserter.getOrCreateTable(ref, BigQueryIO.Write.WriteDisposition.WRITE_EMPTY,
BigQueryTableInserter inserter = new BigQueryTableInserter(mockClient, 5);
inserter.insertAll(ref, rows, ids); | 0 |
if (type.equals(Resource.Type.Cluster)) {
return new ClusterProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Service)) {
return new ServiceProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Component)) {
return new ComponentProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Host)) {
return new HostProvider(clusterDefinition);
} else if (type.equals(Resource.Type.HostComponent)) {
return new HostComponentProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Request)) {
return new RequestProvider(clusterDefinition);
} else if (type.equals(Resource.Type.Task)) {
return new TaskProvider(clusterDefinition);
} else {
return new NoOpProvider(type, clusterDefinition); | 0 |
asserter = new Asserter(JEXL); | 0 |
import com.mongodb.MongoBulkWriteException;
import com.mongodb.client.model.InsertManyOptions;
.setOrdered(true)
abstract boolean ordered();
abstract Builder setOrdered(boolean value);
/**
* Enables ordered bulk insertion (default: true).
*
* @see <a href=
* "https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#basic">
* specification of MongoDb CRUD operations</a>
*/
public Write withOrdered(boolean ordered) {
return builder().setOrdered(ordered).build();
}
builder.add(DisplayData.item("ordered", ordered()));
try {
mongoCollection.insertMany(batch, new InsertManyOptions().ordered(spec.ordered()));
} catch (MongoBulkWriteException e) {
if (spec.ordered()) {
throw e;
}
}
| 0 |
* Autogenerated by Thrift Compiler (0.9.3)
import javax.annotation.Generated;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2015-12-16")
public class TAuthenticationKey implements org.apache.thrift.TBase<TAuthenticationKey, TAuthenticationKey._Fields>, java.io.Serializable, Cloneable, Comparable<TAuthenticationKey> {
private static final _Fields optionals[] = {_Fields.KEY_ID,_Fields.EXPIRATION_DATE,_Fields.CREATION_DATE};
this.secret = org.apache.thrift.TBaseHelper.copyBinary(secret);
return org.apache.thrift.TBaseHelper.copyBinary(secret);
this.secret = secret == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(secret, secret.length));
this.secret = org.apache.thrift.TBaseHelper.copyBinary(secret);
return getKeyId();
return getExpirationDate();
return getCreationDate();
List<Object> list = new ArrayList<Object>();
boolean present_secret = true && (isSetSecret());
list.add(present_secret);
if (present_secret)
list.add(secret);
boolean present_keyId = true && (isSetKeyId());
list.add(present_keyId);
if (present_keyId)
list.add(keyId);
boolean present_expirationDate = true && (isSetExpirationDate());
list.add(present_expirationDate);
if (present_expirationDate)
list.add(expirationDate);
boolean present_creationDate = true && (isSetCreationDate());
list.add(present_creationDate);
if (present_creationDate)
list.add(creationDate);
return list.hashCode(); | 0 |
import java.util.Set;
| 0 |
import org.apache.felix.service.command.CommandSession;
import org.apache.felix.service.command.Descriptor; | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.