auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRemoveRedundantSemicolons () throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test; ;\n"); buf.append("public class Foo {\n"); buf.append(" int a= 3;; ;\n"); buf.append(" int b= 7; buf.append(" int c= 10; \n"); buf.append(" public int foo () {\n"); buf.append(" ;\n"); buf.append(" for (;;)\n"); buf.append(" ;;\n"); buf.append(" ;\n"); buf.append(" while (a++ < 1000) ;\n"); buf.append(" };\n"); buf.append("};\n"); ICompilationUnit cu1= pack1.createCompilationUnit("Foo.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test;\n"); buf.append("public class Foo {\n"); buf.append(" int a= 3;\n"); buf.append(" int b= 7; buf.append(" int c= 10; \n"); buf.append(" public int foo () {\n"); buf.append(" \n"); buf.append(" for (;;)\n"); buf.append(" ;\n"); buf.append(" \n"); buf.append(" while (a++ < 1000) ;\n"); buf.append(" }\n"); buf.append("};\n"); String expected1 = buf.toString(); enable(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS); assertRefactoringResultAsExpected(new ICompilationUnit[] { cu1 }, new String[] { expected1 }); }

Target:
public void testRemoveRedundantSemicolons () throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test; ;\n"); buf.append("enum cars { sedan, coupe };\n"); buf.append("public class Foo {\n"); buf.append(" int add(int a, int b) {return a+b;};\n"); buf.append(" int a= 3;; ;\n"); buf.append(" int b= 7; buf.append(" int c= 10; \n"); buf.append(" public int foo () {\n"); buf.append(" ;\n"); buf.append(" for (;;)\n"); buf.append(" ;;\n"); buf.append(" ;\n"); buf.append(" while (a++ < 1000) ;\n"); buf.append(" };\n"); buf.append("};\n"); ICompilationUnit cu1= pack1.createCompilationUnit("Foo.java", buf.toString(), false, null); buf= new StringBuffer(); buf.append("package test;\n"); buf.append("enum cars { sedan, coupe }\n"); buf.append("public class Foo {\n"); buf.append(" int add(int a, int b) {return a+b;}\n"); buf.append(" int a= 3;\n"); buf.append(" int b= 7; buf.append(" int c= 10; \n"); buf.append(" public int foo () {\n"); buf.append(" \n"); buf.append(" for (;;)\n"); buf.append(" ;\n"); buf.append(" \n"); buf.append(" while (a++ < 1000) ;\n"); buf.append(" }\n"); buf.append("}\n"); String expected1 = buf.toString(); enable(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS); assertRefactoringResultAsExpected(new ICompilationUnit[] { cu1 }, new String[] { expected1 }); }
Source:
private boolean checkPlayerName(final String name) { return !(name.contains(".") | name.contains("/") | name.contains("\\")); }

Target:
private boolean checkPlayerName(final String name) { return !(name.contains(".") || name.contains("/") || name.contains("\\")); }
Source:
public PhoenixConnection(ConnectionQueryServices services, String url, Properties info, PMetaData metaData) throws SQLException { this.url = url; this.info = info == null ? new Properties() : new Properties(info); HashMap<String, String> tmpAugmentedProps = new HashMap(); for (Entry<String, String> kv : services.getProps()) { tmpAugmentedProps.put(kv.getKey(), kv.getValue()); } for (Enumeration e = info.propertyNames(); e.hasMoreElements();) { String key = (String)e.nextElement(); tmpAugmentedProps.put(key, info.getProperty(key)); } this.augmentedProps = new ReadOnlyProps(tmpAugmentedProps.entrySet().iterator()); this.services = new DelegateConnectionQueryServices(services) { @Override public ReadOnlyProps getProps() { return augmentedProps; } }; this.scn = JDBCUtil.getCurrentSCN(url, this.info); this.tenantId = JDBCUtil.getTenantId(url, this.info); this.mutateBatchSize = JDBCUtil.getMutateBatchSize(url, this.info, services.getProps()); datePattern = services.getProps().get(QueryServices.DATE_FORMAT_ATTRIB, DateUtil.DEFAULT_DATE_FORMAT); int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); Format dateTimeFormat = DateUtil.getDateFormatter(datePattern); formatters[PDataType.DATE.ordinal()] = dateTimeFormat; formatters[PDataType.TIME.ordinal()] = dateTimeFormat; this.metaData = metaData; this.mutationState = new MutationState(maxSize, this); }

Target:
public PhoenixConnection(ConnectionQueryServices services, String url, Properties info, PMetaData metaData) throws SQLException { this.url = url; this.info = info == null ? new Properties() : new Properties(info); Map<String, String> existingProps = services.getProps().asMap(); Map<String, String> tmpAugmentedProps = Maps.newHashMapWithExpectedSize(existingProps.size() + info.size()); tmpAugmentedProps.putAll(existingProps); tmpAugmentedProps.putAll((Map)info); final ReadOnlyProps augmentedProps = new ReadOnlyProps(tmpAugmentedProps); this.services = new DelegateConnectionQueryServices(services) { @Override public ReadOnlyProps getProps() { return augmentedProps; } }; this.scn = JDBCUtil.getCurrentSCN(url, this.info); this.tenantId = JDBCUtil.getTenantId(url, this.info); this.mutateBatchSize = JDBCUtil.getMutateBatchSize(url, this.info, services.getProps()); datePattern = services.getProps().get(QueryServices.DATE_FORMAT_ATTRIB, DateUtil.DEFAULT_DATE_FORMAT); int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); Format dateTimeFormat = DateUtil.getDateFormatter(datePattern); formatters[PDataType.DATE.ordinal()] = dateTimeFormat; formatters[PDataType.TIME.ordinal()] = dateTimeFormat; this.metaData = metaData; this.mutationState = new MutationState(maxSize, this); }
Source:
public void appThemeDefined_getsLumoAsTheme() { Mockito.when(classFinder.getSubTypesOf(AppShellConfigurator.class)) .thenReturn(Collections.singleton(MyAppThemeShell.class)); FrontendDependencies dependencies = new FrontendDependencies(classFinder, false);; Assert.assertEquals("Faulty default theme received", FakeLumo.class, dependencies.getThemeDefinition().getTheme()); }

Target:
public void appThemeDefined_getsLumoAsTheme() { Mockito.when(classFinder.getSubTypesOf(AppShellConfigurator.class)) .thenReturn(Collections.singleton(MyAppThemeShell.class)); FrontendDependencies dependencies = new FrontendDependencies(classFinder, false); Assert.assertEquals("Faulty default theme received", FakeLumo.class, dependencies.getThemeDefinition().getTheme()); }
Source:
private List<Object> readList() { if (readChar() != '[') throw new AssertionError(); List<Object> result = new ArrayList<Object>(); while (true) { if (peekChar() == ']') { pos++; return result; } result.add(readValue()); char c = peekChar(); if (c == ',') { pos++; } else if (c != ']') { throw unexpected("expected ',' or '" + ']' + "'"); } } }

Target:
private List<Object> readList() { if (readChar() != '[') throw new AssertionError(); List<Object> result = new ArrayList<Object>(); while (true) { if (peekChar() == ']') { pos++; return result; } result.add(readValue()); char c = peekChar(); if (c == ',') { pos++; } else if (c != ']') { throw unexpected("expected ',' or ']'"); } } }
Source:
private void writeMetrics(ch.qos.logback.classic.Logger logger, RollingFileAppender appender, String currentDate) { LOG.debug("Start writing metric with date to file ..", currentDate); String metric = new StringBuilder(currentDate).append(",") .append(flowName).append(",") .append(fileName).append(",") .append(totalEventsReadPerFile.get()).append(",") .append(totalEventsIngestedPerFile.get()).append(",") .append(minEventSizePerFile.get()).append(",") .append(calculateAverage(totalEventSizePerFile.get(), eventsPerFile.get())).append(",") .append(maxEventSizePerFile.get()).append(",") .append(minWriteLatencyPerStream.get()).append(",") .append(calculateAverage(totalWriteLatencyPerStream.get(), writesPerStream.get())).append(",") .append(maxWriteLatencyPerStream.get()).toString(); appender.doAppend(new LoggingEvent(loggerClass, logger, null, metric, null, null)); LOG.debug("Successfully write metric with date: {}", currentDate); }

Target:
private void writeMetrics(ch.qos.logback.classic.Logger logger, RollingFileAppender appender, String currentDate) { LOG.debug("Start writing metric with date to file ..", currentDate); String metric = new StringBuilder(currentDate).append(",") .append(flowName).append(",") .append(fileName).append(",") .append(totalEventsReadPerFile.get()).append(",") .append(totalEventsIngestedPerFile.get()).append(",") .append(minEventSizePerFile.get()).append(",") .append(calculateAverage(totalEventSizePerFile.get(), eventsPerFile.get())).append(",") .append(maxEventSizePerFile.get()).append(",") .append(minWriteLatencyPerStream.get()).append(",") .append(calculateAverage(totalWriteLatencyPerStream.get(), writesPerStream.get())).append(",") .append(maxWriteLatencyPerStream.get()).toString(); appender.doAppend(new LoggingEvent(loggerClass, logger, null, metric, null, null)); LOG.debug("Successfully wrote metric with date: {}", currentDate); }
Source:
private static List<android.icu.util.TimeZone> getIcuTimeZones(String countryIso) { if (countryIso == null) { if (DBG) Log.d(TAG, "getTimeZones(null): return empty list"); return Collections.emptyList(); } List<android.icu.util.TimeZone> timeZones = TimeZoneFinder.getInstance().lookupTimeZonesByCountry(countryIso); if (timeZones == null) { if (DBG) { Log.d(TAG, "getTimeZones(" + countryIso + "): returned null, converting to empty list"); } return Collections.emptyList(); } return timeZones; }

Target:
private static List<android.icu.util.TimeZone> getIcuTimeZones(String countryIso) { if (countryIso == null) { if (DBG) Log.d(TAG, "getIcuTimeZones(null): return empty list"); return Collections.emptyList(); } List<android.icu.util.TimeZone> timeZones = TimeZoneFinder.getInstance().lookupTimeZonesByCountry(countryIso); if (timeZones == null) { if (DBG) { Log.d(TAG, "getIcuTimeZones(" + countryIso + "): returned null, converting to empty list"); } return Collections.emptyList(); } return timeZones; }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { try { String inputValue = getInputValue(tuple, ptr); String localeISOCode = getLocaleISOCode(tuple, ptr); Boolean useSpecialUpperCaseCollator = getUseSpecialUpperCaseCollator(tuple, ptr); Integer collatorStrength = getCollatorStrength(tuple, ptr); Integer collatorDecomposition = getCollatorDecomposition(tuple, ptr); Locale locale = LocaleUtils.get().getLocaleByIsoCode(localeISOCode); if(LOG.isDebugEnabled()) { LOG.debug(String.format("Locale: " + locale.toLanguageTag())); } LinguisticSort linguisticSort = LinguisticSort.get(locale); Collator collator = BooleanUtils.isTrue(useSpecialUpperCaseCollator) ? linguisticSort.getUpperCaseCollator(false) : linguisticSort.getCollator(); if (collatorStrength != null) { collator.setStrength(collatorStrength); } if (collatorDecomposition != null) { collator.setDecomposition(collatorDecomposition); } if(LOG.isDebugEnabled()) { LOG.debug(String.format("Collator: [strength: %d, decomposition: %d], Special-Upper-Case: %s", collator.getStrength(), collator.getDecomposition(), BooleanUtils.isTrue(useSpecialUpperCaseCollator))); } byte[] collationKeyByteArray = collator.getCollationKey(inputValue).toByteArray(); if(LOG.isDebugEnabled()) { LOG.debug("Collation key bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; } catch (ExpressionEvaluationException e) { LOG.debug("ExpressionEvaluationException caught: " + e.getMessage()); return false; } }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { try { String inputValue = getInputString(tuple, ptr); byte[] collationKeyByteArray = collator.getCollationKey(inputValue).toByteArray(); if (LOG.isDebugEnabled()) { LOG.debug("Collation key bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; } catch (ExpressionEvaluationException e) { LOG.debug("ExpressionEvaluationException caught: " + e.getMessage()); return false; } }
Source:
public double getCurrentSafely(int channel) throws InvalidSensorException { if (channel < 0) { return 0.0; } else if (channel <= 5) { readStatus(1); } else if (channel <= 11) { readStatus(2); } else if (channel <= 15) { readStatus(3); } else { return 0.0; } if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read current for port " + channel + " from PDP"); } return cachedChannelCurrents[channel]; }

Target:
public double getCurrentSafely(int channel) throws InvalidSensorException { if (channel < 0) { return 0.0; } else if (channel <= 5) { readStatus(1); } else if (channel <= 11) { readStatus(2); } else if (channel <= 15) { readStatus(3); } else { LogKitten.w("Trying to read PDP channel " + channel + ", which does not exist!"); return 0.0; } if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read current for port " + channel + " from PDP"); } return cachedChannelCurrents[channel]; }
Source:
public void testMinusBefore() throws IOException { BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, "time:TIME, before:-20160923, timeFormat:YYYYMMdd"); assertFalse(filter.filter(bundle)); }

Target:
public void testMinusBefore() throws IOException { BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, "time:TIME, before:-100000"); assertFalse(filter.filter(bundle)); }
Source:
public final AbstractAuthenticationToken convert(Jwt jwt) { Collection<GrantedAuthority> authorities = extractAuthorities(jwt); if (this.principalClaimName == null) { return new JwtAuthenticationToken(jwt, authorities); } Object principalClaimValue = jwt.getClaim(this.principalClaimName); Assert.isInstanceOf(String.class, principalClaimValue, "Value of principalClaimName must be of type String"); return new JwtAuthenticationToken(jwt, authorities, (String) principalClaimValue); }

Target:
public final AbstractAuthenticationToken convert(Jwt jwt) { Collection<GrantedAuthority> authorities = extractAuthorities(jwt); if (this.principalClaimName == null) { return new JwtAuthenticationToken(jwt, authorities); } String principalClaimValue = jwt.getClaimAsString(this.principalClaimName); return new JwtAuthenticationToken(jwt, authorities, principalClaimValue); }
Source:
public void onGitReferenceUpdated(Event event) { Project.NameKey p = new Project.NameKey(event.getProjectName()); if (event.getRefName().equals(RefNames.REFS_CONFIG)) { try { ProjectConfig oldCfg = parseConfig(p, event.getOldObjectId()); ProjectConfig newCfg = parseConfig(p, event.getNewObjectId()); if (oldCfg != null && newCfg != null) { for (Entry<ProjectConfigEntry> e : pluginConfigEntries) { ProjectConfigEntry configEntry = e.getProvider().get(); String newValue = getValue(newCfg, e); String oldValue = getValue(oldCfg, e); if ((newValue == null && oldValue != null) || !newValue.equals(oldValue)) { switch (configEntry.getType()) { case BOOLEAN: configEntry.onUpdate(p, oldValue != null ? Boolean.parseBoolean(oldValue) : null, newValue != null ? Boolean.parseBoolean(newValue) : null); break; case INT: configEntry.onUpdate(p, oldValue != null ? Integer.parseInt(oldValue) : null, newValue != null ? Integer.parseInt(newValue) : null); break; case LONG: configEntry.onUpdate(p, oldValue != null ? Long.parseLong(oldValue) : null, newValue != null ? Long.parseLong(newValue) : null); break; case LIST: case STRING: default: configEntry.onUpdate(p, oldValue, newValue); } } } } } catch (IOException | ConfigInvalidException e) { log.error(String.format( "Failed to check if plugin config of project %s was updated.", p.get()), e); } } }

Target:
public void onGitReferenceUpdated(Event event) { Project.NameKey p = new Project.NameKey(event.getProjectName()); if (!event.getRefName().equals(RefNames.REFS_CONFIG)) { return; } try { ProjectConfig oldCfg = parseConfig(p, event.getOldObjectId()); ProjectConfig newCfg = parseConfig(p, event.getNewObjectId()); if (oldCfg != null && newCfg != null) { for (Entry<ProjectConfigEntry> e : pluginConfigEntries) { ProjectConfigEntry configEntry = e.getProvider().get(); String newValue = getValue(newCfg, e); String oldValue = getValue(oldCfg, e); if ((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue))) { return; } switch (configEntry.getType()) { case BOOLEAN: configEntry.onUpdate(p, toBoolean(oldValue), toBoolean(newValue)); break; case INT: configEntry.onUpdate(p, toInt(oldValue), toInt(newValue)); break; case LONG: configEntry.onUpdate(p, toLong(oldValue), toLong(newValue)); break; case LIST: case STRING: default: configEntry.onUpdate(p, oldValue, newValue); } } } } catch (IOException | ConfigInvalidException e) { log.error(String.format( "Failed to check if plugin config of project %s was updated.", p.get()), e); } }
Source:
public void testBidirectionalSearch() { Assert.assertEquals(Arrays.asList((String) null), searchForActions(ProblemFactory.getBidirectionalSearch( SimplifiedRoadMapOfPartOfRomania.ARAD, SimplifiedRoadMapOfPartOfRomania.ARAD))); Assert.assertEquals( Arrays.asList(new GoAction(SimplifiedRoadMapOfPartOfRomania.SIBIU), new GoAction(SimplifiedRoadMapOfPartOfRomania.FAGARAS)), searchForActions(ProblemFactory.getBidirectionalSearch( SimplifiedRoadMapOfPartOfRomania.ARAD, SimplifiedRoadMapOfPartOfRomania.BUCHAREST))); }

Target:
public void testBidirectionalSearch() { Pair<Problem<GoAction, InState>, Problem<GoAction, InState>> problemPairtest1 = ProblemFactory.getSimpleBidirectionalSearchProblem( SimplifiedRoadMapOfPartOfRomania.ARAD, SimplifiedRoadMapOfPartOfRomania.ARAD); Assert.assertEquals(Arrays.asList((String) null), searchForActions(problemPairtest1.getFirst(), problemPairtest1.getSecond())); Pair<Problem<GoAction, InState>, Problem<GoAction, InState>> problemPairtest2 = ProblemFactory.getSimpleBidirectionalSearchProblem( SimplifiedRoadMapOfPartOfRomania.ARAD, SimplifiedRoadMapOfPartOfRomania.BUCHAREST); Assert.assertEquals( Arrays.asList(new GoAction(SimplifiedRoadMapOfPartOfRomania.SIBIU), new GoAction(SimplifiedRoadMapOfPartOfRomania.FAGARAS)), searchForActions(problemPairtest2.getFirst(), problemPairtest2.getSecond())); Pair<Problem<GoAction, InState>, Problem<GoAction, InState>> problemPairtest3 = ProblemFactory.getSimpleBidirectionalSearchProblem( SimplifiedRoadMapOfPartOfRomania.SIBIU, SimplifiedRoadMapOfPartOfRomania.TIMISOARA); Assert.assertEquals( Arrays.asList(new GoAction(SimplifiedRoadMapOfPartOfRomania.ARAD)), searchForActions(problemPairtest3.getFirst(), problemPairtest3.getSecond())); }
Source:
public void purge(Publisher publisher, Set<Publisher> equivalencesToRetainAsAliases) { Iterator<Content> content = contentLister.listContent( new ContentListingCriteria.Builder() .forPublisher(publisher) .build() ); while (content.hasNext()) { Content c = (Content) content.next(); retainEquivalencesAsAliases(c, equivalencesToRetainAsAliases); removeAllEquivalences(c); deleteContent(c); } }

Target:
public void purge(Publisher publisher, Set<Publisher> equivalencesToRetainAsAliases) { Iterator<Content> contentIterator = contentLister.listContent( new ContentListingCriteria.Builder() .forPublisher(publisher) .build() ); while (contentIterator.hasNext()) { Content c = contentIterator.next(); retainEquivalencesAsAliases(c, equivalencesToRetainAsAliases); removeAllEquivalences(c); deleteContent(c); } }
Source:
public static RyaStatement readFromKryo(Kryo kryo, Input input, Class<RyaStatement> type){ String subject = input.readString(); String predicate = input.readString(); String objectType = input.readString(); String objectValue = input.readString(); RyaType value; if (objectType.equals("<LINK_0>")){ value = new RyaURI(objectValue); } else { value = new RyaType(new URIImpl(objectType), objectValue); } RyaStatement statement = new RyaStatement(new RyaURI(subject), new RyaURI(predicate), value); int length = 0; boolean hasNextValue = input.readBoolean(); if (hasNextValue){ statement.setContext(new RyaURI(input.readString())); } hasNextValue = input.readBoolean(); if (hasNextValue){ length = input.readInt(); statement.setColumnVisibility(input.readBytes(length)); } hasNextValue = input.readBoolean(); if (hasNextValue){ statement.setQualifer(input.readString()); } hasNextValue = input.readBoolean(); if (hasNextValue){ statement.setTimestamp(input.readLong()); } hasNextValue = input.readBoolean(); if (hasNextValue){ length = input.readInt(); statement.setValue(input.readBytes(length)); } return statement; }

Target:
public static RyaStatement readFromKryo(Kryo kryo, Input input, Class<RyaStatement> type){ return read(input); }
Source:
protected Diagram createSubdiagram() { View contextView = getContextObject(); State contextElement = (State) contextView.getElement(); Diagram subdiagram = ViewService.createDiagram(contextElement, StatechartDiagramEditor.ID, preferencesHint); View figureCompartment = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT); getResource().getContents().add(subdiagram); boolean isHorizontal = isHorizontal(figureCompartment); int offset = 0; int subregions = figureCompartment.getChildren().size(); while (figureCompartment.getChildren().size() > 0) { Node child = (Node) figureCompartment.getChildren().get(0); if (subregions > 1) { Rectangle actualBounds = getActualBounds(child); if (actualBounds != Rectangle.SINGLETON) { Bounds modelBounds = (Bounds) child.getLayoutConstraint(); modelBounds.setWidth(actualBounds.width()); modelBounds.setHeight(actualBounds.height()); if (isHorizontal) { modelBounds.setX(offset); offset += actualBounds.width(); } else { modelBounds.setY(offset); offset += actualBounds.height(); } } } subdiagram.insertChild(child); } @SuppressWarnings("unchecked") List<Edge> edges = figureCompartment.getDiagram().getEdges(); List<Edge> moveEdges = edges.stream().filter( (edge) -> edge.getSource().getDiagram() == subdiagram && edge.getTarget().getDiagram() == subdiagram) .collect(Collectors.toList()); for (Edge edge2 : moveEdges) { subdiagram.insertEdge(edge2); } return subdiagram; }

Target:
protected Diagram createSubdiagram() { View contextView = getContextObject(); State contextElement = (State) contextView.getElement(); Diagram subdiagram = ViewService.createDiagram(contextElement, StatechartDiagramEditor.ID, preferencesHint); View figureCompartment = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT); getResource().getContents().add(subdiagram); boolean isHorizontal = isHorizontal(figureCompartment); int offset = 0; int subregions = figureCompartment.getChildren().size(); while (figureCompartment.getChildren().size() > 0) { Node child = (Node) figureCompartment.getChildren().get(0); if (subregions > 1) { Rectangle actualBounds = getActualBounds(child); if (actualBounds != Rectangle.SINGLETON) { Bounds modelBounds = (Bounds) child.getLayoutConstraint(); modelBounds.setWidth(actualBounds.width()); modelBounds.setHeight(actualBounds.height()); if (isHorizontal) { modelBounds.setX(offset); offset += actualBounds.width(); } else { modelBounds.setY(offset); offset += actualBounds.height(); } } } subdiagram.insertChild(child); } @SuppressWarnings("unchecked") List<Edge> edges = figureCompartment.getDiagram().getEdges(); edges.stream().filter( (edge) -> edge.getSource().getDiagram() == subdiagram && edge.getTarget().getDiagram() == subdiagram) .forEach((edge) -> subdiagram.insertEdge(edge)); return subdiagram; }
Source:
public void deleteTask(TaskDefinition task) throws SchedulerException { if (Context.getSchedulerService().getTaskByName(task.getName()).getStarted()) { Context.getSchedulerService().shutdownTask(task); } Context.getSchedulerService().deleteTask(task.getId()); }

Target:
public void deleteTask(TaskDefinition task) throws SchedulerException { Context.getSchedulerService().deleteTask(task.getId()); }
Source:
public void askingForANonExistingEventTypeResultsIn404() throws Exception { when(repo.findByName(anyString())).thenThrow(new NoSuchEventTypeException("no such event type")); final MockHttpServletRequestBuilder requestBuilder = get("/event-types/" + EVENT_TYPE_NAME) .accept(APPLICATION_JSON); mockMvc.perform(requestBuilder) .andExpect(status().is(404)); }

Target:
public void askingForANonExistingEventTypeResultsIn404() throws Exception { when(repo.findByName(anyString())).thenThrow(new NoSuchEventTypeException("no such event type")); final MockHttpServletRequestBuilder requestBuilder = get("/event-types/" + EVENT_TYPE_NAME) .accept(APPLICATION_JSON); final ThrowableProblem expectedProblem = Problem.valueOf(NOT_FOUND, "EventType '" + EVENT_TYPE_NAME + "' does not exist."); mockMvc.perform(requestBuilder) .andExpect(status().is(404)) .andExpect(content().contentTypeCompatibleWith("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); }
Source:
default void addLore(int index, String... lore) { List<String> curr = lore(); if (curr.isEmpty() || index == curr.size()) { curr.addAll(Arrays.asList(lore)); } else { curr.addAll(index, Arrays.asList(lore)); } setLore(curr); }

Target:
default void addLore(int index, String... lore) { List<String> curr = lore(); if (curr == null) curr = Lists.newArrayList(); if (curr.isEmpty() || index == curr.size()) { curr.addAll(Arrays.asList(lore)); } else { curr.addAll(index, Arrays.asList(lore)); } setLore(curr); }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && obj.getClass() == getClass()) { IntermediateResultPartitionID that = (IntermediateResultPartitionID) obj; return that.intermediateDataSetID.getLowerPart() == this.intermediateDataSetID.getLowerPart() && that.intermediateDataSetID.getUpperPart() == this.intermediateDataSetID.getUpperPart() && that.partitionNum == this.partitionNum; } else { return false; } }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && obj.getClass() == getClass()) { IntermediateResultPartitionID that = (IntermediateResultPartitionID) obj; return that.intermediateDataSetID.equals(this.intermediateDataSetID) && that.partitionNum == this.partitionNum; } else { return false; } }
Source:
protected ScenarioResultMetadata extractResultMetadata(Map<String, Object> requestContext, ScenarioWithIndex scenarioWithIndex) { CoverageAgendaListener coverageAgendaListener = (CoverageAgendaListener) requestContext.get(COVERAGE_LISTENER); Map<String, Integer> ruleExecuted = coverageAgendaListener.getRuleExecuted(); Set<String> availableRules = (Set<String>) requestContext.get(RULES_AVAILABLE); ScenarioResultMetadata scenarioResultMetadata = new ScenarioResultMetadata(scenarioWithIndex); scenarioResultMetadata.addAllAvailable(availableRules); scenarioResultMetadata.addAllExecuted(ruleExecuted); final AtomicInteger counter = new AtomicInteger(0); coverageAgendaListener .getAuditsMessages().forEach(auditMessage -> { String message = "Execution # " + counter.addAndGet(1) + " - " + auditMessage; scenarioResultMetadata.addAuditMessage(message, "INFO"); }); return scenarioResultMetadata; }

Target:
protected ScenarioResultMetadata extractResultMetadata(Map<String, Object> requestContext, ScenarioWithIndex scenarioWithIndex) { CoverageAgendaListener coverageAgendaListener = (CoverageAgendaListener) requestContext.get(COVERAGE_LISTENER); Map<String, Integer> ruleExecuted = coverageAgendaListener.getRuleExecuted(); Set<String> availableRules = (Set<String>) requestContext.get(RULES_AVAILABLE); ScenarioResultMetadata scenarioResultMetadata = new ScenarioResultMetadata(scenarioWithIndex); scenarioResultMetadata.addAllAvailable(availableRules); scenarioResultMetadata.addAllExecuted(ruleExecuted); final AtomicInteger counter = new AtomicInteger(0); coverageAgendaListener .getAuditsMessages().forEach(auditMessage -> scenarioResultMetadata.addAuditMessage(counter.addAndGet(1), auditMessage, "INFO")); return scenarioResultMetadata; }
Source:
protected void removeToken(final String token) { validateToken(token); try { aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME, token); aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME,token + "TOKEN_MAX_LIFETIME_POSTFIX"); } catch (AliasServiceException e) { log.errorAccessingTokenState(e); } }

Target:
protected void removeToken(final String token) { validateToken(token); try { aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME, token); aliasService.removeAliasForCluster(AliasService.NO_CLUSTER_NAME,token + TOKEN_MAX_LIFETIME_POSTFIX); log.removedTokenState(getTokenDisplayText(token)); } catch (AliasServiceException e) { log.failedToRemoveTokenState(getTokenDisplayText(token), e); } }
Source:
private void syncCollapses(final List<String> expandedCollapses) { final Form currentForm = renderer.getCurrentForm(); if (!expandedCollapses.isEmpty()) { currentForm.getFields() .stream() .filter(formField -> expandedCollapses.contains(formField.getFieldName()) && formField.getContainer() instanceof CollapsibleFormGroup) .map(formField -> (CollapsibleFormGroup) formField.getContainer()) .forEach(CollapsibleFormGroup::expand); } else { currentForm.getFields() .stream() .filter(formField -> formField.getContainer() instanceof CollapsibleFormGroup) .findFirst() .map(formField -> (CollapsibleFormGroup)formField.getContainer()) .ifPresent(CollapsibleFormGroup::expand); } }

Target:
private void syncCollapses(final List<String> expandedCollapses) { final Stream<FormField> formFields = renderer.getCurrentForm().getFields().stream() .filter(this::checkCollapsibleGroup); if (!expandedCollapses.isEmpty()) { formFields.filter(formField -> expandedCollapses.contains(formField.getFieldName())) .map(this::toFormGroup) .forEach(CollapsibleFormGroup::expand); } else { formFields.findFirst() .map(this::toFormGroup) .ifPresent(CollapsibleFormGroup::expand); } }
Source:
protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescription operationDescription, SwaggerMethodParser methodParser, Type returnType, Context context) throws Exception { throw logger.logExceptionAsError(new RuntimeException("The resume operation is not available in the base RestProxy class.")); }

Target:
protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescription operationDescription, SwaggerMethodParser methodParser, Type returnType, Context context) throws Exception { throw new Exception("The resume operation is not available in the base RestProxy class."); }
Source:
public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); if (arguments.contains(column)) { throw new IllegalStateException("The arguments of transform function '" + transformFunction + "' should not contain the destination column '" + column + "'"); } transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } if (!Collections.disjoint(transformedColumns, argumentColumns)) { throw new IllegalStateException("Columns:" + transformedColumns.retainAll(argumentColumns) + ", are a result of transformations, and cannot be used as arguments to other transform functions"); } }

Target:
public static void validate(Schema schema) { schema.validate(); Set<String> transformedColumns = new HashSet<>(); Set<String> argumentColumns = new HashSet<>(); for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { try { List<String> arguments = FunctionEvaluatorFactory.getExpressionEvaluator(fieldSpec).getArguments(); Preconditions.checkState(!arguments.contains(column), "The arguments of transform function %s should not contain the destination column %s", transformFunction, column); transformedColumns.add(column); argumentColumns.addAll(arguments); } catch (Exception e) { throw new IllegalStateException( "Exception in getting arguments for transform function '" + transformFunction + "' for column '" + column + "'", e); } } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { validateTimeFieldSpec(fieldSpec); } if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.DATE_TIME)) { validateDateTimeFieldSpec(fieldSpec); } } } Preconditions.checkState(Collections.disjoint(transformedColumns, argumentColumns), "Columns: %s are a result of transformations, and cannot be used as arguments to other transform functions", transformedColumns.retainAll(argumentColumns)); }
Source:
private LineData generateKetonesData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getKetonesReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getKetonesReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getKetonesReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getKetonesReadingsDateTime().get(i)); xVals.add(date + ""); } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_ketones))); }

Target:
private LineData generateKetonesData() { List<String> xVals = new ArrayList<>(); List<Entry> yVals = new ArrayList<>(); int k = 0; for (int i = presenter.getKetonesReadings().size() - 1; i >= 0; i--) { float val = Float.parseFloat(presenter.getKetonesReadings().get(i).toString()); yVals.add(new Entry(k, val)); k++; } for (int i = presenter.getKetonesReadingsDateTime().size() - 1; i >= 0; i--) { String date = presenter.convertDate(presenter.getKetonesReadingsDateTime().get(i)); xVals.add(date); } xValues = xVals; return new LineData(generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_ketones))); }
Source:
private static File convertSamToBam(final String sam) throws IOException { try { final MergeSamFiles msf = new MergeSamFiles(); final File bam = new File(bamOutDir, sam.replaceAll("sam$", "bam")); final int returnCode = msf.instanceMain( new String[]{ "INPUT=" + (new File(testdir, sam).getAbsolutePath()), "CREATE_INDEX=true", "OUTPUT=" + bam.getAbsolutePath()}); Assert.assertEquals(returnCode, 0); return bam; } finally { SAMFileWriterFactory.setDefaultCreateIndexWhileWriting(false); } }

Target:
private static File convertSamToBam(final String sam) throws IOException { final MergeSamFiles msf = new MergeSamFiles(); final File bam = new File(bamOutDir, sam.replaceAll("sam$", "bam")); final int returnCode = msf.instanceMain( new String[]{ "INPUT=" + (new File(testdir, sam).getAbsolutePath()), "CREATE_INDEX=true", "OUTPUT=" + bam.getAbsolutePath()}); Assert.assertEquals(returnCode, 0); return bam; }
Source:
public static void main(String[] args) throws Exception { EncoderConfig config = new EncoderConfig(); JCommander jCommander = new JCommander(config, args); jCommander.setProgramName(CommandLineEncoder.class.getSimpleName()); if (config.help) { jCommander.usage(); return; } String outFileString = config.outputFileBase; if (EncoderConfig.DEFAULT_OUTPUT_FILE_BASE.equals(outFileString)) { outFileString += '.' + config.imageFormat.toLowerCase(Locale.ENGLISH); } HashMap<EncodeHintType,String> hints = new HashMap<EncodeHintType,String>(); if (config.errorCorrectionLevel != "") { hints.put(EncodeHintType.ERROR_CORRECTION,config.errorCorrectionLevel); } BitMatrix matrix = new MultiFormatWriter().encode( config.contents.get(0), config.barcodeFormat, config.width, config.height,hints); MatrixToImageWriter.writeToPath(matrix, config.imageFormat, Paths.get(outFileString)); }

Target:
public static void main(String[] args) throws Exception { EncoderConfig config = new EncoderConfig(); JCommander jCommander = new JCommander(config, args); jCommander.setProgramName(CommandLineEncoder.class.getSimpleName()); if (config.help) { jCommander.usage(); return; } String outFileString = config.outputFileBase; if (EncoderConfig.DEFAULT_OUTPUT_FILE_BASE.equals(outFileString)) { outFileString += '.' + config.imageFormat.toLowerCase(Locale.ENGLISH); } Map<EncodeHintType, Object> hints = new HashMap<>(); if (config.errorCorrectionLevel != null) { hints.put(EncodeHintType.ERROR_CORRECTION, config.errorCorrectionLevel); } BitMatrix matrix = new MultiFormatWriter().encode( config.contents.get(0), config.barcodeFormat, config.width, config.height, hints); MatrixToImageWriter.writeToPath(matrix, config.imageFormat, Paths.get(outFileString)); }
Source:
private BootstrapConfigurationImpl() { this.defaultProviderClassName = null; this.constraintValidatorFactoryClassName = null; this.messageInterpolatorClassName = null; this.traversableResolverClassName = null; this.parameterNameProviderClassName = null; this.clockProviderClassName = null; this.valueExtractorClassNames = new HashSet<>( 0 ); this.validatedExecutableTypes = DEFAULT_VALIDATED_EXECUTABLE_TYPES; this.isExecutableValidationEnabled = true; this.constraintMappingResourcePaths = newHashSet(); this.properties = newHashMap(); }

Target:
private BootstrapConfigurationImpl() { this.defaultProviderClassName = null; this.constraintValidatorFactoryClassName = null; this.messageInterpolatorClassName = null; this.traversableResolverClassName = null; this.parameterNameProviderClassName = null; this.clockProviderClassName = null; this.valueExtractorClassNames = new HashSet<>(); this.validatedExecutableTypes = DEFAULT_VALIDATED_EXECUTABLE_TYPES; this.isExecutableValidationEnabled = true; this.constraintMappingResourcePaths = new HashSet<>(); this.properties = new HashMap<>(); }
Source:
public JsonJourney getLatestJourney(String dgw) { long endTime = System.currentTimeMillis(); long startTime = endTime - 30 * 1000; List<JsonJourneyInfo> journeyInfoList = getJourneyInfo(dgw, startTime, endTime); Collections.sort(journeyInfoList, new Comparator<JsonJourneyInfo>() { @Override public int compare(JsonJourneyInfo lhs, JsonJourneyInfo rhs) { if (rhs.getTimestamp() > lhs.getTimestamp()) { return 1; } else { return rhs.getTimestamp() == lhs.getTimestamp() ? 0 : -1; } } }); String destination = ""; String journeyId = ""; for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_DESTINATION)) { destination = journeyInfo.getValue(); break; } } for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_JOURNEY_ID)) { journeyId = journeyInfo.getValue(); break; } } return new JsonJourney(destination, journeyId); }

Target:
public JsonJourney getLatestJourney(String dgw) { long endTime = System.currentTimeMillis(); long startTime = endTime - 30 * 1000; List<JsonJourneyInfo> journeyInfoList = getJourneyInfo(dgw, startTime, endTime); Collections.sort(journeyInfoList, new Comparator<JsonJourneyInfo>() { @Override public int compare(JsonJourneyInfo first, JsonJourneyInfo second) { if (second.getTimestamp() > first.getTimestamp()) { return 1; } else { return second.getTimestamp() == first.getTimestamp() ? 0 : -1; } } }); String destination = ""; String journeyId = ""; for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_DESTINATION)) { destination = journeyInfo.getValue(); break; } } for (JsonJourneyInfo journeyInfo : journeyInfoList) { if (journeyInfo.getResourceSpec().equals(RESOURCE_SPEC_JOURNEY_ID)) { journeyId = journeyInfo.getValue(); break; } } return new JsonJourney(destination, journeyId); }
Source:
public Object invoke(Method methodToCall, Object instance, Object[] args) throws Throwable { if (suspendedDeclaredMethod && !suspendedBaseClassMethod && reactiveBaseClassMethod) { return invokeReactiveToSuspend(methodToCall, instance, args); } return methodToCall.invoke(instance, args); }

Target:
public Object invoke(Method methodToCall, Object instance, Object[] args) throws Throwable { return shouldAdaptReactiveToSuspended() ? invokeReactiveToSuspend(methodToCall, instance, args) : methodToCall.invoke(instance, args); }
Source:
public void filter(ClientRequestContext requestContext) throws IOException { int size = 0; for (Map.Entry<String, String> entry : RpcContext.getContext().getAttachments().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (StringUtils.isNotEmpty(key)) { if (illegalForRest(key)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); } } if (StringUtils.isNotEmpty(value)) { if (illegalForRest(value)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); } } size += entry.getValue().getBytes("UTF-8").length; if (size > MAX_HEADER_SIZE) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " is too big"); } String attachments = entry.getKey() + "=" + entry.getValue(); requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, attachments); } }

Target:
public void filter(ClientRequestContext requestContext) throws IOException { int size = 0; for (Map.Entry<String, String> entry : RpcContext.getContext().getAttachments().entrySet()) { String key = entry.getKey(); String value = entry.getKey(); if (illegalForRest(key) || illegalForRest(value)) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " must not contain ',' or '=' when using rest protocol"); } if (value != null) { size += value.getBytes("UTF-8").length; } if (size > MAX_HEADER_SIZE) { throw new IllegalArgumentException("The attachments of " + RpcContext.class.getSimpleName() + " is too big"); } String attachments = key + "=" + value; requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, attachments); } }
Source:
public boolean removeAttributeWithoutCheck(PerunSession sess, String key, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_ENTITYLESS_ATTR); boolean changed = getAttributesManagerImpl().removeAttribute(sess, key, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, key, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } log.info("{} removed attribute: by key = {}",sess.getPerunClient().getId(), attribute.getName(), key); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), key); } return changed; }

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, String key, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_ENTITYLESS_ATTR); boolean changed = getAttributesManagerImpl().removeAttribute(sess, key, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, key, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } log.info("{} removed attribute: by key {}.",sess.getLogId(), attribute.getName(), key); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), key); } return changed; }
Source:
Control _getChildren () { NSClipView nsClipView = contentView(); if (nsClipView == null) return new Control [0]; NSArray views = nsClipView.subviews(); int count = (int)views.count(); Control children = new Control [count]; if (count == 0) return children; int j = 0; for (int i=0; i<count; i++){ Widget widget = display.getWidget (views.objectAtIndex (count - i - 1).id); if (widget != null && widget != this && widget instanceof Control) { children [j++] = (Control) widget; } } if (j == count) return children; Control newChildren = new Control [j]; System.arraycopy (children, 0, newChildren, 0, j); return newChildren; }

Target:
Control _getChildren () { NSView nsClipView = contentView(); if (nsClipView == null) return new Control [0]; NSArray views = nsClipView.subviews(); int count = (int)views.count(); Control children = new Control [count]; if (count == 0) return children; int j = 0; for (int i=0; i<count; i++){ Widget widget = display.getWidget (views.objectAtIndex (count - i - 1).id); if (widget != null && widget != this && widget instanceof Control) { children [j++] = (Control) widget; } } if (j == count) return children; Control newChildren = new Control [j]; System.arraycopy (children, 0, newChildren, 0, j); return newChildren; }
Source:
public Response toResponse(Exception exception) { IndyRestMapperResponse irmpr = new IndyRestMapperResponse(exception.getMessage(), LocalDateTime.now()); Optional .ofNullable(exception.getCause()) .ifPresent((exc) -> { irmpr.setCause(exc.getCause()); } ); return Response.ok(irmpr, MediaType.APPLICATION_JSON).build(); }

Target:
public Response toResponse(Exception exception) { IndyRestMapperResponse irmpr = new IndyRestMapperResponse(exception.getMessage(), LocalDateTime.now()); Optional .ofNullable(exception.getCause()) .ifPresent((exc) -> { irmpr.setCause(exc.getCause()); } ); if(exception instanceof IndyWorkflowException || exception instanceof IOException) { return Response.status(Response.Status.BAD_REQUEST).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else if(exception instanceof ServiceUnavailableException ) { return Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else if(exception instanceof NotFoundException) { return Response.status(Response.Status.NOT_FOUND).entity(irmpr).type(MediaType.APPLICATION_JSON).build(); } else { return Response.status(Response.Status.NOT_FOUND).entity(null).build(); } }
Source:
private void setPollInterval(final long pollInterval, final TimeUnit pollIntervalTimeUnit) { this.pollInterval = pollInterval; this.pollIntervalTimeUnit = pollIntervalTimeUnit; }

Target:
private void setPollInterval(final long pollInterval, final TimeUnit pollIntervalTimeUnit) { this.pollInterval = pollInterval; this.pollIntervalTimeUnit = pollIntervalTimeUnit; pollAllSourcesFuture.cancel(false); pollAllSourcesFuture = pollAllSourcesThreadPool.scheduleAtFixedRate( this::pollAllSources, pollInterval, pollInterval, pollIntervalTimeUnit); }
Source:
private static Map<RateCurveId, Curve> mapCurves( Map<RateCurveId, LoadedCurveKey> curveGroups, Map<LoadedCurveKey, Curve> curves) { return curveGroups.entrySet().stream() .filter(e -> curves.containsKey(e.getValue())) .collect(Collector.of( ImmutableMap.Builder<RateCurveId, Curve>::new, (b, e) -> b.put(e.getKey(), curves.get(e.getValue())), (b1, b2) -> b1.putAll(b2.build()), Characteristics.UNORDERED)) .build(); }

Target:
private static Map<RateCurveId, Curve> mapCurves( Map<RateCurveId, LoadedCurveKey> curveGroups, Map<LoadedCurveKey, Curve> curves) { return curveGroups.entrySet().stream() .filter(e -> curves.containsKey(e.getValue())) .collect(toImmutableMap(e -> e.getKey(), e -> curves.get(e.getValue()))); }
Source:
private static List<Variable> removeDuplicates(List<Variable> typeMatches) { HashSet<Variable> set = new HashSet<>(); set.addAll(typeMatches); return Arrays.asList(set.toArray(new Variable[set.size()])); }

Target:
private static List<Variable> removeDuplicates(List<Variable> typeMatches) { return new ArrayList<>(new HashSet<>(typeMatches)); }