id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
5,901
private GestureDetector gestureDetector; private Transform pose; private Camera camera; private ConnectedNode connectedNode; public PosePublisherLayer(String topic, Context context) { <BUG>this(new GraphName(topic), context); </BUG> } public PosePublisherLayer(GraphName topic, Context context) { this.topic = topic;
this(GraphName.of(topic), context);
5,902
public class LaserScanLayer extends SubscriberLayer<sensor_msgs.LaserScan> implements TfLayer { private static final Color FREE_SPACE_COLOR = Color.fromHexAndAlpha("00adff", 0.3f); private GraphName frame; private Shape shape; public LaserScanLayer(String topicName) { <BUG>this(new GraphName(topicName)); </BUG> } public LaserScanLayer(GraphName topicName) { super(topicName, "sensor_msgs/LaserScan");
this(GraphName.of(topicName));
5,903
super.onStart(connectedNode, handler, frameTransformTree, camera); Subscriber<LaserScan> subscriber = getSubscriber(); subscriber.addMessageListener(new MessageListener<LaserScan>() { @Override public void onNewMessage(LaserScan laserScan) { <BUG>frame = new GraphName(laserScan.getHeader().getFrameId()); </BUG> float[] ranges = laserScan.getRanges(); float[] vertices = new float[(ranges.length + 1) * 3]; vertices[0] = 0;
frame = GraphName.of(laserScan.getHeader().getFrameId());
5,904
private final GraphName frame; private final Context context; private final Shape shape; private GestureDetector gestureDetector; public RobotLayer(String frame, Context context) { <BUG>this.frame = new GraphName(frame); </BUG> this.context = context; shape = new RobotShape(); }
this.frame = GraphName.of(frame);
5,905
@Parameter(property = Props.failOnUnresolvedArtifacts.NAME, defaultValue = Props.failOnUnresolvedArtifacts.DEFAULT_VALUE) protected boolean failOnUnresolvedArtifacts; @Parameter(property = Props.failOnUnresolvedDependencies.NAME, defaultValue = Props.failOnUnresolvedDependencies.DEFAULT_VALUE) protected boolean failOnUnresolvedDependencies; @Parameter(property = Props.checkDependencies.NAME, defaultValue = Props.checkDependencies.DEFAULT_VALUE) <BUG>protected boolean checkDependencies; @Parameter(property = Props.versionFormat.NAME, defaultValue = Props.versionFormat.DEFAULT_VALUE)</BUG> protected String versionFormat; @Parameter(property = Props.disallowedExtensions.NAME, defaultValue = Props.disallowedExtensions.DEFAULT_VALUE) protected String disallowedExtensions;
@Parameter(property = Props.resolveProvidedDependencies.NAME, defaultValue = Props.resolveProvidedDependencies.DEFAULT_VALUE) protected boolean resolveProvidedDependencies; @Parameter(property = Props.versionFormat.NAME, defaultValue = Props.versionFormat.DEFAULT_VALUE)
5,906
protected Analyzer prepareAnalyzer(MavenProject project, Reporter reporter) { AnalyzerBuilder.Result res = AnalyzerBuilder.forGavs(this.oldArtifacts, this.newArtifacts) .withAlwaysCheckForReleasedVersion(this.alwaysCheckForReleaseVersion) .withAnalysisConfiguration(this.analysisConfiguration) .withAnalysisConfigurationFiles(this.analysisConfigurationFiles) <BUG>.withCheckDependencies(this.checkDependencies) .withDisallowedExtensions(this.disallowedExtensions)</BUG> .withFailOnMissingConfigurationFiles(this.failOnMissingConfigurationFiles) .withFailOnUnresolvedArtifacts(this.failOnUnresolvedArtifacts) .withFailOnUnresolvedDependencies(this.failOnUnresolvedDependencies)
.withResolveProvidedDependencies(this.resolveProvidedDependencies) .withDisallowedExtensions(this.disallowedExtensions)
5,907
protected boolean skip; @Parameter(property = "revapi.outputDirectory", defaultValue = "${project.reporting.outputDirectory}", required = true, readonly = true) protected String outputDirectory; @Parameter(property = Props.checkDependencies.NAME, defaultValue = Props.checkDependencies.DEFAULT_VALUE) <BUG>protected boolean checkDependencies; @Parameter(property = Props.versionFormat.NAME, defaultValue = Props.versionFormat.DEFAULT_VALUE)</BUG> protected String versionFormat; @Component protected RepositorySystem repositorySystem;
@Parameter(property = Props.resolveProvidedDependencies.NAME, defaultValue = Props.resolveProvidedDependencies.DEFAULT_VALUE) protected boolean resolveProvidedDependencies; @Parameter(property = Props.versionFormat.NAME, defaultValue = Props.versionFormat.DEFAULT_VALUE)
5,908
String versionRegex = getValueOfChild(runConfig, "versionFormat"); AnalyzerBuilder bld = AnalyzerBuilder.forArtifacts(oldArtifacts, newArtifacts) .withAlwaysCheckForReleasedVersion(alwaysUpdate) .withAnalysisConfiguration(this.analysisConfiguration) .withAnalysisConfigurationFiles(this.analysisConfigurationFiles) <BUG>.withCheckDependencies(resolveDependencies) .withDisallowedExtensions(disallowedExtensions)</BUG> .withFailOnMissingConfigurationFiles(failOnMissingConfigurationFiles) .withFailOnUnresolvedArtifacts(failOnMissingArchives) .withFailOnUnresolvedDependencies(failOnMissingSupportArchives)
.withResolveProvidedDependencies(resolveProvidedDependencies) .withDisallowedExtensions(disallowedExtensions)
5,909
private RepositorySystemSession repositorySystemSession; private boolean failOnMissingConfigurationFiles; private boolean failOnUnresolvedArtifacts; private boolean failOnUnresolvedDependencies; private boolean alwaysCheckForReleaseVersion; <BUG>private boolean checkDependencies; private String versionFormat;</BUG> private Revapi revapi; static AnalyzerBuilder forGavs(String[] oldGavs, String[] newGavs) { return new AnalyzerBuilder(oldGavs, newGavs, null, null);
private boolean resolveProvidedDependencies; private String versionFormat;
5,910
AnalyzerBuilder withAlwaysCheckForReleasedVersion(boolean alwaysCheckForReleaseVersion) { this.alwaysCheckForReleaseVersion = alwaysCheckForReleaseVersion; return this; } AnalyzerBuilder withCheckDependencies(boolean checkDependencies) { <BUG>this.checkDependencies = checkDependencies; return this;</BUG> } AnalyzerBuilder withVersionFormat(String versionFormat) { this.versionFormat = versionFormat;
AnalyzerBuilder withResolveProvidedDependencies(boolean resolveProvidedDependencies) { this.resolveProvidedDependencies = resolveProvidedDependencies;
5,911
: Arrays.asList(this.disallowedExtensions.split("\\s*,\\s*")); Supplier<Revapi.Builder> ctor = getDisallowedExtensionsAwareRevapiConstructor(disallowedExtensions); return new Analyzer(analysisConfiguration, analysisConfigurationFiles, oldArtifacts, newArtifacts, oldGavs, newGavs, project, repositorySystem, repositorySystemSession, reporter, locale, log, failOnMissingConfigurationFiles, failOnUnresolvedArtifacts, failOnUnresolvedDependencies, <BUG>alwaysCheckForReleaseVersion, checkDependencies, versionFormat, ctor, revapi); }</BUG> private boolean initializeComparisonArtifacts() { if (oldArtifacts == null) {
alwaysCheckForReleaseVersion, checkDependencies, resolveProvidedDependencies, versionFormat, ctor, }
5,912
private Revapi revapi; Analyzer(String analysisConfiguration, Object[] analysisConfigurationFiles, Artifact[] oldArtifacts, Artifact[] newArtifacts, String[] oldGavs, String[] newGavs, MavenProject project, RepositorySystem repositorySystem, RepositorySystemSession repositorySystemSession, Reporter reporter, Locale locale, Log log, boolean failOnMissingConfigurationFiles, boolean failOnMissingArchives, <BUG>boolean failOnMissingSupportArchives, boolean alwaysUpdate, boolean resolveDependencies, String versionRegex, Supplier<Revapi.Builder> revapiConstructor, Revapi sharedRevapi) {</BUG> this.analysisConfiguration = analysisConfiguration; this.analysisConfigurationFiles = analysisConfigurationFiles; this.oldGavs = oldGavs;
boolean resolveProvidedDependencies, String versionRegex, Supplier<Revapi.Builder> revapiConstructor, Revapi sharedRevapi) {
5,913
this.newArtifacts = newArtifacts; this.project = project; this.repositorySystem = repositorySystem; this.resolveDependencies = resolveDependencies; this.versionRegex = versionRegex == null ? null : Pattern.compile(versionRegex); <BUG>DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(repositorySystemSession); session.setDependencySelector(new ScopeDependencySelector("compile", "provided")); session.setDependencyTraverser(new ScopeDependencyTraverser("compile", "provided")); </BUG> if (alwaysUpdate) {
String[] scopes = resolveProvidedDependencies ? new String[] {"compile", "provided"} : new String[] {"compile"}; session.setDependencySelector(new ScopeDependencySelector(scopes)); session.setDependencyTraverser(new ScopeDependencyTraverser(scopes));
5,914
import org.dalesbred.connection.DriverManagerConnectionProvider; import org.dalesbred.conversion.TypeConversionRegistry; import org.dalesbred.dialect.Dialect; import org.dalesbred.dialect.EnumMode; import org.dalesbred.internal.instantiation.InstantiatorProvider; <BUG>import org.dalesbred.internal.result.*; import org.dalesbred.internal.utils.JndiUtils;</BUG> import org.dalesbred.query.SqlQuery; import org.dalesbred.result.ResultSetProcessor;
import org.dalesbred.internal.result.InstantiatorRowMapper; import org.dalesbred.internal.result.MapResultSetProcessor; import org.dalesbred.internal.result.ResultTableResultSetProcessor; import org.dalesbred.internal.utils.JndiUtils;
5,915
public <T> T executeQuery(@NotNull ResultSetProcessor<T> processor, @NotNull @SQL String sql, Object... args) { return executeQuery(processor, SqlQuery.query(sql, args)); } @NotNull public <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull SqlQuery query) { <BUG>return executeQuery(new ListWithRowMapperResultSetProcessor<>(rowMapper), query); }</BUG> @NotNull public <T> List<T> findAll(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) { return findAll(rowMapper, SqlQuery.query(sql, args));
return executeQuery(rowMapper.list(), query);
5,916
public <T> T findUnique(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { return findUnique(cl, SqlQuery.query(sql, args)); } @NotNull public <T> Optional<T> findOptional(@NotNull RowMapper<T> rowMapper, @NotNull SqlQuery query) { <BUG>return executeQuery(new OptionalResultSetProcessor<>(new ListWithRowMapperResultSetProcessor<>(rowMapper)), query); }</BUG> @NotNull public <T> Optional<T> findOptional(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) { return findOptional(rowMapper, SqlQuery.query(sql, args));
return executeQuery(rowMapper.optional(), query);
5,917
public <T> Optional<T> findOptional(@NotNull RowMapper<T> rowMapper, @NotNull @SQL String sql, Object... args) { return findOptional(rowMapper, SqlQuery.query(sql, args)); } @NotNull public <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull SqlQuery query) { <BUG>return executeQuery(new OptionalResultSetProcessor<>(resultProcessorForClass(cl)), query); }</BUG> @NotNull public <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { return findOptional(cl, SqlQuery.query(sql, args));
return executeQuery(rowMapperForClass(cl).optional(), query);
5,918
for (Object arg : args) dialect.bindArgument(ps, i++, instantiatorRegistry.valueToDatabase(unwrapOptionalAsNull(arg))); } @NotNull private <T> ResultSetProcessor<List<T>> resultProcessorForClass(@NotNull Class<T> cl) { <BUG>return new ReflectionResultSetProcessor<>(cl, instantiatorRegistry); }</BUG> @NotNull public TypeConversionRegistry getTypeConversionRegistry() { return instantiatorRegistry.getTypeConversionRegistry();
return rowMapperForClass(cl).list(); private <T> RowMapper<T> rowMapperForClass(@NotNull Class<T> cl) { return new InstantiatorRowMapper<>(cl, instantiatorRegistry);
5,919
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
5,920
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
5,921
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
5,922
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
5,923
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
5,924
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
5,925
name(trimedValue(deviceProps.getProperty("DeviceFirmware.name"))). url(trimedValue(deviceProps.getProperty("DeviceFirmware.url"))). verifier(trimedValue(deviceProps.getProperty("DeviceFirmware.verifier"))). state(FirmwareState.IDLE). build(); <BUG>DeviceLocation location = new DeviceLocation.Builder(30.28565, -97.73921). elevation(10).build();</BUG> JsonObject data = new JsonObject(); data.addProperty("customField", "customValue"); DeviceMetadata metadata = new DeviceMetadata(data);
[DELETED]
5,926
URLConnection urlConnection = null; try { System.out.println(CLASS_NAME + ": Downloading Firmware from URL " + deviceFirmware.getUrl()); firmwareURL = new URL(deviceFirmware.getUrl()); urlConnection = firmwareURL.openConnection(); <BUG>if(deviceFirmware.getName() != null) { downloadedFirmwareName = deviceFirmware.getName();</BUG> } else { downloadedFirmwareName = "firmware_" +new Date().getTime()+".deb";
if(deviceFirmware.getName() != null && !"".equals(deviceFirmware.getName())) { downloadedFirmwareName = deviceFirmware.getName();
5,927
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import com.hantsylabs.restexample.springmvc.model.User; import com.hantsylabs.restexample.springmvc.repository.UserRepository; @Named <BUG>public class SimpleUserDetailsServiceImpl implements UserDetailsService { private static final Logger log = LoggerFactory .getLogger(SimpleUserDetailsServiceImpl.class);</BUG> @Inject private UserRepository userRepository;
private static final Logger log = LoggerFactory.getLogger(SimpleUserDetailsServiceImpl.class);
5,928
public DataSource dataSource() { return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) .build(); } @Bean <BUG>@Profile("test") </BUG> public DataSource testDataSource() { BasicDataSource bds = new BasicDataSource(); bds.setDriverClassName("com.mysql.jdbc.Driver");
@Profile("staging")
5,929
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); <BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); }</BUG> public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName); customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName); }
5,930
import innovimax.quixproc.datamodel.generator.AGenerator.Variation; import innovimax.quixproc.datamodel.generator.ATreeGenerator; import innovimax.quixproc.datamodel.generator.xml.AXMLGenerator; import innovimax.quixproc.datamodel.generator.xml.AXMLGenerator.SpecialType; import innovimax.quixproc.datamodel.in.QuiXEventStreamReader; <BUG>public class TestGenerator { public static void testAll(int size, Unit unit) throws QuiXException { </BUG> for (ATreeGenerator.Type gtype : EnumSet.of(ATreeGenerator.Type.HIGH_NODE_NAME_SIZE, ATreeGenerator.Type.HIGH_NODE_NAME_SIZE, ATreeGenerator.Type.HIGH_NODE_DENSITY,
enum Process { READ_BYTE, READ_BUFFER, PARSE } public static void testAll(Process process, int size, Unit unit) throws QuiXException, IOException {
5,931
public static void transformConfigFile(InputStream sourceStream, String destPath) throws Exception { try { Yaml yaml = new Yaml(); final Object loadedObject = yaml.load(sourceStream); if (loadedObject instanceof Map) { <BUG>final Map<String, Object> result = (Map<String, Object>) loadedObject; ByteArrayOutputStream nifiPropertiesOutputStream = new ByteArrayOutputStream(); writeNiFiProperties(result, nifiPropertiesOutputStream); DOMSource flowXml = createFlowXml(result); </BUG> writeNiFiPropertiesFile(nifiPropertiesOutputStream, destPath);
final Map<String, Object> loadedMap = (Map<String, Object>) loadedObject; ConfigSchema configSchema = new ConfigSchema(loadedMap); if (!configSchema.isValid()) { throw new InvalidConfigurationException("Failed to transform config file due to:" + configSchema.getValidationIssuesAsString()); } writeNiFiProperties(configSchema, nifiPropertiesOutputStream); DOMSource flowXml = createFlowXml(configSchema);
5,932
writer.println("nifi.h2.url.append=;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE"); writer.println(); writer.println("# FlowFile Repository"); writer.println("nifi.flowfile.repository.implementation=org.apache.nifi.controller.repository.WriteAheadFlowFileRepository"); writer.println("nifi.flowfile.repository.directory=./flowfile_repository"); <BUG>writer.println("nifi.flowfile.repository.partitions=" + getValueString(flowfileRepo, PARTITIONS_KEY)); writer.println("nifi.flowfile.repository.checkpoint.interval=" + getValueString(flowfileRepo,CHECKPOINT_INTERVAL_KEY)); writer.println("nifi.flowfile.repository.always.sync=" + getValueString(flowfileRepo,ALWAYS_SYNC_KEY)); </BUG> writer.println();
writer.println("nifi.flowfile.repository.partitions=" + flowfileRepoSchema.getPartitions()); writer.println("nifi.flowfile.repository.checkpoint.interval=" + flowfileRepoSchema.getCheckpointInterval()); writer.println("nifi.flowfile.repository.always.sync=" + flowfileRepoSchema.getAlwaysSync());
5,933
writer.println("# cluster manager properties (only configure for cluster manager) #"); writer.println("nifi.cluster.is.manager=false"); } catch (NullPointerException e) { throw new ConfigurationChangeException("Failed to parse the config YAML while creating the nifi.properties", e); } finally { <BUG>if (writer != null){ </BUG> writer.flush(); writer.close(); }
if (writer != null) {
5,934
writer.flush(); writer.close(); } } } <BUG>private static DOMSource createFlowXml(Map<String, Object> topLevelYaml) throws IOException, ConfigurationChangeException { </BUG> try { final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true);
private static DOMSource createFlowXml(ConfigSchema configSchema) throws IOException, ConfigurationChangeException {
5,935
docFactory.setNamespaceAware(true); final DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); final Document doc = docBuilder.newDocument(); final Element rootNode = doc.createElement("flowController"); doc.appendChild(rootNode); <BUG>Map<String, Object> processorConfig = (Map<String, Object>) topLevelYaml.get(PROCESSOR_CONFIG_KEY); addTextElement(rootNode, "maxTimerDrivenThreadCount", getValueString(processorConfig, MAX_CONCURRENT_TASKS_KEY, "1")); addTextElement(rootNode, "maxEventDrivenThreadCount", getValueString(processorConfig, MAX_CONCURRENT_TASKS_KEY, "1")); addProcessGroup(rootNode, topLevelYaml, "rootGroup"); Map<String, Object> securityProps = (Map<String, Object>) topLevelYaml.get(SECURITY_PROPS_KEY); if (securityProps != null) { String sslAlgorithm = (String) securityProps.get(SSL_PROTOCOL_KEY); if (sslAlgorithm != null && !(sslAlgorithm.isEmpty())) {</BUG> final Element controllerServicesNode = doc.createElement("controllerServices");
CorePropertiesSchema coreProperties = configSchema.getCoreProperties(); addTextElement(rootNode, "maxTimerDrivenThreadCount", String.valueOf(coreProperties.getMaxConcurrentThreads())); addTextElement(rootNode, "maxEventDrivenThreadCount", String.valueOf(coreProperties.getMaxConcurrentThreads())); addProcessGroup(rootNode, configSchema, "rootGroup"); SecurityPropertiesSchema securityProperties = configSchema.getSecurityProperties(); if (securityProperties.useSSL()) {
5,936
throw new ConfigurationChangeException("Failed to parse the config YAML while trying to add the Provenance Reporting Task", e); } } private static void addConfiguration(final Element element, Map<String, Object> elementConfig) { final Document doc = element.getOwnerDocument(); <BUG>if (elementConfig == null){ </BUG> return; } for (final Map.Entry<String, Object> entry : elementConfig.entrySet()) {
if (elementConfig == null) {
5,937
this.queryLogger = Loggers.getLogger(logger, ".query"); this.fetchLogger = Loggers.getLogger(logger, ".fetch"); queryLogger.setLevel(level); fetchLogger.setLevel(level); indexSettingsService.addListener(new ApplySettings()); <BUG>} private long parseTimeSetting(String name, long defaultNanos) { try { return componentSettings.getAsTime(name, TimeValue.timeValueNanos(defaultNanos)).nanos(); } catch (ElasticSearchParseException e) { logger.error("Could not parse setting for [{}], disabling", name); return -1; }</BUG> }
[DELETED]
5,938
"\t--reset-preferences "+tr("Reset the preferences to default")+"\n\n"+ "\t--load-preferences=<url-to-xml> "+tr("Changes preferences according to the XML file")+"\n\n"+ "\t--set=<key>=<value> "+tr("Set preference key to value")+"\n\n"+ "\t--language=<language> "+tr("Set the language")+"\n\n"+ "\t--version "+tr("Displays the JOSM version and exits")+"\n\n"+ <BUG>"\t--debug "+tr("Print debugging messages to console")+"\n\n"+ "\t--offline=<osm_api|josm_website|all> "+tr("Disable access to the given resource(s), separated by comma")+"\n\n"+</BUG> tr("options provided as Java system properties")+":\n"+ "\t-Djosm.pref=" +tr("/PATH/TO/JOSM/PREF ")+tr("Set the preferences directory")+"\n\n"+ "\t-Djosm.userdata="+tr("/PATH/TO/JOSM/USERDATA")+tr("Set the user data directory")+"\n\n"+
"\t--skip-plugins "+tr("Skip loading plugins")+"\n\n"+ "\t--offline=<osm_api|josm_website|all> "+tr("Disable access to the given resource(s), separated by comma")+"\n\n"+
5,939
NO_MAXIMIZE(false), MAXIMIZE(false), DOWNLOAD(true), DOWNLOADGPS(true), SELECTION(true), <BUG>OFFLINE(true); private String name;</BUG> private boolean requiresArgument; private Option(boolean requiresArgument) {
OFFLINE(true), SKIP_PLUGINS(false), private String name;
5,940
Main.setInitStatusListener(new InitStatusListener() { @Override public void updateStatus(String event) { monitor.indeterminateSubTask(event); } <BUG>}); Collection<PluginInformation> pluginsToLoad = PluginHandler.buildListOfPluginsToLoad(splash, monitor.createSubTaskMonitor(1, false)); if (!pluginsToLoad.isEmpty() && PluginHandler.checkAndConfirmPluginUpdate(splash)) {</BUG> monitor.subTask(tr("Updating plugins")); pluginsToLoad = PluginHandler.updatePlugins(splash, null, monitor.createSubTaskMonitor(1, false), false);
Collection<PluginInformation> pluginsToLoad = null; if (!skipLoadingPlugins) { if (!pluginsToLoad.isEmpty() && PluginHandler.checkAndConfirmPluginUpdate(splash)) {
5,941
RedisConnection<K, V> conn = super.connect(codec); conn.auth(password); return conn;</BUG> } @Override <BUG>public <K, V> RedisAsyncConnection<K, V> connectAsync(RedisCodec<K, V> codec) { RedisAsyncConnection<K, V> conn = super.connectAsync(codec); conn.auth(password); return conn;</BUG> }
public AuthenticatingRedisClient(String host, int port, String password) { super(null, RedisURI.builder().withHost(host).withPort(port).withPassword(password).build()); public AuthenticatingRedisClient(String host, String password) { super(null, RedisURI.builder().withHost(host).withPassword(password).build()); public <K, V> StatefulRedisConnection<K, V> connect(RedisCodec<K, V> codec) { return super.connect(codec);
5,942
RedisAsyncConnection<K, V> conn = super.connectAsync(codec); conn.auth(password); return conn;</BUG> } @Override <BUG>public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) { RedisPubSubConnection<K, V> conn = super.connectPubSub(codec); conn.auth(password); return conn;</BUG> }
public AuthenticatingRedisClient(String host, int port, String password) { super(null, RedisURI.builder().withHost(host).withPort(port).withPassword(password).build()); public AuthenticatingRedisClient(String host, String password) { super(null, RedisURI.builder().withHost(host).withPassword(password).build()); public <K, V> StatefulRedisConnection<K, V> connect(RedisCodec<K, V> codec) { return super.connect(codec);
5,943
this.client = RedisClient.create(clientResources, getRedisURI()); } else { this.client = RedisClient.create(getRedisURI()); } client.setDefaultTimeout(timeout, TimeUnit.MILLISECONDS); <BUG>this.internalPool = new GenericObjectPool<RedisAsyncConnection>(new LettuceFactory(client, dbIndex), poolConfig); }</BUG> private RedisURI getRedisURI() { RedisURI redisUri = isRedisSentinelAware()
this.internalPool = new GenericObjectPool<StatefulConnection<byte[], byte[]>>(new LettuceFactory(client, dbIndex),
5,944
return internalPool.borrowObject(); } catch (Exception e) { throw new PoolException("Could not get a resource from the pool", e); } } <BUG>public void returnBrokenResource(final RedisAsyncConnection<byte[], byte[]> resource) { </BUG> try { internalPool.invalidateObject(resource); } catch (Exception e) {
public void returnBrokenResource(final StatefulConnection<byte[], byte[]> resource) {
5,945
internalPool.invalidateObject(resource); } catch (Exception e) { throw new PoolException("Could not invalidate the broken resource", e); } } <BUG>public void returnResource(final RedisAsyncConnection<byte[], byte[]> resource) { </BUG> try { internalPool.returnObject(resource); } catch (Exception e) {
public void returnResource(final StatefulConnection<byte[], byte[]> resource) {
5,946
super(); this.client = client; this.dbIndex = dbIndex; } @Override <BUG>public void activateObject(PooledObject<RedisAsyncConnection> pooledObject) throws Exception { pooledObject.getObject().select(dbIndex); } public void destroyObject(final PooledObject<RedisAsyncConnection> obj) throws Exception { </BUG> try {
public void activateObject(PooledObject<StatefulConnection<byte[], byte[]>> pooledObject) throws Exception { if (pooledObject.getObject() instanceof StatefulRedisConnection) { ((StatefulRedisConnection) pooledObject.getObject()).sync().select(dbIndex); public void destroyObject(final PooledObject<StatefulConnection<byte[], byte[]>> obj) throws Exception {
5,947
package com.intellij.localvcs.core; import com.intellij.localvcs.core.storage.Content; <BUG>import com.intellij.localvcs.core.storage.Storage; import java.io.IOException;</BUG> import java.util.HashMap; import java.util.Map; public class TestStorage extends Storage {
import com.intellij.localvcs.core.storage.StoredContent; import java.io.IOException;
5,948
public void testPurgingContents() { Content c1 = s.storeContent(b("1")); Content c2 = s.storeContent(b("2")); Content c3 = s.storeContent(b("3")); s.purgeContents(Arrays.asList(c1, c3)); <BUG>assertTrue(s.isContentPurged(c1)); assertFalse(s.isContentPurged(c2)); assertTrue(s.isContentPurged(c3)); </BUG> }
assertTrue(s.isContentPurged((StoredContent)c1)); assertFalse(s.isContentPurged((StoredContent)c2)); assertTrue(s.isContentPurged((StoredContent)c3));
5,949
@Test public void testEquality() { ByteContent bc = new ByteContent("abc".getBytes()); assertTrue(bc.equals(new ByteContent("abc".getBytes()))); assertFalse(bc.equals(new ByteContent("123".getBytes()))); <BUG>Content c = new Content(null, -1) { </BUG> @Override public byte[] getBytes() { return "abc".getBytes();
Content c = new StoredContent(null, -1) {
5,950
throw new IOException(); } public void writeContent(Content content) throws IOException { int id = -1; Class c = content.getClass(); <BUG>if (c.equals(Content.class)) id = 0; </BUG> if (c.equals(UnavailableContent.class)) id = 1; myOs.writeInt(id); content.write(this);
if (c.equals(StoredContent.class)) id = 0;
5,951
public void testDoesNotEqualToAnyOtherContent() { final UnavailableContent u = new UnavailableContent(); ByteContent b = new ByteContent(new byte[]{1, 2, 3}); assertFalse(u.equals(b)); assertFalse(b.equals(u)); <BUG>assertFalse(u.equals(new Content(null, -1) { </BUG> @Override public byte[] getBytes() { return u.getBytes();
assertFalse(u.equals(new StoredContent(null, -1) {
5,952
package com.intellij.localvcs.core; import com.intellij.localvcs.core.revisions.Revision; <BUG>import com.intellij.localvcs.core.storage.Content; import org.junit.Before;</BUG> import org.junit.Test; import java.util.ArrayList; import java.util.List;
import com.intellij.localvcs.core.storage.StoredContent; import org.junit.Before;
5,953
@Override public String toString() { return new String(getBytes()); } @Override <BUG>public boolean equals(Object o) { if (o == null || !getClass().equals(o.getClass())) return false; return myId == ((Content)o).myId; } public int hashCode() { return myId;</BUG> }
[DELETED]
5,954
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
5,955
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
5,956
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
5,957
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
5,958
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
5,959
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
5,960
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
5,961
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
5,962
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
5,963
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
5,964
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
5,965
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
5,966
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
5,967
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
5,968
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
5,969
package com.intellij.ide.scopeView; <BUG>import com.intellij.ProjectTopics; import com.intellij.ide.CopyPasteManagerEx;</BUG> import com.intellij.ide.DeleteProvider; import com.intellij.ide.IdeBundle; import com.intellij.ide.IdeView;
import com.intellij.coverage.CoverageDataManager; import com.intellij.ide.CopyPasteManagerEx;
5,970
else { TreeUtil.sort(treeModel, new DependencyNodeComparator()); treeModel.reload(); } } <BUG>private static class MyTreeCellRenderer extends ColoredTreeCellRenderer { public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {</BUG> if (value instanceof PackageDependenciesNode) { PackageDependenciesNode node = (PackageDependenciesNode)value; if (expanded) {
private class MyTreeCellRenderer extends ColoredTreeCellRenderer { public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
5,971
final ItemPresentation presentation = treeNode.getPresentation(); String locationString = presentation != null ? presentation.getLocationString() : null; if (locationString != null && locationString.length() > 0) { append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES); } <BUG>else { final String location = favoritesTreeNodeDescriptor.getLocation();</BUG> if (location != null && location.length() > 0) { append(" (" + location + ")", SimpleTextAttributes.GRAY_ATTRIBUTES); }
else if (node.getParent() != null && node.getParent().getParent() == null){ final String location = favoritesTreeNodeDescriptor.getLocation();
5,972
customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString()); customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName); customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString()); customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName); customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString()); <BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName); }</BUG> public void init() { try { LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName); customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName); }
5,973
player.giveExp(expInt); } } Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim); if (income != 0D) { <BUG>income = income + ((income > 0D ? income : -income) * boost.getFinal(CurrencyType.MONEY)); if (GconfigManager.useMinimumOveralPayment && income > 0) {</BUG> double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit; if (income < maxLimit) { income = maxLimit;
income = boost.getFinalAmount(CurrencyType.MONEY, income); if (GconfigManager.useMinimumOveralPayment && income > 0) {
5,974
income = maxLimit; } } } if (pointAmount != 0D) { <BUG>pointAmount = pointAmount + ((pointAmount > 0D ? pointAmount : -pointAmount) * boost.getFinal(CurrencyType.POINTS)); if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {</BUG> double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit; if (pointAmount < maxLimit) { pointAmount = maxLimit;
pointAmount = boost.getFinalAmount(CurrencyType.POINTS, pointAmount); if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {
5,975
if (pointAmount < maxLimit) { pointAmount = maxLimit; } } } <BUG>expAmount = expAmount + ((expAmount > 0D ? expAmount : -expAmount) * boost.getFinal(CurrencyType.EXP)); if (GconfigManager.useMinimumOveralPayment && expAmount > 0) {</BUG> double maxLimit = expAmount * GconfigManager.MinimumOveralPaymentLimit; if (expAmount < maxLimit) { expAmount = maxLimit;
expAmount = boost.getFinalAmount(CurrencyType.EXP, expAmount); if (GconfigManager.useMinimumOveralPayment && expAmount > 0) {
5,976
import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredServiceProvider; import com.gamingmesh.jobs.economy.BlackholeEconomy; import com.gamingmesh.jobs.economy.VaultEconomy; <BUG>import com.gamingmesh.jobs.economy.IConomyAdapter; </BUG> public class HookEconomyTask implements Runnable { private Jobs plugin; public HookEconomyTask(Jobs plugin) {
import com.gamingmesh.jobs.economy.IConomy6Adapter;
5,977
private boolean setIConomy() { Plugin p = Bukkit.getServer().getPluginManager().getPlugin("iConomy"); if (p == null) return false; try { <BUG>Jobs.setEconomy(this.plugin, new IConomyAdapter((com.iCo6.iConomy) p)); </BUG> } catch (Exception e) { Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] UNKNOWN iConomy version."); return false;
Jobs.setEconomy(this.plugin, new IConomy6Adapter((com.iCo6.iConomy) p));
5,978
return (int) (r * 100); return r; } public double getFinal(CurrencyType BT) { return getFinal(BT, false, false); <BUG>} public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {</BUG> double r = 0D; for (BoostOf one : BoostOf.values()) { if (!map.containsKey(one))
public double getFinalAmount(CurrencyType BT, double income) { return income + ((income > 0D ? income : -income) * getFinal(BT, false, false)); public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {
5,979
pm.retrieve(sentryRole); sentryRole.removeGMPrivileges(); sentryRole.removePrivileges(); pm.deletePersistent(sentryRole); } <BUG>return new CommitContext(SERVER_UUID, 0l); } }); }</BUG> @Override
return null; return null;
5,980
import org.junit.rules.ExpectedException; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.transaction.api.Transaction; import com.palantir.atlasdb.transaction.api.TransactionTask; <BUG>import com.palantir.common.concurrent.PTExecutors; public class TransactionManagerTest extends TransactionTestSetup {</BUG> @Rule public ExpectedException exception = ExpectedException.none(); @Override
import com.palantir.remoting1.tracing.Tracers; public class TransactionManagerTest extends TransactionTestSetup {
5,981
import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import com.palantir.common.base.Throwables; import com.palantir.common.concurrent.NamedThreadFactory; import com.palantir.common.concurrent.PTExecutors; <BUG>import com.palantir.exception.PalantirInterruptedException; public class InterruptibleProxy implements DelegatingInvocationHandler { </BUG> private final CancelDelegate cancel; @SuppressWarnings("unchecked")
import com.palantir.remoting1.tracing.Tracers; public final class InterruptibleProxy implements DelegatingInvocationHandler {
5,982
import com.palantir.atlasdb.keyvalue.api.Value; import com.palantir.atlasdb.keyvalue.impl.Cells; import com.palantir.atlasdb.table.description.TableMetadata; import com.palantir.common.base.Throwables; import com.palantir.common.concurrent.PTExecutors; <BUG>import com.palantir.common.visitor.Visitor; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;</BUG> @SuppressFBWarnings("SLF4J_ILLEGAL_PASSED_CLASS") public final class CQLKeyValueServices { private static final Logger log = LoggerFactory.getLogger(CQLKeyValueService.class); // not a typo
import com.palantir.remoting1.tracing.Tracers; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
5,983
} enum TransactionType { NONE, LIGHTWEIGHT_TRANSACTION_REQUIRED } <BUG>private final ExecutorService traceRetrievalExec = PTExecutors.newFixedThreadPool(8); </BUG> private static final int MAX_TRIES = 20; private static final long TRACE_RETRIEVAL_MS_BETWEEN_TRIES = 500; @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
private final ExecutorService traceRetrievalExec = Tracers.wrap(PTExecutors.newFixedThreadPool(8));
5,984
import com.palantir.atlasdb.transaction.api.TransactionSerializableConflictException; import com.palantir.common.base.BatchingVisitable; import com.palantir.common.base.BatchingVisitables; import com.palantir.common.base.Throwables; import com.palantir.common.concurrent.PTExecutors; <BUG>import com.palantir.lock.LockRefreshToken; public abstract class AbstractSerializableTransactionTest extends AbstractTransactionTest {</BUG> @Override protected TransactionManager getManager() { return new SerializableTransactionManager(
import com.palantir.remoting1.tracing.Tracers; public abstract class AbstractSerializableTransactionTest extends AbstractTransactionTest {
5,985
t1.commit(); fail(); } catch (TransactionSerializableConflictException e) { } } <BUG>@Test(expected=TransactionFailedRetriableException.class) </BUG> public void testConcurrentWriteSkew() throws InterruptedException, BrokenBarrierException { Transaction t0 = startTransaction(); put(t0, "row1", "col1", "100");
@Test public void testClassicWriteSkew() {
5,986
put(t0, "row1", "col1", "100"); put(t0, "row2", "col1", "100"); t0.commit(); final CyclicBarrier barrier = new CyclicBarrier(2); final Transaction t1 = startTransaction(); <BUG>ExecutorService exec = PTExecutors.newCachedThreadPool(); Future<?> f = exec.submit( new Callable<Void>() { @Override</BUG> public Void call() throws Exception {
Transaction t2 = startTransaction();
5,987
import com.palantir.atlasdb.transaction.service.TransactionService; import com.palantir.atlasdb.transaction.service.TransactionServices; import com.palantir.common.concurrent.PTExecutors; import com.palantir.lock.LockClient; import com.palantir.lock.LockServerOptions; <BUG>import com.palantir.lock.impl.LockServiceImpl; import com.palantir.timestamp.InMemoryTimestampService;</BUG> import com.palantir.timestamp.TimestampService; public class AtlasDbTestCase { protected static LockClient lockClient;
import com.palantir.remoting1.tracing.Tracers; import com.palantir.timestamp.InMemoryTimestampService;
5,988
import java.util.concurrent.ExecutorService; import org.junit.After; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.sweep.AbstractSweeperTest; <BUG>import com.palantir.common.concurrent.PTExecutors; public class InMemorySweeperTest extends AbstractSweeperTest {</BUG> private ExecutorService exec; @Override @After
import com.palantir.remoting1.tracing.Tracers; public class InMemorySweeperTest extends AbstractSweeperTest {
5,989
import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.Value; import com.palantir.common.annotation.Output; import com.palantir.common.base.ClosableIterator; import com.palantir.common.base.ClosableIterators; <BUG>import com.palantir.common.concurrent.PTExecutors; import com.palantir.util.paging.TokenBackedBasicResultsPage;</BUG> @ThreadSafe public class InMemoryKeyValueService extends AbstractKeyValueService { private final ConcurrentMap<TableReference, Table> tables = Maps.newConcurrentMap();
import com.palantir.remoting1.tracing.Tracers; import com.palantir.util.paging.TokenBackedBasicResultsPage;
5,990
private final ConcurrentMap<TableReference, Table> tables = Maps.newConcurrentMap(); private final ConcurrentMap<TableReference, byte[]> tableMetadata = Maps.newConcurrentMap(); private volatile boolean createTablesAutomatically; public InMemoryKeyValueService(boolean createTablesAutomatically) { this(createTablesAutomatically, <BUG>PTExecutors.newFixedThreadPool(16, PTExecutors.newNamedThreadFactory(true))); </BUG> } public InMemoryKeyValueService(boolean createTablesAutomatically, ExecutorService executor) {
Tracers.wrap(PTExecutors.newFixedThreadPool(16, PTExecutors.newNamedThreadFactory(true))));
5,991
import java.util.NavigableMap; import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; import java.util.TreeMap; <BUG>import java.util.concurrent.ScheduledThreadPoolExecutor; </BUG> import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Consumer;
import java.util.concurrent.ScheduledExecutorService;
5,992
import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.cassandra.CassandraClientFactory.ClientCreationFailedException; import com.palantir.atlasdb.util.MetricsManager; import com.palantir.common.base.FunctionCheckedException; import com.palantir.common.base.Throwables; <BUG>import com.palantir.common.concurrent.PTExecutors; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;</BUG> public class CassandraClientPool { private static final Logger log = LoggerFactory.getLogger(CassandraClientPool.class); @VisibleForTesting
import com.palantir.remoting1.tracing.Tracers; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
5,993
static final int MAX_TRIES_TOTAL = 6; volatile RangeMap<LightweightOppToken, List<InetSocketAddress>> tokenMap = ImmutableRangeMap.of(); Map<InetSocketAddress, Long> blacklistedHosts = Maps.newConcurrentMap(); Map<InetSocketAddress, CassandraClientPoolingContainer> currentPools = Maps.newConcurrentMap(); final CassandraKeyValueServiceConfig config; <BUG>final ScheduledThreadPoolExecutor refreshDaemon; </BUG> private final MetricsManager metricsManager = new MetricsManager(); private final RequestMetrics aggregateMetrics = new RequestMetrics(null); private final Map<InetSocketAddress, RequestMetrics> metricsByHost = new HashMap<>();
final ScheduledExecutorService refreshDaemon;
5,994
import com.google.common.primitives.UnsignedBytes; import com.palantir.atlasdb.AtlasDbConstants; import com.palantir.atlasdb.encoding.PtBytes; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.TableReference; <BUG>import com.palantir.common.concurrent.PTExecutors; import com.palantir.util.Pair;</BUG> @Ignore public final class RocksDbKeyValuePerfTest { private static final TableReference T_TABLE = TableReference.createWithEmptyNamespace("t");
import com.palantir.remoting1.tracing.Tracers; import com.palantir.util.Pair;
5,995
private static final TableReference T_TABLE = TableReference.createWithEmptyNamespace("t"); private static final Random RAND = new Random(); private static final int KEY_SIZE = 16; private static final int VALUE_SIZE = 100; private static final int BATCH_SIZE = 1000; <BUG>private final ExecutorService executor = PTExecutors.newCachedThreadPool(); </BUG> private RocksDbKeyValueService db = null; @Before public void setUp() throws IOException {
private final ExecutorService executor = Tracers.wrap(PTExecutors.newCachedThreadPool());
5,996
import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; <BUG>import com.palantir.common.concurrent.PTExecutors; public final class CassandraKeyValueServiceConfigManager {</BUG> private static final Logger log = LoggerFactory.getLogger(CassandraKeyValueServiceConfigManager.class); private final Supplier<CassandraKeyValueServiceConfig> configSupplier; private final ScheduledExecutorService refreshExecutor;
import com.palantir.remoting1.tracing.Tracers; public final class CassandraKeyValueServiceConfigManager {
5,997
Supplier<CassandraKeyValueServiceConfig> configSupplier, long initDelay, long refreshInterval) { CassandraKeyValueServiceConfigManager ret = new CassandraKeyValueServiceConfigManager( configSupplier, <BUG>PTExecutors.newScheduledThreadPool(1), </BUG> initDelay, refreshInterval); ret.init();
Tracers.wrap(PTExecutors.newScheduledThreadPool(1)),
5,998
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.palantir.atlasdb.keyvalue.api.TableReference; <BUG>import com.palantir.common.concurrent.PTExecutors; public class HeartbeatService {</BUG> private static final Logger log = LoggerFactory.getLogger(HeartbeatService.class); public static final String START_BEATING_ERR_MSG = "Can't start new heartbeat because there is an" + " existing heartbeat. Only one heartbeat per lock allowed.";
import com.palantir.remoting1.tracing.Tracers; public class HeartbeatService {
5,999
this.writeConsistency = writeConsistency; this.heartbeatExecutorService = null; } public synchronized void startBeatingForLock(long lockId) { Preconditions.checkState(heartbeatExecutorService == null, START_BEATING_ERR_MSG); <BUG>heartbeatExecutorService = PTExecutors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("Atlas Schema Lock Heartbeat-" + lockTable + "-%d").build()); </BUG> heartbeatExecutorService.scheduleAtFixedRate(
heartbeatExecutorService = Tracers.wrap(PTExecutors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("Atlas Schema Lock Heartbeat-" + lockTable + "-%d").build()));
6,000
import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.Value; import com.palantir.common.base.Throwables; import com.palantir.common.collect.Maps2; import com.palantir.common.concurrent.NamedThreadFactory; <BUG>import com.palantir.common.concurrent.PTExecutors; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;</BUG> @SuppressFBWarnings("SLF4J_ILLEGAL_PASSED_CLASS") public abstract class AbstractKeyValueService implements KeyValueService { private static final Logger log = LoggerFactory.getLogger(KeyValueService.class);
import com.palantir.remoting1.tracing.Tracers; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;