auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testReadValidFile() { Map<Integer, File> filters = new HashMap<>(); filters.put(1101, TILE_1101_FILTER); LocsFileReader locsFileReader = new LocsFileReader(new File("testdata/picard/illumina/readerTests/s_1_6.locs")); List<AbstractIlluminaPositionFileReader.PositionInfo> locs = locsFileReader.toList(); final CbclReader reader = new CbclReader(Arrays.asList(PASSING_CBCL_C1_1, PASSING_CBCL_C2_1), filters, new int[]{2}, 1101, locs, new int[]{1, 2}, false); int i = 0; while (reader.hasNext()) { final BclData bv = reader.next(); for (int cluster = 0; cluster < bv.bases.length; cluster++) { for (int cycle = 0; cycle < bv.bases[cluster].length; cycle++) { String actual = new String(new byte[]{bv.bases[cluster][cycle]}); String expected = new String(new char[]{expectedBases[i]}); Assert.assertEquals(actual, expected, "For cluster " + cluster + " cycle " + cycle + ","); Assert.assertEquals(bv.qualities[cluster][cycle], expectedQuals[i], "For cluster " + cluster + " cycle " + cycle + ","); i++; } } } Assert.assertEquals(i, expectedBases.length); reader.close(); }

Target:
public void testReadValidFile() { final Map<Integer, File> filters = new HashMap<>(); filters.put(1101, TILE_1101_FILTER); final LocsFileReader locsFileReader = new LocsFileReader(new File("testdata/picard/illumina/readerTests/s_1_6.locs")); final List<AbstractIlluminaPositionFileReader.PositionInfo> locs = locsFileReader.toList(); final CbclReader reader = new CbclReader(Arrays.asList(PASSING_CBCL_C1_1, PASSING_CBCL_C2_1), filters, new int[]{2}, 1101, locs, new int[]{1, 2}, false); int i = 0; while (reader.hasNext()) { final BclData bv = reader.next(); for (int cluster = 0; cluster < bv.bases.length; cluster++) { for (int cycle = 0; cycle < bv.bases[cluster].length; cycle++) { final String actual = new String(new byte[]{bv.bases[cluster][cycle]}); final String expected = new String(new char[]{expectedBases[i]}); Assert.assertEquals(actual, expected, "For cluster " + cluster + " cycle " + cycle + ","); Assert.assertEquals(bv.qualities[cluster][cycle], expectedQuals[i], "For cluster " + cluster + " cycle " + cycle + ","); i++; } } } Assert.assertEquals(i, expectedBases.length); reader.close(); }
Source:
public void stream() throws InterruptedException { Runtime.getRuntime().addShutdownHook(new Thread(() -> onShutdown())); streamInternal(new StartingState()); }

Target:
public void stream() throws InterruptedException { Runtime.getRuntime().addShutdownHook(new Thread(() -> onNodeShutdown())); streamInternal(new StartingState()); }
Source:
public boolean sourceStatus(String servicePID) { try { List<Source> sources = helper.getSources(); for (Source source : sources) { if (source instanceof ConfiguredService) { ConfiguredService cs = (ConfiguredService) source; try { Configuration config = helper.getConfiguration(cs); if (config != null && config.getProperties().get("service.pid").equals(servicePID)) { final String sourceId = source.getId(); return sourceIsAvailable(sourceId); } } catch (IOException e) { LOGGER.info("Couldn't find configuration for source '{}'", source.getId()); } } else { LOGGER.info("Source '{}' not a configured service", source.getId()); } } } catch (InvalidSyntaxException e) { LOGGER.info("Could not get service reference list"); } return false; }

Target:
public int sourceStatus(String servicePID) { try { List<Source> sources = helper.getSources(); for (Source source : sources) { if (source instanceof ConfiguredService) { ConfiguredService cs = (ConfiguredService) source; try { Configuration config = helper.getConfiguration(cs); if (config != null && config.getProperties().get("service.pid").equals(servicePID)) { return sourceIsAvailable(source.getId()); } } catch (IOException e) { LOGGER.info("Couldn't find configuration for source '{}'", source.getId()); } } else { LOGGER.info("Source '{}' not a configured service", source.getId()); } } } catch (InvalidSyntaxException e) { LOGGER.info("Could not get service reference list"); } return UNAVAILABLE; }
Source:
public void start() throws StoreException { verifyConfigs(); logger.info("Starting store manager"); for (ReplicaId replica : replicas) { File file = new File(replica.getMountPath()); if (!file.exists()) { throw new IllegalStateException("Mount path does not exist " + replica.getMountPath()); } Store store = new BlobStore(config, scheduler, registry, replica.getReplicaPath(), replica.getCapacityInBytes(), factory, recovery, hardDelete, time); store.start(); stores.put(replica.getPartitionId(), store); } logger.info("Starting store manager complete"); }

Target:
public void start() throws StoreException { logger.info("Starting store manager"); for (ReplicaId replica : replicas) { File file = new File(replica.getMountPath()); if (!file.exists()) { throw new IllegalStateException("Mount path does not exist " + replica.getMountPath()); } Store store = new BlobStore(config, scheduler, registry, replica.getReplicaPath(), replica.getCapacityInBytes(), factory, recovery, hardDelete, time); store.start(); stores.put(replica.getPartitionId(), store); } logger.info("Starting store manager complete"); }
Source:
public Collection<MailAddress> match(Mail mail) throws javax.mail.MessagingException { String mimeType; try { mimeType = getMimeTypeFromMessage(mail.getMessage()); } catch (MimeTypeParseException e) { mimeType = null; } return (content_types.contains(mimeType)) ? mail.getRecipients() : null; }

Target:
public Collection<MailAddress> match(Mail mail) throws javax.mail.MessagingException { Optional<String> mimeTypes = getMimeTypeFromMessage(mail.getMessage()); return mimeTypes.filter(acceptedContentTypes::contains) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); }
Source:
void execute() throws AzureBlobFileSystemException { String latencyHeader = this.client.getAbfsPerfTracker().getClientLatency(); if (latencyHeader != null && !latencyHeader.isEmpty()) { requestHeaders.add(new AbfsHttpHeader("x-ms-abfs-client-latency", latencyHeader)); } int retryCount = 0; while (!executeHttpOperation(retryCount++)) { try { Thread.sleep(client.getRetryPolicy().getRetryInterval(retryCount)); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } if (result.getStatusCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { throw new AbfsRestOperationException(result.getStatusCode(), result.getStorageErrorCode(), result.getStorageErrorMessage(), null, result); } }

Target:
void execute() throws AzureBlobFileSystemException { String latencyHeader = this.client.getAbfsPerfTracker().getClientLatency(); if (latencyHeader != null && !latencyHeader.isEmpty()) { AbfsHttpHeader httpHeader = new AbfsHttpHeader(HttpHeaderConfigurations.X_MS_ABFS_CLIENT_LATENCY, latencyHeader); requestHeaders.add(httpHeader); } int retryCount = 0; while (!executeHttpOperation(retryCount++)) { try { Thread.sleep(client.getRetryPolicy().getRetryInterval(retryCount)); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } if (result.getStatusCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { throw new AbfsRestOperationException(result.getStatusCode(), result.getStorageErrorCode(), result.getStorageErrorMessage(), null, result); } }
Source:
public void shouldCallAdviceForAnnotatedBean() throws Throwable { this.annotatedTestBean.testMethod(); List<Span> spans = new ArrayList<>(this.accumulator.getSpans()); then(new ListOfSpans(spans)).hasSize(1).hasASpanWithName("testMethod"); then(ExceptionUtils.getLastException()).isNull(); }

Target:
public void shouldCallAdviceForAnnotatedBean() throws Throwable { this.annotatedTestBean.testMethod(); List<Span> spans = new ArrayList<>(this.accumulator.getSpans()); then(new ListOfSpans(spans)).hasSize(1).hasASpanWithName("test-method"); then(ExceptionUtils.getLastException()).isNull(); }
Source:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { if ((lastKillTime + period) < System.currentTimeMillis()) { lastKillTime = System.currentTimeMillis(); DatasourceWhitelist whitelist = whitelistRef.get(); for (DruidDataSource dataSource : params.getDataSources()) { if (whitelist == null || whitelist.contains(dataSource.getName())) { indexingServiceClient.killSegments(dataSource.getName(), UBER_INTERVAL); } } } return params; }

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { Set<String> whitelist = params.getCoordinatorDynamicConfig().getKillDataSourceWhitelist(); if (whitelist != null && whitelist.size() > 0 && (lastKillTime + period) < System.currentTimeMillis()) { lastKillTime = System.currentTimeMillis(); for (String dataSource : whitelist) { final Interval intervalToKill = findIntervalForKillTask(dataSource, maxSegmentsToKill); if (intervalToKill != null) { try { indexingServiceClient.killSegments(dataSource, intervalToKill); } catch (Exception ex) { log.error(ex, "Failed to submit kill task for dataSource [%s]", dataSource); if (Thread.currentThread().isInterrupted()) { log.warn("skipping kill task scheduling because thread is interrupted."); break; } } } } } return params; }
Source:
public StreamingPropertyValueRef put(String elementId, String key, String name, Visibility visibility, long timestamp, StreamingPropertyValue value) { StreamAndLength streamAndLength = streamAndLength(value.getInputStream(), value.getLength()); String id = makeId(elementId, key, name, visibility, timestamp); try (Handle handle = dbi.open()) { int count = handle.createQuery(String.format( "select count(*) from %s where %s = ?", tableName, KEY_COLUMN_NAME)) .bind(0, id) .map(IntegerMapper.FIRST) .first(); if (count == 0) { handle.execute(String.format( "insert into %s (%s, %s, %s, %s) values (?, ?, ?, ?)", tableName, KEY_COLUMN_NAME, VALUE_COLUMN_NAME, VALUE_TYPE_COLUMN_NAME, VALUE_LENGTH_COLUMN_NAME), id, streamAndLength.inputStream, value.getValueType().getName(), streamAndLength.length); } else { handle.execute(String.format( "update %s set %s = ?, %s = ? where %s = ?", tableName, VALUE_COLUMN_NAME, VALUE_LENGTH_COLUMN_NAME, KEY_COLUMN_NAME), streamAndLength.inputStream, streamAndLength.length, id); } return new SqlStreamingPropertyValueRef(value, elementId, key, name, visibility, timestamp); } finally { try { streamAndLength.inputStream.close(); } catch (IOException ex) { Throwables.propagate(ex); } } }

Target:
public StreamingPropertyValueRef put(String elementId, String key, String name, Visibility visibility, long timestamp, StreamingPropertyValue value) { StreamAndLength streamAndLength = streamAndLength(value.getInputStream(), value.getLength()); String id = makeId(elementId, key, name, visibility, timestamp); try (Handle handle = dbi.open()) { int count = handle.createQuery(String.format( "select count(*) from %s where %s = ?", tableName, KEY_COLUMN_NAME)) .bind(0, id) .map(IntegerMapper.FIRST) .first(); if (count == 0) { handle.execute(String.format( "insert into %s (%s, %s, %s, %s) values (?, ?, ?, ?)", tableName, KEY_COLUMN_NAME, VALUE_COLUMN_NAME, VALUE_TYPE_COLUMN_NAME, VALUE_LENGTH_COLUMN_NAME), id, streamAndLength.inputStream, value.getValueType().getName(), streamAndLength.length); } else { handle.execute(String.format( "update %s set %s = ?, %s = ? where %s = ?", tableName, VALUE_COLUMN_NAME, VALUE_LENGTH_COLUMN_NAME, KEY_COLUMN_NAME), streamAndLength.inputStream, streamAndLength.length, id); } return new SqlStreamingPropertyValueRef(value, elementId, key, name, visibility, timestamp); } finally { try { streamAndLength.inputStream.close(); } catch (IOException ex) { throw new VertexiumException(ex); } } }
Source:
private static Color createColor(String symbolicName) { IPreferenceStore store = getPreferenceStore(); RGB rgb = null; if (store.contains(symbolicName)) { if (store.isDefault(symbolicName)) rgb = PreferenceConverter.getDefaultColor(store, symbolicName); else rgb = PreferenceConverter.getColor(store, symbolicName); if (rgb != null) { JFaceResources.getColorRegistry().put(symbolicName, rgb); return JFaceResources.getColorRegistry().get(symbolicName); } } return null; }

Target:
private static Color createColor(String symbolicName) { IPreferenceStore store = getPreferenceStore(); if (store.contains(symbolicName)) { RGB rgb = (store.isDefault(symbolicName)) ? PreferenceConverter.getDefaultColor(store, symbolicName) : PreferenceConverter.getColor(store, symbolicName); if (null != rgb) { JFaceResources.getColorRegistry().put(symbolicName, rgb); return JFaceResources.getColorRegistry().get(symbolicName); } } return null; }
Source:
private void mapProject(final IProject source, final IProjectDescription description, final IProgressMonitor monitor, IPath gitDir) throws CoreException, TeamException { IProject destination = source.getWorkspace().getRoot() .getProject(description.getName()); RepositoryMapping repositoryMapping = RepositoryMapping.create(destination, gitDir.toFile()); if (repositoryMapping != null) { GitProjectData projectData = new GitProjectData(destination); projectData.setRepositoryMappings(Arrays.asList(repositoryMapping)); projectData.store(); GitProjectData.add(destination, projectData); RepositoryProvider.map(destination, GitProvider.class.getName()); destination.refreshLocal(IResource.DEPTH_INFINITE, SubMonitor.convert(monitor, 50)); } }

Target:
private void mapProject(final IProject source, final IProjectDescription description, final IProgressMonitor monitor, IPath gitDir) throws CoreException, TeamException { IProject destination = source.getWorkspace().getRoot() .getProject(description.getName()); RepositoryMapping repositoryMapping = RepositoryMapping.create(destination, gitDir.toFile()); if (repositoryMapping != null) { GitProjectData projectData = new GitProjectData(destination); projectData.setRepositoryMappings(Arrays.asList(repositoryMapping)); projectData.store(); GitProjectData.add(destination, projectData); RepositoryProvider.map(destination, GitProvider.class.getName()); destination.refreshLocal(IResource.DEPTH_INFINITE, monitor); } }
Source:
private void updateSmudgedEntries() throws IOException { TreeWalk walk = new TreeWalk(repository); List<String> pathes = new ArrayList<String>(128); try { for (int i = 0; i < entryCnt; i++) if (sortedEntries[i].isSmudged()) pathes.add(sortedEntries[i].getPathString()); if (pathes.isEmpty()) return; walk.setFilter(PathFilterGroup.createFromStrings(pathes)); DirCacheIterator iIter = new DirCacheIterator(this); FileTreeIterator fIter = new FileTreeIterator(repository); walk.addTree(iIter); walk.addTree(fIter); walk.setRecursive(true); while (walk.next()) { iIter = walk.getTree(0, DirCacheIterator.class); if (iIter == null) continue; fIter = walk.getTree(1, FileTreeIterator.class); if (fIter == null) continue; DirCacheEntry entry = iIter.getDirCacheEntry(); if (entry.isSmudged() && iIter.idEqual(fIter)) { entry.setLength(fIter.getEntryLength()); entry.setLastModified(fIter.getEntryLastModified()); } } } finally { walk.release(); } }

Target:
private void updateSmudgedEntries() throws IOException { TreeWalk walk = new TreeWalk(repository); List<String> paths = new ArrayList<String>(128); try { for (int i = 0; i < entryCnt; i++) if (sortedEntries[i].isSmudged()) paths.add(sortedEntries[i].getPathString()); if (paths.isEmpty()) return; walk.setFilter(PathFilterGroup.createFromStrings(paths)); DirCacheIterator iIter = new DirCacheIterator(this); FileTreeIterator fIter = new FileTreeIterator(repository); walk.addTree(iIter); walk.addTree(fIter); walk.setRecursive(true); while (walk.next()) { iIter = walk.getTree(0, DirCacheIterator.class); if (iIter == null) continue; fIter = walk.getTree(1, FileTreeIterator.class); if (fIter == null) continue; DirCacheEntry entry = iIter.getDirCacheEntry(); if (entry.isSmudged() && iIter.idEqual(fIter)) { entry.setLength(fIter.getEntryLength()); entry.setLastModified(fIter.getEntryLastModified()); } } } finally { walk.release(); } }
Source:
public boolean isValidVariableName(final String source) { return FEELParser.checkVariableName(source).isEmpty(); }

Target:
public boolean isValidVariableName(final String source) { return FEELParser.isVariableNameValid(source); }
Source:
public void offsetSerDeTest() throws IOException { String name = UtilsTest.getRandomString(10); long offset = Utils.getRandomLong(new Random(), Long.MAX_VALUE); Offset logOffset = new Offset(name, offset); byte[] serialized = logOffset.toBytes(); Offset deserializedOffset = Offset.fromBytes(new DataInputStream(new ByteBufferInputStream(ByteBuffer.wrap(serialized)))); assertEquals("Original offset 'name' does not match with the deserialized offset", logOffset.getName(), deserializedOffset.getName()); assertEquals("Original offset 'offset' does not match with the deserialized offset", logOffset.getName(), deserializedOffset.getName()); assertEquals("Original offset does not match with the deserialized offset", logOffset, deserializedOffset); assertEquals("Hashcode doesn't match", logOffset.hashCode(), deserializedOffset.hashCode()); }

Target:
public void offsetSerDeTest() throws IOException { String name = UtilsTest.getRandomString(10); long offset = Utils.getRandomLong(new Random(), Long.MAX_VALUE); Offset logOffset = new Offset(name, offset); byte[] serialized = logOffset.toBytes(); Offset deserializedOffset = Offset.fromBytes(new DataInputStream(new ByteBufferInputStream(ByteBuffer.wrap(serialized)))); assertEquals("Original offset 'name' does not match with the deserialized offset", name, deserializedOffset.getName()); assertEquals("Original offset 'offset' does not match with the deserialized offset", offset, deserializedOffset.getOffset()); assertEquals("Original offset does not match with the deserialized offset", logOffset, deserializedOffset); assertEquals("Hashcode doesn't match", logOffset.hashCode(), deserializedOffset.hashCode()); }
Source:
public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = SanitizationHelper.sanitizeForHtml(email); if (email.isEmpty()) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE_EMPTY_STRING, email, EMAIL_FIELD_NAME, REASON_EMPTY, EMAIL_MAX_LENGTH); } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }

Target:
public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = SanitizationHelper.sanitizeForHtml(email); if (email.isEmpty()) { return getPopulatedEmptyStringErrorMessage(EMAIL_ERROR_MESSAGE_EMPTY_STRING, EMAIL_FIELD_NAME, EMAIL_MAX_LENGTH); } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }
Source:
private File guessWorkTreeOrFail() throws IOException { final Config cfg = getConfig(); String path = cfg.getString(CONFIG_CORE_SECTION, null, CONFIG_KEY_WORKTREE); if (path != null) return safeFS().resolve(getGitDir(), path).getCanonicalFile(); if (cfg.getString(CONFIG_CORE_SECTION, null, CONFIG_KEY_BARE) != null) { if (cfg.getBoolean(CONFIG_CORE_SECTION, CONFIG_KEY_BARE, true)) { setBare(); return null; } return getGitDir().getParentFile(); } if (getGitDir().getName().equals(DOT_GIT)) { return getGitDir().getParentFile(); } setBare(); return null; }

Target:
private File guessWorkTreeOrFail() throws IOException { final Config cfg = getConfig(); String path = cfg.getString(CONFIG_CORE_SECTION, null, CONFIG_KEY_WORKTREE); if (path != null) return safeFS().resolve(getGitDir(), path).getCanonicalFile(); if (cfg.getString(CONFIG_CORE_SECTION, null, CONFIG_KEY_BARE) != null) { if (cfg.getBoolean(CONFIG_CORE_SECTION, CONFIG_KEY_BARE, true)) { setBare(); return null; } return getGitDir().getParentFile(); } if (getGitDir().getName().equals(DOT_GIT)) { return getGitDir().getParentFile(); } if (getGitDir() != null) { File gitDirFile = new File(getGitDir(), "gitdir"); if (gitDirFile.isFile()) { String workDirPath = new String(IO.readFully(gitDirFile)).trim(); File workTreeDotGitFile = new File(workDirPath); if (!workTreeDotGitFile.isAbsolute()) { workTreeDotGitFile = new File(getGitDir(), workDirPath) .getCanonicalFile(); } if (workTreeDotGitFile != null) { return workTreeDotGitFile.getParentFile(); } } } setBare(); return null; }
Source:
public void onDisable() { this.getServer().getMessenger().unregisterIncomingPluginChannel(this, "vanishStatus"); this.getServer().getMessenger().unregisterOutgoingPluginChannel(this, "vanishStatus"); for (final Player player : VanishPlugin.this.getServer().getOnlinePlayers()) { if (player != null) { if (this.manager.isVanished(player)) { player.sendMessage(ChatColor.DARK_AQUA + "[Vanish] You have been forced visible by a reload."); } } } VanishNoPacket.setInstance(null); this.hookManager.onDisable(); this.manager.onPluginDisable(); this.getServer().getScheduler().cancelTasks(this); Debuggle.nah(); this.getLogger().info("v${project.version} unloaded."); }

Target:
public void onDisable() { for (final Player player : VanishPlugin.this.getServer().getOnlinePlayers()) { if (player != null) { if (this.manager.isVanished(player)) { player.sendMessage(ChatColor.DARK_AQUA + "[Vanish] You have been forced visible by a reload."); } } } VanishNoPacket.setInstance(null); this.hookManager.onDisable(); this.manager.onPluginDisable(); this.getServer().getScheduler().cancelTasks(this); Debuggle.nah(); this.getLogger().info("v${project.version} unloaded."); }
Source:
public DataTable transpose() { List<List<String>> transposed = new ArrayList<List<String>>(); for (int i = 0; i < gherkinRows.size(); i++) { Row gherkinRow = gherkinRows.get(i); for (int j = 0; j < gherkinRow.getCells().size(); j++) { List<String> row = null; if (j < transposed.size()) { row = transposed.get(j); } if (row == null) { row = new ArrayList<String>(); transposed.add(row); } while (i > row.size()) { row.add(new String()); } row.add(gherkinRow.getCells().get(j)); } } return new DataTable(this.gherkinRows, transposed, this.tableConverter); }

Target:
public DataTable transpose() { List<List<String>> transposed = new ArrayList<List<String>>(); for (int i = 0; i < gherkinRows.size(); i++) { Row gherkinRow = gherkinRows.get(i); for (int j = 0; j < gherkinRow.getCells().size(); j++) { List<String> row = null; if (j < transposed.size()) { row = transposed.get(j); } if (row == null) { row = new ArrayList<String>(); transposed.add(row); } row.add(gherkinRow.getCells().get(j)); } } return new DataTable(this.gherkinRows, transposed, this.tableConverter); }
Source:
protected CommunicationGroup createAndStoreGroup(final Node representative, final int index) { final boolean isSingleton = sccInformationProvider.sccs.getPartition(representative).size() == 1; final boolean isReceiver = representative instanceof Receiver; final boolean isDefault = isReceiver && ((Receiver) representative).getMailbox() instanceof AdaptiveMailbox; final boolean isInDREDMode = representative instanceof RederivableNode && ((RederivableNode) representative).isInDREDMode(); CommunicationGroup group = null; if (isSingleton && (isDefault || !isReceiver) && !isInDREDMode) { group = new CommunicationGroup.Singleton(this, representative, index); } else { group = new CommunicationGroup.Recursive(this, representative, index); } addToGroup(representative, group); return group; }

Target:
protected CommunicationGroup createAndStoreGroup(final Node representative, final int index) { final boolean isSingleton = sccInformationProvider.sccs.getPartition(representative).size() == 1; final boolean isReceiver = representative instanceof Receiver; final boolean isPosetIndifferent = isReceiver && ((Receiver) representative).getMailbox() instanceof AdaptiveMailbox; final boolean isInDRedMode = representative instanceof RederivableNode && ((RederivableNode) representative).isInDRedMode(); CommunicationGroup group = null; if (isSingleton && (isPosetIndifferent || !isReceiver) && !isInDRedMode) { group = new CommunicationGroup.Singleton(this, representative, index); } else { group = new CommunicationGroup.Recursive(this, representative, index); } addToGroup(representative, group); return group; }
Source:
public void required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError() throws Throwable { optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() { @Override public TestSetup apply(Long aLong) throws Throwable { return new TestSetup(env, processorBufferSize) {{ final ManualSubscriberWithErrorCollection<T> sub1 = new ManualSubscriberWithErrorCollection<T>(env); env.subscribe(processor, sub1); final ManualSubscriberWithErrorCollection<T> sub2 = new ManualSubscriberWithErrorCollection<T>(env); env.subscribe(processor, sub2); final Exception ex = new RuntimeException("Test exception"); if (doesCoordinatedEmission()) { sub1.request(1); sub2.request(1); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x); expectNextElement(sub2, x); sub1.request(1); sub2.request(1); sendError(ex); } else { sub1.request(1); expectRequest(); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x); sub1.request(1); sendError(ex); } sub1.expectError(ex); sub2.expectError(ex); env.verifyNoAsyncErrorsNoDelay(); }}; } }); }

Target:
public void required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError() throws Throwable { optionalMultipleSubscribersTest(2, new Function<Long,TestSetup>() { @Override public TestSetup apply(Long aLong) throws Throwable { return new TestSetup(env, processorBufferSize) {{ final ManualSubscriberWithErrorCollection<T> sub1 = new ManualSubscriberWithErrorCollection<T>(env); env.subscribe(processor, sub1); final ManualSubscriberWithErrorCollection<T> sub2 = new ManualSubscriberWithErrorCollection<T>(env); env.subscribe(processor, sub2); final Exception ex = new RuntimeException("Test exception"); if (doesCoordinatedEmission()) { sub1.request(1); sub2.request(1); expectRequest(); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x); expectNextElement(sub2, x); sub1.request(1); sub2.request(1); } else { sub1.request(1); expectRequest(env.defaultTimeoutMillis(), "If the Processor coordinates requests/emissions when having multiple Subscribers" + " at once, please override doesCoordinatedEmission() to return true in this " + "IdentityProcessorVerification to allow this test to pass."); final T x = sendNextTFromUpstream(); expectNextElement(sub1, x, "If the Processor coordinates requests/emissions when having multiple Subscribers" + " at once, please override doesCoordinatedEmission() to return true in this " + "IdentityProcessorVerification to allow this test to pass."); sub1.request(1); } sendError(ex); sub1.expectError(ex); sub2.expectError(ex); env.verifyNoAsyncErrorsNoDelay(); }}; } }); }
Source:
boolean isTscFrequencyNeeded() { return vm.getClusterArch().getFamily().equals(ArchitectureType.x86) && vm.getVmType().equals(VmType.HighPerformance) && vm.getMigrationSupport() == MigrationSupport.MIGRATABLE; }

Target:
boolean isTscFrequencyNeeded() { return vm.getClusterArch().getFamily().equals(ArchitectureType.x86) && vm.getVmType().equals(VmType.HighPerformance) && vm.getMigrationSupport() == MigrationSupport.MIGRATABLE && cpuFlagsSupplier.get().contains("nonstop_tsc"); }
Source:
public static void main(String[] args) throws Exception { List<ObjectName> objectNames = new LinkedList<ObjectName>(); objectNames.add(null); if (args.length > 0) { new JmxScraper(args[0], args[1], args[2], objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } else { new JmxScraper("", "", "", objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } }

Target:
public static void main(String[] args) throws Exception { List<ObjectName> objectNames = new LinkedList<ObjectName>(); objectNames.add(null); if (args.length > 0){ new JmxScraper(args[0], "", "", objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } else if (args.length >= 3){ new JmxScraper(args[0], args[1], args[2], objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } else { new JmxScraper("", "", "", objectNames, new LinkedList<ObjectName>(), new StdoutWriter()).doScrape(); } }
Source:
public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFException { fStreamInput = streamInput; fFile = fStreamInput.getFile(); try { fFileChannel = NonNullUtils.checkNotNull(FileChannel.open(fFile.toPath(), StandardOpenOption.READ)); } catch (IOException e) { throw new CTFIOException(e); } try { fPacketReader = new CTFStreamInputPacketReader(this); fPacketIndex = 0; goToNextPacket(); } catch (Exception e) { try { close(); } catch (IOException e1) { } throw e; } }

Target:
public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFException { fStreamInput = streamInput; fFile = fStreamInput.getFile(); try { fFileChannel = FileChannel.open(fFile.toPath(), StandardOpenOption.READ); } catch (IOException e) { throw new CTFIOException(e); } try { fPacketReader = new CTFStreamInputPacketReader(this); fPacketIndex = 0; goToNextPacket(); } catch (Exception e) { try { close(); } catch (IOException e1) { } throw e; } }
Source:
private boolean isStaleMessage(Message message, String currentState) { if (_isTaskFrameworkPipeline || currentState == null || message.getFromState() == null || message.getToState() == null) { return false; } return !message.getFromState().equalsIgnoreCase(currentState) || message.getToState() .equalsIgnoreCase(currentState); }

Target:
private boolean isStaleMessage(Message message, String currentState) { if (currentState == null || message.getFromState() == null || message.getToState() == null) { return false; } return !message.getFromState().equalsIgnoreCase(currentState) || message.getToState() .equalsIgnoreCase(currentState); }
Source:
public CompletableFuture<Boolean> replaceIssueMilestone(TurboIssue issue, Optional<Integer> newMilestone) { logger.info("Changing milestone for " + issue + " in models"); CompletableFuture<Optional<TurboIssue>> localMilestoneReplaceFuture = repoOpControl.replaceIssueMilestoneLocally(issue, newMilestone); localMilestoneReplaceFuture.thenRun(this::refreshUI); return updateIssueMilestonesOnServer(issue, newMilestone) .thenCombine(localMilestoneReplaceFuture, (isUpdateSuccessful, originalIssue) -> handleIssueMilestoneUpdateOnServerResult(isUpdateSuccessful, originalIssue)); }

Target:
public CompletableFuture<Boolean> replaceIssueMilestone(TurboIssue issue, Optional<Integer> newMilestone) { logger.info("Changing milestone for " + issue + " in models"); CompletableFuture<Optional<TurboIssue>> localMilestoneReplaceFuture = repoOpControl.replaceIssueMilestoneLocally(issue, newMilestone); localMilestoneReplaceFuture.thenRun(this::refreshUI); return updateIssueMilestonesOnServer(issue, newMilestone) .thenCombine(localMilestoneReplaceFuture, this::handleIssueMilestoneUpdateOnServerResult); }
Source:
private Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, Map<Guid, VdcObjectType> entityMap) { if (entityMap == null) { entityMap = Collections.emptyMap(); } List<CommandAssociatedEntity> results = new ArrayList<>(entityMap.size()); for (Map.Entry<Guid, VdcObjectType> entry : entityMap.entrySet()) { results.add(new CommandAssociatedEntity(cmdId, entry.getValue(), entry.getKey())); } return results; }

Target:
private Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, Map<Guid, VdcObjectType> entityMap) { if (entityMap == null) { return Collections.emptyList(); } List<CommandAssociatedEntity> results = new ArrayList<>(entityMap.size()); for (Map.Entry<Guid, VdcObjectType> entry : entityMap.entrySet()) { results.add(new CommandAssociatedEntity(cmdId, entry.getValue(), entry.getKey())); } return results; }
Source:
private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), principalName, false, false); if (principalRecord == null) { throw new RuntimeException(String.format("Unable to find principal %s in domain '%s'", principalName, authzName)); } return new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); }

Target:
private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), principalName, false, false); if (principalRecord == null) { throw new RuntimeException(String.format("Unable to find principal %s in domain '%s'", principalName, authzName)); } DbUser user = new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); user.setId(Guid.newGuid()); return user; }
Source:
public Filter merge(Filter filter) { boolean skipBrackets = !filter.hasMultiple() || operatorItem == filter.operatorItem || filter.isInverted() || (operatorItem == FilterItem.OR && filter.operatorItem == FilterItem.AND); insertOperator(); if (!skipBrackets) { filterItems.addLast(FilterItem.OPEN); } filter.filterItems.stream().forEach(filterItems::addLast); if (!skipBrackets) { filterItems.addLast(FilterItem.CLOSE); } return this; }

Target:
public Filter merge(Filter filter) { boolean addBrackets = !filter.isInverted() || filter.hasMultiple() && !(operatorItem == filter.operatorItem); insertOperator(); if (addBrackets) { filterItems.addLast(FilterItem.OPEN); } filter.filterItems.stream().forEach(filterItems::addLast); if (addBrackets) { filterItems.addLast(FilterItem.CLOSE); } return this; }
Source:
public String getFirstAllowedEditorRole() { return edit == null || edit.isEmpty() ? "" : edit; }

Target:
public String getFirstAllowedEditorRole() { return StringUtils.defaultString(edit); }
Source:
public GdbMemoryBlockRetrievalManager(String modelId, ILaunchConfiguration config, DsfSession session) throws DebugException { fModelId = modelId; fSession = session; fLaunchConfig = config; }

Target:
public GdbMemoryBlockRetrievalManager(String modelId, ILaunchConfiguration config, DsfSession session) { fModelId = modelId; fSession = session; fLaunchConfig = config; }
Source:
private void handlePotentialTimeout(Invocation invocation) { Object identifier = invocation.getIdentifier(); Invocation currentInvocation = activeAsyncInvocations.get(identifier); if (currentInvocation != null && currentInvocation == invocation) { TrackingCallable currentWrapper = activeIdentifiers.get(identifier); if (currentWrapper != null) { invocation.handleTimeout(currentWrapper); } } }

Target:
private void handlePotentialTimeout(Invocation invocation) { Object identifier = invocation.getIdentifier(); Invocation currentInvocation = activeAsyncInvocations.get(identifier); if (currentInvocation == invocation) { TrackingCallable currentWrapper = activeIdentifiers.get(identifier); if (currentWrapper != null) { invocation.handleTimeout(currentWrapper); } } }
Source:
public boolean test(R record) { return record.headers().allWithName(name).hasNext(); }

Target:
public boolean test(R record) { Iterator<Header> headerIterator = record.headers().allWithName(name); return headerIterator != null && headerIterator.hasNext(); }
Source:
public void run() throws Exception { while (true) { if (IFuture.CURRENT.get().isCancelled() || m_sessionProvider.isClosing()) { LOG.debug("JMS MessageConsumer for was closed", m_destination); break; } Message message; try { message = JmsSessionProviderMigration.receive(m_sessionProvider, m_subscribeInput, m_receiveTimeoutMillis); if (message == null) { continue; } } catch (Exception e) { if (IFuture.CURRENT.get().isCancelled() || m_sessionProvider.isClosing()) { LOG.debug("JMS MessageConsumer for was closed", m_destination); break; } BEANS.get(MomExceptionHandler.class).handle(e); continue; } try { LOG.debug("Receiving JMS message [message={}]", message); m_mom.getMessageHandler().handleIncoming(m_destination, message, m_marshaller); onJmsMessage(message); } catch (Exception e) { if (isRollbackNecessary(e)) { Session transactedSession = null; try { transactedSession = m_sessionProvider.getSession(); transactedSession.rollback(); } catch (final JMSException ex) { LOG.error("Failed to rollback transacted session [session={}]", transactedSession, ex); } } BEANS.get(MomExceptionHandler.class).handle(e); } } LOG.debug("JMS MessageConsumer for was closed", m_destination); }

Target:
public void run() throws Exception { while (true) { if (IFuture.CURRENT.get().isCancelled() || m_sessionProvider.isClosing()) { LOG.debug("JMS MessageConsumer for was closed", m_destination); break; } final Session transactedSession; final Message message; try { transactedSession = m_sessionProvider.getSession(); message = JmsSessionProviderMigration.receive(m_sessionProvider, m_subscribeInput, m_receiveTimeoutMillis); if (message == null) { continue; } } catch (Exception e) { if (IFuture.CURRENT.get().isCancelled() || m_sessionProvider.isClosing()) { LOG.debug("JMS MessageConsumer for was closed", m_destination); break; } LOG.warn("JMS MessageConsumer for is still idle after several retry attempts", m_destination, e); continue; } try { m_mom.getMessageHandler().handleIncoming(m_destination, message, m_marshaller); onJmsMessage(message); } catch (Exception e) { if (isRollbackNecessary(e)) { try { transactedSession.rollback(); } catch (final JMSException ex) { LOG.error("Failed to rollback transacted session [session={}]", transactedSession, ex); } } BEANS.get(MomExceptionHandler.class).handle(e); } } LOG.debug("JMS MessageConsumer for was closed", m_destination); }
Source:
create(String name, InputKind kind, Map<String, Object> args) { args = Args.create(args).add("name", name); String path = this.path + "/" + kind.getRelpath(); service.post(path, args); invalidate(); return (T)get(name); }

Target:
create(String name, InputKind kind, Map<String, Object> args) { args = Args.create(args).add("name", name); String path = this.path + "/" + kind.getRelativePath(); service.post(path, args); invalidate(); return (T)get(name); }
Source:
public DecodingFormat<DeserializationSchema<RowData>> createDecodingFormat( DynamicTableFactory.Context context, ReadableConfig formatOptions) { FactoryUtil.validateFactoryOptions(this, formatOptions); String schemaRegistryURL = formatOptions.get(SCHEMA_REGISTRY_URL); return new DecodingFormat<DeserializationSchema<RowData>>() { @Override public DeserializationSchema<RowData> createRuntimeDecoder( DynamicTableSource.Context context, DataType producedDataType) { final RowType rowType = (RowType) producedDataType.getLogicalType(); final TypeInformation<RowData> rowDataTypeInfo = (TypeInformation<RowData>) context.createTypeInformation(producedDataType); return new DebeziumAvroDeserializationSchema( rowType, rowDataTypeInfo, schemaRegistryURL); } @Override public ChangelogMode getChangelogMode() { return ChangelogMode.newBuilder() .addContainedKind(RowKind.INSERT) .addContainedKind(RowKind.UPDATE_BEFORE) .addContainedKind(RowKind.UPDATE_AFTER) .addContainedKind(RowKind.DELETE) .build(); } }; }

Target:
public DecodingFormat<DeserializationSchema<RowData>> createDecodingFormat( DynamicTableFactory.Context context, ReadableConfig formatOptions) { FactoryUtil.validateFactoryOptions(this, formatOptions); String schemaRegistryURL = formatOptions.get(SCHEMA_REGISTRY_URL); return new DecodingFormat<DeserializationSchema<RowData>>() { @Override public DeserializationSchema<RowData> createRuntimeDecoder( DynamicTableSource.Context context, DataType producedDataType) { final RowType rowType = (RowType) producedDataType.getLogicalType(); final TypeInformation<RowData> producedTypeInfo = context.createTypeInformation(producedDataType); return new DebeziumAvroDeserializationSchema( rowType, producedTypeInfo, schemaRegistryURL); } @Override public ChangelogMode getChangelogMode() { return ChangelogMode.newBuilder() .addContainedKind(RowKind.INSERT) .addContainedKind(RowKind.UPDATE_BEFORE) .addContainedKind(RowKind.UPDATE_AFTER) .addContainedKind(RowKind.DELETE) .build(); } }; }
Source:
public List<Repository> getSelectedRepositories() { if (repos.isEmpty()) { return null; } return repos; }

Target:
public List<Repository> getSelectedRepositories() { if (repos.isEmpty()) return null; return repos; }
Source:
protected Map<String, String> params() { return Map.of( "card[cvc]", cvc, "card[exp_month]", expiryMonth, "card[exp_year]", expiryYear, "card[number]", cardNo, "type", "card"); }

Target:
protected Map<String, String> params() { Map<String, String> localParams = new HashMap<>(); localParams.put("card[exp_month]", authCardDetails.expiryMonth()); localParams.put("card[exp_year]", authCardDetails.expiryYear()); localParams.put("card[number]", authCardDetails.getCardNo()); localParams.put("card[cvc]", authCardDetails.getCvc()); localParams.put("card[name]", authCardDetails.getCardHolder()); localParams.put("type", "card"); authCardDetails.getAddress().ifPresent(address -> { localParams.put("card[address_line1]", address.getLine1()); if (StringUtils.isNotBlank(address.getLine2())) { localParams.put("card[address_line2]", address.getLine2()); } localParams.put("card[address_city]", address.getCity()); localParams.put("card[address_country]", address.getCountry()); localParams.put("card[address_zip]", address.getPostcode()); }); return Map.copyOf(localParams); }
Source:
public NfcStatus disableExclusiveNfc() { NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity); if (adapter != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { disableReaderMode(adapter); } else { disableForegroundDispatch(adapter); } return NfcStatus.AVAILABLE; } if (handleUnavailableNfc) toast("NFC is not available on this device"); return NfcStatus.NOT_AVAILABLE; }

Target:
public void disableExclusiveNfc() { NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity); if (adapter != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { disableReaderMode(adapter); } else { disableForegroundDispatch(adapter); } } }
Source:
@Override public void load(Request request, int networkPolicy, Callback callback) { try { Source source = Okio.source(getInputStream(request)); callback.onSuccess(new Result(source, DISK)); } catch (Exception e) { callback.onError(e); } }

Target:
@Override public void load(Request request, int networkPolicy, Callback callback) { boolean signaledCallback = false; try { Source source = Okio.source(getInputStream(request)); signaledCallback = true; callback.onSuccess(new Result(source, DISK)); } catch (Exception e) { if (!signaledCallback) { callback.onError(e); } } }
Source:
public Location getLastLocation() { if (!googleApiClient.isConnected()) { new Thread(googleApiClient::blockingConnect).start(); } return fusedLocationProviderApi.getLastLocation(googleApiClient); }

Target:
public Location getLastLocation() { if (!googleApiClient.isConnected()) { googleApiClient.blockingConnect(); } return fusedLocationProviderApi.getLastLocation(googleApiClient); }
Source:
protected ResultHeaderItem(final String name) { this.name = name; }

Target:
protected ResultHeaderItem(final String name) { this.name = notEmpty(name, "name"); }
Source:
public void request_with_unknown_binding_only_forward_traffic() throws Exception { when(bindingRepo.findOne(BINDING_ID)).thenReturn(null); mockMvc.perform(get(Path.PROXY_CONTEXT+"/"+BINDING_ID) .header(ProxyController.HEADER_FORWARD_URL,"www.google.fr") .accept(MediaType.ALL)) .andExpect(status().is(HttpStatus.MOVED_TEMPORARILY.value())); }

Target:
public void request_with_unknown_binding_only_forward_traffic() throws Exception { when(bindingRepo.findOne(BINDING_ID)).thenReturn(null); mockMvc.perform(get(Path.PROXY_CONTEXT+"/"+BINDING_ID) .header(ProxyController.HEADER_FORWARD_URL,"www.cloudfoundry.org") .accept(MediaType.ALL)) .andExpect(status().is(HttpStatus.MOVED_TEMPORARILY.value())); }
Source:
public void immediateFade(String channelString, String fadeString, Boolean resumeAfter) { List<DmxChannel> channels = new ArrayList<>(); try { List<BaseDmxChannel> configChannels = BaseDmxChannel.fromString(channelString, getUniverseId()); logger.trace("found channels in {}", configChannels.size(), this.thing.getUID()); for (BaseDmxChannel channel : configChannels) { channels.add(getDmxChannel(channel, this.thing)); } } catch (IllegalArgumentException e) { logger.debug("invalid channel configuration: {}", channelString); return; } ValueSet value = ValueSet.fromString(fadeString); if (value.isEmpty()) { logger.info("invalid fade configuration: {}", fadeString); return; } Integer channelCounter = 0; for (DmxChannel channel : channels) { if (resumeAfter) { channel.suspendAction(); } else { channel.clearAction(); } channel.addChannelAction( new FadeAction(value.getFadeTime(), value.getValue(channelCounter), value.getHoldTime())); if (resumeAfter) { channel.addChannelAction(new ResumeAction()); } channelCounter++; } }

Target:
public void immediateFade(String channelString, String fadeString, Boolean resumeAfter) { List<DmxChannel> channels = new ArrayList<>(); try { List<BaseDmxChannel> configChannels = BaseDmxChannel.fromString(channelString, getUniverseId()); logger.trace("found channels in {}", configChannels.size(), this.thing.getUID()); for (BaseDmxChannel channel : configChannels) { channels.add(getDmxChannel(channel, this.thing)); } } catch (IllegalArgumentException e) { logger.warn("invalid channel configuration: {}", channelString); return; } ValueSet value = ValueSet.fromString(fadeString); if (value.isEmpty()) { logger.warn("invalid fade configuration: {}", fadeString); return; } Integer channelCounter = 0; for (DmxChannel channel : channels) { if (resumeAfter) { channel.suspendAction(); } else { channel.clearAction(); } channel.addChannelAction( new FadeAction(value.getFadeTime(), value.getValue(channelCounter), value.getHoldTime())); if (resumeAfter) { channel.addChannelAction(new ResumeAction()); } channelCounter++; } }
Source:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { context.setDisposer(new MesosSingleUseSlaveDisposer()); Computer computer = workspace.toComputer(); if (computer != null) { if (MesosComputer.class.isInstance(computer)) { String msg = "Marking " + computer.getName() + " as single-use."; LOGGER.warning(msg); listener.getLogger().println(msg); MesosSlave mesosSlave = (MesosSlave) computer.getNode(); if (mesosSlave != null) { mesosSlave.setSingleUse(true); } } else { listener.getLogger().println("Not able to set single-use slave, this is a " + computer.getClass()); } } }

Target:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { context.setDisposer(new MesosSingleUseSlaveDisposer()); Computer computer = workspace.toComputer(); if (computer != null) { if (MesosComputer.class.isInstance(computer)) { String msg = "Marking " + computer.getName() + " as single-use."; LOGGER.info(msg); listener.getLogger().println(msg); MesosSlave mesosSlave = (MesosSlave) computer.getNode(); if (mesosSlave != null) { mesosSlave.setSingleUse(true); } } else { listener.getLogger().println("Not able to set single-use slave, this is a " + computer.getClass()); } } }