auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addSortOrder(Optional<QueryOrdering> ordering, SearchRequestBuilder reqBuilder) { QueryOrdering order = ordering.get(); for (QueryOrdering.Node node : order.getSortOrder()) { if ("relevance".equalsIgnoreCase(node.getPath())) { reqBuilder.addSort(SortBuilders.scoreSort().order(SortOrder.DESC)); } else { reqBuilder.addSort( SortBuilders .fieldSort(translateOrderField(node.getPath())) .missing("_last") .order(node.isAscending() ? SortOrder.ASC : SortOrder.DESC) ); } } }

Target:
private void addSortOrder(Optional<QueryOrdering> ordering, SearchRequestBuilder reqBuilder) { QueryOrdering order = ordering.get(); for (QueryOrdering.Clause clause : order.getSortOrder()) { if ("relevance".equalsIgnoreCase(clause.getPath())) { reqBuilder.addSort(SortBuilders.scoreSort().order(SortOrder.DESC)); } else { reqBuilder.addSort( SortBuilders .fieldSort(translateOrderField(clause.getPath())) .missing("_last") .order(clause.isAscending() ? SortOrder.ASC : SortOrder.DESC) ); } } }
Source:
private Map<String, String> fetchRemoteScripts(String location, boolean isRecursive) { final Map<String, String> scripts = new HashMap<>(); final String contentTreeUrl = getContentTreeUrl(location); final JsonParser jsonParser = new JsonParser(); Reader reader = null; try { reader = new InputStreamReader(new URL(contentTreeUrl).openStream()); } catch (final IOException e) { e.printStackTrace(); } if (reader != null) { final JsonObject rootObject = jsonParser.parse(reader).getAsJsonObject(); final JsonArray projectTree = rootObject.getAsJsonArray(JSON_TREE_LABEL); for (final JsonElement element : projectTree) { final JsonObject object = element.getAsJsonObject(); final String scriptPath = object.get(JSON_PATH_LABEL).getAsString(); final String scriptName = (scriptPath.contains(SEPARATOR)) ? getScriptName(scriptPath) : scriptPath; final String scriptSHA = object.get(JSON_SHA_LABEL).getAsString(); final String scriptType = object.get(JSON_TYPE_LABEL).getAsString(); if (scriptType.equals(JSON_BLOB_LABEL)) { final String repositoryName = getRepositoryName(location); final String relativeScriptPath = getRelativeScriptPath(location); if (isRecursive) { if (repositoryName.equals(relativeScriptPath) || scriptPath.startsWith(relativeScriptPath)) { scripts.put(scriptSHA, scriptPath); } } else { if ((repositoryName.equals(relativeScriptPath) && !scriptPath.contains(SEPARATOR)) || (scriptPath.endsWith(relativeScriptPath + SEPARATOR + scriptName))) { scripts.put(scriptSHA, scriptPath); } } } } } return scripts; }

Target:
private Map<String, String> fetchRemoteScripts(String location, boolean isRecursive) { final Map<String, String> scripts = new HashMap<>(); final String contentTreeUrl = getContentTreeUrl(location); final JsonParser jsonParser = new JsonParser(); try (Reader reader = new InputStreamReader(new URL(contentTreeUrl).openStream())) { final JsonObject rootObject = jsonParser.parse(reader).getAsJsonObject(); final JsonArray projectTree = rootObject.getAsJsonArray(JSON_TREE_LABEL); for (final JsonElement element : projectTree) { final JsonObject object = element.getAsJsonObject(); final String scriptPath = object.get(JSON_PATH_LABEL).getAsString(); final String scriptName = (scriptPath.contains(SEPARATOR)) ? getScriptName(scriptPath) : scriptPath; final String scriptSHA = object.get(JSON_SHA_LABEL).getAsString(); final String scriptType = object.get(JSON_TYPE_LABEL).getAsString(); if (scriptType.equals(JSON_BLOB_LABEL)) { final String repositoryName = getRepositoryName(location); final String relativeScriptPath = getRelativeScriptPath(location); if (isRecursive) { if (repositoryName.equals(relativeScriptPath) || scriptPath.startsWith(relativeScriptPath)) { scripts.put(scriptSHA, scriptPath); } } else if ((repositoryName.equals(relativeScriptPath) && !scriptPath.contains(SEPARATOR)) || (scriptPath.endsWith(relativeScriptPath + SEPARATOR + scriptName))) { scripts.put(scriptSHA, scriptPath); } } } } catch (final IOException e) { Logger.error(Activator.PLUGIN_ID, "Unable to fetch content: " + e.getMessage()); } return scripts; }
Source:
public SRResult similarity(String phrase1, String phrase2, Language language, boolean explanations) throws DaoException { if (phrase1 == null || phrase2 == null) { throw new NullPointerException("Null phrase passed to similarity"); } try { TIntDoubleHashMap scores1 = getConceptVector(phrase1, language); TIntDoubleHashMap scores2 = getConceptVector(phrase2, language); double sim = SimUtils.cosineSimilarity(scores1, scores2); return new SRResult(sim); } catch (WikapidiaException e) { throw new DaoException(e); } }

Target:
public SRResult similarity(String phrase1, String phrase2, Language language, boolean explanations) throws DaoException { if (phrase1 == null || phrase2 == null) { throw new NullPointerException("Null phrase passed to similarity"); } TIntDoubleHashMap scores1 = getConceptVector(phrase1, language); TIntDoubleHashMap scores2 = getConceptVector(phrase2, language); double sim = SimUtils.cosineSimilarity(scores1, scores2); return new SRResult(sim); }
Source:
public AmqpInboundPolledChannelAdapterSpec(ConnectionFactory connectionFactory, AmqpAckCallbackFactory ackCallbackFactory, String queue) { this.target = new AmqpMessageSource(connectionFactory, ackCallbackFactory, queue); }

Target:
AmqpInboundPolledChannelAdapterSpec(ConnectionFactory connectionFactory, AmqpAckCallbackFactory ackCallbackFactory, String queue) { this.target = new AmqpMessageSource(connectionFactory, ackCallbackFactory, queue); }
Source:
public OutputColumns getOutputColumns() { StringBuilder builder = new StringBuilder("Hash of "); for (int i = 0; i < _columns.length; i++) { if (i != 0) { builder.append(", "); } builder.append(_columns[i].getName()); if (i == COLUMNS_LIMIT) { builder.append("..."); break; } } return new OutputColumns(String.class, builder.toString(), "Input length"); }

Target:
public OutputColumns getOutputColumns() { final StringJoiner joiner = new StringJoiner(", "); for (InputColumn<?> column : _columns) { joiner.add(column.getName()); } return new OutputColumns(String.class, "Hash of " + joiner.toString(), "Input length"); }
Source:
public void update(CommandsInterface ci, IccCardStatus ics, int phoneId) { synchronized (mLock) { CardState oldState = mCardState; mCardState = ics.mCardState; mPhoneId = phoneId; parseAtr(ics.atr); mCi = ci; RadioState radioState = mCi.getRadioState(); if (DBG) { log("update: radioState=" + radioState + " mLastRadioState=" + mLastRadioState); } if ((oldState == null || oldState != CardState.CARDSTATE_ABSENT) && mCardState == CardState.CARDSTATE_ABSENT) { if (radioState == RadioState.RADIO_ON && mLastRadioState == RadioState.RADIO_ON) { if (DBG) log("update: notify card removed"); sendMessage(obtainMessage(EVENT_CARD_REMOVED, null)); } UiccController.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, mPhoneId); if (mUiccCard != null) { mUiccCard.dispose(); mUiccCard = null; } } else if ((oldState == null || oldState == CardState.CARDSTATE_ABSENT) && mCardState != CardState.CARDSTATE_ABSENT) { if (radioState == RadioState.RADIO_ON && mLastRadioState == RadioState.RADIO_ON) { if (DBG) log("update: notify card added"); sendMessage(obtainMessage(EVENT_CARD_ADDED, null)); } if (mUiccCard != null) { loge("update: mUiccCard != null when card was present; disposing it now"); mUiccCard.dispose(); } if (!mIsEuicc) { mUiccCard = new UiccCard(mContext, mCi, ics, mPhoneId); } else { mUiccCard = new EuiccCard(mContext, mCi, ics, phoneId); } } else { if (mUiccCard != null) { mUiccCard.update(mContext, mCi, ics); } } mLastRadioState = radioState; } }

Target:
public void update(CommandsInterface ci, IccCardStatus ics, int phoneId) { synchronized (mLock) { CardState oldState = mCardState; mCardState = ics.mCardState; mPhoneId = phoneId; parseAtr(ics.atr); mCi = ci; RadioState radioState = mCi.getRadioState(); if (DBG) { log("update: radioState=" + radioState + " mLastRadioState=" + mLastRadioState); } if (oldState != CardState.CARDSTATE_ABSENT && mCardState == CardState.CARDSTATE_ABSENT) { if (radioState == RadioState.RADIO_ON && mLastRadioState == RadioState.RADIO_ON) { if (DBG) log("update: notify card removed"); sendMessage(obtainMessage(EVENT_CARD_REMOVED, null)); } UiccController.updateInternalIccState( IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, mPhoneId); if (mUiccCard != null) { mUiccCard.dispose(); mUiccCard = null; } } else if ((oldState == null || oldState == CardState.CARDSTATE_ABSENT) && mCardState != CardState.CARDSTATE_ABSENT) { if (radioState == RadioState.RADIO_ON && mLastRadioState == RadioState.RADIO_ON) { if (DBG) log("update: notify card added"); sendMessage(obtainMessage(EVENT_CARD_ADDED, null)); } if (mUiccCard != null) { loge("update: mUiccCard != null when card was present; disposing it now"); mUiccCard.dispose(); } if (!mIsEuicc) { mUiccCard = new UiccCard(mContext, mCi, ics, mPhoneId); } else { mUiccCard = new EuiccCard(mContext, mCi, ics, phoneId); } } else { if (mUiccCard != null) { mUiccCard.update(mContext, mCi, ics); } } mLastRadioState = radioState; } }
Source:
public Collection<trainingListeners> getTrainingListeners() { return trainingListeners; }

Target:
public Collection<TrainingListener> getTrainingListeners() { return trainingListeners; }
Source:
public List<ICommand> getSortedCommandList() { List<ICommand> list = new ArrayList<ICommand>(commandMap.size()); list.addAll(commandMap.values()); Collections.sort(list); return list; }

Target:
public List<ICommand> getSortedCommandList() { List<ICommand> list = new ArrayList<ICommand>(getSubCommands()); Collections.sort(list); return list; }
Source:
private boolean rewrite() { match(subject); if (success) { List<ExtendedSubstitution> normalizedExtSubsts = getCNFExtendedSubstitutions( fExtSubst, fMultiExtSubsts); Profiler.startTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); ExtendedSubstitution solution = null; for (ExtendedSubstitution extSubst : normalizedExtSubsts) { Map<Variable, Term> updatedSubst = RewriteEngineUtils. evaluateConditions(rule, extSubst.substitution(), context); if (updatedSubst != null) { extSubst.setSubst(updatedSubst); solution = extSubst; break; } } Profiler.stopTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); if (solution != null) { Profiler.startTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); Transformer substAndEvalTransformer = new CopyOnShareSubstAndEvalTransformer( solution.substitution(), rule.reusableVariables().elementSet(), context); for (Cell cell : solution.writeCells()) { CellLabel cellLabel = cell.getLabel(); Term rightHandSide = getWriteCellRHS(cellLabel); if (rule.cellsToCopy().contains(cellLabel)) { rightHandSide = DeepCloner.clone(rightHandSide); } cell.unsafeSetContent((Term) rightHandSide.accept(substAndEvalTransformer)); } context.setTopTerm(subject); Profiler.stopTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); } else { success = false; } } return success; }

Target:
private boolean rewrite() { match(subject); if (success) { List<ExtendedSubstitution> normalizedExtSubsts = getCNFExtendedSubstitutions( fExtSubst, fMultiExtSubsts); Profiler.startTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); ExtendedSubstitution solution = null; for (ExtendedSubstitution extSubst : normalizedExtSubsts) { Map<Variable, Term> updatedSubst = RewriteEngineUtils. evaluateConditions(rule, extSubst.substitution(), context); if (updatedSubst != null) { extSubst.setSubst(updatedSubst); solution = extSubst; break; } } Profiler.stopTimer(Profiler.EVALUATE_SIDE_CONDITIONS_TIMER); if (solution != null) { Profiler.startTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); Transformer substAndEvalTransformer = new CopyOnShareSubstAndEvalTransformer( solution.substitution(), rule.reusableVariables().elementSet(), context); for (Cell cell : solution.writeCells()) { CellLabel cellLabel = cell.getLabel(); Term rightHandSide = getWriteCellRHS(cellLabel); if (rule.cellsToCopy().contains(cellLabel)) { rightHandSide = DeepCloner.clone(rightHandSide); } cell.unsafeSetContent((Term) rightHandSide.accept(substAndEvalTransformer)); } Profiler.stopTimer(Profiler.LOCAL_REWRITE_BUILD_RHS_TIMER); } else { success = false; } } return success; }
Source:
public void benchSyncOnSubscribe(final SingleInput input) { createSyncOnSubscribe(input.iterator).call(input.newSubscriber()); }

Target:
public void benchSyncOnSubscribe(final SingleInput input) { createSyncOnSubscribe(input.iterable.iterator()).call(input.newSubscriber()); }
Source:
public void createAndClaimRadiologyReport_shouldThrowAnUnsupportedOperationExceptionIfGivenOrderHasACompletedRadiologyReport() throws Exception { RadiologyOrder existingRadiologyOrder = radiologyService .getRadiologyOrderByOrderId(RADIOLOGY_ORDER_WITH_STUDY_AND_CLAIMED_RADIOLOGY_REPORT); RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setRadiologyReportStatus(RadiologyReportStatus.CLAIMED); radiologyService.saveRadiologyReport(existingRadiologyReport); radiologyService.completeRadiologyReport(existingRadiologyReport, providerService.getProvider(1)); expectedException.expect(UnsupportedOperationException.class); expectedException .expectMessage("cannot create radiologyReport for this radiologyOrder because it is already completed"); radiologyService.createAndClaimRadiologyReport(existingRadiologyOrder); }

Target:
public void createAndClaimRadiologyReport_shouldThrowAnUnsupportedOperationExceptionIfGivenOrderHasACompletedRadiologyReport() throws Exception { RadiologyOrder existingRadiologyOrder = radiologyService .getRadiologyOrderByOrderId(RADIOLOGY_ORDER_WITH_STUDY_AND_COMPLETED_RADIOLOGY_REPORT); RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setReportStatus(RadiologyReportStatus.CLAIMED); radiologyService.saveRadiologyReport(existingRadiologyReport); radiologyService.completeRadiologyReport(existingRadiologyReport, providerService.getProvider(1)); expectedException.expect(UnsupportedOperationException.class); expectedException .expectMessage("cannot create radiologyReport for this radiologyOrder because it is already completed"); radiologyService.createAndClaimRadiologyReport(existingRadiologyOrder); }
Source:
public Object isSlaFailed() { final ExecutableFlow flow; try { flow = this.executorLoader.fetchExecutableFlow(this.execId); logger.info("Flow for execid " + this.execId + " is " + flow.toString()); } catch (final ExecutorManagerException e) { logger.error("Can't get executable flow.", e); return true; } return isSlaMissed(flow); }

Target:
public Object isSlaFailed() { final ExecutableFlow flow; try { flow = this.executorLoader.fetchExecutableFlow(this.execId); logger.info("Flow for execid " + this.execId + " is " + flow.getId()); } catch (final ExecutorManagerException e) { logger.error("Can't get executable flow.", e); return true; } return isSlaMissed(flow); }
Source:
protected TupleBatch fetchNextReady() throws DbException { final Operator child = getChild(); TupleBatch tb = child.nextReady(); while (tb != null) { for (int row = 0; row < tb.numTuples(); ++row) { IntIterator iter = groupStates.getIndices(tb, gfields, row).intIterator(); int indice; if (!iter.hasNext()) { addToResult(); groupStates.addTuple(tb, gfields, row, true); for (int i = 0; i < internalAggs.size(); ++i) { internalAggs.get(i).initState(groupStates.getData()); } indice = groupStates.getData().numTuples() - 1; } else { indice = iter.next(); } for (int i = 0; i < internalAggs.size(); ++i) { internalAggs.get(i).addRow(tb, row, groupStates.getData(), indice); } } if (resultBuffer.hasFilledTB()) { return resultBuffer.popFilled(); } tb = child.nextReady(); } if (child.eos()) { addToResult(); return resultBuffer.popAny(); } return null; }

Target:
protected TupleBatch fetchNextReady() throws DbException { final Operator child = getChild(); TupleBatch tb = child.nextReady(); while (tb != null) { for (int row = 0; row < tb.numTuples(); ++row) { IntIterator iter = groupStates.getIndices(tb, gfields, row).intIterator(); int index; if (!iter.hasNext()) { generateResult(); groupStates.addTuple(tb, gfields, row, true); int offset = gfields.length; for (Aggregator agg : internalAggs) { agg.initState(groupStates.getData(), offset); offset += agg.getStateSize(); } index = groupStates.getData().numTuples() - 1; } else { index = iter.next(); } int offset = gfields.length; for (Aggregator agg : internalAggs) { agg.addRow(tb, row, groupStates.getData(), index, offset); offset += agg.getStateSize(); } } if (resultBuffer.hasFilledTB()) { return resultBuffer.popFilled(); } tb = child.nextReady(); } if (child.eos()) { generateResult(); return resultBuffer.popAny(); } return null; }
Source:
public static NodeBuilder getNode(@NotNull NodeBuilder nodeBuilder, @NotNull String path) { for (String name : PathUtils.elements(checkNotNull(path))) { nodeBuilder = nodeBuilder.getChildNode(checkNotNull(name)); } return nodeBuilder; }

Target:
public static NodeBuilder getNode(@NotNull NodeBuilder nodeBuilder, @NotNull String path) { NodeBuilder resultNodeBuilder = nodeBuilder; for (String name : PathUtils.elements(checkNotNull(path))) { resultNodeBuilder = resultNodeBuilder.getChildNode(checkNotNull(name)); } return resultNodeBuilder; }
Source:
public UserIdentity getUserIdentityByToken(String token) throws AuthException { log.debug("KeystoneService: entered getUserIdentityByToken. Token={}", token); if (StringUtils.isEmpty(token)) { throw new InvalidCredentialsException("No token was passed in."); } KeystoneAccess access; try { access = client.getToken(token); } catch (Exception ex) { log.debug("Authentication failed: "+ex.getMessage()); throw new InvalidCredentialsException("Invalid token"); } return (access == null) ? null : getUserIdentity(access); }

Target:
public UserIdentity getUserIdentityByToken(String token) throws AuthException { log.debug("KeystoneService: entered getUserIdentityByToken. Token={}", token); if (StringUtils.isEmpty(token)) { throw new InvalidCredentialsException("No token was passed in."); } KeystoneAccess access = null; try { access = client.getToken(token); } catch (KeystoneConnectionException kex) { log.debug("Authentication connection failed: "+kex.getMessage()); } catch (KeystoneServerException ex) { log.debug("Authentication failed: "+ex.getMessage()); throw new InvalidCredentialsException("Invalid token"); } return (access == null) ? null : getUserIdentity(access); }
Source:
public void send(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setAttribute(Const.ParamsNames.ERROR, "" + isError); addStatusMessagesToPageData(req); clearStatusMessageForRequest(req); resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); String jsonData = (new Gson()).toJson(data); resp.getWriter().write(jsonData); }

Target:
public void send(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.setAttribute(Const.ParamsNames.ERROR, "" + isError); addStatusMessagesToPageData(req); if (isClearingStatusMessage) { clearStatusMessageForRequest(req); } resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); String jsonData = (new Gson()).toJson(data); resp.getWriter().write(jsonData); }
Source:
private void addGeoOverlay(final RelativeLayout imageViewLayout, final Image img) { try { final File file = LocalStorage.getStorageFile(geocode, img.getUrl(), true, true); if (file == null) { return; } final Metadata metadata = ImageMetadataReader.readMetadata(file); final Collection<GpsDirectory> gpsDirectories = metadata.getDirectoriesOfType(GpsDirectory.class); if (gpsDirectories == null) { return; } for (GpsDirectory gpsDirectory : gpsDirectories) { final GeoLocation geoLocation = gpsDirectory.getGeoLocation(); if (geoLocation != null && !geoLocation.isZero()) { final ImageView geoOverlay = (ImageView) imageViewLayout.findViewById(R.id.geo_overlay); geoOverlay.setVisibility(View.VISIBLE); geoOverlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View wpNavView) { final Geopoint gpt = new Geopoint(geoLocation.getLatitude(), geoLocation.getLongitude()); wpNavView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { NavigationAppFactory.startDefaultNavigationApplication(1, activity, gpt); } }); wpNavView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(final View v) { NavigationAppFactory.startDefaultNavigationApplication(2, activity, gpt); return true; } }); } }); break; } } } catch(Exception e) { Log.e("ImagesList.addGeoOverlay", e); } }

Target:
private void addGeoOverlay(final RelativeLayout imageViewLayout, final Image img) { try { final File file = LocalStorage.getStorageFile(geocode, img.getUrl(), true, false); final Metadata metadata = ImageMetadataReader.readMetadata(file); final Collection<GpsDirectory> gpsDirectories = metadata.getDirectoriesOfType(GpsDirectory.class); if (gpsDirectories == null) { return; } for (final GpsDirectory gpsDirectory : gpsDirectories) { final GeoLocation geoLocation = gpsDirectory.getGeoLocation(); if (geoLocation != null && !geoLocation.isZero()) { final ImageView geoOverlay = (ImageView) imageViewLayout.findViewById(R.id.geo_overlay); geoOverlay.setVisibility(View.VISIBLE); geoOverlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View wpNavView) { final Geopoint gpt = new Geopoint(geoLocation.getLatitude(), geoLocation.getLongitude()); wpNavView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { NavigationAppFactory.startDefaultNavigationApplication(1, activity, gpt); } }); wpNavView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(final View v) { NavigationAppFactory.startDefaultNavigationApplication(2, activity, gpt); return true; } }); } }); break; } } } catch (final Exception e) { Log.e("ImagesList.addGeoOverlay", e); } }
Source:
public int getDeploymentDeficit(AtBContract contract) { if (!contract.isActive()) { return 0; } else if (contract.getStartDate().after(getDate())) { return 0; } else if (contract.getStartDate().equals(getDate())) { return 0; } int total = -contract.getRequiredLances(); int role = -Math.max(1, contract.getRequiredLances() / 2); for (Lance l : lances.values()) { if (l.getMissionId() == contract.getId() && l.getRole() != Lance.ROLE_UNASSIGNED) { total++; if (l.getRole() == contract.getRequiredLanceType()) { role++; } } } if (total >= 0 && role >= 0) { return 0; } return Math.abs(Math.min(total, role)); }

Target:
public int getDeploymentDeficit(AtBContract contract) { if (!contract.isActive()) { return 0; } else if (contract.getStartDate().compareTo(getDate()) >= 0) { return 0; } int total = -contract.getRequiredLances(); int role = -Math.max(1, contract.getRequiredLances() / 2); for (Lance l : lances.values()) { if (l.getMissionId() == contract.getId() && l.getRole() != Lance.ROLE_UNASSIGNED) { total++; if (l.getRole() == contract.getRequiredLanceType()) { role++; } } } if (total >= 0 && role >= 0) { return 0; } return Math.abs(Math.min(total, role)); }
Source:
public String getTitle() { return "LibraryScreen"; }

Target:
public String getTitle() { return ts.getTranslation( LibraryConstants.LibraryScreen ); }
Source:
public static BaseFilterOperator getLeafFilterOperator(PredicateEvaluator predicateEvaluator, DataSource dataSource, int numDocs) { if (predicateEvaluator.isAlwaysFalse()) { return EmptyFilterOperator.getInstance(); } else if (predicateEvaluator.isAlwaysTrue()) { return new MatchAllFilterOperator(numDocs); } Predicate.Type predicateType = predicateEvaluator.getPredicateType(); if (predicateType == Predicate.Type.RANGE) { if (dataSource.getDataSourceMetadata().isSorted() && (dataSource.getDictionary() != null)) { return new SortedIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } if (dataSource.getRangeIndex() != null) { return new RangeIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } else if (predicateType == Predicate.Type.REGEXP_LIKE) { return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } else { if (dataSource.getDataSourceMetadata().isSorted() && (dataSource.getDictionary() != null)) { return new SortedIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } if (dataSource.getInvertedIndex() != null) { return new BitmapBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } }

Target:
public static BaseFilterOperator getLeafFilterOperator(PredicateEvaluator predicateEvaluator, DataSource dataSource, int numDocs) { if (predicateEvaluator.isAlwaysFalse()) { return EmptyFilterOperator.getInstance(); } else if (predicateEvaluator.isAlwaysTrue()) { return new MatchAllFilterOperator(numDocs); } Predicate.Type predicateType = predicateEvaluator.getPredicateType(); if (predicateType == Predicate.Type.RANGE) { if (dataSource.getDataSourceMetadata().isSorted() && dataSource.getDictionary() != null) { return new SortedIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } if (dataSource.getRangeIndex() != null) { return new RangeIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } else if (predicateType == Predicate.Type.REGEXP_LIKE) { return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } else { if (dataSource.getDataSourceMetadata().isSorted() && dataSource.getDictionary() != null) { return new SortedIndexBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } if (dataSource.getInvertedIndex() != null) { return new BitmapBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } return new ScanBasedFilterOperator(predicateEvaluator, dataSource, numDocs); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); mWebView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = mWebView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); AirMapType mapType = AirMapType.fromBundle(getArguments()); mWebView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); mWebView.addJavascriptInterface(new MapsJavaScriptInterface(), "Android"); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); mWebView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = mWebView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); AirMapType mapType = AirMapType.fromBundle(getArguments()); mWebView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); mWebView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }
Source:
TextLayout getTextLayout(int lineIndex) { if (lineSpacingProvider == null) { return getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), styledText.lineSpacing); } int newLineSpacing = styledText.lineSpacing; Integer spacing = lineSpacingProvider.getLineSpacing(lineIndex); if (spacing != null && spacing.intValue() >= 0) { newLineSpacing = spacing; } if (isSameLineSpacing(lineIndex, newLineSpacing)) { return getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), newLineSpacing); } TextLayout layout = getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), styledText.lineSpacing); if (layout.getSpacing() != newLineSpacing) { layout.setSpacing(newLineSpacing); reset(lineIndex, 0); if (lineSpacingComputing) { return layout; } int lastLineIndex = styledText.getPartialBottomIndex() + 1; if (lineIndex >= styledText.topIndex && lineIndex <= lastLineIndex) { try { lineSpacingComputing = true; styledText.resetCache(lineIndex, 1); styledText.setVariableLineHeight(); styledText.setCaretLocation(); styledText.redraw(); } finally { lineSpacingComputing = false; } } } return layout; }

Target:
TextLayout getTextLayout(int lineIndex) { if (lineSpacingProvider == null) { return getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), styledText.lineSpacing); } int newLineSpacing = styledText.lineSpacing; Integer spacing = lineSpacingProvider.getLineSpacing(lineIndex); if (spacing != null && spacing.intValue() >= 0) { newLineSpacing = spacing; } if (isSameLineSpacing(lineIndex, newLineSpacing)) { return getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), newLineSpacing); } TextLayout layout = getTextLayout(lineIndex, styledText.getOrientation(), styledText.getWrapWidth(), newLineSpacing); if (layout.getSpacing() != newLineSpacing) { layout.setSpacing(newLineSpacing); lineSpacingChanged.add(lineIndex); } return layout; }
Source:
protected DocumentModel createCollection(final String newTitle, final String newDescription, final DocumentModel context, final CoreSession session) { DocumentModel defaultCollections = getUserDefaultCollections(session); PathSegmentService pss = Framework.getService(PathSegmentService.class); String pssTitle = pss.generatePathSegment(newTitle); Map<String, Object> options = new HashMap<>(); options.put(CoreEventConstants.PARENT_PATH, defaultCollections.getPath().toString()); options.put(CoreEventConstants.DESTINATION_NAME, pssTitle); DocumentModel newCollection = session.createDocumentModel(CollectionConstants.COLLECTION_TYPE, options); newCollection.setPathInfo(defaultCollections.getPath().toString(), pssTitle); newCollection.setPropertyValue("dc:title", newTitle); newCollection.setPropertyValue("dc:description", newDescription); return session.createDocument(newCollection); }

Target:
protected DocumentModel createCollection(final String newTitle, final String newDescription, final DocumentModel context, final CoreSession session) { DocumentModel defaultCollections = getUserDefaultCollections(session); PathSegmentService pss = Framework.getService(PathSegmentService.class); Map<String, Object> options = new HashMap<>(); options.put(CoreEventConstants.PARENT_PATH, defaultCollections.getPath().toString()); options.put(CoreEventConstants.DESTINATION_NAME, pss.generatePathSegment(newTitle)); DocumentModel newCollection = session.createDocumentModel(CollectionConstants.COLLECTION_TYPE, options); newCollection.setPropertyValue("dc:title", newTitle); newCollection.setPropertyValue("dc:description", newDescription); return session.createDocument(newCollection); }
Source:
private List<JobTaskMoveAssignment> pruneTaskReassignments(Iterable<JobTaskMoveAssignment> candidateAssignments) { List<JobTaskMoveAssignment> rv = new ArrayList<>(); Map<String, Boolean> snapshot = new HashMap<>(recentlyBalancedHosts.asMap()); for (JobTaskMoveAssignment assignment : candidateAssignments) { String newHostID = assignment.getTargetUUID(); if(assignment.delete()) { rv.add(assignment); } if (newHostID == null) { continue; } JobKey jobKey = assignment.getJobKey(); String jobID = (jobKey == null) ? null : jobKey.getJobUuid(); if (isExtremeHost(newHostID, true, true)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it is already heavily loaded", jobID, newHostID); continue; } HostState newHost = hostManager.getHostState(newHostID); if ((newHost == null) || newHost.hasLive(jobKey) || !canReceiveNewTasks(newHost)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it cannot receive the new task", jobID, newHostID); continue; } if (snapshot.containsKey(newHostID)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it already received a different task recently", jobID, newHostID); continue; } rv.add(assignment); recentlyBalancedHosts.put(newHostID, true); } return rv; }

Target:
private List<JobTaskMoveAssignment> pruneTaskReassignments(Iterable<JobTaskMoveAssignment> candidateAssignments) { List<JobTaskMoveAssignment> rv = new ArrayList<>(); Map<String, Boolean> snapshot = new HashMap<>(recentlyBalancedHosts.asMap()); for (JobTaskMoveAssignment assignment : candidateAssignments) { String newHostID = assignment.getTargetUUID(); if(assignment.delete()) { rv.add(assignment); } else { if (newHostID == null) { continue; } JobKey jobKey = assignment.getJobKey(); String jobID = (jobKey == null) ? null : jobKey.getJobUuid(); if (isExtremeHost(newHostID, true, true)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it is already heavily loaded", jobID, newHostID); continue; } HostState newHost = hostManager.getHostState(newHostID); if ((newHost == null) || newHost.hasLive(jobKey) || !canReceiveNewTasks(newHost)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it cannot receive the new task", jobID, newHostID); continue; } if (snapshot.containsKey(newHostID)) { log.warn("[spawn.balancer] decided not to move task from job to host " + "because it already received a different task recently", jobID, newHostID); continue; } rv.add(assignment); recentlyBalancedHosts.put(newHostID, true); } } return rv; }
Source:
public List<TranscriptConsequence> findCanonicalTranscriptCandidates( List<TranscriptConsequence> transcriptConsequences ) { List<TranscriptConsequence> transcripts = new ArrayList<>(); for (TranscriptConsequence transcript : transcriptConsequences) { if (transcript.getTranscriptId() != null && transcript.getCanonical() != null && transcript.getCanonical().equals("1")) { transcripts.add(transcript); } } return transcripts; }

Target:
private List<TranscriptConsequence> findCanonicalTranscriptCandidates( List<TranscriptConsequence> transcriptConsequences ) { List<TranscriptConsequence> transcripts = new ArrayList<>(); for (TranscriptConsequence transcript : transcriptConsequences) { if (transcript.getTranscriptId() != null && transcript.getCanonical() != null && transcript.getCanonical().equals("1")) { transcripts.add(transcript); } } return transcripts; }
Source:
protected Boolean doInBackground(Void... params) { try { populateHtml(inputFile, values); return true; } catch (IOException e) { errorType = IO_ERROR; return false; } catch (RuntimeException e) { errorType = VALIDATION_ERROR; return false; } }

Target:
protected PrintTaskResult doInBackground(Void... params) { try { populateAndSaveHtml(templateFile, templatePopulationMapping, populatedFilepath); return PrintTaskResult.SUCCESS; } catch (IOException e) { return PrintTaskResult.IO_ERROR; } catch (PrintValidationException e) { problemString = e.getMessage(); return e.getErrorType(); } }
Source:
public Response resolve(Action action) { validateParameters(action, "resolutionType"); ResolutionType resolutionType = validateEnum(ResolutionType.class, action.getResolutionType().toUpperCase()); switch (resolutionType) { case ADD: return addToMissingServers(action); case COPY: return copy(action); default: return null; } }

Target:
public Response resolve(Action action) { validateParameters(action, "resolutionType"); ResolutionType resolutionType = EnumValidator.validateEnum(ResolutionType.class, action.getResolutionType(),true); switch (resolutionType) { case ADD: return addToMissingServers(action); case COPY: return copy(action); default: return null; } }
Source:
private void connectionChanged(Connection connection, ConnectionState state) { if (state == ConnectionState.CONNECTING) { roster = connection.getRoster(); if (roster == null) { log.fatal("A new connection without a roster should not happen!"); return; } roster.addRosterListener(rosterListener); discoveryService.connectionChanged(connection); contacts.clear(); } else if (state == ConnectionState.CONNECTED) { contacts.init(roster); notifyListeners(null, UpdateType.CONNECTED); } else { if (roster != null) roster.removeRosterListener(rosterListener); roster = null; discoveryService.connectionChanged(null); contacts.getAll().forEach(XMPPContact::removeResources); notifyListeners(null, UpdateType.NOT_CONNECTED); } }

Target:
private void connectionChanged(Connection connection, ConnectionState state) { if (state == ConnectionState.CONNECTING) { roster = connection.getRoster(); if (roster == null) { log.fatal("A new connection without a roster should not happen!"); return; } roster.addRosterListener(rosterListener); discoveryService.connectionChanged(connection); contacts.clear(); } else if (state == ConnectionState.CONNECTED) { contacts.init(roster); notifyListeners(null, UpdateType.CONNECTED); } else if (state == ConnectionState.DISCONNECTING || state == ConnectionState.ERROR) { if (roster != null) roster.removeRosterListener(rosterListener); roster = null; discoveryService.connectionChanged(null); contacts.getAll().forEach(XMPPContact::removeResources); notifyListeners(null, UpdateType.NOT_CONNECTED); } }
Source:
public ForkJoinStrategy createForkJoinStrategy(ProcessingStrategy processingStrategy, int maxConcurrency, boolean delayErrors, long timeout, Scheduler timeoutScheduler, ErrorType timeoutErrorType) { reactor.core.scheduler.Scheduler reactorTimeoutScheduler = Schedulers.fromExecutorService(timeoutScheduler); return (original, routingPairs) -> { final AtomicInteger count = new AtomicInteger(); final CoreEvent.Builder resultBuilder = builder(original); return from(routingPairs) .map(addSequence(count)) .flatMapSequential(processRoutePair(processingStrategy, maxConcurrency, delayErrors, timeout, reactorTimeoutScheduler, timeoutErrorType), maxConcurrency) .collectList() .doOnNext(list -> { if (list.stream().anyMatch(event -> event.getError().isPresent() && !isOriginalError(event.getError().get(), original.getError()))) { throw propagate(createCompositeRoutingException(list.stream() .map(event -> removeOriginalError(event, original.getError())).collect(toList()))); } }) .doOnNext(mergeVariables(original, resultBuilder)) .map(createResultEvent(original, resultBuilder)); }; }

Target:
public ForkJoinStrategy createForkJoinStrategy(ProcessingStrategy processingStrategy, int maxConcurrency, boolean delayErrors, long timeout, Scheduler timeoutScheduler, ErrorType timeoutErrorType) { reactor.core.scheduler.Scheduler reactorTimeoutScheduler = Schedulers.fromExecutorService(timeoutScheduler); return (original, routingPairs) -> { final AtomicInteger count = new AtomicInteger(); final CoreEvent.Builder resultBuilder = builder(original); return from(routingPairs) .map(addSequence(count)) .flatMapSequential(processRoutePair(processingStrategy, maxConcurrency, delayErrors, timeout, reactorTimeoutScheduler, timeoutErrorType), maxConcurrency) .reduce(new Pair<List<CoreEvent>, Boolean>(new ArrayList<>(), false), (pair, event) -> { pair.getFirst().add(event); boolean hasNewError = event.getError().map(err -> !isOriginalError(err, original.getError())).orElse(false); return new Pair(pair.getFirst(), pair.getSecond() || hasNewError); }) .doOnNext(p -> { Pair<List<CoreEvent>, Boolean> pair = (Pair<List<CoreEvent>, Boolean>) p; if (pair.getSecond()) { throw propagate(createCompositeRoutingException(pair.getFirst().stream() .map(event -> removeOriginalError(event, original.getError())).collect(toList()))); } }) .map(pair -> ((Pair<List<CoreEvent>, Boolean>) pair).getFirst()) .doOnNext(mergeVariables(original, resultBuilder)) .map(createResultEvent(original, resultBuilder)); }; }
Source:
@Override public Response intercept(Chain chain) throws IOException { Request originalRequest = chain.request(); Request.Builder builder = originalRequest.newBuilder(); final String token = loginPrefs.getAuthorizationHeader(); if (token != null) { builder.addHeader("Authorization", token); } else { logger.warn("Token cannot be null when AUTH_JSON is also null, something is WRONG!"); } return chain.proceed(builder.build()); }

Target:
public Response intercept(Chain chain) throws IOException { final Request.Builder builder = chain.request().newBuilder(); final String token = loginPrefs.getAuthorizationHeader(); if (token != null) { builder.addHeader("Authorization", token); } return chain.proceed(builder.build()); }
Source:
public void withPoller() { assertTrue(this.withPoller instanceof PollingConsumer); }

Target:
public void withPoller() { assertThat(this.withPoller1, Matchers.instanceOf(PollingConsumer.class)); }
Source:
String generateDeclarations( List<SourceFile> sourceFiles, List<SourceFile> externs, Depgraph depgraph) throws AssertionError { compiler.initOptions(opts.getCompilerOptions()); for (SourceFile sf : sourceFiles) { Node ast = compiler.parse(sf); String moduleId = getGoogModuleId(ast); if (moduleId != null) { importRenameMap.putAll(getImportRenameMap(moduleId, ast)); } } compiler.compile(externs, sourceFiles, opts.getCompilerOptions()); unknownType = compiler.getTypeRegistry().getNativeType(JSTypeNative.UNKNOWN_TYPE); numberType = compiler.getTypeRegistry().getNativeType(JSTypeNative.NUMBER_TYPE); iterableType = compiler.getTypeRegistry().getType("Iterable"); iteratorIterableType = compiler.getTypeRegistry().getType("IteratorIterable"); String dts = ""; if (compiler.getTopScope() != null) { precomputeChildLists(); collectTypedefs(); dts = produceDts(depgraph); } errorManager.doGenerateReport(); return dts; }

Target:
String generateDeclarations( List<SourceFile> sourceFiles, List<SourceFile> externs, Depgraph depgraph) throws AssertionError { compiler.compile(externs, sourceFiles, opts.getCompilerOptions()); if (opts.partialInput) { importRenameMap = ImportRenameMapBuilder.build(compiler.getParsedInputs()); } unknownType = compiler.getTypeRegistry().getNativeType(JSTypeNative.UNKNOWN_TYPE); numberType = compiler.getTypeRegistry().getNativeType(JSTypeNative.NUMBER_TYPE); iterableType = compiler.getTypeRegistry().getType("Iterable"); iteratorIterableType = compiler.getTypeRegistry().getType("IteratorIterable"); String dts = ""; if (compiler.getTopScope() != null) { precomputeChildLists(); collectTypedefs(); dts = produceDts(depgraph); } errorManager.doGenerateReport(); return dts; }
Source:
public void visitCfg() { if (cfgStartNode instanceof ControlFlowBlock) { ProgramState initialState = ProgramState.emptyState(); for (Symbol localVar : trackedVariables) { if ("arguments".equals(localVar.name())) { initialState = initialState.copyAndAddValue(localVar, SymbolicValue.UNKNOWN); } } for (Symbol functionParameter : functionParameters) { initialState = initialState.copyAndAddValue(functionParameter, SymbolicValue.UNKNOWN); } workList.addLast(new BlockExecution((ControlFlowBlock) cfgStartNode, initialState)); } for (int i = 0; i < 10000 && !workList.isEmpty(); i++) { BlockExecution blockExecution = workList.removeFirst(); Tree branchingTree = blockExecution.block.branchingTree(); if (branchingTree != null && branchingTree.is(Kind.TRY_STATEMENT)) { return; } execute(blockExecution); } if (workList.isEmpty()) { reportIssues(); } }

Target:
public void visitCfg() { workList.addLast(new BlockExecution(cfgStartBlock, initialState())); for (int i = 0; i < MAX_BLOCK_EXECUTIONS && !workList.isEmpty(); i++) { BlockExecution blockExecution = workList.removeFirst(); if (!alreadyProcessed.contains(blockExecution)) { if (hasTryBranchingTree(blockExecution.block())) { return; } execute(blockExecution); alreadyProcessed.add(blockExecution); } } if (workList.isEmpty()) { reportIssues(); } }
Source:
public CompletableFuture<HRegionLocation> getRegionLocation(byte[] row, boolean reload){ try { this.regionsFuture = getRegionsAsync(reload); } catch (IOException e) { e.getCause(); } Futures.addCallback(this.regionsFuture, new FutureCallback<List<HRegionLocation>>() { @Override public void onSuccess(@Nullable List<HRegionLocation> result) { for(HRegionLocation region : result) { if (region.getRegion().containsRow(row)) { hRegionLocation = region; } } } @Override public void onFailure(Throwable t) { synchronized (BigtableAsyncTableRegionLocator.this) { regionsFuture = null; } } }); if(hRegionLocation == null) { LOG.info("Region not found for row: ", Bytes.toStringBinary(row)); } return CompletableFuture.completedFuture(hRegionLocation); }

Target:
public CompletableFuture<HRegionLocation> getRegionLocation(byte[] row, boolean reload) { return FutureUtils.toCompletableFuture(getRegionsAsync(reload)) .thenApplyAsync(result -> { for (HRegionLocation region : result) { if (region.getRegion().containsRow(row)) { hRegionLocation = region; break; } } return hRegionLocation; }); }
Source:
public SyntaxToken MEMBER_MODIFIER() { return b.<SyntaxToken>nonterminal().is( b.firstOf( b.token(PHPKeyword.PUBLIC), b.token(PHPKeyword.PROTECTED), b.token(PHPKeyword.PRIVATE), b.token(PHPKeyword.STATIC), b.token(PHPKeyword.ABSTRACT), b.token(PHPKeyword.FINAL) )); }

Target:
public SyntaxToken MEMBER_MODIFIER() { return b.<SyntaxToken>nonterminal(PHPLexicalGrammar.MEMBER_MODIFIER).is( b.firstOf( b.token(PHPKeyword.PUBLIC), b.token(PHPKeyword.PROTECTED), b.token(PHPKeyword.PRIVATE), b.token(PHPKeyword.STATIC), b.token(PHPKeyword.ABSTRACT), b.token(PHPKeyword.FINAL))); }
Source:
private static Collection<Geocache> importCachesFromGPXResponse(final HttpResponse response) { if (response == null) { return Collections.emptyList(); } Collection<Geocache> caches; try { caches = new ECGPXParser(StoredList.TEMPORARY_LIST_ID).parse(response.getEntity().getContent(), null); } catch (Exception e) { Log.e("Error importing gpx from extremcaching.com", e); return Collections.emptyList(); } return caches; }

Target:
private static Collection<Geocache> importCachesFromGPXResponse(final HttpResponse response) { if (response == null) { return Collections.emptyList(); } try { return new GPX10Parser(StoredList.TEMPORARY_LIST_ID).parse(response.getEntity().getContent(), null); } catch (Exception e) { Log.e("Error importing gpx from extremcaching.com", e); return Collections.emptyList(); } }
Source:
public static Map<String, Object> getTypesMapFromAppMap(Map<String, Object> appMap) { Map<String, Object> typesMap; try { if (log.isDebugEnabled()) { log.debug("Opening TOSCA for obtaining types"); } typesMap = (Map<String, Object>) appMap.get(TOSCAkeywords.NODE_TYPES); } catch (NullPointerException E) { log.error("It was not found '" + TOSCAkeywords.NODE_TYPES + "' . Cannot be unveiled the types of modules"); return null; } return typesMap; }

Target:
public static Map<String, Object> getTypesMapFromAppMap(Map<String, Object> appMap) { Map<String, Object> typesMap; try { log.debug("Opening TOSCA for obtaining types"); typesMap = (Map<String, Object>) appMap.get(TOSCAkeywords.NODE_TYPES); } catch (NullPointerException E) { log.error("It was not found '" + TOSCAkeywords.NODE_TYPES + "' . Cannot be unveiled the types of modules"); return null; } return typesMap; }
Source:
public App(AppConfig appConfig) { this.appConfig = appConfig; ExecutorService collectionThreadPool = appConfig.getThreadPoolSize() >= 1 ? Executors.newFixedThreadPool(appConfig.getThreadPoolSize()) : Executors.newCachedThreadPool(); collectionProcessor = new TaskProcessor(collectionThreadPool, appConfig.getReporter(), LOGGER); ExecutorService recoveryThreadPool = appConfig.getReconnectionThreadPoolSize() >= 1 ? Executors.newFixedThreadPool(appConfig.getReconnectionThreadPoolSize()) : Executors.newCachedThreadPool(); recoveryProcessor = new TaskProcessor(recoveryThreadPool, appConfig.getReporter(), LOGGER); if (appConfig.remoteEnabled()) { client = new HttpClient(appConfig.getIPCHost(), appConfig.getIPCPort(), false); } this.configs = getConfigs(appConfig); }

Target:
public App(AppConfig appConfig) { this.appConfig = appConfig; ExecutorService collectionThreadPool = appConfig.getThreadPoolSize() >= 1 ? Executors.newFixedThreadPool(appConfig.getThreadPoolSize()) : Executors.newCachedThreadPool(); collectionProcessor = new TaskProcessor(collectionThreadPool, appConfig.getReporter()); ExecutorService recoveryThreadPool = appConfig.getReconnectionThreadPoolSize() >= 1 ? Executors.newFixedThreadPool(appConfig.getReconnectionThreadPoolSize()) : Executors.newCachedThreadPool(); recoveryProcessor = new TaskProcessor(recoveryThreadPool, appConfig.getReporter()); if (appConfig.remoteEnabled()) { client = new HttpClient(appConfig.getIpcHost(), appConfig.getIpcPort(), false); } this.configs = getConfigs(appConfig); }