auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void categorizeRequiredField(Element element, VariableElement variableElement) { if (Utils.isPrimitiveType(variableElement)) { Utils.error(String.format(Locale.US, "@Required and @NotNull annotation is unnecessary for primitive field \"%s\".", element)); return; } if (Utils.isRealmModel(variableElement)) { Utils.error(String.format(Locale.US, "Field \"%s\" with type \"%s\" cannot be @Required or @NotNull.", element, element.asType())); return; } if (nullableFields.contains(variableElement)) { Utils.error(String.format(Locale.US, "Field \"%s\" with type \"%s\" appears to be nullable. Consider removing @Required.", element, element.asType())); } }

Target:
private void categorizeRequiredField(Element element, VariableElement variableElement) { if (Utils.isPrimitiveType(variableElement)) { Utils.error(String.format(Locale.US, "@Required or @NotNull annotation is unnecessary for primitive field \"%s\".", element)); return; } if (Utils.isRealmModel(variableElement)) { Utils.error(String.format(Locale.US, "Field \"%s\" with type \"%s\" cannot be @Required or @NotNull.", element, element.asType())); return; } if (nullableFields.contains(variableElement)) { Utils.error(String.format(Locale.US, "Field \"%s\" with type \"%s\" appears to be nullable. Consider removing @Required.", element, element.asType())); } }
Source:
public Publisher<Void> apply(HttpServerRequest httpRequest, HttpServerResponse httpResponse) { LOGGER.debug( "Accepted request: {}, headers: {}, params: {}", httpRequest, httpRequest.requestHeaders(), httpRequest.params()); if (httpRequest.method() != POST) { LOGGER.error("Unsupported HTTP method. Expected POST, actual {}", httpRequest.method()); return methodNotAllowed(httpResponse); } return httpRequest .receive() .aggregate() .switchIfEmpty( Mono.defer(() -> ByteBufMono.just(ByteBufAllocator.DEFAULT.compositeBuffer()))) .map(ByteBuf::retain) .doOnNext(content -> metrics.markRequest()) .flatMap(content -> handleRequest(content, httpRequest, httpResponse)) .doOnSuccess(avoid -> metrics.markResponse()) .onErrorResume(t -> error(httpResponse, DefaultErrorMapper.INSTANCE.toMessage(t))); }

Target:
public Publisher<Void> apply(HttpServerRequest httpRequest, HttpServerResponse httpResponse) { LOGGER.debug( "Accepted request: {}, headers: {}, params: {}", httpRequest, httpRequest.requestHeaders(), httpRequest.params()); if (httpRequest.method() != POST) { LOGGER.error("Unsupported HTTP method. Expected POST, actual {}", httpRequest.method()); return methodNotAllowed(httpResponse); } return httpRequest .receive() .aggregate() .switchIfEmpty(Mono.defer(() -> ByteBufMono.just(Unpooled.EMPTY_BUFFER))) .map(ByteBuf::retain) .doOnNext(content -> metrics.markRequest()) .flatMap(content -> handleRequest(content, httpRequest, httpResponse)) .doOnSuccess(avoid -> metrics.markResponse()) .onErrorResume(t -> error(httpResponse, DefaultErrorMapper.INSTANCE.toMessage(t))); }
Source:
private void addOrUpdateActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { Date minEndTime = new Date(payload.startTime.getTime() - yonaProperties.getAnalysisService().getConflictInterval()); DayActivity dayActivity = cacheService.fetchDayActivityForUser(userAnonymized.getID(), matchingGoal.getID(), getZonedStartOfDay(payload.startTime, userAnonymized)); Activity activity = dayActivity != null ? dayActivity.getLatestActivity() : null; if (activity == null || activity.getEndTime().before(minEndTime)) { dayActivity = createNewActivity(dayActivity, payload, userAnonymized, matchingGoal); cacheService.updateDayActivityForUser(dayActivity); if (matchingGoal.isNoGoGoal()) { sendConflictMessageToAllDestinationsOfUser(dayActivity, payload, userAnonymized, dayActivity.getLatestActivity(), matchingGoal); } } else if (payload.endTime.getTime() - activity.getEndTime().getTime() >= yonaProperties.getAnalysisService() .getUpdateSkipWindow() || payload.startTime.before(activity.getStartTime())) { updateLastActivity(dayActivity, payload, userAnonymized, matchingGoal, activity); cacheService.updateDayActivityForUser(dayActivity); } }

Target:
private void addOrUpdateActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { Date minEndTime = new Date(payload.startTime.getTime() - yonaProperties.getAnalysisService().getConflictInterval()); DayActivity dayActivity = cacheService.fetchDayActivityForUser(userAnonymized.getID(), matchingGoal.getID(), getStartOfDay(payload.startTime, userAnonymized)); Activity activity = dayActivity == null ? null : dayActivity.getLastActivity(); if (activity == null || activity.getEndTime().before(minEndTime)) { addActivity(payload, userAnonymized, matchingGoal, dayActivity); } else if (payload.endTime.getTime() - activity.getEndTime().getTime() >= yonaProperties.getAnalysisService() .getUpdateSkipWindow() || payload.startTime.before(activity.getStartTime())) { updateActivity(payload, userAnonymized, matchingGoal, dayActivity, activity); } }
Source:
public Value<Boolean> hideEnchantments() { return SpongeValueFactory.getInstance().createValue(Keys.HIDE_ENCHANTMENTS, enchantments, false); }

Target:
public Value<Boolean> hideEnchantments() { return SpongeValueFactory.getInstance().createValue(Keys.HIDE_ENCHANTMENTS, this.enchantments, false); }
Source:
private BootstrapContextCoordinator() { this.bootstrapContexts = new ConcurrentHashMap<String, CloneableBootstrapContext>(); this.defaultBootstrapContext = null; this.workManagerCoordinator = null; this.activeBootstrapContexts = new HashMap<String, CloneableBootstrapContext>(); this.refCountBootstrapContexts = new HashMap<String, Integer>(); }

Target:
public BootstrapContextCoordinator() { this.bootstrapContexts = new ConcurrentHashMap<String, CloneableBootstrapContext>(); this.defaultBootstrapContext = null; this.workManagerCoordinator = null; this.activeBootstrapContexts = new HashMap<String, CloneableBootstrapContext>(); this.refCountBootstrapContexts = new HashMap<String, Integer>(); }
Source:
public ExportWiki(String url, String user, String password) throws AuthenticationException { BasicEndpoint basicEndpoint = new BasicEndpoint(); basicEndpoint.setUrl(url); basicEndpoint.setForceTrustSSLCertificate(true); basicEndpoint.setUser(user); basicEndpoint.setPassword(password); basicEndpoint.login(user, password); wikiService = new WikiService(); setEndpoint(basicEndpoint); }

Target:
public ExportWiki(String url, String user, String password) throws AuthenticationException { BasicEndpoint basicEndpoint = new BasicEndpoint(); basicEndpoint.setUrl(url); basicEndpoint.setForceTrustSSLCertificate(true); basicEndpoint.login(user, password); wikiService = new WikiService(); setEndpoint(basicEndpoint); }
Source:
public String getRequestUri() { return wrapped.getRequestPath(); }

Target:
public String getRequestUri() { return wrapped.getRequestUri(); }
Source:
public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry) { final AmazonDynamoDBClientBuilder clientBuilder = AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties)); final Object region = properties.toMap().get("region"); if (region != null && region instanceof String) { clientBuilder.setRegion(region.toString()); } final AmazonDynamoDB client = clientBuilder.build(); final SimpleTableDef[] tableDefs = properties.getTableDefs(); return new DynamoDbDataContext(client, tableDefs); }

Target:
public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry) { final AmazonDynamoDBClientBuilder clientBuilder = AmazonDynamoDBClientBuilder.standard().withCredentials(getCredentials(properties)); final Object region = properties.toMap().get("region"); if (region instanceof String) { clientBuilder.setRegion((String) region); } final AmazonDynamoDB client = clientBuilder.build(); final SimpleTableDef[] tableDefs = properties.getTableDefs(); return new DynamoDbDataContext(client, tableDefs); }
Source:
public void process(EquivalentContentUpdatedMessage message) throws RecoverableException { Id contentId = message.getContentRef().getId(); log.debug("Processing message on id {}, took PT{}S, message: {}", contentId, getTimeToProcessInSeconds(message)); Timer.Context time = timer.time(); try { Content content = getContent(contentId); neo4JContentStore.writeContent(content); time.stop(); } catch (Exception e) { failureMeter.mark(); throw Throwables.propagate(e); } }

Target:
public void process(EquivalentContentUpdatedMessage message) throws RecoverableException { Id contentId = message.getContentRef().getId(); log.debug("Processing message on id {}, took PT{}S, message: {}", contentId, getTimeToProcessInSeconds(message), message); Timer.Context time = timer.time(); try { Content content = getContent(contentId); neo4JContentStore.writeContent(content); time.stop(); } catch (Exception e) { failureMeter.mark(); throw Throwables.propagate(e); } }
Source:
public Object visit(ASTUserClass node, Object data) { if (Helper.isTestMethodOrClass(node)) { return data; } List<ASTVariableDeclaration> variableDecls = node.findDescendantsOfType(ASTVariableDeclaration.class); for (ASTVariableDeclaration varDecl : variableDecls) { findSafeLiterals(varDecl); } List<ASTFieldDeclaration> fieldDecl = node.findDescendantsOfType(ASTFieldDeclaration.class); for (ASTFieldDeclaration fDecl : fieldDecl) { findSafeLiterals(fDecl); } List<ASTNewObjectExpression> newObjects = node.findDescendantsOfType(ASTNewObjectExpression.class); for (ASTNewObjectExpression newObj : newObjects) { checkNewObjects(newObj, data); } return data; }

Target:
public Object visit(ASTUserClass node, Object data) { if (Helper.isTestMethodOrClass(node)) { return data; } List<ASTVariableDeclaration> variableDecls = node.findDescendantsOfType(ASTVariableDeclaration.class); for (ASTVariableDeclaration varDecl : variableDecls) { findSafeLiterals(varDecl); } List<ASTFieldDeclaration> fieldDecl = node.findDescendantsOfType(ASTFieldDeclaration.class); for (ASTFieldDeclaration fDecl : fieldDecl) { findSafeLiterals(fDecl); } List<ASTNewObjectExpression> newObjects = node.findDescendantsOfType(ASTNewObjectExpression.class); for (ASTNewObjectExpression newObj : newObjects) { checkNewObjects(newObj, data); } listOfStringLiteralVariables.clear(); return data; }
Source:
void join(RowMutationState newRow) { for (Map.Entry<PColumn,byte[]> valueEntry : newRow.getColumnValues().entrySet()) { getColumnValues().put(valueEntry.getKey(), valueEntry.getValue()); } getOrderOfStatementsInConnection().addAll(newRow.getOrderOfStatementsInConnection()); }

Target:
void join(RowMutationState newRow) { getColumnValues().putAll(newRow.getColumnValues()); statementIndexes = joinSortedIntArrays(statementIndexes, newRow.getStatementIndexes()); }
Source:
protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { throw new OperationFailedException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }

Target:
protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { throw new IllegalStateException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Source:
public void executeOn(Project project, SensorContext context) { if (projectIssues != null && projectIssues.issues() != null) { for (org.sonar.api.issue.Issue i : projectIssues.issues()) { System.out.println(i.ruleKey() + ": " + i.message()); } } try { boolean notifyStash = config.hasToNotifyStash(); if (notifyStash) { String stashURL = stashRequestFacade.getStashURL(); int stashTimeout = config.getStashTimeout(); StashCredentials stashCredentials = stashRequestFacade.getCredentials(); try (StashClient stashClient = new StashClient(stashURL, stashCredentials, stashTimeout, config.getSonarQubeVersion())) { updateStashWithSonarInfo(stashClient, stashCredentials, project, context); } } } catch (StashConfigurationException e) { LOGGER.error("Unable to push SonarQube report to Stash: {}", e.getMessage()); LOGGER.debug(STACK_TRACE, e); } }

Target:
public void executeOn(Project project, SensorContext context) { try { boolean notifyStash = config.hasToNotifyStash(); if (notifyStash) { String stashURL = stashRequestFacade.getStashURL(); int stashTimeout = config.getStashTimeout(); StashCredentials stashCredentials = stashRequestFacade.getCredentials(); try (StashClient stashClient = new StashClient(stashURL, stashCredentials, stashTimeout, config.getSonarQubeVersion())) { updateStashWithSonarInfo(stashClient, stashCredentials); } } } catch (StashConfigurationException e) { LOGGER.error("Unable to push SonarQube report to Stash: {}", e.getMessage()); LOGGER.debug(STACK_TRACE, e); } }
Source:
public void verifyQuerySucceedsAfterClear() throws Exception { Region cities = clientCacheRule.createProxyRegion("cities"); IntStream.range(0, 100).forEach(i -> cities.put(i, new City(i))); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); Region region = internalCache.getRegion("cities"); assertThat(region.size()).isEqualTo(100); }, server1, server2); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery(MUMBAI_QUERY); Query query2 = queryService.newQuery(ID_10_QUERY); assertThat(((SelectResults) query.execute()).size()).isEqualTo(50); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(1); cities.clear(); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); Region region = internalCache.getRegion("cities"); assertThat(region.size()).isEqualTo(0); }, server1, server2); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(0); MemberVM.invokeInEveryMember(() -> { InternalCache internalCache = ClusterStartupRule.getCache(); QueryService qs = internalCache.getQueryService(); Region region = internalCache.getRegion("cities"); Index cityId = qs.getIndex(region, "cityId"); IndexStatistics statistics = cityId.getStatistics(); assertThat(statistics.getNumberOfKeys()).isEqualTo(0); assertThat(statistics.getNumberOfValues()).isEqualTo(0); Index cityName = qs.getIndex(region, "cityName"); IndexStatistics statistics1 = cityName.getStatistics(); assertThat(statistics1.getNumberOfKeys()).isEqualTo(0); assertThat(statistics1.getNumberOfValues()).isEqualTo(0); }, server1, server2); }

Target:
public void verifyQuerySucceedsAfterClear() throws Exception { IntStream.range(0, 100).forEach(i -> cities.put(i, new City(i))); QueryService queryService = clientCache.getQueryService(); Query query = queryService.newQuery(MUMBAI_QUERY); Query query2 = queryService.newQuery(ID_10_QUERY); assertThat(((SelectResults) query.execute()).size()).isEqualTo(50); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(1); cities.clear(); invokeInEveryMember(() -> { verifyIndexesAfterClear("cities", "cityId", "cityName"); }, server1, server2); assertThat(((SelectResults) query.execute()).size()).isEqualTo(0); assertThat(((SelectResults) query2.execute()).size()).isEqualTo(0); }
Source:
public void testNonNullFileText() throws IOException { final String charsetName = "ISO-8859-1"; final FileText fileText = new FileText(new File("src/test/resources/com/puppycrawl/tools/" + "checkstyle/api/import-control_complete.xml"), charsetName); final SortedSet<LocalizedMessage> messages = new TreeSet<>(); messages.add(new LocalizedMessage(0, 0, "a Bundle", "message.key", new Object[] {"arg"}, null, getClass(), null)); final FileProcessingResult processingResult = new FileProcessingResult(fileText, messages); assertEquals(charsetName, processingResult.getFileText().getCharset().name()); }

Target:
public void testNonNullFileText() throws IOException { final String charsetName = "ISO-8859-1"; final File file = temporaryFolder.newFile("test.java"); final FileText fileText = new FileText(file, charsetName); final SortedSet<LocalizedMessage> messages = new TreeSet<>(); messages.add(new LocalizedMessage(0, 0, "a Bundle", "message.key", new Object[] {"arg"}, null, getClass(), null)); final FileProcessingResult processingResult = new FileProcessingResult( file.getAbsolutePath(), fileText, messages); assertNotNull(processingResult.getFileText()); }
Source:
public FunctionalExtraction( final Function<String, String> extractionFunction, final boolean retainMissingValue, final String replaceMissingValueWith, final boolean injective ) { this.retainMissingValue = retainMissingValue; this.replaceMissingValueWith = Strings.isNullOrEmpty(replaceMissingValueWith) ? null : replaceMissingValueWith; Preconditions.checkArgument( !(this.retainMissingValue && !Strings.isNullOrEmpty(this.replaceMissingValueWith)), "Cannot specify a [replaceMissingValueWith] and set [retainMissingValue] to true" ); if (this.retainMissingValue) { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? (Strings.isNullOrEmpty(dimValue) ? null : dimValue) : retval; } }; } else { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? FunctionalExtraction.this.replaceMissingValueWith : retval; } }; } this.extractionType = injective ? ExtractionType.ONE_TO_ONE : ExtractionType.MANY_TO_ONE; }

Target:
public FunctionalExtraction( final Function<String, String> extractionFunction, final boolean retainMissingValue, final String replaceMissingValueWith, final boolean injective ) { this.retainMissingValue = retainMissingValue; this.replaceMissingValueWith = Strings.emptyToNull(replaceMissingValueWith); Preconditions.checkArgument( !(this.retainMissingValue && !Strings.isNullOrEmpty(this.replaceMissingValueWith)), "Cannot specify a [replaceMissingValueWith] and set [retainMissingValue] to true" ); if (this.retainMissingValue) { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? Strings.emptyToNull(dimValue) : retval; } }; } else { this.extractionFunction = new Function<String, String>() { @Nullable @Override public String apply(@Nullable String dimValue) { final String retval = extractionFunction.apply(dimValue); return Strings.isNullOrEmpty(retval) ? FunctionalExtraction.this.replaceMissingValueWith : retval; } }; } this.extractionType = injective ? ExtractionType.ONE_TO_ONE : ExtractionType.MANY_TO_ONE; }
Source:
public void validateTerms(Set<ValueIndexTerm> queryTerms) throws IllegalArgumentException { checkNotNullAndNotEmpty(queryTerms); checkInvalidAndRequiredTerms(queryTerms, NAME, new String[]{ null, null, scorecardTerm.getTerm() }, (t) -> (t instanceof ValueModuleRootPathIndexTerm), (t) -> (t instanceof ValuePackageNameIndexTerm), (t) -> (t.getTerm().equals(scorecardTerm.getTerm()))); }

Target:
public void validateTerms(Set<ValueIndexTerm> queryTerms) throws IllegalArgumentException { checkNotNullAndNotEmpty(queryTerms); checkInvalidAndRequiredTerms(queryTerms, NAME, new String[]{ null, null, scorecardTerm.getTerm() }, (t) -> (t instanceof ValueModuleRootPathIndexTerm), (t) -> (t instanceof ValuePackageNameIndexTerm), (t) -> (Objects.equals(t.getTerm(), scorecardTerm.getTerm()))); }
Source:
private boolean isHoldingLease() { final DateTime lease = getLease().withMillisOfSecond(0); return lease != null && lease.equals(latestOwnedLease.withMillisOfSecond(0)) && lease.plusMinutes(getLeaseTimeMinutes()) .isAfterNow(); }

Target:
private boolean isHoldingLease() { final DateTime lease = getLease(); return lease != null && lease.equals(latestOwnedLease) && lease.plusMinutes(getLeaseTimeMinutes()).isAfterNow(); }
Source:
protected void validateComponent(final List<Diagnostic> diags) { super.validateComponent(diags); if (BooleanUtils.isFalse(isFileTypeValid())) { String invalidMessage = String.format(I18nUtilities.format(null, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_TYPE), StringUtils.join(getFileTypes().toArray(new Object[getFileTypes().size()]), ",")); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } if (BooleanUtils.isFalse(isFileSizeValid())) { String invalidMessage = String.format(I18nUtilities.format(null, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_SIZE), FileUtil.readableFileSize(getMaxFileSize())); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } }

Target:
protected void validateComponent(final List<Diagnostic> diags) { super.validateComponent(diags); if (!isFileTypeValid()) { String invalidMessage = FileUtil.getInvalidFileTypeMessage(getFileTypes()); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } if (!isFileSizeValid()) { String invalidMessage = FileUtil.getInvalidFileSizeMessage(getMaxFileSize()); Diagnostic diag = new DiagnosticImpl(Diagnostic.ERROR, this, invalidMessage); diags.add(diag); } }
Source:
public String run( ReportInfo ri ) { String ret = ""; Context context = null; try { context = new Context(); Iterator<Item> item_iter = null; try { item_iter = embargoService.findItemsByLiftMetadata(context); } catch (IllegalArgumentException e) { error(e, "No embargoed items found"); } catch (Exception e) { error(e); } while (item_iter != null && item_iter.hasNext()) { Item item = item_iter.next(); String handle = item.getHandle(); DCDate date = null; try { date = embargoService.getEmbargoTermsAsDate(context, item); } catch (Exception e) { } ret += String.format("%s embargoed till [%s]\n", handle, date != null ? date.toString() : "null"); } context.complete(); } catch (SQLException e) { try { if ( null != context ) { context.abort(); } } catch (Exception e1) { } } return ret; }

Target:
public String run( ReportInfo ri ) { String ret = ""; Context context = null; try { context = new Context(); Iterator<Item> item_iter = null; try { item_iter = embargoService.findItemsByLiftMetadata(context); } catch (IllegalArgumentException e) { error(e, "No embargoed items found"); } catch (Exception e) { error(e); } while (item_iter != null && item_iter.hasNext()) { Item item = item_iter.next(); String handle = item.getHandle(); DCDate date = null; try { date = embargoService.getEmbargoTermsAsDate(context, item); } catch (Exception e) { error(e); } ret += String.format("%s embargoed till [%s]\n", handle, date != null ? date.toString() : "null"); } context.complete(); } catch (SQLException e) { error(e); try { if ( null != context ) { context.abort(); } } catch (Exception e1) { error(e); } } return ret; }
Source:
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { ItemStack result; InventoryCrafting inventory = new InventoryCrafting(new Container() { public boolean canInteractWith(EntityPlayer player) { return false; } }, gridSize, gridSize); for (int i = 0; i < inventory.getSizeInventory(); i++) { inventory.setInventorySlotContents(i, stack); } if(!StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world).isEmpty()){ return StorageBlockCraftingManager.getInstance().findMatchingRecipe(inventory, world); } try{result = CraftingManager.findMatchingRecipe(inventory, world).getRecipeOutput(); }catch(NullPointerException e){ return ItemStack.EMPTY; } if(isResultStackReversible(result, gridSize, world)){ StorageBlockCraftingManager.getInstance().addRecipe(CraftingManager.findMatchingRecipe(inventory, world)); return result; } return ItemStack.EMPTY; }

Target:
public static ItemStack getRecipe(ItemStack stack, World world, int gridSize) { StorageBlockCraftingManager craftingManagerSB = StorageBlockCraftingManager.getInstance(); InventoryCrafting inventory = inventoryCrafting[3 - gridSize]; for (int i = 0; i < inventory.getSizeInventory(); i++) { inventory.setInventorySlotContents(i, stack); } ItemStack notEmptyRecipe = craftingManagerSB.findMatchingRecipe(inventory, world); if (!notEmptyRecipe.isEmpty()) { return notEmptyRecipe; } ItemStack result = getNNRecipeOutput(inventory, world); if (isResultStackReversible(result, world)) { craftingManagerSB.addRecipe(CraftingManager.findMatchingRecipe(inventory, world)); return result; } return ItemStack.EMPTY; }
Source:
public void testResizeNodes() throws Exception { final Node stage = createNode(AdHocSubprocess.class, 5.0, 5.0, 225.0, 225.0); final Node task = createNode(UserTask.class, 5.0, 5.0, 75.0, 75.0); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(stage, task, index, originalParent, originalIndex); command.resizeNodes(); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 225.0, 225.0)), command.originalParentBounds); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 75.0, 75.0)), command.originalBounds); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(STAGE_GAP, STAGE_GAP, STAGE_GAP + CHILD_WIDTH, STAGE_GAP + CHILD_HEIGHT), ((View) task.getContent()).getBounds()); command.undoResizeNodes(); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(5.0, 5.0, 75.0, 75.0), ((View) task.getContent()).getBounds()); }

Target:
public void testResizeNodes() { final Node stage = createNode(AdHocSubprocess.class, 5.0, 5.0, 225.0, 225.0); final Node task = createNode(UserTask.class, 5.0, 5.0, 75.0, 75.0); final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(stage, task, index, originalParent, originalIndex); command.resizeNodes(); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 225.0, 225.0)), command.originalParentBounds); assertEquals(Optional.of(Bounds.create(5.0, 5.0, 75.0, 75.0)), command.originalBounds); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(STAGE_GAP, STAGE_GAP, STAGE_GAP + CHILD_WIDTH, STAGE_GAP + CHILD_HEIGHT), ((View) task.getContent()).getBounds()); command.undoResizeNodes(); assertEquals(Bounds.create(5.0, 5.0, 225.0, 225.0), ((View) stage.getContent()).getBounds()); assertEquals(Bounds.create(5.0, 5.0, 75.0, 75.0), ((View) task.getContent()).getBounds()); }
Source:
public void log(PerunSession sess, AuditEvent event) { if(TransactionSynchronizationManager.isActualTransactionActive()) { log.trace("Auditer stores audit message to current transaction. Message: {}.", event.getMessage()); List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { newTopLevelTransaction(); topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { log.error("Failed to log event in Auditer because topLevelTransaction was null."); return; } } List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1); List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1); messages.add(new AuditerMessage(sess, event)); } else { this.storeMessageToDb(sess, event); } }

Target:
public void log(PerunSession sess, AuditEvent event) { if(TransactionSynchronizationManager.isActualTransactionActive()) { log.trace("Auditer stores audit message to current transaction. Message: {}.", event.getMessage()); List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { newTopLevelTransaction(); topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { log.error("Failed to log event: " + event + " in Auditer because topLevelTransaction was null."); return; } } List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1); List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1); messages.add(new AuditerMessage(sess, event)); } else { this.storeMessageToDb(sess, event); } }
Source:
public ScheduledThreadPoolMetricsHandler(RuntimeCapability capability, final ServiceName serviceNameBase) { super(METRICS, capability, null); }

Target:
public ScheduledThreadPoolMetricsHandler(RuntimeCapability capability, final ServiceName serviceNameBase) { super(METRICS, capability, serviceNameBase); }
Source:
private void handleFixtureComparison() throws UnsupportedEncodingException { for ( Class<?> fixture : fixturesFor ) { String expectedFixture = getMapperName( fixture ); URL expectedFile = getClass().getClassLoader().getResource( expectedFixture ); if ( expectedFile == null ) { fail( String.format( "No reference file could be found for Mapper %s. You should create a file %s", fixture.getName(), expectedFixture ) ); } else { File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), "UTF-8" ) ); forMapper( fixture ).hasSameMapperContent( expectedResource ); } fixture.getPackage().getName(); } }

Target:
private void handleFixtureComparison() throws UnsupportedEncodingException { for ( Class<?> fixture : fixturesFor ) { String expectedFixture = FIXTURES_ROOT + getMapperName( fixture ); URL expectedFile = getClass().getClassLoader().getResource( expectedFixture ); if ( expectedFile == null ) { fail( String.format( "No reference file could be found for Mapper %s. You should create a file %s", fixture.getName(), expectedFixture ) ); } else { File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), "UTF-8" ) ); forMapper( fixture ).hasSameMapperContent( expectedResource ); } fixture.getPackage().getName(); } }
Source:
public void removeInstallation(Installation installation) { installation.setCategories(null); updateInstallation(installation); installationDao.delete(installation); }

Target:
public void removeInstallation(Installation installation) { installationDao.delete(installation); }
Source:
public void withAssertions_assertThat_iterator_Test() { assertThat(Arrays.asList(ITEMS).iterator()).toIterable().contains(ITEMS[0]); }

Target:
public void withAssertions_assertThat_iterator_Test() { assertThat(Arrays.asList(ITEMS).iterator()).hasNext(); }
Source:
public <R> R execute(PartitionContext partitionContext, RetryPolicy retry, ServiceCallback<S, R> callback) { Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; Exception lastException; do { ServiceEndPoint endPoint = chooseEndPoint(getValidEndPoints(), partitionContext); try { R result = executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteAttemptFailures.mark(); if (!isRetriableException(e)) { throw Throwables.propagate(e); } lastException = e; } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); throw new MaxRetriesException( "Exception from the last retry attempt", lastException ); }

Target:
public <R> R execute(PartitionContext partitionContext, RetryPolicy retry, ServiceCallback<S, R> callback) { Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; Exception lastException; do { ServiceEndPoint endPoint = chooseEndPoint(getValidEndPoints(), partitionContext); try { R result = executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteAttemptFailures.mark(); if (!isRetriableException(e)) { throw Throwables.propagate(e); } LOG.info("Retriable exception from end point id: " + endPoint.getId(), e); lastException = e; } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); throw new MaxRetriesException(lastException); }
Source:
List<String> findDumpDatesOnline(String relativeDirectory) { List<String> result = new ArrayList<String>(); try (BufferedReader in = this.webResourceFetcher .getBufferedReaderForUrl(WmfDumpFile.DUMP_SITE_BASE_URL + relativeDirectory + this.projectName + "/")) { String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.startsWith("<tr><td class=\"n\">")) { String dateStamp = inputLine.substring(27, 35); if (dateStamp.matches("\\d\\d\\d\\d\\d\\d\\d\\d")) { result.add(dateStamp); } } } } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } Collections.sort(result, Collections.reverseOrder()); return result; }

Target:
List<String> findDumpDatesOnline(String relativeDirectory) { List<String> result = new ArrayList<String>(); try (BufferedReader in = this.webResourceFetcher .getBufferedReaderForUrl(WmfDumpFile.DUMP_SITE_BASE_URL + relativeDirectory + this.projectName + "/")) { String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.startsWith("<tr><td class=\"n\">")) { String dateStamp = inputLine.substring(27, 35); if (dateStamp.matches(WmfDumpFileManager.DATE_STAMP_PATTERN)) { result.add(dateStamp); } } } } catch (IOException e) { logger.error("Failed to fetch available dump dates online."); } Collections.sort(result, Collections.reverseOrder()); return result; }
Source:
public void creates_instances_with_arguments() { assertEquals(new ConstructorInstantiator("someString").newInstance(SomeClass2.class).getClass(), SomeClass2.class); }

Target:
public void creates_instances_with_arguments() { assertEquals(new ConstructorInstantiator(false, "someString").newInstance(SomeClass2.class).getClass(), SomeClass2.class); }
Source:
public void createBeanPool() throws Exception { boolean result = fragment.addBeanPool() .name(BEAN_POOL_TBA) .maxPoolSize("30") .timeout("8") .timeoutUnit("MINUTES") .finish(); Assert.assertTrue("Window should be closed", result); new ResourceVerifier(BEAN_POOL_TBA_ADDRESS, client).verifyExists("Fails because of <LINK_0>"); }

Target:
public void createBeanPool() throws Exception { boolean result = fragment.addBeanPool() .name(BEAN_POOL_TBA) .maxPoolSize("30") .timeout("8") .timeoutUnit("MINUTES") .finish(); Assert.assertTrue("Window should be closed", result); new ResourceVerifier(BEAN_POOL_TBA_ADDRESS, client).verifyExists("Probably fails because of <LINK_0>"); }
Source:
public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { RuntimeState state = runtimes.remove(event.getIdentity().getWorkspaceId()); if (state != null) { eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(state.runtime.getContext().getIdentity() .getWorkspaceId()) .withPrevStatus(WorkspaceStatus.STOPPING) .withStatus(STOPPED) .withError("Error occurs on workspace runtime stop. Error: " + event.getError())); } } }

Target:
public void onEvent(RuntimeStatusEvent event) { if (event.isFailed()) { RuntimeState state = runtimes.remove(event.getIdentity().getWorkspaceId()); if (state != null) { eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(state.runtime.getContext().getIdentity() .getWorkspaceId()) .withPrevStatus(WorkspaceStatus.RUNNING) .withStatus(STOPPED) .withError("Error occurs on workspace runtime stop. Error: " + event.getError())); } } }
Source:
private static boolean isLargeFile(DiffInfo diffInfo) { JsArray<Region> c = diffInfo.content(); int lenA = 0, lenB = 0; for (int i = 0; i < c.length(); i++) { Region r = c.get(i); if (r.ab() != null) { int n = r.ab().length(); lenA += n; lenB += n; } else { if (r.a() != null) { lenA += r.a().length(); } if (r.b() != null) { lenB += r.b().length(); } } if (lenA > 500 || lenB > 500) { return true; } } return false; }

Target:
private static boolean isLargeFile(DiffInfo diffInfo) { return (diffInfo.meta_a() != null && diffInfo.meta_a().lines() > 500) || (diffInfo.meta_b() != null && diffInfo.meta_b().lines() > 500); }
Source:
public MachineService(MachineManager machineManager) { this.machineManager = machineManager; this.dtoFactory = getInstance(); }

Target:
public MachineService(MachineManager machineManager) { this.machineManager = machineManager; this.dtoFactory = DtoFactory.getInstance(); }
Source:
public void setState(final Map<String, Object> loadedState) { super.setState(loadedState); count = (Integer)loadedState.get("count"); }

Target:
public void setState(final Map<String, Object> loadedState) { super.setState(loadedState); count = (long)loadedState.get("count"); }
Source:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } you.lookAtCards("Discard", targetPlayer.getHand(), game); TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS); target.setNotTarget(true); you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game); targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }

Target:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } you.lookAtCards("Discard", targetPlayer.getHand(), game); TargetCard target = new TargetCardInHand(0, 2, StaticFilters.FILTER_CARD_CARDS); target.setNotTarget(true); you.choose(Outcome.Discard, targetPlayer.getHand(), target, game); targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }
Source:
protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = vmTemplateDao.getInstanceTypeByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = vmTemplateDao.getInstanceType(getParameters().getId()); } getQueryReturnValue().setReturnValue(instance); }

Target:
protected void executeQueryCommand() { InstanceType instance; GetVmTemplateParameters params = getParameters(); if (params.getName() != null) { instance = vmTemplateDao.getInstanceTypeByName(params.getName(), getUserID(), getParameters().isFiltered()); } else { instance = vmTemplateDao.getInstanceType(getParameters().getId(), getUserID(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(instance); }
Source:
public ParametersAction(@Nonnull List<ParameterValue> parameters) { wasInitializedWithNullParameters = parameters == null; this.parameters = parameters != null ? parameters : Collections.<ParameterValue>emptyList(); String paramNames = SystemProperties.getString(SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME); safeParameters = new TreeSet<>(); if (paramNames != null) { safeParameters.addAll(Arrays.asList(paramNames.split(","))); } }

Target:
public ParametersAction(@Nonnull List<ParameterValue> parameters) { wasInitializedWithNullParameters = parameters == null; if (wasInitializedWithNullParameters && LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Parameters action has been initialized with null parameters. " + "It is a bug in a plugin or script, which created this action (see JENKINS-39495). " + "See next system log entries to see for which Run it has been created", new IllegalStateException("Parameters list is null for the action")); } this.parameters = parameters != null ? new ArrayList<>(parameters) : Collections.<ParameterValue>emptyList(); String paramNames = SystemProperties.getString(SAFE_PARAMETERS_SYSTEM_PROPERTY_NAME); safeParameters = new TreeSet<>(); if (paramNames != null) { safeParameters.addAll(Arrays.asList(paramNames.split(","))); } }
Source:
public void testTierManagerStateSync() throws Exception { clusterControl.terminateOnePassive(); ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .defaultServerResource("test") .resourcePool("foo", 8L, MB) .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); EhcacheClientEntity clientEntity = getEntity(service); clusterControl.startOneServer(); clusterControl.waitForRunningPassivesInStandby(); clusterControl.terminateActive(); clusterControl.waitForActive(); clientEntity.validate(configuration.getServerConfiguration()); service.stop(); }

Target:
public void testTierManagerStateSync() throws Exception { clusterControl.terminateOnePassive(); ClusteringServiceConfiguration configuration = ClusteringServiceConfigurationBuilder.cluster(URI.create(STRIPE_URI)) .autoCreate() .defaultServerResource("test") .resourcePool("foo", 8L, MB) .build(); ClusteringService service = new ClusteringServiceFactory().create(configuration); service.start(null); EhcacheClientEntity clientEntity = getEntity(service); clusterControl.startOneServer(); clusterControl.waitForRunningPassivesInStandby(); clusterControl.terminateActive(); clientEntity.validate(configuration.getServerConfiguration()); service.stop(); }
Source:
public OutputColumns getOutputColumns() { final String name = _column.getName() + " (" + _dictionary.getName() + " removed)"; switch (_removedMatches) { case LIST: return new OutputColumns(new String[] { name, OUTPUT_COLUMN_REMOVED_MATCHES }, new Class[] { String.class, List.class }); default: return new OutputColumns(String.class, new String[] { name, OUTPUT_COLUMN_REMOVED_MATCHES }); } }

Target:
public OutputColumns getOutputColumns() { final String[] columnNames = new String[2]; final Class<?>[] columnTypes = new Class[2]; columnNames[0] = _column.getName() + " (" + _dictionary.getName() + " removed)"; columnTypes[0] = String.class; columnNames[1] = OUTPUT_COLUMN_REMOVED_MATCHES; switch (_removedMatchesType) { case STRING: columnTypes[1] = String.class; break; case LIST: columnTypes[1] = List.class; break; default: throw new UnsupportedOperationException("Unsupported output type: " + _removedMatchesType); } return new OutputColumns(columnNames, columnTypes); }
Source:
public void adjustUserName(LdapProviderType ldapProviderType) { StringBuilder userDNSb = new StringBuilder(); if ( ldapProviderType.equals(LdapProviderType.activeDirectory) ) { userDNSb.append("CN=").append(userName).append(",CN=Users"); } else if (ldapProviderType.equals(LdapProviderType.rhds) || ldapProviderType.equals(LdapProviderType.openLdap)) { userDNSb.append("uid=").append(userName).append(",ou=People"); } else { userDNSb.append("uid=").append(userName).append(",cn=Users").append(",cn=Accounts"); } if (baseDN != null && !baseDN.isEmpty()) { String dcDN = getDcDN(baseDN); if (!dcDN.isEmpty()) { userDNSb.append(",").append(dcDN); } } userName = userDNSb.toString(); }

Target:
public void adjustUserName(LdapProviderType ldapProviderType) { StringBuilder userDNSb = new StringBuilder(); if ( ldapProviderType.equals(LdapProviderType.activeDirectory) ) { userDNSb.append("CN=").append(userName).append(",CN=Users"); } else if (ldapProviderType.equals(LdapProviderType.rhds) || ldapProviderType.equals(LdapProviderType.openLdap)) { userDNSb.append("uid=").append(userName).append(",ou=People"); } else { userDNSb.append("uid=").append(userName).append(",cn=Users").append(",cn=Accounts"); } if (StringUtils.isNotEmpty(baseDN)) { String dcDN = getDcDN(baseDN); if (!dcDN.isEmpty()) { userDNSb.append(",").append(dcDN); } } userName = userDNSb.toString(); }
Source:
public Set<CronTaskConfigurationDto> getCronTaskConfigurations() { return cronTaskConfigurations != null ? cronTaskConfigurations : new LinkedHashSet<>(); }

Target:
public Set<CronTaskConfigurationDto> getCronTaskConfigurations() { return cronTaskConfigurations != null ? cronTaskConfigurations : (cronTaskConfigurations = new LinkedHashSet<>()); }
Source:
public String getEventTitle(BigDecimal latitude, BigDecimal longitude) throws IOException { JsonObject feature = this.geoservePlaces.getNearestPlace(latitude, longitude); Double distance = feature.getJsonObject("properties").getJsonNumber("distance").doubleValue(); System.out.println("-------------------\n\n\ndistance: " + distance); System.out.println("\ndistanceThreshold: " + this.distanceThreshold + "\n\n\n--------------"); if (distance > this.distanceThreshold) { return this.geoserveRegions.getFeRegionName(latitude, longitude); } return this.formatEventTitle(feature); }

Target:
public String getEventTitle(BigDecimal latitude, BigDecimal longitude) throws IOException { try { JsonObject feature = this.geoservePlaces.getNearestPlace(latitude, longitude); Double distance = feature.getJsonObject("properties").getJsonNumber("distance").doubleValue(); if (distance < this.distanceThreshold) { return this.formatEventTitle(feature); } } catch (Exception e) { LOGGER.log(Level.WARNING, "[" + this.getName() + "] failed to get nearest place from geoserve places service."); } return this.geoserveRegions.getFeRegionName(latitude, longitude); }
Source:
void processStatusException() { final Error expectedError = Error.getDefaultInstance(); final Metadata metadata = MetadataConverter.toMetadata(expectedError); final StatusException statusException = INVALID_ARGUMENT.asException(metadata); assertEquals(expectedError, StreamObservers.fromStreamError(statusException) .get()); }

Target:
void processStatusException() { final Error expectedError = Error.getDefaultInstance(); final Metadata metadata = MetadataConverter.toMetadata(expectedError); final StatusException statusException = INVALID_ARGUMENT.asException(metadata); assertEquals(expectedError, fromStreamError(statusException).get()); }
Source:
public void getCanceledJobs() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "test_get_canceled_jobs"; try { client.putBucket(new PutBucketRequest(bucketName)); final List<Ds3Object> objectsOne = new ArrayList<>(); final Ds3Object obj = new Ds3Object("testOne", 2); objectsOne.add(obj); final Ds3ClientHelpers.Job jobOne = wrap(client).startWriteJob(bucketName, objectsOne); final UUID jobOneId = jobOne.getJobId(); final CancelJobSpectraS3Response cancelResponse = client .cancelJobSpectraS3(new CancelJobSpectraS3Request(jobOneId)); final GetCanceledJobsSpectraS3Response getCanceledJobsResponse = client .getCanceledJobsSpectraS3(new GetCanceledJobsSpectraS3Request()); List<UUID> canceledJobsUUIDs = new ArrayList<>(); for (CanceledJob job : getCanceledJobsResponse.getCanceledJobListResult().getCanceledJobs()) { canceledJobsUUIDs.add(job.getId()); } assertTrue(canceledJobsUUIDs.contains(jobOneId)); } finally { deleteAllContents(client, bucketName); } }

Target:
public void getCanceledJobs() throws IOException, SignatureException, XmlProcessingException { try { final Ds3ClientHelpers.Job jobOne = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(new Ds3Object("test", 2))); final UUID jobOneId = jobOne.getJobId(); client.cancelJobSpectraS3(new CancelJobSpectraS3Request(jobOneId)); final GetCanceledJobsSpectraS3Response getCanceledJobsResponse = client .getCanceledJobsSpectraS3(new GetCanceledJobsSpectraS3Request()); final List<UUID> canceledJobsUUIDs = new ArrayList<>(); for (final CanceledJob job : getCanceledJobsResponse.getCanceledJobListResult().getCanceledJobs()) { canceledJobsUUIDs.add(job.getId()); } assertTrue(canceledJobsUUIDs.contains(jobOneId)); } finally { deleteAllContents(client, BUCKET_NAME); } }