auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { return checkNotNull(new ArrayList<IBaseEventInfo>()); }

Target:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { return checkNotNull(Collections.EMPTY_LIST); }
Source:
void set(DiffPreferences prefs) { this.prefs = prefs; setIgnoreWhitespace(prefs.ignoreWhitespace()); tabWidth.setIntValue(prefs.tabSize()); lineLength.setIntValue(prefs.lineLength()); syntaxHighlighting.setValue(prefs.syntaxHighlighting()); whitespaceErrors.setValue(prefs.showWhitespaceErrors()); showTabs.setValue(prefs.showTabs()); lineNumbers.setValue(prefs.showLineNumbers()); leftSide.setValue(view.diffTable.isVisibleA()); topMenu.setValue(!prefs.hideTopMenu()); manualReview.setValue(prefs.manualReview()); expandAllComments.setValue(prefs.expandAllComments()); renderEntireFile.setValue(prefs.renderEntireFile()); renderEntireFile.setEnabled(view.canEnableRenderEntireFile(prefs)); setTheme(prefs.theme()); autoHideEmptyPane.setValue(prefs.autoHideEmptyPane()); mode.setEnabled(prefs.syntaxHighlighting()); if (prefs.syntaxHighlighting()) { setMode(view.getCmFromSide(DisplaySide.B).getStringOption("mode")); } switch (view.getIntraLineStatus()) { case OFF: case OK: intralineDifference.setValue(prefs.intralineDifference()); break; case TIMEOUT: case FAILURE: intralineDifference.setValue(false); intralineDifference.setEnabled(false); break; } if (prefs.context() == WHOLE_FILE_CONTEXT) { contextLastValue = DEFAULT_CONTEXT; context.setText(""); contextEntireFile.setValue(true); } else { context.setIntValue(prefs.context()); contextEntireFile.setValue(false); } }

Target:
void set(DiffPreferences prefs) { this.prefs = prefs; setIgnoreWhitespace(prefs.ignoreWhitespace()); tabWidth.setIntValue(prefs.tabSize()); lineLength.setIntValue(prefs.lineLength()); syntaxHighlighting.setValue(prefs.syntaxHighlighting()); whitespaceErrors.setValue(prefs.showWhitespaceErrors()); showTabs.setValue(prefs.showTabs()); lineNumbers.setValue(prefs.showLineNumbers()); leftSide.setValue(view.diffTable.isVisibleA()); leftSide.setEnabled(!prefs.hideEmptyPane()); emptyPane.setValue(!prefs.hideEmptyPane()); topMenu.setValue(!prefs.hideTopMenu()); manualReview.setValue(prefs.manualReview()); expandAllComments.setValue(prefs.expandAllComments()); renderEntireFile.setValue(prefs.renderEntireFile()); renderEntireFile.setEnabled(view.canEnableRenderEntireFile(prefs)); setTheme(prefs.theme()); mode.setEnabled(prefs.syntaxHighlighting()); if (prefs.syntaxHighlighting()) { setMode(view.getCmFromSide(DisplaySide.B).getStringOption("mode")); } switch (view.getIntraLineStatus()) { case OFF: case OK: intralineDifference.setValue(prefs.intralineDifference()); break; case TIMEOUT: case FAILURE: intralineDifference.setValue(false); intralineDifference.setEnabled(false); break; } if (prefs.context() == WHOLE_FILE_CONTEXT) { contextLastValue = DEFAULT_CONTEXT; context.setText(""); contextEntireFile.setValue(true); } else { context.setIntValue(prefs.context()); contextEntireFile.setValue(false); } }
Source:
public boolean shouldUpdateFragmentOnUpdateEvent(StatsEvents.SectionUpdatedAbstract event) { if (!isAdded()) { return false; } if (!getDate().equals(event.mDate)) { return false; } if (!isSameBlog(event)) { return false; } if (event.mTimeframe != getTimeframe()) { return false; } return true; }

Target:
public boolean shouldUpdateFragmentOnUpdateEvent(StatsEvents.SectionUpdatedAbstract event) { if (!isAdded()) { return false; } if (!getDate().equals(event.mDate)) { return false; } if (!isSameBlog(event)) { return false; } if (!event.mTimeframe.equals(getTimeframe())) { return false; } return true; }
Source:
public Map<String, Object> perform() { ArrayList<Map<String, String>> list = null; Map<String, Object> results = new HashMap<String, Object>(2); int totalItemCount = 0; List<User> users = null; int realUserCount = 0; try { totalItemCount = getUserCount(); if (start < totalItemCount) { users = getUsers(); realUserCount = users.size(); } if (users != null) { int pageSize = realUserCount; list = new ArrayList<Map<String, String>>(pageSize); for (User aUser : users) { Map<String, String> aRecord = new HashMap<String, String>(); String fullName = aUser.getFullName(); fullName = (UtilMethods.isSet(fullName) ? fullName : " "); String emailAddress = aUser.getEmailAddress(); emailAddress = (UtilMethods.isSet(emailAddress) ? emailAddress : " "); aRecord.put("id", aUser.getUserId()); aRecord.put("type", USER_TYPE_VALUE); aRecord.put("name", fullName); aRecord.put("emailaddress", emailAddress); list.add(aRecord); } } else { list = new ArrayList<Map<String, String>>(0); } } catch (Exception ex) { Logger.warn(UserAjax.class, "::processUsersList -> Could not process list of users."); list = new ArrayList<Map<String, String>>(0); } results.put("data", list); results.put("total", totalItemCount); return results; }

Target:
public Map<String, Object> perform() { ArrayList<Map<String, String>> list = null; Map<String, Object> results = new HashMap<String, Object>(2); int totalItemCount = 0; List<User> users = null; int realUserCount = 0; try { totalItemCount = getUserCount(); if (start < totalItemCount) { users = getUsers(); realUserCount = users.size(); } if (users != null) { int pageSize = realUserCount; list = new ArrayList<Map<String, String>>(pageSize); for (User aUser : users) { final Map<String, String> aRecord = map( "id", aUser.getUserId(), "type", USER_TYPE_VALUE, "name", UtilMethods.isSet(aUser.getFullName()) ? aUser.getFullName() : " ", "emailaddress", UtilMethods.isSet(aUser.getEmailAddress()) ? aUser.getEmailAddress() : " "); list.add(aRecord); } } else { list = EMPTY_MAP_LIST; } } catch (Exception ex) { Logger.warn(UserAjax.class, "::processUsersList -> Could not process list of users."); list = new ArrayList<Map<String, String>>(0); } results.put("data", list); results.put("total", totalItemCount); return results; }
Source:
public void toStringTest() { final NodeList<Name> list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); assertEquals("abcbcdcde", list.toString()); }

Target:
public void toStringTest() { final NodeList<Name> list = nodeList(new Name("abc"), new Name("bcd"), new Name("cde")); assertEquals("[abc, bcd, cde]", list.toString()); }
Source:
protected Map<String, Object> doWork() { log.info("Starting "+getClass().getSimpleName()+": " + this); DataForQueryStressor stressTestStressor = null; stressTestStressor = new DataForQueryStressor(); stressTestStressor.setNodeIndex(getSlaveIndex(), getActiveSlaveCount()); stressTestStressor.setDurationMillis(duration); stressTestStressor.setWildCard(isWildCard); stressTestStressor.setDataPath(dataPath); stressTestStressor.setPropertyLength(propertyLength); PropertyHelper.copyProperties(this, stressTestStressor); return stressTestStressor.stress(cacheWrapper); }

Target:
protected Map<String, Object> doWork() { log.info("Starting "+getClass().getSimpleName()+": " + this); DataForQueryStressor stressTestStressor = null; stressTestStressor = new DataForQueryStressor(); stressTestStressor.setNodeIndex(getSlaveIndex(), getActiveSlaveCount()); PropertyHelper.copyProperties(this, stressTestStressor); return stressTestStressor.stress(cacheWrapper); }
Source:
private Response processMessage(final MessageHandler handler, final Message message) { Response response; try { response = handler.handle(message); } catch (MessageHandler.HandleException e) { response = Response.of(e.getMessage()); LOGGER.log(Level.WARNING, "Exception while processing message", e); } return response; }

Target:
private Response processMessage(final MessageHandler handler, final Message message) { Response response; try { response = handler.handle(message); } catch (MessageHandler.HandleException e) { response = Response.of(e.getMessage()); LOGGER.log(Level.WARNING, "Exception while processing message " + message, e); } return response; }
Source:
public void shouldReturnRelationshipForLookupGetRelationshipByTypeUuidAndPersonBUuid() { String className = Relationship.class.getSimpleName(); String relationshipTypeUuid = "relationshipTypeUuid"; String personUuid = "personUuid"; Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(RELATIONSHIP_TYPE_UUID, relationshipTypeUuid); lookupFields.put(PERSON_UUID, personUuid); Relationship expected = prepareRelationship(); when(relationshipService.getByTypeUuidAndPersonUuid(eq(null), eq(relationshipTypeUuid), eq(personUuid))) .thenReturn(expected); Object object = taskDataProvider.lookup(className, BY_PERSON_UUID, lookupFields); verify(relationshipService).getByTypeUuidAndPersonUuid(eq(null), eq(relationshipTypeUuid), eq(personUuid)); assertEquals(expected, object); }

Target:
public void shouldReturnRelationshipForLookupGetRelationshipByTypeUuidAndPersonBUuid() { String className = Relationship.class.getSimpleName(); String relationshipTypeUuid = "relationshipTypeUuid"; String personUuid = "personUuid"; Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(RELATIONSHIP_TYPE_UUID, relationshipTypeUuid); lookupFields.put(PERSON_UUID, personUuid); List<Relationship> expected = prepareRelationship(); when(relationshipService.getByTypeUuidAndPersonUuid(eq(null), eq(relationshipTypeUuid), eq(personUuid))) .thenReturn(expected); Object object = taskDataProvider.lookup(className, BY_PERSON_UUID, lookupFields); verify(relationshipService).getByTypeUuidAndPersonUuid(eq(null), eq(relationshipTypeUuid), eq(personUuid)); assertEquals(expected.get(0), object); }
Source:
private InternetAddress toNormalizedAddress(String address) throws UnsupportedEncodingException { if (address == null) { return null; } if (!address.contains("@")) { if (defaultSuffix != null && defaultSuffix.contains("@")) { address += defaultSuffix; } else { return null; } } try { return Mailer.StringToAddress(address, charset); } catch (AddressException e) { if (listener != null) { listener.getLogger().println("Unable to send to address: " + address); e.printStackTrace(listener.error(e.getMessage())); } return null; } }

Target:
private InternetAddress toNormalizedAddress(String address) throws UnsupportedEncodingException { if (address == null) { return null; } if (!address.contains("@")) { if (defaultSuffix != null && defaultSuffix.contains("@")) { address += defaultSuffix; } else { return null; } } try { return Mailer.StringToAddress(address, charset); } catch (AddressException e) { logError("Unable to send to address: " + address, e); return null; } }
Source:
private TmfTraceManager() { fTraces = new LinkedHashMap<ITmfTrace, TmfTraceContext>(); fFilters = new LinkedHashMap<ITmfTrace, ITmfFilter>(); TmfSignalManager.registerVIP(this); }

Target:
private TmfTraceManager() { fTraces = new LinkedHashMap<ITmfTrace, TmfTraceContext>(); TmfSignalManager.registerVIP(this); }
Source:
public static String loadResource(final InputStream in) throws Exception { final Reader reader = new InputStreamReader(in); final StringBuilder text = new StringBuilder(); final char[] buf = new char[1024]; int len = 0; while ((len = reader.read(buf)) >= 0) { text.append(buf, 0, len); } return text.toString(); }

Target:
public static String loadResource(final InputStream in) throws Exception { return IOUtils.readLines(in, StandardCharsets.UTF_8).stream().collect(Collectors.joining(System.lineSeparator())); }
Source:
public SetWireframe(boolean enabled) { this.enabled = enabled; this.mode = enabled? ENABLED_MODE: DISABLED_MODE; }

Target:
public SetWireframe(boolean enabled) { this.enabled = enabled; this.mode = enabled ? GL_LINE : GL_FILL; }
Source:
public static SphereClient createHttpTestDouble(final Function<HttpRequestIntent, HttpResponse> function) { return new SphereClient() { private final ObjectMapper objectMapper = SphereJsonUtils.newObjectMapper(); @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(sphereRequest, objectMapper, SphereApiConfig.of("fake-project-key-for-testing", "<LINK_0>"), httpResponse, null); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } } @Override public void close() { } @Override public String toString() { return "SphereClientHttpTestDouble"; } @Override public SphereApiConfig getConfig() { return SphereApiConfig.of("DUMMY_PROJECT_KEY","DUMMY_API_URL"); } }; }

Target:
public static SphereClient createHttpTestDouble(final Function<HttpRequestIntent, HttpResponse> function) { return new SphereClient() { private final ObjectMapper objectMapper = SphereJsonUtils.newObjectMapper(); @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(sphereRequest, objectMapper, sphereApiConfig, httpResponse, null); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } } @Override public void close() { } @Override public String toString() { return "SphereClientHttpTestDouble"; } @Override public SphereApiConfig getConfig() { return sphereApiConfig; } }; }
Source:
public void testScoresMismatchIfNoContentAliasMatch(){ Item subject = new Item("subj", "subj", Publisher.YOUVIEW); Alias subjAlias = new Alias("subjAlias", "subjAlias"); subject.setAliases(ImmutableSet.of(subjAlias)); Item candidate = new Item("cand", "cand", Publisher.PA); Alias candAlias = new Alias("candAlias", "candAlias"); candidate.setAliases(ImmutableSet.of(candAlias)); ScoredCandidates<Item> results = scorer.score( subject, ImmutableSet.of(candidate), new DefaultDescription()); assertThat(results.candidates().get(candidate), is(mismatchScore)); }

Target:
public void testScoresMismatchIfNoContentAliasMatch(){ Item subject = new Item("subj", "subj", Publisher.YOUVIEW); Alias subjAlias = new Alias("subjAlias one", "subjAlias two"); subject.setAliases(ImmutableSet.of(subjAlias)); Item candidate = new Item("cand", "cand", Publisher.PA); Alias candAlias = new Alias("candAlias one", "candAlias two"); candidate.setAliases(ImmutableSet.of(candAlias)); ScoredCandidates<Item> results = scorer.score( subject, ImmutableSet.of(candidate), new DefaultDescription()); assertThat(results.candidates().get(candidate), is(mismatchScore)); }
Source:
public AsyncFuture<FullQuery> query(final FullQuery.Request request) { if (!concurrentQueries.tryAcquire()) { throw new GoAwayException( "Node has reached maximum number of concurrent MetricManager requests (" + concurrentQueriesBackoff + ")"); } final QueryOptions options = request.getOptions(); final QueryContext queryContext = request.getContext(); queryLogger.logIncomingRequestAtNode(queryContext, request); final DataInMemoryReporter dataInMemoryReporter = reporter.newDataInMemoryReporter(); final QuotaWatcher quotaWatcher = new QuotaWatcher( options.getDataLimit().orElse(dataLimit).asLong().orElse(Long.MAX_VALUE), options .getAggregationLimit() .orElse(aggregationLimit) .asLong() .orElse(Long.MAX_VALUE), dataInMemoryReporter); final OptionalLimit seriesLimit = options.getSeriesLimit().orElse(LocalMetricManager.this.seriesLimit); final boolean failOnLimits = options.getFailOnLimits().orElse(LocalMetricManager.this.failOnLimits); final OptionalLimit groupLimit = options.getGroupLimit().orElse(LocalMetricManager.this.groupLimit); final LazyTransform<FindSeries, FullQuery> transform = new Transform(request, failOnLimits, seriesLimit, groupLimit, quotaWatcher, dataInMemoryReporter); return metadata .findSeries( new FindSeries.Request(request.getFilter(), request.getRange(), seriesLimit)) .onDone(reporter.reportFindSeries()) .lazyTransform(transform) .directTransform(fullQuery -> { queryLogger.logOutgoingResponseAtNode(queryContext, fullQuery); return fullQuery; }) .onDone(reporter.reportQueryMetrics()) .onFinished(concurrentQueries::release); }

Target:
public AsyncFuture<FullQuery> query(final FullQuery.Request request) { if (!concurrentQueries.tryAcquire()) { return async.failed(new GoAwayException( "Node has reached maximum number of concurrent MetricManager requests (" + concurrentQueriesBackoff + ")")); } try { return protectedQuery(request).onFinished(concurrentQueries::release); } catch (Exception e) { concurrentQueries.release(); throw new RuntimeException(e); } }
Source:
public void testGetRelativePath() { ______TS("web URL with no relative path"); String url = "<LINK_2>"; assertEquals("", Url.getRelativePath(url)); ______TS("typical web URL"); url = "<LINK_1>"; assertEquals("/page", Url.getRelativePath(url)); }

Target:
public void testGetRelativePath() throws Exception { ______TS("web URL with no relative path"); String url = "<LINK_2>"; assertEquals("", Url.getRelativePath(url)); ______TS("typical web URL"); url = "<LINK_0>"; assertEquals("/page?key1=value1", Url.getRelativePath(url)); }
Source:
private void setRepartitionTopicMetadataNumberOfPartitions(final Map<String, InternalTopicConfig> repartitionTopicMetadata, final Map<Integer, TopicsInfo> topicGroups, final Cluster metadata) { final Set<String> allRepartitionSourceTopics = new HashSet<>(); final Map<String, TopicNode> builtTopicNodes = new HashMap<>(); for (final TopicsInfo topicsInfo : topicGroups.values()) { for (final String topicName : topicsInfo.repartitionSourceTopics.keySet()) { allRepartitionSourceTopics.add(topicName); } for (final String sourceTopic : topicsInfo.sourceTopics) { if (builtTopicNodes.containsKey(sourceTopic)) { builtTopicNodes.get(sourceTopic).addDownStreamTopicsInfo(topicsInfo); } else { final TopicNode topicNode = new TopicNode(sourceTopic); topicNode.addDownStreamTopicsInfo(topicsInfo); builtTopicNodes.put(sourceTopic, topicNode); } } for (final String sinkTopic : topicsInfo.sinkTopics) { if (builtTopicNodes.containsKey(sinkTopic)) { builtTopicNodes.get(sinkTopic).addUpStreamTopicsInfo(topicsInfo); } else { final TopicNode topicNode = new TopicNode(sinkTopic); topicNode.addUpStreamTopicsInfo(topicsInfo); builtTopicNodes.put(sinkTopic, topicNode); } } } for (final String topic : allRepartitionSourceTopics) { calcRepartitionNumForTopic(topic, repartitionTopicMetadata, metadata, builtTopicNodes, new HashMap<TopicsInfo, Integer>()); } }

Target:
private void setRepartitionTopicMetadataNumberOfPartitions(final Map<String, InternalTopicConfig> repartitionTopicMetadata, final Map<Integer, TopicsInfo> topicGroups, final Cluster metadata) { final Set<String> allRepartitionSourceTopics = new HashSet<>(); final Map<String, TopicNode> builtTopicNodes = new HashMap<>(); for (final TopicsInfo topicsInfo : topicGroups.values()) { allRepartitionSourceTopics.addAll(topicsInfo.repartitionSourceTopics.keySet()); for (final String sourceTopic : topicsInfo.sourceTopics) { builtTopicNodes.computeIfAbsent(sourceTopic, topic -> new TopicNode(topic)); builtTopicNodes.get(sourceTopic).addDownStreamTopicsInfo(topicsInfo); } for (final String sinkTopic : topicsInfo.sinkTopics) { builtTopicNodes.computeIfAbsent(sinkTopic, topic -> new TopicNode(topic)); builtTopicNodes.get(sinkTopic).addUpStreamTopicsInfo(topicsInfo); } } for (final String topic : allRepartitionSourceTopics) { calcRepartitionNumForTopic(topic, repartitionTopicMetadata, metadata, builtTopicNodes, new HashMap<TopicsInfo, Integer>()); } }
Source:
public static boolean isOverlord(Properties properties) { return Boolean.valueOf(properties.getProperty("druid.coordinator.asOverlord.enabled")); }

Target:
public static boolean isOverlord(Properties properties) { return Boolean.parseBoolean(properties.getProperty("druid.coordinator.asOverlord.enabled")); }
Source:
private void updateMessageState(Collection<Message> msgsToBeUpdated, HelixDataAccessor accessor, String instanceName) { if (!msgsToBeUpdated.isEmpty()) { Builder keyBuilder = accessor.keyBuilder(); List<String> updateMsgPaths = new ArrayList<>(); List<DataUpdater<ZNRecord>> updaters = new ArrayList<>(); for (Message msg : msgsToBeUpdated) { updateMsgPaths.add(msg.getKey(keyBuilder, instanceName).getPath()); updaters.add(currentData -> { if (currentData == null) { LOG.warn( "Message targets at has already been removed before it is set as READ on instance {}", msg.getId(), msg.getTgtName(), instanceName); return null; } return msg.getRecord(); }); } accessor.updateChildren(updateMsgPaths, updaters, AccessOption.PERSISTENT); } boolean isNewMessageUpdated = false; for (Message msg : msgsToBeUpdated) { if (msg.getMsgState().equals(MessageState.NEW)) { isNewMessageUpdated = true; } else { _knownMessageIds.add(msg.getId()); } } if (isNewMessageUpdated) { sendNopMessage(accessor, instanceName); } }

Target:
private void updateMessageState(Collection<Message> msgsToBeUpdated, HelixDataAccessor accessor, String instanceName) { if (msgsToBeUpdated.isEmpty()) { return; } Builder keyBuilder = accessor.keyBuilder(); List<Message> updateMsgs = new ArrayList<>(); List<String> updateMsgPaths = new ArrayList<>(); List<DataUpdater<ZNRecord>> updaters = new ArrayList<>(); for (Message msg : msgsToBeUpdated) { updateMsgs.add(msg); updateMsgPaths.add(msg.getKey(keyBuilder, instanceName).getPath()); updaters.add(currentData -> { if (currentData == null) { LOG.warn( "Message targets at has already been removed before it is set as READ on instance {}", msg.getId(), msg.getTgtName(), instanceName); return null; } return msg.getRecord(); }); } boolean[] updateResults = accessor.updateChildren(updateMsgPaths, updaters, AccessOption.PERSISTENT); boolean isMessageUpdatedAsNew = false; for (int i = 0; i < updateMsgs.size(); i++) { Message msg = updateMsgs.get(i); if (msg.getMsgState().equals(MessageState.NEW)) { isMessageUpdatedAsNew = true; } else { _knownMessageIds.add(msg.getId()); if (!updateResults[i]) { LOG.error("Failed to update the message {}.", msg.getMsgId()); } } } if (isMessageUpdatedAsNew) { sendNopMessage(accessor, instanceName); } }
Source:
protected void setScopedObjectsField() { JClass keyWildCard = classes().KEY.narrow(codeModel().wildcard()); JClass scopedHashMap = classes().HASH_MAP.narrow(keyWildCard, classes().OBJECT); getRoboGuiceHolder().scopedObjects = getGeneratedClass().field(JMod.PROTECTED, scopedHashMap, "scopedObjects" + ModelConstants.generationSuffix()); getRoboGuiceHolder().scopedObjects.assign(JExpr._new(scopedHashMap)); }

Target:
protected void setScopedObjectsField() { JClass keyWildCard = classes().KEY.narrow(codeModel().wildcard()); JClass scopedHashMap = classes().HASH_MAP.narrow(keyWildCard, classes().OBJECT); getRoboGuiceHolder().scopedObjects = getGeneratedClass().field(JMod.PROTECTED, scopedHashMap, "scopedObjects" + generationSuffix()); getRoboGuiceHolder().scopedObjects.assign(JExpr._new(scopedHashMap)); }
Source:
public void preProcess(ActionParameters params) throws ActionException { if (!params.getUser().isAdmin()) { throw new ActionDeniedException("Unauthorized"); } }

Target:
public void preProcess(ActionParameters params) throws ActionException { params.requireAdminUser(); if (userService == null) { throw new ActionParamsException("User service not initialized"); } }
Source:
private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) throws ClassCastException { IncludedStructuralElement dragStructure = (IncludedStructuralElement) dragNode.getDataObject(); IncludedStructuralElement dropStructure = (IncludedStructuralElement) dropNode.getDataObject(); StructuralElementViewInterface divisionView = dataEditor.getRuleset().getStructuralElementView( dropStructure.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); LinkedList<IncludedStructuralElement> dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragStructure.getType())) { dragParents = MetadataEditor.getAncestorsOfStructure(dragStructure, dataEditor.getWorkpiece().getRootElement()); if (!dragParents.isEmpty()) { IncludedStructuralElement parentStructure = dragParents.get(dragParents.size() - 1); if (parentStructure.getChildren().contains(dragStructure)) { preserveLogical(); return; } else { Helper.setErrorMessage("Parents of structure " + dragNode.getLabel() + " do not contain structure!"); } } else { Helper.setErrorMessage("No parents of structure " + dragNode.getLabel() + " found!"); } } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.forbiddenChildElement", Arrays.asList(dragNode.getLabel(), dropNode.getLabel()))); } show(); }

Target:
private void checkLogicalDragDrop(StructureTreeNode dragNode, StructureTreeNode dropNode) { IncludedStructuralElement dragStructure = (IncludedStructuralElement) dragNode.getDataObject(); IncludedStructuralElement dropStructure = (IncludedStructuralElement) dropNode.getDataObject(); StructuralElementViewInterface divisionView = dataEditor.getRuleset().getStructuralElementView( dropStructure.getType(), dataEditor.getAcquisitionStage(), dataEditor.getPriorityList()); LinkedList<IncludedStructuralElement> dragParents; if (divisionView.getAllowedSubstructuralElements().containsKey(dragStructure.getType())) { dragParents = MetadataEditor.getAncestorsOfStructure(dragStructure, dataEditor.getWorkpiece().getRootElement()); if (!dragParents.isEmpty()) { IncludedStructuralElement parentStructure = dragParents.get(dragParents.size() - 1); if (parentStructure.getChildren().contains(dragStructure)) { preserveLogical(); return; } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.childNotContainedError", Collections.singletonList(dragNode.getLabel()))); } } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.noParentsError", Collections.singletonList(dragNode.getLabel()))); } } else { Helper.setErrorMessage(Helper.getTranslation("dataEditor.forbiddenChildElement", Arrays.asList(dragNode.getLabel(), dropNode.getLabel()))); } show(); }
Source:
public void testCollisionPlayerCoin() { final double oldscore = State.getScore(); final int oldcoins = State.getCoins(); crashMap.collide(player,coin); assertEquals(oldscore + Coin.VALUE, State.getScore(), StateTest.DELTA); assertEquals(oldcoins + 1, State.getCoins()); }

Target:
public void testCollisionPlayerCoin() { final double oldscore = State.getScore(); final int oldcoins = State.getCoins(); collisionHandler.collide(player, coin); assertEquals(oldscore + Coin.VALUE, State.getScore(), StateTest.DELTA); assertEquals(oldcoins + 1, State.getCoins()); }
Source:
public void test_pipe2_errno() throws Exception { try { Libcore.os.pipe2(1); fail(); } catch(ErrnoException expected) }

Target:
public void test_pipe2_errno() throws Exception { try { Libcore.os.pipe2(-1); fail(); } catch(ErrnoException expected) { } }
Source:
protected BinaryConverter<M> getConverterFor(Class<M> clazz) { throw new RuntimeException("Unsupported"); }

Target:
protected BinaryConverter<M> getConverterFor(Class<M> clazz) { throw new UnsupportedOperationException(); }
Source:
public void shutdown(boolean flushAndCheckpoint) { if (_shutdownCompleted) { return; } _logger.info("Shutting down event producer for " + getTaskString()); _shutdownRequested = true; if (_checkpointHandler != null) { _checkpointHandler.shutdown(flushAndCheckpoint); } try { _transportProvider.close(); } catch (TransportException e) { _logger.warn("Closing the TransportProvider failed with exception", e); } _shutdownCompleted = true; }

Target:
public void shutdown(boolean flushAndCheckpoint) { if (_shutdownCompleted) { return; } _logger.info("Shutting down event producer for " + getTaskString()); _shutdownRequested = true; _checkpointHandler.ifPresent(h -> h.shutdown(flushAndCheckpoint)); try { _transportProvider.close(); } catch (TransportException e) { _logger.warn("Closing the TransportProvider failed with exception", e); } _shutdownCompleted = true; }
Source:
public AnyLicenseInfo clone() { try { SpdxListedLicense retval = new SpdxListedLicense(this.getName(), this.getLicenseId(), this.getLicenseText(), this.getSeeAlso(), this.getSeeAlsoDetails(), this.getComment(), this.getStandardLicenseHeader(), this.getStandardLicenseTemplate(), this.getStandardLicenseHeaderTemplate(), this.isOsiApproved(), this.getFsfLibre()); retval.setDeprecated(this.isDeprecated()); return retval; } catch (InvalidSPDXAnalysisException e) { throw new AssertionError("Clone should never cause an Invalid SPDX Exception",e); } }

Target:
public AnyLicenseInfo clone() { try { SpdxListedLicense retval = new SpdxListedLicense(this.getName(), this.getLicenseId(), this.getLicenseText(), this.getSeeAlso(), this.getCrossRef(), this.getComment(), this.getStandardLicenseHeader(), this.getStandardLicenseTemplate(), this.getStandardLicenseHeaderTemplate(), this.isOsiApproved(), this.getFsfLibre()); retval.setDeprecated(this.isDeprecated()); return retval; } catch (InvalidSPDXAnalysisException e) { throw new AssertionError("Clone should never cause an Invalid SPDX Exception",e); } }
Source:
public void usingGreaterThanWithNamedParameter() { String queryString = "SELECT u FROM User u WHERE :age<u.age"; StringQuery query = new StringQuery(queryString); softly.assertThat(query.getQueryString()).isEqualTo(queryString); softly.assertThat(query.hasParameterBindings()).isTrue(); softly.assertThat(query.getParameterBindings()).hasSize(1); softly.assertThat(query.getParameterBindings().get(0).getName()).isEqualTo("age"); softly.assertAll(); }

Target:
public void usingGreaterThanWithNamedParameter() { String queryString = "SELECT u FROM User u WHERE :age>u.age"; StringQuery query = new StringQuery(queryString); softly.assertThat(query.getQueryString()).isEqualTo(queryString); softly.assertThat(query.hasParameterBindings()).isTrue(); softly.assertThat(query.getParameterBindings()).hasSize(1); softly.assertThat(query.getParameterBindings().get(0).getName()).isEqualTo("age"); softly.assertAll(); }
Source:
public DayActivityOverviewDto<DayActivityWithBuddiesDto> getUserDayActivityOverviewWithBuddies(UUID userId, LocalDate date) { UUID userAnonymizedId = userService.getUserAnonymizedId(userId); Interval interval = Interval.createDayInterval(date); Set<BuddyDto> buddies = buddyService.getBuddiesOfUserThatAcceptedSending(userId); LocalDate earliestPossibleDate = determineEarliestBuddyStatusChangeDate(buddies); List<DayActivityOverviewDto<DayActivityWithBuddiesDto>> dayActivityOverviews = getUserDayActivityOverviewsWithBuddies( userAnonymizedId, earliestPossibleDate, interval, buddies); return dayActivityOverviews.get(0); }

Target:
public DayActivityOverviewDto<DayActivityWithBuddiesDto> getUserDayActivityOverviewWithBuddies(UUID userId, LocalDate date) { UUID userAnonymizedId = userService.getUserAnonymizedId(userId); Interval interval = Interval.createDayInterval(date); Set<BuddyDto> buddies = buddyService.getBuddiesOfUserThatAcceptedSending(userId); Require.that(!buddies.isEmpty(), () -> BuddyNotFoundException.userHasNoBuddies(userId)); LocalDate earliestPossibleDate = determineEarliestBuddyStatusChangeDate(buddies); List<DayActivityOverviewDto<DayActivityWithBuddiesDto>> dayActivityOverviews = getUserDayActivityOverviewsWithBuddies( userAnonymizedId, earliestPossibleDate, interval, buddies); return dayActivityOverviews.get(0); }
Source:
public void testCategoryAttributeMapping() { MetacardImpl metacard = new MetacardImpl(); metacard.setAttribute(Core.TITLE, "The Title"); List<HtmlExportCategory> categoryList = new ArrayList<>(); categoryList.add(new HtmlCategoryModel("Core", coreList)); HtmlMetacardModel metacardModel = new HtmlMetacardModel(metacard, categoryList); HtmlExportCategory category = metacardModel.getCategories().get(0); assertThat(category.getAttributes().get("Title").getValue(), is("The Title")); }

Target:
public void testCategoryAttributeMapping() { MetacardImpl metacard = new MetacardImpl(); metacard.setAttribute(Core.TITLE, METACARD_TITLE); List<HtmlExportCategory> categoryList = new ArrayList<>(); categoryList.add(new HtmlCategoryModel("Core", coreList)); HtmlMetacardModel metacardModel = new HtmlMetacardModel(metacard, categoryList); HtmlExportCategory category = metacardModel.getCategories().get(0); String titleValue = category.getAttributeMappings().get("Title").getValue(); assertThat(titleValue, is(METACARD_TITLE)); }
Source:
public MutableSpan(MutableSpan toCopy) { if (toCopy == null) throw new NullPointerException("toCopy == null"); traceId = toCopy.traceId; parentId = toCopy.parentId; id = toCopy.id; kind = toCopy.kind; flags = toCopy.flags; startTimestamp = toCopy.startTimestamp; finishTimestamp = toCopy.finishTimestamp; name = toCopy.name; localServiceName = toCopy.localServiceName; localIp = toCopy.localIp; localPort = toCopy.localPort; remoteServiceName = toCopy.remoteServiceName; remoteIp = toCopy.remoteIp; remotePort = toCopy.remotePort; tags = toCopy.tags != null ? new ArrayList<>(toCopy.tags) : null; annotations = toCopy.annotations != null ? new ArrayList<>(toCopy.annotations) : null; error = toCopy.error; }

Target:
public MutableSpan(MutableSpan toCopy) { if (toCopy == null) throw new NullPointerException("toCopy == null"); traceId = toCopy.traceId; localRootId = toCopy.localRootId; parentId = toCopy.parentId; id = toCopy.id; kind = toCopy.kind; flags = toCopy.flags; startTimestamp = toCopy.startTimestamp; finishTimestamp = toCopy.finishTimestamp; name = toCopy.name; localServiceName = toCopy.localServiceName; localIp = toCopy.localIp; localPort = toCopy.localPort; remoteServiceName = toCopy.remoteServiceName; remoteIp = toCopy.remoteIp; remotePort = toCopy.remotePort; tags = toCopy.tags != null ? new ArrayList<>(toCopy.tags) : null; annotations = toCopy.annotations != null ? new ArrayList<>(toCopy.annotations) : null; error = toCopy.error; }
Source:
public static byte[] read(InputStream is) throws IOException { int l = is.available(); byte[] buffer = new byte[l+1]; int length = 0; while ((l = is.read(buffer, length, buffer.length - length)) != -1) { length += l; if (length == buffer.length) { byte[] b = new byte[buffer.length + 4096]; System.arraycopy(buffer, 0, b, 0, length); buffer = b; } } return buffer; }

Target:
public static byte[] read(InputStream is) throws IOException { int l = is.available(); byte[] buffer = new byte[l+1]; int length = 0; while ((l = is.read(buffer, length, buffer.length - length)) != -1) { length += l; if (length == buffer.length) { byte[] b = new byte[buffer.length + 4096]; System.arraycopy(buffer, 0, b, 0, length); buffer = b; } } if (length < buffer.length) { byte[] b = new byte[length]; System.arraycopy(buffer, 0, b, 0, length); buffer = b; } return buffer; }
Source:
public void passesValidationForNullCardExpiry() { TelephoneChargeCreateRequest telephoneChargeCreateRequest = telephoneRequestBuilder .withCardExpiry(null) .build(); Set<ConstraintViolation<TelephoneChargeCreateRequest>> constraintViolations = validator.validate(telephoneChargeCreateRequest); assertThat(constraintViolations.size(), isNumber(0)); }

Target:
public void passesValidationForNullCardExpiry() { TelephoneChargeCreateRequest telephoneChargeCreateRequest = telephoneRequestBuilder .withCardExpiry(null) .build(); Set<ConstraintViolation<TelephoneChargeCreateRequest>> constraintViolations = validator.validate(telephoneChargeCreateRequest); assertThat(constraintViolations.isEmpty(), is(true)); }
Source:
protected String adjustPayloadBeforeSavingResource(ResourceManager mgr, CommandContext context, File f, String payload) { if (context.getAppConfig().getExcludeFields() != null) { for(String field : context.getAppConfig().getExcludeFields()) { logger.info("Excluding property %s from payload", field); payload = payloadPropertyFilter.excludeProperty(payload, field); } } if (context.getAppConfig().getIncludeFields() != null) { Map<String, String> field = context.getAppConfig().getIncludeFields(); for(String key : field.keySet()) { logger.info("Adding property %s with value %s payload", key, field.get(key)); payload = payloadPropertyFilter.includeProperty(payload, key, field.get(key)); } } return payload; }

Target:
protected String adjustPayloadBeforeSavingResource(ResourceManager mgr, CommandContext context, File f, String payload) { if (context.getAppConfig().getExcludeProperties() != null) { String[] properties = context.getAppConfig().getExcludeProperties(); logger.info("Excluding property %s from payload", Arrays.asList(properties)); payload = payloadParser.excludeProperties(payload, properties); } if (context.getAppConfig().getIncludeProperties() != null) { String[] properties = context.getAppConfig().getIncludeProperties(); logger.info("Including property %s from payload", Arrays.asList(properties)); payload = payloadParser.includeProperties(payload, properties); } return payload; }
Source:
public int hashCode() { int result = remoteViews.hashCode(); result = 31 * result + viewId; return result; }

Target:
@Override public int hashCode() { return 31 * remoteViews.hashCode() + viewId; }
Source:
public void addPendingUsage(String username, PublicKeyHash writer, int size) { int userId = getUserId(username); int writerId = getWriterId(writer); try (PreparedStatement insert = conn.prepareStatement(commands.insertOrIgnoreCommand("INSERT ", "INTO pendingusage (user_id, writer_id, pending_bytes) VALUES(?, ?, ?)"))) { insert.setInt(1, userId); insert.setInt(2, writerId); insert.setInt(3, 0); insert.executeUpdate(); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } try (PreparedStatement insert = conn.prepareStatement("UPDATE pendingusage SET pending_bytes = pending_bytes + ? " + "WHERE writer_id = ?;")) { insert.setLong(1, size); insert.setInt(2, writerId); int count = insert.executeUpdate(); if (count != 1) throw new IllegalStateException("Didn't update one record!"); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }

Target:
public void addPendingUsage(String username, PublicKeyHash writer, int size) { int userId = getUserId(username); int writerId = getWriterId(writer); try (Connection conn = getNonCommittingConnection(); PreparedStatement defaultInsert = conn.prepareStatement(commands.insertOrIgnoreCommand( "INSERT ", "INTO pendingusage (user_id, writer_id, pending_bytes) VALUES(?, ?, ?)")); PreparedStatement insert = conn.prepareStatement("UPDATE pendingusage SET pending_bytes = pending_bytes + ? " + "WHERE writer_id = ?;")) { try { defaultInsert.setInt(1, userId); defaultInsert.setInt(2, writerId); defaultInsert.setInt(3, 0); defaultInsert.executeUpdate(); insert.setLong(1, size); insert.setInt(2, writerId); int count = insert.executeUpdate(); if (count != 1) throw new IllegalStateException("Didn't update one record!"); conn.commit(); } catch (SQLException e) { conn.rollback(); throw e; } } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }
Source:
private boolean requireApiVersion(String apiVer) { if (apiVer.equals(sJsApiVersion)) { return true; } return false; }

Target:
private boolean requireApiVersion(String apiVer) { return apiVer.equals(sCurrentJsApiVersion); }
Source:
private void parseECAction(final ECState type) throws XMLStreamException { ECAction ecAction = LibraryElementFactory.eINSTANCE.createECAction(); String algorithm = getAttributeValue(LibraryElementTags.ALGORITHM_ELEMENT); if (algorithm != null) { if (algorithmNameECActionMapping.containsKey(algorithm)) { algorithmNameECActionMapping.get(algorithm).add(ecAction); } else { List<ECAction> temp = new ArrayList<>(); temp.add(ecAction); algorithmNameECActionMapping.put(algorithm, temp); } } String output = getAttributeValue(LibraryElementTags.OUTPUT_ATTRIBUTE); if (output != null) { Event outp = outputEvents.get(output); if (outp != null) { ecAction.setOutput(outp); } } proceedToEndElementNamed(LibraryElementTags.ECACTION_ELEMENT); type.getECAction().add(ecAction); }

Target:
private void parseECAction(final ECState type) throws XMLStreamException { ECAction ecAction = LibraryElementFactory.eINSTANCE.createECAction(); String algorithm = getAttributeValue(LibraryElementTags.ALGORITHM_ELEMENT); if (null != algorithm) { if (algorithmNameECActionMapping.containsKey(algorithm)) { algorithmNameECActionMapping.get(algorithm).add(ecAction); } else { List<ECAction> temp = new ArrayList<>(); temp.add(ecAction); algorithmNameECActionMapping.put(algorithm, temp); } } String output = getAttributeValue(LibraryElementTags.OUTPUT_ATTRIBUTE); if (null != output) { Event outp = outputEvents.get(output); if (null != outp) { ecAction.setOutput(outp); } } proceedToEndElementNamed(LibraryElementTags.ECACTION_ELEMENT); type.getECAction().add(ecAction); }
Source:
private KeyStore createTrustStore() throws CreateException { trustStorePassword = null == trustStorePassword ? "" : trustStorePassword; KeyStore trustStore; InputStream is = null; try { trustStore = KeyStore.getInstance(trustStoreType); is = IOUtils.getResourceAsStream(trustStoreName, getClass()); if (null == is) { throw new FileNotFoundException("Failed to load truststore from classpath or local file: " + trustStoreName); } trustStore.load(is, trustStorePassword.toCharArray()); } catch (Exception e) { throw new CreateException(failedToLoad("TrustStore: " + trustStoreName), e, this); } finally { if (is != null) { closeQuietly(is); } } return trustStore; }

Target:
private KeyStore createTrustStore() throws CreateException { trustStorePassword = null == trustStorePassword ? "" : trustStorePassword; try (InputStream is = getResourceAsStream(trustStoreName, getClass())) { KeyStore trustStore = getInstance(trustStoreType); if (null == is) { throw new FileNotFoundException("Failed to load truststore from classpath or local file: " + trustStoreName); } trustStore.load(is, trustStorePassword.toCharArray()); return trustStore; } catch (Exception e) { throw new CreateException(failedToLoad("TrustStore: " + trustStoreName), e, this); } }
Source:
public void processRequest(HashMap<String, String> paramMap) { String jobId = paramMap.get(ServerUtils.JOB_ID_KEY); String superstepId = paramMap.get(ServerUtils.SUPERSTEP_ID_KEY); if (jobId == null || superstepId == null ) { this.statusCode = HttpURLConnection.HTTP_BAD_REQUEST; this.response = String.format("Invalid parameters. %s and %s are mandatory parameter.", ServerUtils.JOB_ID_KEY, ServerUtils.SUPERSTEP_ID_KEY); return; } ArrayList<String> vertexIds = null; try { vertexIds = ServerUtils.getVerticesDebugged("job_201405061024_0019", 0); } catch(IOException ex) { this.statusCode = HttpURLConnection.HTTP_INTERNAL_ERROR; this.response = "Internal Server Error."; return; } this.statusCode = HttpURLConnection.HTTP_OK; this.response = new JSONArray(vertexIds).toString(); }

Target:
public void processRequest(HashMap<String, String> paramMap) { String jobId = paramMap.get(ServerUtils.JOB_ID_KEY); String superstepId = paramMap.get(ServerUtils.SUPERSTEP_ID_KEY); try { if (jobId == null || superstepId == null) { throw new IllegalArgumentException("Missing mandatory params."); } ArrayList<String> vertexIds = null; long superstepNo = Long.parseLong(superstepId); if (superstepNo < -1) { throw new NumberFormatException("Superstep must be integer >= -1."); } vertexIds = ServerUtils.getVerticesDebugged(jobId, superstepNo); this.statusCode = HttpURLConnection.HTTP_OK; this.response = new JSONArray(vertexIds).toString(); } catch (NumberFormatException e) { this.statusCode = HttpURLConnection.HTTP_BAD_REQUEST; this.response = String.format("%s must be an integer >= -1.", ServerUtils.SUPERSTEP_ID_KEY); } catch (IllegalArgumentException e) { this.statusCode = HttpURLConnection.HTTP_BAD_REQUEST; this.response = String.format("Invalid parameters. %s and %s are mandatory parameter.", ServerUtils.JOB_ID_KEY, ServerUtils.SUPERSTEP_ID_KEY); } catch (IOException e) { this.statusCode = HttpURLConnection.HTTP_INTERNAL_ERROR; this.response = "Internal Server Error."; } }
Source:
public void testUpdate() throws Exception { server.enqueue(jsonResponse("/storageaccountupdate.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); StorageServiceUpdateParams.StorageServiceUpdateProperties props = StorageServiceUpdateParams.StorageServiceUpdateProperties.create(null, null, null, null, null, null, null, null, null); final StorageServiceUpdateParams params = storageAPI.update("TESTSTORAGE", props, ImmutableMap.of("another_property_name", "another_property_value")); assertTrue(params.tags().containsKey("another_property_name")); assertSent(server, "PATCH", "/subscriptions/" + subsriptionId + "/resourcegroups/" + resourceGroup + "/providers/Microsoft.Storage/storageAccounts/TESTSTORAGE?api-version=2015-06-15"); }

Target:
public void testUpdate() throws Exception { server.enqueue(jsonResponse("/storageaccountupdate.json")); final StorageAccountApi storageAPI = api.getStorageAccountApi(resourceGroup); StorageServiceUpdateParams.StorageServiceUpdateProperties props = StorageServiceUpdateParams.StorageServiceUpdateProperties.create(StorageService.AccountType.Standard_LRS); final StorageServiceUpdateParams params = storageAPI.update("TESTSTORAGE", ImmutableMap.of("another_property_name", "another_property_value"), props); assertTrue(params.tags().containsKey("another_property_name")); assertSent(server, "PATCH", "/subscriptions/" + subsriptionId + "/resourcegroups/" + resourceGroup + "/providers/Microsoft.Storage/storageAccounts/TESTSTORAGE?api-version=2015-06-15", String.format("{\"properties\":{ \"accountType\": \"Standard_LRS\" },\"tags\":{\"another_property_name\":\"another_property_value\"}}")); }
Source:
public static boolean isBinary(InputStream raw) throws IOException { final byte[] buffer = new byte[FIRST_FEW_BYTES]; final int read = raw.read(buffer, 0, buffer.length); return isBinary(buffer, read); }

Target:
public static boolean isBinary(InputStream raw) throws IOException { final byte[] buffer = new byte[FIRST_FEW_BYTES]; int cnt = 0; while (cnt < buffer.length) { final int read = raw.read(buffer, cnt, buffer.length - cnt); if (read == -1) break; cnt += read; } return isBinary(buffer, cnt); }
Source:
public void onResponse(Map<String, Object> response) { infoReturn.eval(); proceedProxyReturnValue(); VdsBrokerObjectsBuilder.updateVDSDynamicData(getVds(), infoReturn.info); setReturnValue(getVds()); if (getParameters().getCallback() != null) { getParameters().getCallback().onResponse(Collections.singletonMap("result", getVDSReturnValue())); } }

Target:
public void onResponse(Map<String, Object> response) { handleResponse(); getParameters().getCallback().onResponse(Collections.singletonMap("result", getVDSReturnValue())); }
Source:
public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_main); ButterKnife.bind(this); new PrerequisitesChecker(this).execute(); userModel.initialize(this); locationUpdatesService.initialize(getApplication()); startSyncService(); drawerNavigation.setNavigationItemSelectedListener(this); setSupportActionBar(toolbar); ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close); drawerLayout.setDrawerListener(mDrawerToggle); mDrawerToggle.syncState(); navigateTo(R.id.navigation_map); }

Target:
public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_main); ButterKnife.bind(this); new PrerequisitesChecker(this).execute(); userModel.initialize(this); locationUpdatesService.initialize(getApplication()); startSyncService(); }
Source:
public ResponseEntity<String> getApplicants() { resultList = applicantService.getApplicants(); String result = jsonUtil.toJson(resultList); return new ResponseEntity<>(result, HttpStatus.OK); }

Target:
public ResponseEntity<List<Applicant>> getApplicants() { List<Applicant> resultList = applicantService.getApplicants(); if(resultList.isEmpty() || resultList == null){ return new ResponseEntity<>(resultList, HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(resultList, HttpStatus.OK); }
Source:
public void testNUllVmElementForFloatingDisk() { List<DiskVmElement> allDves = dao.getAll(); assertTrue(allDves.stream().filter(dve -> dve.getDiskId().equals(FixturesTool.FLOATING_DISK_ID)).collect( Collectors.toList()).isEmpty()); }

Target:
public void testNUllVmElementForFloatingDisk() { List<DiskVmElement> allDves = dao.getAll(); assertTrue(allDves.stream().noneMatch(dve -> dve.getDiskId().equals(FixturesTool.FLOATING_DISK_ID))); }
Source:
public HelloWorldServlet(@PluginName String pluginName, @PluginCanonicalWebUrl String url) { log.info("Cookbook Plugin '" + pluginName + "' at url " + url + ""); }

Target:
public HelloWorldServlet(@PluginName String pluginName, @PluginCanonicalWebUrl String url) { log.info(String.format("Cookbook Plugin '%' at url %s", pluginName, url)); }