Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
public FileCleanerTestCase(String name) {
0
private volatile long lastTimeoutCheckMillis; final long selectTimeoutMillis = this.reactorConfig.getSelectIntervalMillis(); final int readyCount = this.selector.select(selectTimeoutMillis); final long currentTimeMillis = System.currentTimeMillis(); if( (currentTimeMillis - this.lastTimeoutCheckMillis) >= this.reactorConfig.getSelectIntervalMillis()) { this.lastTimeoutCheckMillis = currentTimeMillis; checkTimeout(key, currentTimeMillis); private void checkTimeout(final SelectionKey key, final long nowMillis) { channel.checkTimeout(nowMillis);
0
* @version CVS $Id: HTMLEventLinkTransformer.java,v 1.3 2004/03/11 09:44:02 cziegeler Exp $ if ( "a".equals(name) || "form".equals(name) ) {
0
import static java.nio.charset.StandardCharsets.UTF_8; import java.util.Collections; import org.apache.accumulo.core.Constants; // want the instance id to be stable for the life of this instance object, // so only get it once String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + instanceName; byte[] iidb = zooCache.get(instanceNamePath); if (iidb == null) { throw new RuntimeException( "Instance name " + instanceName + " does not exist in zookeeper. " + "Run \"accumulo org.apache.accumulo.server.util.ListInstances\" to see a list."); } instanceId = new String(iidb, UTF_8); if (zooCache.get(Constants.ZROOT + "/" + instanceId) == null) { if (instanceName == null) throw new RuntimeException("Instance id " + instanceId + " does not exist in zookeeper"); throw new RuntimeException("Instance id " + instanceId + " pointed to by the name " + instanceName + " does not exist in zookeeper"); } String masterLocPath = ZooUtil.getRoot(getInstanceID()) + Constants.ZMASTER_LOCK; OpTimer timer = null; if (log.isTraceEnabled()) { log.trace("tid={} Looking up master location in zookeeper.", Thread.currentThread().getId()); timer = new OpTimer().start(); } byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath); if (timer != null) { timer.stop(); log.trace("tid={} Found master at {} in {}", Thread.currentThread().getId(), (loc == null ? "null" : new String(loc, UTF_8)), String.format("%.3f secs", timer.scale(TimeUnit.SECONDS))); } if (loc == null) { return Collections.emptyList(); } return Collections.singletonList(new String(loc, UTF_8));
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/src/java/org/apache/commons/jelly/tags/xml/Attic/ParseTag.java,v 1.2 2002/02/12 21:34:34 jstrachan Exp $ * $Revision: 1.2 $ * $Date: 2002/02/12 21:34:34 $ * $Id: ParseTag.java,v 1.2 2002/02/12 21:34:34 jstrachan Exp $ import org.apache.commons.jelly.TagSupport; * @version $Revision: 1.2 $ public class ParseTag extends TagSupport { public void run(Context context, Writer writer) throws Exception { String text = getBodyText( context ); log.debug( "About to parse: " + text ); document = getSAXReader().read( new StringReader( text ) );
0
import org.apache.commons.configuration.tree.DefaultConfigurationNode; public void testSetRootNode() { config.setRootNode(new DefaultConfigurationNode("testNode")); assertNotSame("Same root node", config.getRootNode(), config.getRoot()); assertEquals("Wrong name of root node", "testNode", config.getRoot().getName()); config.setRootNode(new HierarchicalConfiguration.Node("test")); assertSame("Wrong root node", config.getRootNode(), config.getRoot()); } public void testSetRootNodeNull() { try { config.setRootNode(null); fail("Could set null root node!"); } catch(IllegalArgumentException iex) { //ok } }
0
* Constructs a new <code>PixelToMMTest</code>. * Creates the <code>TranscoderInput</code>.
0
private ConcurrentMap<String, String> systemNameToComputationIdMap; this.systemNameToComputationIdMap = new ConcurrentHashMap<>(); String computationId = systemNameToComputationIdMap.containsKey(mapTask.getSystemName()) ? systemNameToComputationIdMap.get(mapTask.getSystemName()) : mapTask.getSystemName(); if (!instructionMap.containsKey(computationId)) { LOG.info("Adding config for {}: {}", computationId, mapTask); outputMap.put(computationId, new ConcurrentLinkedQueue<Windmill.WorkItemCommitRequest>()); instructionMap.put(computationId, mapTask); mapTaskExecutors.put(computationId, new ConcurrentLinkedQueue<WorkerAndContext>()); computationId, new ConcurrentHashMap<ByteString, UnboundedSource.UnboundedReader<?>>()); for (Windmill.GetConfigResponse.SystemNameToComputationIdMapEntry entry : response.getSystemNameToComputationIdMapList()) { systemNameToComputationIdMap.put(entry.getSystemName(), entry.getComputationId()); }
0
if ((backgroundRenderThread != null) && (backgroundRenderThread.isAlive())) { backgroundRenderThread.interrupt(); } clearBuffer(w, h); // BUG: something is not initialized or // got destroyed in the interrupted thread // not a disaster since another repaint will follow // TODO: thread this (it's used by DynamicRenderer)
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. */ /* /** * List of mandatory resources that need to be installed * @return */ Resource[] getRequiredResources(); /** * List of optional resources that may be installed * @return */ /** * List of reasons why a resource has been included either as a mandatory or * optional resource during the resolution. * * @param resource * @return an array of Reason */ Reason[] getReason(Resource resource); /** * List of requirements that could not be satisfied during the resolution * @return */ Reason[] getUnsatisfiedRequirements();
0
switch (userAuth.next(null)) { case Success: authFuture.setAuthed(true); username = userAuth.getUsername(); authed = true; setState(State.Running); break; case Failure: authFuture.setAuthed(false); userAuth = null; setState(State.WaitForAuth); break; case Continued: break; } switch (userAuth.next(null)) { case Success: authFuture.setAuthed(true); username = userAuth.getUsername(); authed = true; setState(State.Running); break; case Failure: authFuture.setAuthed(false); userAuth = null; setState(State.WaitForAuth); break; case Continued: break; } switch (userAuth.next(null)) { case Success: authFuture.setAuthed(true); username = userAuth.getUsername(); authed = true; setState(State.Running); break; case Failure: authFuture.setAuthed(false); userAuth = null; setState(State.WaitForAuth); break; case Continued: break; }
0
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.felix.ipojo.runtime.core.components; import org.apache.felix.ipojo.runtime.core.services.BarService; import org.apache.felix.ipojo.runtime.core.services.FooService; import java.util.Properties; public class FooBarProviderType1 implements FooService, BarService { public boolean foo() { return true; } public Properties fooProps() { return new Properties(); } public boolean bar() { return true; } public Properties getProps() { return new Properties(); } public boolean getBoolean() { return true; } public double getDouble() { return 1.0; } public int getInt() { return 1; } public long getLong() { return 1; } public Boolean getObject() { return new Boolean(true); } }
0
* Implementation of <code>SVGContext</code> for if (info.glyphIndexStart == info.glyphIndexEnd) { if (it.isGlyphVisible(info.glyphIndexStart)) { b = it.getGlyphCellBounds(info.glyphIndexStart); } for (int k = info.glyphIndexStart; k <= info.glyphIndexEnd; k++) { Rectangle2D gb = it.getGlyphCellBounds(k); if (path == null) { path = new GeneralPath(gb); } else { path.append(gb, false); } if (b == null) { }
0
ITaskConfig newTask = buildScheduledTask(0, 5).getAssignedTask().getTask(); assertResponse(OK, thrift.startJobUpdate(request, SESSION));
0
import org.apache.beam.sdk.values.KV; final PCollection<KV<String, Long>> pCollection = .containsInAnyOrder(KV.of("A", 3L), KV.of("B", 1L), KV.of("C", 2L), KV.of("X", 1L));
0
// Follow this Vertex's edges if this isn't the last level of depth if (counter < max) { while (edgeIterator != null && edgeIterator.hasNext()) { Edge edge = edgeIterator.next(); String label = edge.getLabel(); Map<String,String> jsonEdgeMap = new HashMap<>(); String tail = edge.getVertex(Direction.OUT).getId().toString(); String head = edge.getVertex(Direction.IN).getId().toString(); jsonEdgeMap.put("tail", tail); jsonEdgeMap.put("head", head); jsonEdgeMap.put("label", label); Direction d; if (tail.equals(vtx.getId().toString())) { d = Direction.IN; } else { d = Direction.OUT; } /* If we want an Edge's property keys, uncomment here. Or we can parameterize it. * Code is here now for reference/memory-jogging. for (String pKey: edge.getPropertyKeys()) { jsonEdgeMap.put(pKey, edge.getProperty(pKey).toString()); } */ e.put(edge.getId().toString(), new JSONObject(jsonEdgeMap)); searchWalker (edge.getVertex(d), max, counter, e, v, edgesToFollow); }
0
package aQute.libg.reporter; import java.util.*; public interface Reporter { void error(String s, Object ... args); void warning(String s, Object ... args); void progress(String s, Object ... args); void trace(String s, Object ... args); List<String> getWarnings(); List<String> getErrors(); boolean isPedantic(); }
0
import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; private static final Cache<String, Throwable> exceptionsCache = CacheBuilder.newBuilder() .expireAfterWrite(5, TimeUnit.MINUTES) .build(); protected static String logException(final Throwable throwable) { final String msg = "Caught exception getting JMX metrics : " + throwable.getLocalizedMessage(); if (LOG.isDebugEnabled()) { LOG.debug(msg, throwable); } else { try { exceptionsCache.get(msg, new Callable<Throwable>() { @Override public Throwable call() { LOG.error(msg + ", skipping same exceptions for next 5 minutes", throwable); return throwable; } }); } catch (ExecutionException ignored) { } }
0
import org.apache.accumulo.core.clientImpl.ClientContext;
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v 1.26 2002/07/07 23:08:41 craigmcc Exp $ * $Revision: 1.26 $ * $Date: 2002/07/07 23:08:41 $ * @version $Revision: 1.26 $ $Date: 2002/07/07 23:08:41 $ Map description = new HashMap(); if (bean instanceof DynaBean) { DynaProperty descriptors[] = ((DynaBean) bean).getDynaClass().getDynaProperties(); for (int i = 0; i < descriptors.length; i++) { String name = descriptors[i].getName(); } } else { PropertyDescriptor descriptors[] = PropertyUtils.getPropertyDescriptors(bean); for (int i = 0; i < descriptors.length; i++) { String name = descriptors[i].getName(); if (descriptors[i].getReadMethod() != null) description.put(name, getProperty(bean, name)); }
0
/** Retrieve settings of this flow. */
0
private MetricsMap<MetricName, GaugeCell> gauges = new MetricsMap<>(new MetricsMap.Factory<MetricName, GaugeCell>() { @Override public GaugeCell createInstance(MetricName unusedKey) { return new GaugeCell(); } }); /** * Return the {@link DistributionCell} that should be used for implementing the given * {@code metricName} in this container. */ /** * Return the {@link GaugeCell} that should be used for implementing the given * {@code metricName} in this container. */ public GaugeCell getGauge(MetricName metricName) { return gauges.get(metricName); } extractUpdates(distributions), extractUpdates(gauges)); extractCumulatives(distributions), extractCumulatives(gauges));
0
String basedir = System.getProperty("basedir"); String file = "file:" + basedir + "/build.xml"; uriAttr.setValue(file); ResourceResolver res = ResourceResolver.getInstance(uriAttr, file);
0
import java.io.Serializable; * @throws NullPointerException if either argument is null throw new NullPointerException("Predicate must not be null"); throw new NullPointerException("Transformers must not be null"); * @throws NullPointerException if either argument is null throw new NullPointerException("Predicate must not be null"); throw new NullPointerException("Transformer must not be null");
0
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
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.http.config; import junit.framework.Assert; import org.junit.Test; public class TestRegistry { @Test public void testCompleted() throws Exception { Registry<String> reg = new Registry.Builder<String>().register("Stuff", "Stuff").build(); Assert.assertEquals("Stuff", reg.lookup("Stuff")); Assert.assertEquals("Stuff", reg.lookup("stuff")); Assert.assertEquals(null, reg.lookup("miss")); Assert.assertEquals(null, reg.lookup(null)); } }
0
* @version CVS $Id: AbstractStreamSource.java,v 1.5 2004/02/28 04:17:50 antonio Exp $ m.invoke(xhtmlconvert, new Object[] { Boolean.TRUE }); m.invoke(xhtmlconvert, new Object[] { Boolean.TRUE }); m.invoke(xhtmlconvert, new Object[] { Boolean.FALSE });
0
private static final String PROP_DIRECTORY = "configurator.binaries"; // JSON or URLs ? if ( !initial.trim().startsWith("{") ) { // JSON
0
/* $Id: LogUtils.java,v 1.7 2004/05/10 06:36:38 skitching Exp $ * Copyright 2004 The Apache Software Foundation.
0
import java.util.List; import org.apache.http.nio.reactor.IOReactorException; assertTrue(ex instanceof IOReactorException); assertNotNull(ex.getCause()); assertTrue(ex.getCause() instanceof IllegalStateException); List<ExceptionEvent> auditlog = this.server.getAuditLog(); assertNotNull(auditlog); assertEquals(1, auditlog.size()); assertTrue(ex instanceof IOReactorException); assertNotNull(ex.getCause()); assertTrue(ex.getCause() instanceof IllegalStateException); List<ExceptionEvent> auditlog = this.server.getAuditLog(); assertNotNull(auditlog); assertEquals(1, auditlog.size());
0
/* * Copyright (C) 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.dataflow.sdk.util; import com.google.api.client.auth.oauth2.Credential; import com.google.cloud.dataflow.sdk.options.PipelineOptions; import java.io.IOException; import java.security.GeneralSecurityException; /** * Construct an oauth credential to be used by the SDK and the SDK workers. * Always returns a null Credential object. */ public class NoopCredentialFactory implements CredentialFactory { public static NoopCredentialFactory fromOptions(PipelineOptions options) { return new NoopCredentialFactory(); } @Override public Credential getCredential() throws IOException, GeneralSecurityException { return null; } }
0
BasicHttpRequest request = new BasicHttpRequest("GET", host, targets[i]);
0
private Collection<ComponentConfigMappingEntity> configMappingEntities; @OneToMany(mappedBy = "serviceComponentDesiredStateEntity") public Collection<ComponentConfigMappingEntity> getComponentConfigMappingEntities() { return configMappingEntities; } public void setComponentConfigMappingEntities(Collection<ComponentConfigMappingEntity> entities) { configMappingEntities = entities; }
0
public class ResourceAdapterServiceImpl extends FilterService { private Object m_callbackInstance = null; private String m_callbackChanged = "changed"; public ResourceAdapterServiceImpl(DependencyManager dm, String resourceFilter, boolean propagate, Object callbackInstance, String callbackChanged) { m_callbackInstance = callbackInstance; m_callbackChanged = callbackChanged; .add(dm.createResourceDependency() .setFilter(resourceFilter) .setAutoConfig(false) .setCallbacks("added", "removed")); .setCallbacks(m_callbackInstance, null, m_callbackChanged, null) for (int i = 0; i < dependencies.size(); i++) { service.add(((Dependency) dependencies.get(i)).createCopy());
0
import java.io.IOException;
0
@Test(enabled = false) @BeforeClass(enabled = false) @Test(enabled=false)
0
Table.ID tableId = Table.ID.of(conn.tableOperations().tableIdMap().get(tableName)); Table.ID tableId = Table.ID.of(conn.tableOperations().tableIdMap().get(tableName));
1
PCollectionList.of(pcol1).and(pcol2).apply(Flatten.pCollections());
0
@Override public String getMask() { return mask; }
0
package org.apache.http.impl.client.integration; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.TargetAuthenticationStrategy; public class TestClientAuthentication extends IntegrationTestBase { startServer(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder().setCredentialsProvider(credsProvider).build(); this.httpclient = new HttpClientBuilder() .setCredentialsProvider(credsProvider) .setTargetAuthenticationStrategy(authStrategy) .build(); this.httpclient = new HttpClientBuilder().build(); this.httpclient = new HttpClientBuilder().build();
0
if (!saslEnabled()) {
0
import org.apache.hc.core5.util.Timeout; private final Timeout socketTimeout; protected EndpointDetails(final SocketAddress remoteAddress, final SocketAddress localAddress, final Timeout socketTimeout) { this.socketTimeout = socketTimeout; public Timeout getSocketTimeout() { return socketTimeout;
0
import java.util.HashMap; import java.util.Map; import org.apache.ambari.server.api.resources.ResourceInstance; import org.apache.ambari.server.controller.spi.Resource; import org.apache.ambari.server.orm.entities.ViewInstanceEntity; import org.apache.ambari.server.security.authorization.AuthorizationException; import org.apache.ambari.server.view.ViewRegistry;
0
import org.apache.xml.security.utils.resolver.ResourceResolverContext; public XMLSignatureInput engineResolveURI(ResourceResolverContext context) Document doc = context.attr.getOwnerElement().getOwnerDocument(); if (context.uriToResolve.equals("")) { String id = context.uriToResolve.substring(1); "signature.Verification.MissingID", exArgs, context.uriToResolve, context.baseUri if (context.secureValidation) { Element start = context.attr.getOwnerDocument().getDocumentElement(); "signature.Verification.MultipleIDs", exArgs, context.uriToResolve, context.baseUri if (context.baseUri != null && context.baseUri.length() > 0) { result.setSourceURI(context.baseUri.concat(context.uriToResolve)); result.setSourceURI(context.uriToResolve); public boolean engineCanResolveURI(ResourceResolverContext context) { if (context.uriToResolve == null) { if (context.uriToResolve.equals("") || ((context.uriToResolve.charAt(0) == '#') && !context.uriToResolve.startsWith("#xpointer(")) log.debug("State I can resolve reference: \"" + context.uriToResolve + "\""); log.debug("Do not seem to be able to resolve reference: \"" + context.uriToResolve + "\"");
0
log.debug("Iterator options: " + iterOpts); log.debug("Loading " + iterInfo.className + " " + iterInfo.iterName + " " + iterInfo.priority);
0
import org.apache.http.client.config.AuthSchemes; import org.apache.http.client.config.RequestConfig; RequestConfig config = RequestConfig.custom() .setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC)) .build(); context.setAttribute(ClientContext.REQUEST_CONFIG, config);
0
* listing and converting that information into an * <a href="org.apache.commons.net.ftp.FTPFile.html"> FTPFile </a> instance. * @version $Id: FTPFileEntryParser.java,v 1.2 2002/04/30 13:59:42 brekke Exp $
0
import static org.apache.commons.beanutils.BeanUtils.setProperty; import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor; PropertyDescriptor desc = getPropertyDescriptor( top, actualName ); setProperty( top, actualName, actualValue );
0
import org.apache.sshd.common.PropertyResolverUtils; this.pool = new LinkedBlockingQueue<>(PropertyResolverUtils.getIntProperty(session, POOL_SIZE_PROP, DEFAULT_POOL_SIZE));
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.svggen.font.table; import java.io.IOException; import java.io.RandomAccessFile; /** * Coverage Index (GlyphID) = StartCoverageIndex + GlyphID - Start GlyphID * * @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a> * @version $Id$ */ public class RangeRecord { private int start; private int end; private int startCoverageIndex; /** Creates new RangeRecord */ public RangeRecord(RandomAccessFile raf) throws IOException { start = raf.readUnsignedShort(); end = raf.readUnsignedShort(); startCoverageIndex = raf.readUnsignedShort(); } public boolean isInRange(int glyphId) { return (start <= glyphId && glyphId <= end); } public int getCoverageIndex(int glyphId) { if (isInRange(glyphId)) { return startCoverageIndex + glyphId - start; } return -1; } }
0
validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 2); validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 2); validateArgumentCount(arguments, tableOp, 2); validateArgumentCount(arguments, tableOp, 2); validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 3); validateArgumentCount(arguments, tableOp, 3); validateArgumentCount(arguments, tableOp, 4); validateArgumentCount(arguments, tableOp, 5); validateArgumentCount(arguments, tableOp, 1); validateArgumentCount(arguments, tableOp, 2); validateArgumentCount(arguments, tableOp, 2); private void validateArgumentCount(List<ByteBuffer> arguments, TableOperation op, int expected) throws ThriftTableOperationException { if (arguments.size() != expected) { throw new ThriftTableOperationException(null, null, op, TableOperationExceptionType.OTHER, "Unexpected number of arguments : " + expected + " != " + arguments.size()); } }
0
/** Expressions implementing array operations. */
0
ViewInstanceEntity persistedInstance = mergeViewInstance(instanceEntity, viewEntity.getResourceType()); String viewName = view.getName(); ViewEntity persistedView = viewDAO.findByName(viewName); // create an admin resource type to represent this view ResourceTypeEntity resourceType = resourceTypeDAO.merge(view.getResourceType()); view.setResourceType(resourceType);
0
Assert.assertTrue(capturedCRProperties.containsKey("create_ambari_principal")); } else if ("create_ambari_principal".equals(property)) { Assert.assertEquals(property, propertiesKerberosEnv.get(property), "false"); Assert.assertTrue(capturedCRProperties.containsKey("create_ambari_principal")); } else if ("create_ambari_principal".equals(property)) { Assert.assertEquals(property, propertiesKerberosEnv.get(property), "false");
0
ImmutableList.<HierarchicalTypeDefinition<ClassType>>of(classDef)); public EnumType defineEnumType(String name, EnumValue...values) throws MetadataException { assert name != null; if (types.containsKey(name)) { throw new MetadataException(String.format("Redefinition of type %s not supported", name)); } EnumType eT = new EnumType(this, name, values); types.put(name, eT); return eT; }
0
private static boolean matchIdentity(final String host, final String identity, final boolean strict) { if (host == null) { return false; } final String normalizedHost = host.toLowerCase(Locale.ROOT); final String normalizedIdentity = identity.toLowerCase(Locale.ROOT); // The CN better have at least two dots if it wants wildcard // action. It also can't be [*.co.uk] or [*.co.jp] or // [*.org.uk], etc... final String parts[] = normalizedIdentity.split("\\."); final boolean doWildcard = parts.length >= 3 && parts[0].endsWith("*") && (!strict || validCountryWildcard(parts)); if (doWildcard) { boolean match; final String firstpart = parts[0]; if (firstpart.length() > 1) { // e.g. server* final String prefix = firstpart.substring(0, firstpart.length() - 1); // e.g. server final String suffix = normalizedIdentity.substring(firstpart.length()); // skip wildcard part from cn final String hostSuffix = normalizedHost.substring(prefix.length()); // skip wildcard part from normalizedHost match = normalizedHost.startsWith(prefix) && hostSuffix.endsWith(suffix); } else { match = normalizedHost.endsWith(normalizedIdentity.substring(1)); } return match && (!strict || countDots(normalizedHost) == countDots(normalizedIdentity)); } else { return normalizedHost.equals(normalizedIdentity); } private static boolean validCountryWildcard(final String parts[]) { public static boolean acceptableCountryWildcard(final String cn) { return validCountryWildcard(cn.split("\\.")); }
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.8 $ $Date: 2004/02/28 13:18:33 $
0
package org.apache.accumulo.monitor.rest.trace;
0
import org.apache.ambari.server.api.services.AmbariMetaInfo; * Gets a list of stacks which are between the current stack version and the * target stack version inclusive. For example, if upgrading from HDP-2.2 to * HDP-2.4, this should include HDP-2.3 and HDP-2.4. * <p/> * This method is used to combine the correct configuration packs for a * specific upgrade from * {@link AmbariMetaInfo#getConfigUpgradePack(String, String)}. * * @return a list of intermediate stacks (target stack inclusive) or * {@code null} if none. *
0
public PCollection<T> expand(PCollection<T> input) {
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.state.kerberos; public enum KerberosDescriptorType { SERVICE("service", "services"), COMPONENT("component", "components"), IDENTITY("identity", "identities"), PRINCIPAL("principal", "principals"), KEYTAB("keytab", "keytabs"), CONFIGURATION("configuration", "configurations"); private final String descriptorName; private final String descriptorPluralName; private KerberosDescriptorType(String descriptorName, String descriptorPluralName) { this.descriptorName = descriptorName; this.descriptorPluralName = descriptorPluralName; } /** * Gets the identifying name for this KerberosDescriptorType * * @return a String declaring the identifying name for this KerberosDescriptorType */ public String getDescriptorName() { return descriptorName; } /** * Gets the identifying name for a group of this KerberosDescriptorType * * @return a String declaring the identifying name for a group of this KerberosDescriptorType */ public String getDescriptorPluralName() { return descriptorPluralName; } }
0
/** If set, the snapshot from which the job should be created. */ @Hidden @Experimental @Description("If set, the snapshot from which the job should be created.") String getCreateFromSnapshot(); void setCreateFromSnapshot(String value);
0
if (waitTillSuspended) { while (state == SUSPENDING) { try { stateLock.wait(); } catch(InterruptedException ie) { } } }
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.codec.language.bm; /** * Types of rule. * * @author Apache Software Foundation * @since 2.0 */ public enum RuleType { APPROX("approx"), EXACT("exact"), RULES("rules"); private final String name; RuleType(String name) { this.name = name; } public String getName() { return this.name; } }
0
import com.google.common.base.Preconditions;
0
final ServletInfo info = new ServletInfo("test", "/test", Collections.<String, String> emptyMap()); final ServletInfo info1 = new ServletInfo("test", "/test", Collections.<String, String> emptyMap()); final ServletInfo info2 = new ServletInfo("test", "/test", Collections.<String, String> emptyMap());
0
Option oopt = new Option("o", false, "Use HTTP/S 1.0"); oopt.setRequired(false); Option topt = new Option("t", true, "Client side socket timeout (in ms) - default 60 Secs"); topt.setRequired(false); topt.setArgName("socket-Timeout"); "header lines. (repeatable as -H \"h1: v1\",\"h2: v2\" etc)"); options.addOption(topt); options.addOption(oopt); String headerStr = cmd.getOptionValue('H'); httpBenchmark.headers = headerStr.split(","); } if (cmd.hasOption('t')) { String t = cmd.getOptionValue('t'); try { httpBenchmark.socketTimeout = Integer.parseInt(t); } catch (NumberFormatException ex) { printError("Invalid socket timeout: " + t); } } if (cmd.hasOption('o')) { httpBenchmark.useHttp1_0 = true;
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/MapIterator.java,v 1.5 2004/01/05 21:37:13 scolebourne Exp $ * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * @version $Revision: 1.5 $ $Date: 2004/01/05 21:37:13 $ * @throws java.util.NoSuchElementException if the iteration is finished
0
public FileBasedReader<String> createSingleFileReader(PipelineOptions options) { Reader<String> reader = source.createReader(options); try (BoundedSource.BoundedReader<String> reader = source.createReader(null)) {
0
import java.util.ArrayList; import java.util.List; public class TraceList { public String id; public Long start; public List<TraceInformation> traces; public TraceList() { traces = new ArrayList<>(); public TraceList(String id) { this.id = id; this.traces = new ArrayList<>(); public void addTrace(TraceInformation traces) { this.traces.add(traces); public void addStartTime(Long start) { this.start = start;
0
/** * Update stacks from the files at stackRoot. * * @return a track action response * @throws AmbariException if */ public RequestStatusResponse updateStacks() throws AmbariException;
0
* @param url the java.net.URL class we reference.
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
import org.apache.beam.sdk.extensions.euphoria.beam.window.WindowingUtils;
0
import java.util.Iterator; import java.util.Objects; import java.util.function.Predicate; /** * @since 4.4 */ @Override public boolean removeIf(final Predicate<? super C> filter) { if (Objects.isNull(filter)) { return false; } boolean changed = false; final Iterator<C> it = iterator(); while (it.hasNext()) { if (filter.test(it.next())) { it.remove(); changed = true; } } if (changed) { reindex(); } return changed; }
0
import org.apache.felix.dm.annotation.api.Property; @Service(properties={@Property(name="language", value="fr")})
0
* @version $Revision$ $Date$
0
import org.apache.beam.sdk.schemas.Schema.FieldType; FieldType keyDescriptor = sourceSchema.getField(refIndexKey).getType(); CalciteUtils.toSqlTypeName(keyDescriptor), FieldType valueDescriptor = sourceSchema.getField(refIndexValue).getType(); CalciteUtils.toSqlTypeName(valueDescriptor), FieldType fieldType = sourceSchema.getField(refIndex).getType(); CalciteUtils.toSqlTypeName(fieldType), FieldType typeDescriptor = CalciteUtils.toFieldType(call.type); VarianceFn.newPopulation(BigDecimalConverter.forSqlType( typeDescriptor.getTypeName()))); VarianceFn.newSample(BigDecimalConverter.forSqlType(typeDescriptor.getTypeName()))); BigDecimalConverter.forSqlType(typeDescriptor.getTypeName()))); CovarianceFn.newSample(BigDecimalConverter.forSqlType( typeDescriptor.getTypeName()))); sourceSchema.getField(srcFieldIndex).getType().getTypeName()); sourceSchema.getField(srcFieldIndexKey).getType().getTypeName()); sourceSchema.getField(srcFieldIndexValue).getType().getTypeName());
0
for (final String protocol: protocols) { for (final String cipher: ciphers) {
0
protected FileSystem createFileSystem(final FileName name, final FileObject file, final FileSystemOptions fileSystemOptions)
1
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at
0
import org.apache.http.util.Args; Args.notNull(host, "HTTP host"); Args.notNull(host, "HTTP host"); Args.notNull(host, "HTTP host");
0
"enabledServices", protected List<String> enabledServices = null; * @return the enabledServices public List<String> getEnabledServices() { return enabledServices; * @param enabledServices the enabledServices to set public void setEnabledServices(List<String> enabledServices) { this.enabledServices = enabledServices;
0
public void testWithNamespace() throws IOException, XmlPullParserException { String empty = "<metatype:MetaData xmlns:metatype=\"http://www.osgi.org/xmlns/metatype/v1.0.0\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ></metatype:MetaData>"; MetaData mti = read( empty ); assertNotNull( mti ); assertNull( mti.getLocalePrefix() ); assertNull( mti.getObjectClassDefinitions() ); } public void testWithInvalidNamespaceUri() throws IOException, XmlPullParserException { String empty = "<metatype:MetaData xmlns:metatype=\"http://www.osgi.org/xmlns/datatype/v1.0.0\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ></metatype:MetaData>"; Exception exc = null; try { MetaData mti = read( empty ); } catch (Exception e) { exc = e; } assertNotNull(exc); } public void testWithInvalidNamespaceName() throws IOException, XmlPullParserException { String empty = "<datatype:MetaData xmlns:metatype=\"http://www.osgi.org/xmlns/metatype/v1.0.0\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ></datatype:MetaData>"; MetaData mti = read( empty ); assertNull( mti ); }
0
private transient final Log log = LogFactory.getLog(getClass()); this.log.debug("User credentials not available"); if (this.log.isErrorEnabled()) { this.log.error("Authentication error: " + ex.getMessage());
0
pkgs = new ExportedPackage[exporters.length];
0
* Copyright 2002-2006 The Apache Software Foundation. * * * /** text of the script. */ /** syntax tree. */ /** * Create a new Script from the given string and parsed syntax. * @param scriptText the text of the script. * @param scriptTree the parsed script. */ * @return the value of the script. Usually the value of the last * executed statement. * @throws Exception on any error.
0
ApproximateQuantilesCombineFn<T, Top.Natural<T>> create(int numQuantiles) { return create(numQuantiles, new Top.Natural<T>());
0
* Parent element. /** * Is the visit annotation a class annotation? */ private boolean m_classAnnotation; * Metadata collector. * @param elem the parent element * @param collector the metadata collector * @param root is the annotation a root * @param clazz the annotation is a class annotation. public CustomAnnotationVisitor(Element elem, MetadataCollector collector, boolean root, boolean clazz) { m_classAnnotation = clazz; return new CustomAnnotationVisitor(elem, m_collector, false, false); if (! m_collector.getIds().containsKey(m_elem.getNameSpace()) && m_classAnnotation) { return new CustomAnnotationVisitor(elem, m_collector, false, false);
0
* @version CVS $Id: LogicsheetCodeGenerator.java,v 1.1 2004/03/10 12:58:04 stephan Exp $
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
Connector conn = WalkingSecurity.get(state).getSystemConnector(); String tableName = WalkingSecurity.get(state).getTableName(); boolean exists = WalkingSecurity.get(state).getTableExists(); boolean hasPermission = WalkingSecurity.get(state).canCreateTable(WalkingSecurity.get(state).getSysAuthInfo()); WalkingSecurity.get(state).initTable(tableName); WalkingSecurity.get(state).initTable(tableName); WalkingSecurity.get(state).grantTablePermission(conn.whoami(), tableName, tp);
1
package org.apache.hc.core5.http.impl.nio;
1
delegate.setUser("userName"); final Connection conn1 = ds.getConnection("userName", "password"); final Connection conn2 = ds.getConnection("userName", "password"); final Connection conn3 = ds.getConnection("userName", "password"); final UserPassKey key = new UserPassKey("userName", "password"); final UserPassKey key = new UserPassKey("userName", "password");
0
"dataflow.gcr.io/v1beta3/beam-java-batch:beam-master-20160926"; "dataflow.gcr.io/v1beta3/beam-java-streaming:beam-master-20160926";
0
import org.apache.http.HttpResponse; class ResponseEntityProxy extends HttpEntityWrapper implements EofSensorWatcher { private final ConnectionHolder connHolder; public static void enchance(final HttpResponse response, final ConnectionHolder connHolder) { final HttpEntity entity = response.getEntity(); if (entity != null && entity.isStreaming() && connHolder != null) { response.setEntity(new ResponseEntityProxy(entity, connHolder)); } } ResponseEntityProxy(final HttpEntity entity, final ConnectionHolder connHolder) { this.connHolder = connHolder; if (this.connHolder != null) { this.connHolder.abortConnection(); if (this.connHolder != null) { if (this.connHolder.isReusable()) { this.connHolder.releaseConnection(); final boolean open = connHolder != null && !connHolder.isReleased(); @Override public String toString() { final StringBuilder sb = new StringBuilder("ResponseEntityProxy{"); sb.append(wrappedEntity); sb.append('}'); return sb.toString(); }
0
@Test public void testTANH() throws Exception { Schema resultType = Schema.builder().addNullableField("field", Schema.FieldType.DOUBLE).build(); Row resultRow1 = Row.withSchema(resultType).addValues(Math.tanh(1.0)).build(); String sql1 = "SELECT TANH(CAST(1.0 as DOUBLE))"; PCollection<Row> result1 = boundedInputDouble.apply("testUdf1", SqlTransform.query(sql1).withAutoUdfUdafLoad(true)); PAssert.that(result1).containsInAnyOrder(resultRow1); Row resultRow2 = Row.withSchema(resultType).addValues(Math.tanh(0.0)).build(); String sql2 = "SELECT TANH(CAST(0.0 as DOUBLE))"; PCollection<Row> result2 = boundedInputDouble.apply("testUdf2", SqlTransform.query(sql2).withAutoUdfUdafLoad(true)); PAssert.that(result2).containsInAnyOrder(resultRow2); Row resultRow3 = Row.withSchema(resultType).addValues(Math.tanh(-1.0)).build(); String sql3 = "SELECT TANH(CAST(-1.0 as DOUBLE))"; PCollection<Row> result3 = boundedInputDouble.apply("testUdf3", SqlTransform.query(sql3).withAutoUdfUdafLoad(true)); PAssert.that(result3).containsInAnyOrder(resultRow3); pipeline.run().waitUntilFinish(); } builder.put(HyperbolicTangent.FUNCTION_NAME, HyperbolicTangent.class);
0
* Accumulo was the same as Property.INSTANCE_DFS_DIR. If any other HDFS directory was used, any interactions with the table would fail because the relative * path in the metadata table (created by the ImportTable process) would be converted to a non-existent absolute path.
0
ZipFile zip; ZipEntry entry; long lastModified; String extra; ZipResource(ZipFile zip, ZipEntry entry, long lastModified) throws UnsupportedEncodingException { this.zip = zip; this.entry = entry; this.lastModified = lastModified; byte[] data = entry.getExtra(); if (data != null) this.extra = new String(data, "UTF-8"); } public InputStream openInputStream() throws IOException { return zip.getInputStream(entry); } public String toString() { return ":" + zip.getName() + "(" + entry.getName() + "):"; } public static ZipFile build(Jar jar, File file) throws ZipException, IOException { return build(jar, file, null); } public static ZipFile build(Jar jar, File file, Pattern pattern) throws ZipException, IOException { try { ZipFile zip = new ZipFile(file); nextEntry: for (Enumeration< ? extends ZipEntry> e = zip.entries(); e.hasMoreElements();) { ZipEntry entry = e.nextElement(); if (pattern != null) { Matcher m = pattern.matcher(entry.getName()); if (!m.matches()) continue nextEntry; } if (!entry.isDirectory()) { long time = entry.getTime(); if (time <= 0) time = file.lastModified(); jar.putResource(entry.getName(), new ZipResource(zip, entry, time), true); } } return zip; } catch (ZipException ze) { throw new ZipException("The JAR/ZIP file (" + file.getAbsolutePath() + ") seems corrupted, error: " + ze.getMessage()); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Problem opening JAR: " + file.getAbsolutePath()); } } public void write(OutputStream out) throws Exception { FileResource.copy(this, out); } public long lastModified() { return lastModified; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public long size() { return entry.getSize(); }
0
String pythonCmd = configs.getProperty(Configuration.AMBARI_PYTHON_WRAP_KEY); commandParams.put("output_file", componentName + "-configs" + Configuration.DEF_ARCHIVE_EXTENSION); String cmd = pythonCmd + " " + commandScriptAbsolute + " generate_configs " + jsonFileName.getAbsolutePath() + " " +
0