auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void whenLossTolerant_andOwnerCrashes_thenContinue() { final ReliableMessageListenerMock listener = new ReliableMessageListenerMock(); listener.isLossTolerant = true; topic.addMessageListener(listener); topic.publish("item1"); topic.publish("item2"); assertTrueEventually(() -> { assertContains(listener.objects, "item1"); assertContains(listener.objects, "item2"); }); TestUtil.terminateInstance(topicOwnerInstance); assertTrueEventually(() -> { String item = "newItem " + UUID.randomUUID(); topic.publish(item); assertTrueEventually(() -> { assertContains(listener.objects, item); assertFalse(topic.runnersMap.isEmpty()); }, 5); }); }

Target:
public void whenLossTolerant_andOwnerCrashes_thenContinue() { final ReliableMessageListenerMock listener = new ReliableMessageListenerMock(); listener.isLossTolerant = true; topic.addMessageListener(listener); topic.publish("item1"); topic.publish("item2"); assertTrueEventually(() -> { assertContains(listener.objects, "item1"); assertContains(listener.objects, "item2"); }); TestUtil.terminateInstance(topicOwnerInstance); assertTrueEventually(() -> { String item = "newItem " + UUID.randomUUID(); topic.publish(item); assertTrueEventually(() -> assertContains(listener.objects, item), 5); }); }
Source:
private String parse() throws AssertionError { Options opts = new Options(!withExterns); List<SourceFile> sourceFiles = new ArrayList<>(); if (getSubject().roots.isEmpty() || !getSubject().roots.get(0).getName().equals("base.js")) { sourceFiles.add(CLUTZ_GOOG_BASE); } for (File nonroot : getSubject().nonroots) { sourceFiles.add(SourceFile.fromFile(nonroot, UTF_8)); } List<String> roots = new ArrayList<>(); for (File root : getSubject().roots) { sourceFiles.add(SourceFile.fromFile(root, UTF_8)); roots.add(root.getPath()); } if (getSubject().sourceText != null) { sourceFiles.add(SourceFile.fromCode("main.js", getSubject().sourceText)); roots.add("main.js"); } List<SourceFile> externs = withExterns ? DeclarationGenerator.getDefaultExterns(opts) : NO_EXTERNS; if (withExterns) externs.addAll(THIRD_PARTY_EXTERNS); String actual = new DeclarationGenerator(opts) .generateDeclarations(sourceFiles, externs, new Depgraph(roots)); return actual; }

Target:
private String parse() throws AssertionError { Options opts = new Options(!withExterns); List<SourceFile> sourceFiles = new ArrayList<>(); if (getSubject().roots.isEmpty() || !getSubject().roots.get(0).getName().equals("base.js")) { sourceFiles.add(CLUTZ_GOOG_BASE); } for (File nonroot : getSubject().nonroots) { sourceFiles.add(SourceFile.fromFile(nonroot, UTF_8)); } List<String> roots = new ArrayList<>(); for (File root : getSubject().roots) { sourceFiles.add(SourceFile.fromFile(root, UTF_8)); roots.add(root.getPath()); } if (getSubject().sourceText != null) { sourceFiles.add(SourceFile.fromCode("main.js", getSubject().sourceText)); roots.add("main.js"); } List<SourceFile> externs = NO_EXTERNS; if (withExterns) { externs = DeclarationGenerator.getDefaultExterns(opts); externs.addAll(THIRD_PARTY_EXTERNS); } String actual = new DeclarationGenerator(opts) .generateDeclarations(sourceFiles, externs, new Depgraph(roots)); return actual; }
Source:
private static String getColumnRangesMetadataSqlQuery(RaptorTableHandle raptorTableHandle, List<TableColumn> raptorColumns) { String shardIndexTableName = shardIndexTable(raptorTableHandle.getTableId()); List<String> aggregatedColumns = raptorColumns.stream() .flatMap(column -> Stream.of( format("min(%s)", minColumn(column.getColumnId())), format("max(%s)", maxColumn(column.getColumnId())))) .collect(toImmutableList()); return format("SELECT %s FROM %s", Joiner.on(", ").join(aggregatedColumns), shardIndexTableName); }

Target:
private static String getColumnRangesMetadataSqlQuery(RaptorTableHandle raptorTableHandle, List<TableColumn> raptorColumns) { String columns = raptorColumns.stream() .flatMap(column -> Stream.of( format("min(%s)", minColumn(column.getColumnId())), format("max(%s)", maxColumn(column.getColumnId())))) .collect(joining(", ")); return format("SELECT %s FROM %s", columns, shardIndexTable(raptorTableHandle.getTableId())); }
Source:
public RecordingRequester create(FormEntryPrompt prompt, boolean externalRecorderPreferred) { Optional<String> audioQuality = FormEntryPromptUtils.getAttributeValue(prompt, "quality"); if (audioQuality.isPresent() && (audioQuality.get().equals("normal") || audioQuality.get().equals("voice-only"))) { return new InternalRecordingRequester(activity, audioRecorderViewModel, permissionUtils, lifecycle, questionMediaManager); } else if (audioQuality.isPresent() && audioQuality.get().equals("external")) { return new ExternalAppRecordingRequester(activity, activityAvailability, waitingForDataRegistry, permissionUtils); } else if (externalRecorderPreferred) { return new ExternalAppRecordingRequester(activity, activityAvailability, waitingForDataRegistry, permissionUtils); } else { return new InternalRecordingRequester(activity, audioRecorderViewModel, permissionUtils, lifecycle, questionMediaManager); } }

Target:
public RecordingRequester create(FormEntryPrompt prompt, boolean externalRecorderPreferred) { String audioQuality = FormEntryPromptUtils.getAttributeValue(prompt, "quality"); if (audioQuality != null && (audioQuality.equals("normal") || audioQuality.equals("voice-only"))) { return new InternalRecordingRequester(activity, audioRecorderViewModel, permissionUtils, lifecycle, questionMediaManager); } else if (audioQuality != null && audioQuality.equals("external")) { return new ExternalAppRecordingRequester(activity, activityAvailability, waitingForDataRegistry, permissionUtils); } else if (externalRecorderPreferred) { return new ExternalAppRecordingRequester(activity, activityAvailability, waitingForDataRegistry, permissionUtils); } else { return new InternalRecordingRequester(activity, audioRecorderViewModel, permissionUtils, lifecycle, questionMediaManager); } }
Source:
public void testInsufficientData() throws IOException { InputStreamFactory in = new ResourceAsStreamFactory(getClass(), "/opennlp/tools/sentdetect/SentencesInsufficient.txt"); TrainingParameters mlParams = new TrainingParameters(); mlParams.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(100)); mlParams.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(0)); SentenceDetectorFactory factory = new SentenceDetectorFactory("en", true, null, null); SentenceDetectorME.train("en", new SentenceSampleStream( new PlainTextByLineStream(in, StandardCharsets.UTF_8)), factory, mlParams); }

Target:
public void testInsufficientData() throws IOException { InputStreamFactory in = new ResourceAsStreamFactory(getClass(), "/opennlp/tools/sentdetect/SentencesInsufficient.txt"); TrainingParameters mlParams = new TrainingParameters(); mlParams.put(TrainingParameters.ITERATIONS_PARAM, "100"); mlParams.put(TrainingParameters.CUTOFF_PARAM, "0"); SentenceDetectorFactory factory = new SentenceDetectorFactory("en", true, null, null); SentenceDetectorME.train("en", new SentenceSampleStream( new PlainTextByLineStream(in, StandardCharsets.UTF_8)), factory, mlParams); }
Source:
public @ResponseBody AffiliationGroupContainer getGroupedAffiliations(@PathVariable("orcid") String orcid) { AffiliationGroupContainer result = new AffiliationGroupContainer(); Map<AffiliationType, List<AffiliationGroup<AffiliationSummary>>> affiliationsMap = affiliationsManagerReadOnly.getGroupedAffiliations(orcid, true); for (AffiliationType type : AffiliationType.values()) { if (affiliationsMap.containsKey(type)) { List<AffiliationGroup<AffiliationSummary>> elementsList = affiliationsMap.get(type); List<AffiliationGroupForm> elementsFormList = new ArrayList<AffiliationGroupForm>(); IntStream.range(0, elementsList.size()).forEach(idx -> { AffiliationGroupForm groupForm = AffiliationGroupForm.valueOf(elementsList.get(idx), type.name() + '_' + idx, orcid); AffiliationForm defaultAffiliation = groupForm.getDefaultAffiliation(); if (defaultAffiliation != null) { defaultAffiliation.setCountryForDisplay(groupForm.getDefaultAffiliation().getCountry().getValue()); } for (AffiliationForm aff : groupForm.getAffiliations()) { aff.setCountryForDisplay(aff.getCountry().getValue()); } elementsFormList.add(groupForm); }); result.getAffiliationGroups().put(type, elementsFormList); } } return result; }

Target:
public @ResponseBody AffiliationGroupContainer getGroupedAffiliations(@PathVariable("orcid") String orcid) { AffiliationGroupContainer result = new AffiliationGroupContainer(); Map<AffiliationType, List<AffiliationGroup<AffiliationSummary>>> affiliationsMap = affiliationsManagerReadOnly.getGroupedAffiliations(orcid, true); for (AffiliationType type : AffiliationType.values()) { if (affiliationsMap.containsKey(type)) { List<AffiliationGroup<AffiliationSummary>> elementsList = affiliationsMap.get(type); List<AffiliationGroupForm> elementsFormList = new ArrayList<AffiliationGroupForm>(); IntStream.range(0, elementsList.size()).forEach(idx -> { AffiliationGroupForm groupForm = AffiliationGroupForm.valueOf(elementsList.get(idx), type.name() + '_' + idx, orcid); AffiliationForm defaultAffiliation = groupForm.getDefaultAffiliation(); if (defaultAffiliation != null) { if (!PojoUtil.isEmpty(groupForm.getDefaultAffiliation().getCountry())) { defaultAffiliation.setCountryForDisplay(groupForm.getDefaultAffiliation().getCountry().getValue()); } } for (AffiliationForm aff : groupForm.getAffiliations()) { if (!PojoUtil.isEmpty(aff.getCountry())) { aff.setCountryForDisplay(aff.getCountry().getValue()); } } elementsFormList.add(groupForm); }); result.getAffiliationGroups().put(type, elementsFormList); } } return result; }
Source:
public void linkingObjects_IllegalStateException_ifNotYetLoaded() { final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { final BacklinksTarget target1 = realm.createObject(BacklinksTarget.class); target1.setId(1); final BacklinksSource source = realm.createObject(BacklinksSource.class); source.setChild(target1); } }); final BacklinksTarget targetAsync = realm.where(BacklinksTarget.class) .equalTo(BacklinksTarget.FIELD_ID, 1L).findFirstAsync(); assertFalse(targetAsync.isLoaded()); thrown.expect(IllegalStateException.class); targetAsync.getParents(); fail(); }

Target:
public void linkingObjects_IllegalStateException_ifNotYetLoaded() { final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { final BacklinksTarget target = realm.createObject(BacklinksTarget.class); target.setId(1); final BacklinksSource source = realm.createObject(BacklinksSource.class); source.setChild(target); } }); final BacklinksTarget targetAsync = realm.where(BacklinksTarget.class) .equalTo(BacklinksTarget.FIELD_ID, 1L).findFirstAsync(); assertFalse(targetAsync.isLoaded()); thrown.expect(IllegalStateException.class); targetAsync.getParents(); fail(); }
Source:
private void handleStreamZero(FrameType type, ByteBuf frame) { switch (type) { case ERROR: tryTerminateOnZeroError(frame); break; case LEASE: leaseHandler.receive(frame); break; case KEEPALIVE: if (keepAliveFramesAcceptor != null) { keepAliveFramesAcceptor.receive(frame); } break; default: if (LOGGER.isDebugEnabled()) { LOGGER.debug("Requester received unsupported frame on stream 0: " + frame.toString()); } } }

Target:
private void handleStreamZero(FrameType type, ByteBuf frame) { switch (type) { case ERROR: tryTerminateOnZeroError(frame); break; case LEASE: leaseHandler.receive(frame); break; case KEEPALIVE: if (keepAliveFramesAcceptor != null) { keepAliveFramesAcceptor.receive(frame); } break; default: if (LOGGER.isInfoEnabled()) { LOGGER.info("Requester received unsupported frame on stream 0: " + frame.toString()); } } }
Source:
public ResponseEntity<String> resetPassword(@PathVariable("activationkey") String activationkey, @RequestBody Map<String, String> body) { String newPassword = body.get("newPassword"); if (userService.getUserByActivationKey(activationkey) == null) { return new ResponseEntity<String>("Invalid Activation Key", HttpStatus.BAD_REQUEST); } else { userService.changePasswordUsingActivationKey(activationkey, newPassword); return new ResponseEntity<String>(HttpStatus.OK); } }

Target:
public void resetPassword(@PathVariable("activationkey") String activationkey, @RequestBody Map<String, String> body) { String newPassword = body.get("newPassword"); try { userService.changePasswordUsingActivationKey(activationkey, newPassword); } catch (InvalidActivationKeyException ex) { throw new ValidationException(ex.getMessage()); } }
Source:
public boolean traceExists(List<EObject> selection, EClass traceType, EObject traceModel) { TraceMetaModelAdapter traceAdapter = ExtensionPointHelper.getTraceMetamodelAdapter().get(); List<EObject> allElements = new ArrayList<>(); allElements.addAll(selection); EObject source = allElements.get(0); allElements.remove(0); List<EObject> targets = allElements; EObject tempTraceModel = ExtensionPointHelper.getTracePersistenceAdapter().get() .getTraceModel(new ResourceSetImpl()); EObject tempTlink = traceAdapter.createTrace(traceType, tempTraceModel, selection); Connection connection = new Connection(source, targets, tempTlink); List<Connection> relevantConnections = new ArrayList<>(); for (Connection c : traceAdapter.getAllTraceLinks(traceModel)) { if (connection.equals(c)) { relevantConnections.add(c); } } if (relevantConnections.size() > 0) { return true; } else return false; }

Target:
public boolean traceExists(List<EObject> selection, EClass traceType, EObject traceModel) { TraceMetaModelAdapter traceAdapter = ExtensionPointHelper.getTraceMetamodelAdapter().get(); List<EObject> allElements = new ArrayList<>(selection); EObject source = allElements.get(0); allElements.remove(0); List<EObject> targets = allElements; EObject tempTraceModel = ExtensionPointHelper.getTracePersistenceAdapter().get() .getTraceModel(new ResourceSetImpl()); EObject tempTlink = traceAdapter.createTrace(traceType, tempTraceModel, selection); Connection connection = new Connection(source, targets, tempTlink); return traceAdapter.getAllTraceLinks(traceModel).stream().anyMatch(c -> c.equals(connection)); }
Source:
public void run() { try (AutoCloseable ctx = requestContext.open()) { HashSet<Branch.NameKey> pending = new HashSet<>(); List<ChangeData> changes = queryProvider.get().allSubmitted(); for (ChangeData cd : changes) { try { pending.add(cd.change().getDest()); } catch (OrmException e) { log.error("Error reading submitted change", e); } } for (Branch.NameKey branch : pending) { mergeQueue.schedule(branch); } } catch (Exception e) { log.error("Cannot reload MergeQueue", e); } }

Target:
public void run() { try (AutoCloseable ctx = requestContext.open()) { HashSet<Branch.NameKey> pending = new HashSet<>(); for (ChangeData cd : queryProvider.get().allSubmitted()) { try { pending.add(cd.change().getDest()); } catch (OrmException e) { log.error("Error reading submitted change", e); } } for (Branch.NameKey branch : pending) { mergeQueue.schedule(branch); } } catch (Exception e) { log.error("Cannot reload MergeQueue", e); } }
Source:
public static boolean kafkaDetected() { AdminClient client = null; try { client = AdminClient.create(getDefaultAdminProperties()); client.findAllBrokers(); return true; } catch (RuntimeException e) { return false; } finally { if (client != null) { client.close(); } } }

Target:
public static boolean kafkaDetected() { AdminClient client = AdminClient.create(getDefaultAdminProperties()); try { client.findAllBrokers(); return true; } catch (RuntimeException e) { return false; } finally { if (client != null) { client.close(); } } }
Source:
protected Iterable<? extends RunningInstance> pollRunningInstancesByRegionsAndIds(final Multimap<String,String> idsByRegions) { Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations = transform(idsByRegions.keySet(), instancesByIdInRegionFunction(idsByRegions)); return concat(concat(reservations)); }

Target:
protected Iterable<? extends RunningInstance> pollRunningInstancesByRegionsAndIds(final Multimap<String,String> idsByRegions) { Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations = transform(idsByRegions.keySet(), instancesByIdInRegion(idsByRegions)); return concat(concat(reservations)); }
Source:
public void testIsLiquidTumor() throws Exception { TumorType tumorType = new TumorType(); MainType mainType = new MainType(); tumorType.setMainType(mainType); assertFalse("Empty tumor type is not liquid tumor", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Leukemia"); assertTrue("Leukemia is liquid tumor", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Melanoma"); assertFalse("Melanoma is not liquid tumor", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Melanoma"); tumorType.setTissue("BLOOD"); assertTrue("Tissue has higher priority than main type", TumorTypeUtils.isLiquidTumor(tumorType)); }

Target:
public void testIsLiquidTumor() throws Exception { TumorType tumorType = new TumorType(); MainType mainType = new MainType(); tumorType.setMainType(mainType); assertFalse("Empty tumor type is liquid tumor, but it should not be.", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Leukemia"); assertTrue("Leukemia is not liquid tumor, but it should be.", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Melanoma"); assertFalse("Melanoma is liquid tumor, but it should not be.", TumorTypeUtils.isLiquidTumor(tumorType)); mainType.setName("Melanoma"); tumorType.setTissue("BLOOD"); assertTrue("Tissue does not have higher priority than main type, but it should have.", TumorTypeUtils.isLiquidTumor(tumorType)); }
Source:
void shouldWriteOnePointPerName() throws Exception { final Map<String, Point> pointsByName = ImmutableMap.of( "United Kingdom", new Point(1011, 1021), "Germany", new Point(2011, 2021), "Eastern United States", new Point(3011, 3021)); final String content = writeToString(os -> PointFileReaderWriter.writeOneToOne(os, pointsByName)); assertThat(content, containsString("United Kingdom (1011,1021)")); assertThat(content, containsString("Germany (2011,2021)")); assertThat(content, containsString("Eastern United States (3011,3021)")); }

Target:
void shouldWriteOnePointPerName() throws Exception { final Map<String, Point> pointsByName = ImmutableMap.of( "United Kingdom", new Point(1011, 1021), "Germany", new Point(2011, 2021), "Eastern United States", new Point(3011, 3021)); final String content = writeToString(os -> PointFileReaderWriter.writeOneToOne(os, pointsByName)); assertThat( content, is( "" + "United Kingdom (1011,1021) \r\n" + "Germany (2011,2021) \r\n" + "Eastern United States (3011,3021) ")); }
Source:
public Callable<Exercise> getAdaptiveExercise() throws OAuthSystemException, OAuthProblemException, NotLoggedInException { return wrapWithNotLoggedInException(new Callable<Exercise>() { @Override public Exercise call() throws Exception { try { Callable<String> download = new HttpTasks(). getForText(URI.create("<LINK_0>")); String json = download.call(); return adaptiveExerciseParser.parseFromJson(json); } catch (Exception ex) { return null; } } }); }

Target:
public Callable<Exercise> getAdaptiveExercise() throws OAuthSystemException, OAuthProblemException, NotLoggedInException { return wrapWithNotLoggedInException(new Callable<Exercise>() { @Override public Exercise call() throws Exception { try { Callable<String> download = new HttpTasks() .getForText(URI.create(SKILLIFIER_URL)); String json = download.call(); return adaptiveExerciseParser.parseFromJson(json); } catch (Exception ex) { LOG.log(Level.WARNING, "Downloading and parsing adaptive exercise URL failed."); return null; } } }); }
Source:
public void process(KeyFilter<? super K> filter, final CacheLoaderTask<K, V> task, Executor executor, final boolean fetchValue, final boolean fetchMetadata) { filter = PersistenceUtil.notNull(filter); ArrayList<KeyValuePair<K, FileEntry>> keysToLoad = new ArrayList<>(entries.size()); synchronized (entries) { for (Map.Entry<K, FileEntry> e : entries.entrySet()) { if (filter.accept(e.getKey())) keysToLoad.add(new KeyValuePair<>(e.getKey(), e.getValue())); } keysToLoad.sort((o1, o2) -> { long offset1 = o1.getValue().offset; long offset2 = o2.getValue().offset; return offset1 < offset2 ? -1 : offset1 == offset2 ? 0 : 1; }); } ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContextImpl taskContext = new TaskContextImpl(); for (KeyValuePair<K, FileEntry> entry : keysToLoad) { if (taskContext.isStopped()) break; final K key = entry.getKey(); eacs.submit(() -> { try { final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata); if (marshalledEntry != null) { task.processEntry(marshalledEntry, taskContext); } return null; } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } }); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { throw new PersistenceException("Execution exception!", eacs.getFirstException()); } }

Target:
public void process(KeyFilter<? super K> filter, final CacheLoaderTask<K, V> task, Executor executor, final boolean fetchValue, final boolean fetchMetadata) { filter = PersistenceUtil.notNull(filter); ArrayList<KeyValuePair<K, FileEntry>> keysToLoad = new ArrayList<>(entries.size()); synchronized (entries) { for (Map.Entry<K, FileEntry> e : entries.entrySet()) { if (filter.accept(e.getKey())) keysToLoad.add(new KeyValuePair<>(e.getKey(), e.getValue())); } } keysToLoad.sort((o1, o2) -> { long offset1 = o1.getValue().offset; long offset2 = o2.getValue().offset; return offset1 < offset2 ? -1 : offset1 == offset2 ? 0 : 1; }); ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContextImpl taskContext = new TaskContextImpl(); for (KeyValuePair<K, FileEntry> entry : keysToLoad) { if (taskContext.isStopped()) break; final K key = entry.getKey(); eacs.submit(() -> { try { final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata); if (marshalledEntry != null) { task.processEntry(marshalledEntry, taskContext); } return null; } catch (Exception e) { log.errorExecutingParallelStoreTask(e); throw e; } }); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { throw new PersistenceException("Execution exception!", eacs.getFirstException()); } }
Source:
private List<DiseaseOccurrence> refineSubsetForOtherDiseaseGroup(List<DiseaseOccurrence> occurrences) { if (minDistinctCountries != null) { extractDistinctGaulCodes(occurrences); while (!minDataSpreadCheckForOtherDiseaseGroup()) { if (occurrences.equals(allOccurrences)) { return null; } int n = occurrences.size(); occurrences = allOccurrences.subList(0, n + 1); countriesWithAtLeastOneOccurrence.add(occurrences.get(n).getLocation().getCountryGaulCode()); } } return occurrences; }

Target:
private List<DiseaseOccurrence> refineSubsetForOtherDiseaseGroup(List<DiseaseOccurrence> occurrences) { if (minDistinctCountries != null) { extractDistinctGaulCodes(occurrences); while (!minDataSpreadCheckForOtherDiseaseGroup()) { int n = occurrences.size(); if (n == allOccurrences.size()) { return null; } DiseaseOccurrence nextOccurrence = allOccurrences.get(n); occurrences.add(nextOccurrence); countriesWithAtLeastOneOccurrence.add(nextOccurrence.getLocation().getCountryGaulCode()); } } return occurrences; }
Source:
public boolean starred() throws IOException { final Request request = this.entry.uri().path(RtGist.PATH_ELEMENT_STAR) .back().method("GET"); final Response response = request.fetch(); if (response.status() == HttpURLConnection.HTTP_NO_CONTENT || response.status() == HttpURLConnection.HTTP_NOT_FOUND) { return response.status() == HttpURLConnection.HTTP_NO_CONTENT; } throw new AssertionError( String.format( "HTTP status %s", response.status() ) ); }

Target:
public boolean starred() throws IOException { final RestResponse response = this.request.method("GET").fetch() .as(RestResponse.class).assertStatus( Matchers.isOneOf( HttpURLConnection.HTTP_NO_CONTENT, HttpURLConnection.HTTP_NOT_FOUND ) ); return response.status() == HttpURLConnection.HTTP_NO_CONTENT; }
Source:
public void test03_New_Line() throws IOException { driver.findElement(By.id("03")).click(); inputFieldAccessor.overrideValue(By.id("text-output"), "Spring\nmvc\nspring mvc", driver); driver.findElement(By.id("btn-output")).click(); WebElement newLineOutput = driver.findElement(By.id("newLineOutput")); BufferedReader newLineOutputTextReader = new BufferedReader(new StringReader( newLineOutput.getText())); assertThat(newLineOutputTextReader.readLine(), is("Spring")); assertThat(newLineOutputTextReader.readLine(), is("mvc")); assertThat(newLineOutputTextReader.readLine(), is("spring mvc")); assertThat(newLineOutputTextReader.readLine(), nullValue()); assertThat(newLineOutput.findElements(By.tagName("br")).size(), is(2)); screenCapture.save(driver); driver.get(applicationContextUrl); driver.findElement(By.id("EL")).click(); driver.findElement(By.id("03")).click(); inputFieldAccessor.overrideValue(By.id("text-output"), "Spring_Mvc", driver); driver.findElement(By.id("btn-output")).click(); assertThat(driver.getPageSource().contains("Spring_Mvc"), is(true)); }

Target:
public void test03_New_Line() throws IOException { driver.findElement(By.id("03")).click(); inputFieldAccessor.overrideValue(By.id("text-output"), "Spring\nmvc\nspring mvc", driver); driver.findElement(By.id("btn-output")).click(); WebElement newLineOutput = driver.findElement(By.id("newLineOutput")); BufferedReader newLineOutputTextReader = new BufferedReader(new StringReader( newLineOutput.getText())); try { assertThat(newLineOutputTextReader.readLine(), is("Spring")); assertThat(newLineOutputTextReader.readLine(), is("mvc")); assertThat(newLineOutputTextReader.readLine(), is("spring mvc")); assertThat(newLineOutputTextReader.readLine(), nullValue()); } finally { newLineOutputTextReader.close(); } assertThat(newLineOutput.findElements(By.tagName("br")).size(), is(2)); screenCapture.save(driver); driver.get(applicationContextUrl); driver.findElement(By.id("EL")).click(); driver.findElement(By.id("03")).click(); inputFieldAccessor.overrideValue(By.id("text-output"), "Spring_Mvc", driver); driver.findElement(By.id("btn-output")).click(); assertThat(driver.getPageSource().contains("Spring_Mvc"), is(true)); }
Source:
public MeasureDefinition withObjUriQualifiers(final ObjQualifierConverter objQualifierConverter) { if (popAttribute instanceof IdentifierObjQualifier) { final IdentifierObjQualifier identifierPopAttribute = (IdentifierObjQualifier) popAttribute; Validate.notNull(objQualifierConverter, "'objQualifierConverter' must not be null!"); return objQualifierConverter.convertToUriQualifier(identifierPopAttribute) .map(uriObjQualifier -> new PopMeasureDefinition(measureIdentifier, uriObjQualifier)) .orElseThrow(() -> new IllegalArgumentException(format("The converter does not know how to convert identifier '%s'!", popAttribute))); } return this; }

Target:
public MeasureDefinition withObjUriQualifiers(final ObjQualifierConverter objQualifierConverter) { return ObjIdentifierUtilities.copyIfNecessary( this, popAttribute, uriObjQualifier -> new PopMeasureDefinition(measureIdentifier, uriObjQualifier), objQualifierConverter ); }
Source:
public int read() throws IOException { ByteBuffer buffer = singleByteBufferChannel.getBuffer(); buffer.clear(); int data = -1; if (read(singleByteBufferChannel) != -1) { buffer.flip(); data = buffer.get() & 0xFF; } return data; }

Target:
public int read() throws IOException { ByteBuffer buffer = singleByteBufferChannel.getBuffer(); buffer.clear(); int data = -1; if (read(singleByteBufferChannel) != -1) { buffer.flip(); data = buffer.get() & 0xFF; totalBytesRead++; } return data; }
Source:
private List<DiskImage> getDisksBasedOnImage() { if (disksImages == null) { disksImages = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_SNAPABLE, ONLY_ACTIVE); } return disksImages; }

Target:
private List<DiskImage> getDisksBasedOnImage() { if (disksImages == null) { disksImages = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_NOT_SHAREABLE, ONLY_ACTIVE); } return disksImages; }
Source:
private void flushAppender(AsyncAppender appender) throws InterruptedException { int timeWaiting = 0; while (timeWaiting < appender.getMaxFlushTime() && appender.getNumberOfElementsInQueue() > 0) { Thread.sleep(100); timeWaiting += 100; } if (appender.getNumberOfElementsInQueue() > 0) { appender.addWarn("Possibly " + appender.getNumberOfElementsInQueue() + " will be discarded"); } }

Target:
private void flushAppender(AsyncAppender appender) throws InterruptedException { int timeWaiting = 0; while (timeWaiting < appender.getMaxFlushTime() && appender.getNumberOfElementsInQueue() > 0) { Thread.sleep(100); timeWaiting += 100; } if (appender.getNumberOfElementsInQueue() > 0) { appender.addWarn(appender.getNumberOfElementsInQueue() + " events may be discarded"); } }
Source:
public void activateAggregation(AggregationPropertyPath.Type aggregationType) { super.activateAggregation( aggregationType ); if ( aggregationType == AggregationPropertyPath.Type.COUNT ) { count = true; } }

Target:
public void activateAggregation(AggregationPropertyPath.Type aggregationType) { super.activateAggregation( aggregationType ); this.aggregationPropertyPathType = aggregationType; }
Source:
private Response addDomain(VdcActionType action, StorageDomain model, StorageDomainStatic entity, Guid hostId, StorageServerConnections connection) { Response response = null; boolean isConnNew = false; if (connection.getstorage_type().isFileDomain() && StringUtils.isEmpty(connection.getid())) { isConnNew = true; connection.setid(addStorageServerConnection(connection, hostId)); } entity.setStorage(connection.getid()); if (action == VdcActionType.AddNFSStorageDomain || action == VdcActionType.AddPosixFsStorageDomain || action == VdcActionType.AddGlusterFsStorageDomain) { org.ovirt.engine.core.common.businessentities.StorageDomain existing = getExistingStorageDomain(hostId, entity.getStorageType(), entity.getStorageDomainType(), connection); if (existing != null) { setStorageDomainProperties(entity, existing.getStorageStaticData()); entity = existing.getStorageStaticData(); action = VdcActionType.AddExistingFileStorageDomain; } } if (action != VdcActionType.AddExistingFileStorageDomain) { validateParameters(model, 2, "name"); } try { response = performCreate(action, getAddParams(entity, hostId), ID_RESOLVER); } catch (WebFaultException e) { if (isConnNew) { removeStorageServerConnection(connection, hostId); } throw e; } return response; }

Target:
private Response addDomain(VdcActionType action, StorageDomain model, StorageDomainStatic entity, Guid hostId, StorageServerConnections connection) { Response response = null; boolean isConnNew = false; if (connection.getstorage_type().isFileDomain() && StringUtils.isEmpty(connection.getid())) { isConnNew = true; connection.setid(addStorageServerConnection(connection, hostId)); } entity.setStorage(connection.getid()); if (action == VdcActionType.AddNFSStorageDomain || action == VdcActionType.AddPosixFsStorageDomain || action == VdcActionType.AddGlusterFsStorageDomain) { org.ovirt.engine.core.common.businessentities.StorageDomain existing = getExistingStorageDomain(hostId, entity.getStorageType(), entity.getStorageDomainType(), connection); if (existing != null) { StorageDomainMapper.map(model, existing.getStorageStaticData()); entity = existing.getStorageStaticData(); action = VdcActionType.AddExistingFileStorageDomain; } } if (action != VdcActionType.AddExistingFileStorageDomain) { validateParameters(model, 2, "name"); } try { response = performCreate(action, getAddParams(entity, hostId), ID_RESOLVER); } catch (WebFaultException e) { if (isConnNew) { removeStorageServerConnection(connection, hostId); } throw e; } return response; }
Source:
public void testCheckAndUpdateConfigMapConcurrently() throws Exception { final List<CompletableFuture<Void>> futures = new ArrayList<>(); final int target = 10; final int updateIntervalMs = 100; for (String key : data.keySet()) { futures.add(FutureUtils.runAfterwardsAsync(FutureUtils.completedVoidFuture(), () -> { for (int index = 0; index < target; index++) { final boolean updated = flinkKubeClient.checkAndUpdateConfigMap( TEST_CONFIG_MAP_NAME, configMap -> { final int newValue = Integer.valueOf(configMap.getData().get(key)) + 1; configMap.getData().put(key, String.valueOf(newValue)); return Optional.of(configMap); }).get(); assertThat(updated, is(true)); try { Thread.sleep((long) (updateIntervalMs * Math.random())); } catch (InterruptedException e) { } } }, kubernetesResource.getExecutorService())); } FutureUtils.waitForAll(futures).get(TIMEOUT, TimeUnit.MILLISECONDS); final Optional<KubernetesConfigMap> configMapOpt = flinkKubeClient.getConfigMap(TEST_CONFIG_MAP_NAME); assertThat(configMapOpt.isPresent(), is(true)); assertThat(configMapOpt.get().getData().values(), everyItem(is(String.valueOf(target)))); }

Target:
public void testCheckAndUpdateConfigMapConcurrently() throws Exception { final List<CompletableFuture<Void>> futures = new ArrayList<>(); final int target = 10; final int updateIntervalMs = 100; for (String key : data.keySet()) { futures.add(CompletableFuture.runAsync(() -> { for (int index = 0; index < target; index++) { final boolean updated = flinkKubeClient.checkAndUpdateConfigMap( TEST_CONFIG_MAP_NAME, configMap -> { final int newValue = Integer.valueOf(configMap.getData().get(key)) + 1; configMap.getData().put(key, String.valueOf(newValue)); return Optional.of(configMap); }).join(); assertThat(updated, is(true)); try { Thread.sleep((long) (updateIntervalMs * Math.random())); } catch (InterruptedException e) { } } }, executorService)); } FutureUtils.waitForAll(futures).get(TIMEOUT, TimeUnit.MILLISECONDS); final Optional<KubernetesConfigMap> configMapOpt = flinkKubeClient.getConfigMap(TEST_CONFIG_MAP_NAME); assertThat(configMapOpt.isPresent(), is(true)); assertThat(configMapOpt.get().getData().values(), everyItem(is(String.valueOf(target)))); }
Source:
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { FlingRegister.flingDetected(); String navigation = (String) GeneralSharedPreferences.getInstance() .get(GeneralKeys.KEY_NAVIGATION); if (e1 != null && e2 != null && navigation.contains(GeneralKeys.NAVIGATION_SWIPE) && allowSwiping) { int xpixellimit = (int) (ScreenUtils.getXPixelsNumberPerInch() * .25); int ypixellimit = (int) (ScreenUtils.getYPixelsNumberPerInch() * .25); if (odkView != null && odkView.suppressFlingGesture(e1, e2, velocityX, velocityY)) { return false; } if (beenSwiped) { return false; } float diffX = Math.abs(e1.getX() - e2.getX()); float diffY = Math.abs(e1.getY() - e2.getY()); if (odkView != null && canScrollVertically() && getGestureAngle(diffX, diffY) > 30) { return false; } if ((diffX > xpixellimit && diffY < ypixellimit) || diffX > xpixellimit * 2) { beenSwiped = true; if (velocityX > 0) { if (e1.getX() > e2.getX()) { Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX()); onSwipe.showNextView(); } else { onSwipe.showPreviousView(); } } else { if (e1.getX() < e2.getX()) { Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX()); onSwipe.showPreviousView(); } else { onSwipe.showNextView(); } } return true; } } return false; }

Target:
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { FlingRegister.flingDetected(); String navigation = (String) GeneralSharedPreferences.getInstance() .get(GeneralKeys.KEY_NAVIGATION); if (e1 != null && e2 != null && navigation.contains(GeneralKeys.NAVIGATION_SWIPE) && allowSwiping) { int xpixellimit = (int) (ScreenUtils.xdpi() * .25); int ypixellimit = (int) (ScreenUtils.ydpi() * .25); if (odkView != null && odkView.suppressFlingGesture(e1, e2, velocityX, velocityY)) { return false; } if (beenSwiped) { return false; } float diffX = Math.abs(e1.getX() - e2.getX()); float diffY = Math.abs(e1.getY() - e2.getY()); if (odkView != null && canScrollVertically() && getGestureAngle(diffX, diffY) > 30) { return false; } if ((diffX > xpixellimit && diffY < ypixellimit) || diffX > xpixellimit * 2) { beenSwiped = true; if (velocityX > 0) { if (e1.getX() > e2.getX()) { Timber.e("showNextView VelocityX is bogus! %f > %f", e1.getX(), e2.getX()); onSwipe.showNextView(); } else { onSwipe.showPreviousView(); } } else { if (e1.getX() < e2.getX()) { Timber.e("showPreviousView VelocityX is bogus! %f < %f", e1.getX(), e2.getX()); onSwipe.showPreviousView(); } else { onSwipe.showNextView(); } } return true; } } return false; }
Source:
private <T> Set<T> toSet(T ele, T... eles) { return Stream.concat(Stream.of(ele), Stream.of(eles)).collect(Collectors.toSet()); }

Target:
private <T> Set<T> toSet(T ele, T... eles) { return toStream(ele, eles).collect(Collectors.toSet()); }
Source:
public static Optional<VoltPhysicalLimit> buildFragmentLimit(VoltPhysicalLimit coordinatorLimit, RelDistribution fragmentDist, RelNode fragmentNode) { RexNode limit = coordinatorLimit.getLimit(); RexNode offset = coordinatorLimit.getOffset(); if (limit == null) { return Optional.empty(); } VoltPhysicalLimit fragmentLimit = null; if (offset == null) { fragmentLimit = new VoltPhysicalLimit( coordinatorLimit.getCluster(), coordinatorLimit.getTraitSet().replace(fragmentDist), fragmentNode, null, limit, false); } else { RexNode combinedLimit = null; RexBuilder builder = coordinatorLimit.getCluster().getRexBuilder(); if (RexUtil.isLiteral(limit, true) && RexUtil.isLiteral(offset, true)) { int intLimit = RexLiteral.intValue(limit); int intOffset = RexLiteral.intValue(offset); combinedLimit = builder.makeLiteral(intLimit + intOffset, limit.getType(), true); } else { combinedLimit = builder.makeCall( SqlStdOperatorTable.PLUS, offset, limit); } fragmentLimit = new VoltPhysicalLimit( coordinatorLimit.getCluster(), coordinatorLimit.getTraitSet().replace(fragmentDist), fragmentNode, null, combinedLimit, false); } return Optional.of(fragmentLimit); }

Target:
public static Optional<VoltPhysicalLimit> buildFragmentLimit(VoltPhysicalLimit coordinatorLimit, RelDistribution fragmentDist, RelNode fragmentNode) { RexNode limit = coordinatorLimit.getLimit(); RexNode offset = coordinatorLimit.getOffset(); if (limit == null) { return Optional.empty(); } VoltPhysicalLimit fragmentLimit = null; if (offset == null) { fragmentLimit = new VoltPhysicalLimit( coordinatorLimit.getCluster(), coordinatorLimit.getTraitSet().replace(fragmentDist), fragmentNode, null, limit, false); } else { final RexNode combinedLimit; RexBuilder builder = coordinatorLimit.getCluster().getRexBuilder(); if (RexUtil.isLiteral(limit, true) && RexUtil.isLiteral(offset, true)) { int intLimit = RexLiteral.intValue(limit); int intOffset = RexLiteral.intValue(offset); combinedLimit = builder.makeLiteral(intLimit + intOffset, limit.getType(), true); } else { combinedLimit = builder.makeCall( SqlStdOperatorTable.PLUS, offset, limit); } fragmentLimit = new VoltPhysicalLimit( coordinatorLimit.getCluster(), coordinatorLimit.getTraitSet().replace(fragmentDist), fragmentNode, null, combinedLimit, false); } return Optional.of(fragmentLimit); }
Source:
public static HadoopDruidIndexerConfig fromMap(Map<String, Object> argSpec) { if (argSpec.containsKey("registererers")) { List<Registererer> registererers = Lists.transform( MapUtils.getList(argSpec, "registererers"), new Function<Object, Registererer>() { @Override public Registererer apply(@Nullable Object input) { try { return (Registererer) Class.forName((String) input).newInstance(); } catch (Exception e) { throw Throwables.propagate(e); } } } ); for (Registererer registererer : registererers) { registererer.register(); registererer.registerSubType(jsonMapper); } } final HadoopDruidIndexerConfig retVal = jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class); retVal.verify(); return retVal; }

Target:
public static HadoopDruidIndexerConfig fromMap(Map<String, Object> argSpec) { if (argSpec.containsKey("registererers")) { List<Registererer> registererers = Lists.transform( MapUtils.getList(argSpec, "registererers"), new Function<Object, Registererer>() { @Override public Registererer apply(@Nullable Object input) { try { return (Registererer) Class.forName((String) input).newInstance(); } catch (Exception e) { throw Throwables.propagate(e); } } } ); RegisteringNode.registerHandlers(registererers, Arrays.asList(jsonMapper)); } final HadoopDruidIndexerConfig retVal = jsonMapper.convertValue(argSpec, HadoopDruidIndexerConfig.class); retVal.verify(); return retVal; }
Source:
static PendingAddOp create(LedgerHandle lh, ByteBuf payload, AddCallback cb, Object ctx) { PendingAddOp op = RECYCLER.get(); op.lh = lh; op.isRecoveryAdd = false; op.cb = cb; op.ctx = ctx; op.entryId = LedgerHandle.INVALID_ENTRY_ID; op.currentLedgerLength = -1; op.payload = payload; op.entryLength = payload.readableBytes(); op.completed = false; op.ackSet = lh.distributionSchedule.getAckSet(); op.addOpLogger = lh.bk.getAddOpLogger(); op.timeoutNanos = TimeUnit.SECONDS.toNanos(lh.bk.getConf().getAddEntryQuorumTimeout()); op.pendingWriteRequests = 0; op.callbackTriggered = false; op.hasRun = false; op.requestTimeNanos = Long.MAX_VALUE; return op; }

Target:
static PendingAddOp create(LedgerHandle lh, ByteBuf payload, AddCallback cb, Object ctx) { PendingAddOp op = RECYCLER.get(); op.lh = lh; op.isRecoveryAdd = false; op.cb = cb; op.ctx = ctx; op.entryId = LedgerHandle.INVALID_ENTRY_ID; op.currentLedgerLength = -1; op.payload = payload; op.entryLength = payload.readableBytes(); op.completed = false; op.ackSet = lh.distributionSchedule.getAckSet(); op.addOpLogger = lh.bk.getAddOpLogger(); op.timeoutNanos = lh.bk.addEntryQuorumTimeoutNanos; op.pendingWriteRequests = 0; op.callbackTriggered = false; op.hasRun = false; op.requestTimeNanos = Long.MAX_VALUE; return op; }
Source:
public void initialize(RealtimeContext context) throws Exception { super.initialize(context); BasicAWSCredentials awsCred = new BasicAWSCredentials(config.awsAccessKey, config.awsAccessSecret); kinesisClient = new AmazonKinesisClient(awsCred); createAndWaitForStreamToBecomeAvailable(kinesisClient, config.name, config.shardCount); }

Target:
public void initialize(RealtimeContext context) throws Exception { super.initialize(context); BasicAWSCredentials awsCred = new BasicAWSCredentials(config.awsAccessKey, config.awsAccessSecret); kinesisClient = new AmazonKinesisClient(awsCred); KinesisUtil.createAndWaitForStream(kinesisClient, config.name, config.shardCount); }
Source:
public Collection<CauseOfInterruption> getCausesOfInterruption(){ return Collections.unmodifiableCollection(causes); }

Target:
public @Nonnull Collection<CauseOfInterruption> getCausesOfInterruption() { return Collections.unmodifiableCollection(causes); }
Source:
public void whenKafkaPublishTimeoutThenCircuitIsOpened() throws Exception { when(nakadiSettings.getKafkaSendTimeoutMs()).thenReturn(1000L); when(kafkaProducer.partitionsFor(EXPECTED_PRODUCER_RECORD.topic())).thenReturn(ImmutableList.of( new PartitionInfo(EXPECTED_PRODUCER_RECORD.topic(), 1, new Node(1, "host", 9091), null, null))); when(kafkaProducer.send(any(), any())).thenAnswer(invocation -> { final Callback callback = (Callback) invocation.getArguments()[1]; callback.onCompletion(null, new TimeoutException()); return null; }); final List<BatchItem> batches = new LinkedList<>(); for (int i = 0; i < 1000; i++) { try { final BatchItem batchItem = new BatchItem(new JSONObject()); batchItem.setPartition("1"); batches.add(batchItem); kafkaTopicRepository.syncPostBatch(EXPECTED_PRODUCER_RECORD.topic(), ImmutableList.of(batchItem)); fail(); } catch (final EventPublishingException e) { } } Assert.assertTrue(batches.stream() .filter(item -> item.getResponse().getPublishingStatus() == EventPublishingStatus.FAILED && item.getResponse().getDetail().equals("timed out")) .count() >= 1); }

Target:
public void whenKafkaPublishTimeoutThenCircuitIsOpened() throws Exception { when(nakadiSettings.getKafkaSendTimeoutMs()).thenReturn(1000L); when(kafkaProducer.partitionsFor(EXPECTED_PRODUCER_RECORD.topic())).thenReturn(ImmutableList.of( new PartitionInfo(EXPECTED_PRODUCER_RECORD.topic(), 1, new Node(1, "host", 9091), null, null))); when(kafkaProducer.send(any(), any())).thenAnswer(invocation -> { final Callback callback = (Callback) invocation.getArguments()[1]; callback.onCompletion(null, new TimeoutException()); return null; }); final List<BatchItem> batches = new LinkedList<>(); for (int i = 0; i < 1000; i++) { try { final BatchItem batchItem = new BatchItem(new JSONObject()); batchItem.setPartition("1"); batches.add(batchItem); kafkaTopicRepository.syncPostBatch(EXPECTED_PRODUCER_RECORD.topic(), ImmutableList.of(batchItem)); fail(); } catch (final EventPublishingException e) { } } Assert.assertTrue(batches.stream() .filter(item -> item.getResponse().getPublishingStatus() == EventPublishingStatus.FAILED && item.getResponse().getDetail().equals("short circuited")) .count() >= 1); }
Source:
protected void checkValidAndUniqueInstanceHeaderTitle(String instanceHeaderCellValue, int columnIndex) { if (instanceHeaderCellValue.isEmpty()) { throw new IllegalArgumentException(ScenarioSimulationEditorConstants.INSTANCE.instanceTitleEmptyError()); } if (instanceHeaderCellValue.contains(".")) { throw new IllegalArgumentException(ScenarioSimulationEditorConstants.INSTANCE.instanceTitleWithPeriodsError()); } Range instanceLimits = getInstanceLimits(columnIndex); SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); FactIdentifier factIdentifier = simulationDescriptor.getFactMappingByIndex(columnIndex).getFactIdentifier(); if (IntStream.range(0, getColumnCount()) .filter(index -> index < instanceLimits.getMinRowIndex() || index > instanceLimits.getMaxRowIndex()) .filter(index -> !Objects.equals(factIdentifier, simulationDescriptor.getFactMappingByIndex(index).getFactIdentifier())) .mapToObj(index -> (ScenarioGridColumn) getColumns().get(index)) .filter(elem -> elem.getInformationHeaderMetaData() != null) .map(ScenarioGridColumn::getInformationHeaderMetaData) .anyMatch(elem -> Objects.equals(elem.getTitle(), instanceHeaderCellValue))) { throw new IllegalArgumentException(ScenarioSimulationEditorConstants.INSTANCE. instanceTitleAssignedError(instanceHeaderCellValue)); } }

Target:
protected void checkValidAndUniqueInstanceHeaderTitle(String instanceHeaderCellValue, int columnIndex) { if (instanceHeaderCellValue.contains(".")) { throw new IllegalArgumentException(ScenarioSimulationEditorConstants.INSTANCE.instanceTitleWithPeriodsError()); } Range instanceLimits = getInstanceLimits(columnIndex); SimulationDescriptor simulationDescriptor = simulation.getSimulationDescriptor(); FactIdentifier factIdentifier = simulationDescriptor.getFactMappingByIndex(columnIndex).getFactIdentifier(); if (IntStream.range(0, getColumnCount()) .filter(index -> index < instanceLimits.getMinRowIndex() || index > instanceLimits.getMaxRowIndex()) .filter(index -> !Objects.equals(factIdentifier, simulationDescriptor.getFactMappingByIndex(index).getFactIdentifier())) .mapToObj(index -> (ScenarioGridColumn) getColumns().get(index)) .filter(elem -> elem.getInformationHeaderMetaData() != null) .map(ScenarioGridColumn::getInformationHeaderMetaData) .anyMatch(elem -> Objects.equals(elem.getTitle(), instanceHeaderCellValue))) { throw new IllegalArgumentException(ScenarioSimulationEditorConstants.INSTANCE. instanceTitleAssignedError(instanceHeaderCellValue)); } }
Source:
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) { if (modeManager.getCurrentMode() == Mode.SUSPEND) { log.debug("Pinsetter trigger listener detected SUSPEND mode, " + "vetoing job to be executed"); return true; } return false; }

Target:
public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) { if (modeManager.getLastCandlepinModeChange().getMode() == Mode.SUSPEND) { log.debug("Pinsetter trigger listener detected SUSPEND mode, " + "vetoing job to be executed"); return true; } return false; }