auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateList(List<Encounter> visitEncounters) { List<Encounter> displayableEnounters = new ArrayList<>(); for (Encounter encounter : visitEncounters) { String[] displayableEncounterTypes = ApplicationConstants.EncounterTypes.ENCOUNTER_TYPES_DISPLAYS; String encounterTypeDisplay = encounter.getEncounterType().getDisplay(); if (Arrays.asList(displayableEncounterTypes).contains(encounterTypeDisplay)) { displayableEnounters.add(encounter); } } mExpandableListAdapter = new VisitExpandableListAdapter(this.getActivity(), displayableEnounters); mExpandableListView.setAdapter(mExpandableListAdapter); mExpandableListView.setGroupIndicator(null); }

Target:
public void updateList(List<Encounter> visitEncounters) { final String[] displayableEncounterTypes = ApplicationConstants.EncounterTypes.ENCOUNTER_TYPES_DISPLAYS; final HashSet<String> displayableEncounterTypesArray = new HashSet<>(Arrays.asList(displayableEncounterTypes)); List<Encounter> displayableEncounters = new ArrayList<>(); for (Encounter encounter : visitEncounters) { String encounterTypeDisplay = encounter.getEncounterType().getDisplay(); if (displayableEncounterTypesArray.contains(encounterTypeDisplay)) { displayableEncounters.add(encounter); } } mExpandableListAdapter = new VisitExpandableListAdapter(this.getActivity(), displayableEncounters); mExpandableListView.setAdapter(mExpandableListAdapter); mExpandableListView.setGroupIndicator(null); }
Source:
public <M1 extends Model<IS, IA>> StackedDatasetTrainer<IS, IA, O, AM, L> addTrainer( DatasetTrainer<M1, L> trainer) { submodelsTrainers.add(new DatasetTrainer<Model<IS, IA>, L>() { @Override public <K, V> Model<IS, IA> fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return trainer.fit(datasetBuilder, featureExtractor, lbExtractor); } @Override protected boolean checkState(Model<IS, IA> mdl) { return true; } @Override protected <K, V> Model<IS, IA> updateModel(Model<IS, IA> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return null; } @Override public <K, V> Model<IS, IA> update(Model<IS, IA> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { DatasetTrainer<Model<IS, IA>, L> trainer1 = (DatasetTrainer<Model<IS, IA>, L>)trainer; return trainer1.update(mdl, datasetBuilder, featureExtractor, lbExtractor); } }); return this; }

Target:
public <M1 extends Model<IS, IA>> StackedDatasetTrainer<IS, IA, O, AM, L> addTrainer( DatasetTrainer<M1, L> trainer) { submodelsTrainers.add(new DatasetTrainer<Model<IS, IA>, L>() { @Override public <K, V> Model<IS, IA> fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return trainer.fit(datasetBuilder, featureExtractor, lbExtractor); } @Override public <K, V> Model<IS, IA> update(Model<IS, IA> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { DatasetTrainer<Model<IS, IA>, L> trainer1 = (DatasetTrainer<Model<IS, IA>, L>)trainer; return trainer1.update(mdl, datasetBuilder, featureExtractor, lbExtractor); } @Override protected boolean checkState(Model<IS, IA> mdl) { return true; } @Override protected <K, V> Model<IS, IA> updateModel(Model<IS, IA> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { return null; } }); return this; }
Source:
private void updateIdentifierDetails(OzoneTokenIdentifier identifier) { int sequenceNum; long now = Time.now(); sequenceNum = incrementDelegationTokenSeqNum(); identifier.setIssueDate(now); identifier.setMasterKeyId(getCurrentKey().getKeyId()); identifier.setSequenceNumber(sequenceNum); identifier.setMaxDate(Time.now() + getTokenMaxLifetime()); identifier.setOmCertSerialId(getOmCertificateSerialId()); }

Target:
private void updateIdentifierDetails(OzoneTokenIdentifier identifier) { int sequenceNum; long now = Time.now(); sequenceNum = incrementDelegationTokenSeqNum(); identifier.setIssueDate(now); identifier.setMasterKeyId(getCurrentKey().getKeyId()); identifier.setSequenceNumber(sequenceNum); identifier.setMaxDate(now + getTokenMaxLifetime()); identifier.setOmCertSerialId(getOmCertificateSerialId()); }
Source:
private void applyEntrypoint(Entrypoint entrypoint, List<HasMetadata> list) { ContainerSearch search = new ContainerSearch( entrypoint.getDeployment(), entrypoint.getPod(), entrypoint.getContainer(), entrypoint.getPodSelector(), entrypoint.getDeploymentSelector()); List<Container> cs = search.search(list); List<String> command = entrypoint.getCommand(); List<String> args = entrypoint.getArgs(); for (Container c : cs) { c.setCommand(command); c.setArgs(args); } }

Target:
private void applyEntrypoint(Entrypoint entrypoint, List<HasMetadata> list) { ContainerSearch search = new ContainerSearch( entrypoint.getParentName(), entrypoint.getParentSelector(), entrypoint.getContainerName()); List<Container> cs = search.search(list); List<String> command = entrypoint.getCommand(); List<String> args = entrypoint.getArgs(); for (Container c : cs) { c.setCommand(command); c.setArgs(args); } }
Source:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { fab_layout.setOrientation(LinearLayout.HORIZONTAL); rvContributionsList.setLayoutManager(gridLayoutManager); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { fab_layout.setOrientation(LinearLayout.VERTICAL); rvContributionsList.setLayoutManager(linearLayoutManager); } }

Target:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { fab_layout.setOrientation(LinearLayout.HORIZONTAL); rvContributionsList.setLayoutManager(new GridLayoutManager(getContext(),SPAN_COUNT)); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { fab_layout.setOrientation(LinearLayout.VERTICAL); rvContributionsList.setLayoutManager(new LinearLayoutManager(getContext())); } }
Source:
private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<GetBlobResult>(opChain, false) { @Override public void onCompletion(GetBlobResult result, Exception exception) { continueChain(opChain); } }; BlobId originalId, fraudId; try { originalId = new BlobId(opChain.blobId, clusterMap); fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (originalId.getAccountId() + 1), (short) (originalId.getContainerId() + 1)); } catch (IOException e) { FutureResult<Void> future = new FutureResult<>(); future.done(null, e); callback.onCompletion(null, e); TestFuture<Void> testFuture = new TestFuture<Void>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { throw e; } }; opChain.testFutures.add(testFuture); return; } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }

Target:
private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<>(opChain, true); BlobId originalId, fraudId; try { originalId = new BlobId(opChain.blobId, clusterMap); fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (originalId.getAccountId() + 1), (short) (originalId.getContainerId() + 1)); } catch (IOException e) { FutureResult<Void> future = new FutureResult<>(); future.done(null, e); callback.onCompletion(null, e); TestFuture<Void> testFuture = new TestFuture<Void>(future, genLabel("getBlobAuthorizationFail", true), opChain) { @Override void check() throws Exception { throw e; } }; opChain.testFutures.add(testFuture); return; } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlobAuthorizationFail", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRemoveSessionCommand())) { } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { stopGeoRepSession(); } else if(command.equals(getPauseSessionCommand())) { pauseGeoRepSession(); } else if(command.equals(getResumeSessionCommand())) { resumeGeoRepSession(); } else if(command.equals(getSessionOptionsCommand())) { } else if(command.equals(getViewSessionDetailsCommand())) { } else if (command.equals(getRefreshSessionsCommand())) { refreshSessions(); } else if (command.getName().equalsIgnoreCase("onStartGeoRepSession")) { onGeoRepSessionAction(VdcActionType.StartGlusterVolumeGeoRep, constants.startVerb()); } else if (command.getName().equalsIgnoreCase("onStopGeoRepSession")) { onGeoRepSessionAction(VdcActionType.StopGeoRepSession, constants.stopVerb()); } else if (command.getName().equalsIgnoreCase("onPauseGeoRepSession")) { onGeoRepSessionAction(VdcActionType.PauseGlusterVolumeGeoRepSession, constants.pauseVerb()); } else if (command.getName().equalsIgnoreCase("onResumeGeoRepSession")) { onGeoRepSessionAction(VdcActionType.ResumeGeoRepSession, constants.resumeVerb()); } else if (command.getName().equalsIgnoreCase("closeWindow")) { closeWindow(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRemoveSessionCommand())) { } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { stopGeoRepSession(); } else if(command.equals(getPauseSessionCommand())) { pauseGeoRepSession(); } else if(command.equals(getResumeSessionCommand())) { resumeGeoRepSession(); } else if(command.equals(getSessionOptionsCommand())) { } else if(command.equals(getViewSessionDetailsCommand())) { } else if (command.equals(getRefreshSessionsCommand())) { refreshSessions(); } else if (command.getName().equalsIgnoreCase("onStartGeoRepSession")) { onGeoRepSessionAction(VdcActionType.StartGlusterVolumeGeoRep); } else if (command.getName().equalsIgnoreCase("onStopGeoRepSession")) { onGeoRepSessionAction(VdcActionType.StopGeoRepSession); } else if (command.getName().equalsIgnoreCase("onPauseGeoRepSession")) { onGeoRepSessionAction(VdcActionType.PauseGlusterVolumeGeoRepSession); } else if (command.getName().equalsIgnoreCase("onResumeGeoRepSession")) { onGeoRepSessionAction(VdcActionType.ResumeGeoRepSession); } else if (command.getName().equalsIgnoreCase("closeWindow")) { closeWindow(); } }
Source:
public Map<String, String> readExecutionEnvironmentContainerIdMapping() { Map<String, String> executionEnvironmentContainerIdMapping = new HashMap<>(); metadataStore.all().forEach((processorId, valueBytes) -> { if (valueBytes != null) { String executionEnvContainerId = valueSerde.fromBytes(valueBytes); executionEnvironmentContainerIdMapping.put(processorId, executionEnvContainerId); } }); if (LOG.isDebugEnabled()) { for (Map.Entry<String, String> entry : executionEnvironmentContainerIdMapping.entrySet()) { LOG.debug("Execution evironment container id for container {}: {}", entry.getKey(), entry.getValue()); } } return executionEnvironmentContainerIdMapping; }

Target:
public Map<String, String> readExecutionEnvironmentContainerIdMapping() { Map<String, String> executionEnvironmentContainerIdMapping = new HashMap<>(); metadataStore.all().forEach((processorId, valueBytes) -> { if (valueBytes != null) { String executionEnvContainerId = valueSerde.fromBytes(valueBytes); executionEnvironmentContainerIdMapping.put(processorId, executionEnvContainerId); } }); if (LOG.isDebugEnabled()) { for (Map.Entry<String, String> entry : executionEnvironmentContainerIdMapping.entrySet()) { LOG.debug("Processor has executionEnvContainerId as {}", entry.getKey(), entry.getValue()); } } return executionEnvironmentContainerIdMapping; }
Source:
protected ResponseEntity<String> getAnnotationById(String identifier, String profileStr, String language) throws HttpException { try { AnnotationId annoId = new BaseAnnotationId(getConfiguration().getAnnotationBaseUrl(), identifier); Annotation annotation = getAnnotationService().getAnnotationById(annoId, null); SearchProfiles searchProfile = SearchProfiles.getByStr(profileStr); getAnnotationService().dereferenceSemanticTags(annotation, searchProfile, language); JsonLd annotationLd = new AnnotationLdSerializer(annotation); String jsonLd = annotationLd.toString(4); String eTag; if (annotation.getLastUpdate() != null) eTag = generateETag(annotation.getLastUpdate()); else eTag = generateETag(annotation.getGenerated()); MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>(5); headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT); headers.add(HttpHeaders.ETAG, eTag); headers.add(HttpHeaders.LINK, HttpHeaders.VALUE_LDP_RESOURCE); headers.add(HttpHeaders.ALLOW, AnnotationHttpHeaders.ALLOW_GPuDOH); ResponseEntity<String> response = new ResponseEntity<String>(jsonLd, headers, HttpStatus.OK); return response; } catch (RuntimeException e) { throw new InternalServerException(e); } catch (HttpException e) { throw e; } catch (Exception e) { throw new InternalServerException(e); } }

Target:
protected ResponseEntity<String> getAnnotationById(String identifier, String profileStr, String language) throws HttpException { try { AnnotationId annoId = new BaseAnnotationId(getConfiguration().getAnnotationBaseUrl(), identifier); Annotation annotation = getAnnotationService().getAnnotationById(annoId, null); SearchProfiles searchProfile = SearchProfiles.getByStr(profileStr); getAnnotationService().dereferenceSemanticTags(annotation, searchProfile, language); JsonLd annotationLd = new AnnotationLdSerializer(annotation); String jsonLd = annotationLd.toString(4); String apiVersion = getConfiguration().getAnnotationApiVersion(); String eTag = generateETag(annotation.getGenerated(), WebAnnotationFields.FORMAT_JSONLD, apiVersion); MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>(5); headers.add(HttpHeaders.VARY, HttpHeaders.ACCEPT); headers.add(HttpHeaders.ETAG, eTag); headers.add(HttpHeaders.LINK, HttpHeaders.VALUE_LDP_RESOURCE); headers.add(HttpHeaders.ALLOW, AnnotationHttpHeaders.ALLOW_GPuDOH); ResponseEntity<String> response = new ResponseEntity<String>(jsonLd, headers, HttpStatus.OK); return response; } catch (RuntimeException e) { throw new InternalServerException(e); } catch (HttpException e) { throw e; } catch (Exception e) { throw new InternalServerException(e); } }
Source:
public void paste() { List<BibEntry> entriesToAdd = Globals.clipboardManager.extractData(); if (!entriesToAdd.isEmpty()) { database.getDatabase().insertEntries(entriesToAdd); undoManager.addEdit(new UndoableInsertEntries(database.getDatabase(), entriesToAdd, true)); for (BibEntry entryToAdd : entriesToAdd) { UpdateField.setAutomaticFields(entryToAdd, Globals.prefs.getUpdateFieldPreferences()); } BibEntry firstNewEntry = entriesToAdd.get(0); if (Globals.prefs.getBoolean(JabRefPreferences.AUTO_OPEN_FORM)) { panel.showAndEdit(firstNewEntry); } clearAndSelect(firstNewEntry); this.requestFocus(); } }

Target:
public void paste() { List<BibEntry> entriesToAdd = Globals.clipboardManager.extractData(); panel.insertEntries(entriesToAdd); if (!entriesToAdd.isEmpty()) { this.requestFocus(); } }
Source:
public Map<String, Ref> getRefs(String prefix) throws IOException { final RefList<Ref> packed = getPackedRefs(); final RefList<LooseRef> oldLoose = looseRefs.get(); LooseScanner scan = new LooseScanner(oldLoose); scan.scan(prefix); RefList<LooseRef> loose; if (scan.newLoose != null) { loose = scan.newLoose.toRefList(); if (looseRefs.compareAndSet(oldLoose, loose)) modCnt.incrementAndGet(); } else loose = oldLoose; fireRefsChanged(); RefList.Builder<Ref> symbolic = scan.symbolic; for (int idx = 0; idx < symbolic.size();) { Ref ref = symbolic.get(idx); ref = resolve(ref, 0, prefix, loose, packed); if (ref != null && ref.getObjectId() != null) { symbolic.set(idx, ref); idx++; } else { symbolic.remove(idx); final int toRemove = loose.find(ref.getName()); if (0 <= toRemove) loose = loose.remove(toRemove); } } return new RefMap(prefix, packed, upcast(loose), symbolic.toRefList()); }

Target:
public Map<String, Ref> getRefs(String prefix) throws IOException { final RefList<Ref> packed = getPackedRefs(); final RefList<LooseRef> oldLoose = looseRefs.get(); LooseScanner scan = new LooseScanner(oldLoose); scan.scan(prefix); RefList<LooseRef> loose; if (scan.newLoose != null) { loose = scan.newLoose.toRefList(); if (looseRefs.compareAndSet(oldLoose, loose)) modCnt.incrementAndGet(); } else loose = oldLoose; fireRefsChanged(); RefList.Builder<Ref> symbolic = scan.symbolic; for (int idx = 0; idx < symbolic.size();) { final Ref symbolicRef = symbolic.get(idx); final Ref resolvedRef = resolve(symbolicRef, 0, prefix, loose, packed); if (resolvedRef != null && resolvedRef.getObjectId() != null) { symbolic.set(idx, resolvedRef); idx++; } else { symbolic.remove(idx); final int toRemove = loose.find(symbolicRef.getName()); if (0 <= toRemove) loose = loose.remove(toRemove); } } return new RefMap(prefix, packed, upcast(loose), symbolic.toRefList()); }
Source:
private static Method[] populateSetters(Class<?> cls, String propertyName) { String setterName = ""; if (propertyName != null && propertyName.length() > 0){ setterName = new StringBuilder("set").append(propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH)) .append(propertyName.substring(1)).toString(); } List<Method> resultList = null; for (Method method : cls.getMethods()) { if (method.getName().equals(setterName)) { Class<?>[] clazzes = method.getParameterTypes(); if (clazzes.length != 1) continue; if (resultList == null) resultList = new ArrayList<Method>(); resultList.add(method); } } Method[] result = EMPTY_METHOD_ARRAY; if (resultList != null && !resultList.isEmpty()) result = resultList.toArray(new Method[resultList.size()]); Map<String, Method[]> classMap = SETTERS_METHODS_CACHE.computeIfAbsent(cls, k -> new ConcurrentHashMap<>()); classMap.put(propertyName, result); return result; }

Target:
private static Method[] populateSetters(Class<?> cls, String propertyName) { String setterName = ""; if (propertyName != null && propertyName.length() > 0){ setterName = new StringBuilder("set").append(propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH)) .append(propertyName.substring(1)).toString(); } List<Method> resultList = null; for (Method method : cls.getMethods()) { if (method.getName().equals(setterName)) { Class<?>[] clazzes = method.getParameterTypes(); if (clazzes.length != 1) continue; if (resultList == null) resultList = new ArrayList<Method>(); resultList.add(method); } } Method[] result = EMPTY_METHOD_ARRAY; if (resultList != null && !resultList.isEmpty()) result = resultList.toArray(new Method[resultList.size()]); SETTERS_METHODS_CACHE.computeIfAbsent(cls, k -> new ConcurrentHashMap<>()).put(propertyName, result); return result; }
Source:
private Callable<Void> createDiscoveryJob( MemberId member, DiscoveryServiceFactory disoveryServiceFactory, Set<MemberId> expectedTargetSet ) throws ExecutionException, InterruptedException { Neo4jJobScheduler jobScheduler = new Neo4jJobScheduler(); jobScheduler.init(); ResolutionResolver resolutionResolver = new NoOpResolutionResolver(); CoreTopologyService topologyService = disoveryServiceFactory .coreTopologyService( config(), null, member, jobScheduler, logProvider, userLogProvider, resolutionResolver ); return sharedClientStarter( topologyService, expectedTargetSet ); }

Target:
private Callable<Void> createDiscoveryJob( MemberId member, DiscoveryServiceFactory disoveryServiceFactory, Set<MemberId> expectedTargetSet ) throws ExecutionException, InterruptedException { Neo4jJobScheduler jobScheduler = new Neo4jJobScheduler(); jobScheduler.init(); HostnameResolver hostnameResolver = new NoOpHostnameResolver(); CoreTopologyService topologyService = disoveryServiceFactory .coreTopologyService( config(), null, member, jobScheduler, logProvider, userLogProvider, hostnameResolver ); return sharedClientStarter( topologyService, expectedTargetSet ); }
Source:
private static Map<String, Object> response(Object id, Object value) { Map<String, Object> response = new HashMap<>(); response.put("jsonrpc", VERSION); response.put("id", id); if (value instanceof Error) { response.put("error", value); } else { response.put("result", value); } return response; }

Target:
private static Map<String, Object> response(Object id, Object value) { Map<String, Object> response = new HashMap<>(); response.put(JSONRPC, VERSION); response.put("id", id); if (value instanceof Error) { response.put("error", value); } else { response.put("result", value); } return response; }
Source:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); this.controller = (ClinicalStatusController)this.mocker.getComponentUnderTest(); this.logger = this.mocker.getMockedLogger(); this.documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class); DocumentReference patientDocument = new DocumentReference("wiki", "patient", "00000001"); doReturn(patientDocument).when(this.patient).getDocument(); doReturn(this.doc).when(this.documentAccessBridge).getDocument(patientDocument); doReturn(this.data).when(this.doc).getXObject(Patient.CLASS_REFERENCE); }

Target:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); this.documentAccessBridge = this.mocker.getInstance(DocumentAccessBridge.class); DocumentReference patientDocument = new DocumentReference("wiki", "patient", "00000001"); doReturn(patientDocument).when(this.patient).getDocument(); doReturn(this.doc).when(this.documentAccessBridge).getDocument(patientDocument); doReturn(this.data).when(this.doc).getXObject(Patient.CLASS_REFERENCE); }
Source:
public void init(Scene scene) { SimpleDoubleProperty p = Settings.getInstance().getDoubleProperty("SCREEN_HEIGHT"); p.addListener((o, old, newVal) -> { scrollPane.setPrefHeight(newVal.intValue() - 240); }); table.prefHeightProperty().bind(scrollPane.heightProperty().subtract(10)); scrollPane.setPrefHeight(p.intValue() - 240); }

Target:
public void init(Scene scene) { scrollPane.prefHeightProperty().bind(Settings.getInstance().getDoubleProperty("SCREEN_HEIGHT").subtract(240)); table.prefHeightProperty().bind(scrollPane.heightProperty().subtract(10)); }
Source:
public void preInit(FMLPreInitializationEvent event) { instance = this; configPath = event.getModConfigurationDirectory() + "/RTG/"; Mods.syncAllConfigs(); this.registerStructures(); Logger.info("[FMLPreInitializationEvent] Creating RTG's EventManager"); eventMgr = new EventManagerRTG(); worldtype = new WorldTypeRTG("RTG"); }

Target:
public void preInit(FMLPreInitializationEvent event) { instance = this; configPath = event.getModConfigurationDirectory() + "/RTG/"; Mods.syncAllConfigs(); this.registerStructures(); Logger.info("[FMLPreInitializationEvent] Creating RTG's EventManager"); eventMgr = new EventManagerRTG(); worldtype = new WorldTypeRTG(ModInfo.MOD_ID); }
Source:
private void updateUser(UserDto user, User userEntity, UserDto originalUser) { if (user.getCreationTime().isPresent() && !user.isChanged(originalUser)) { Require.that(yonaProperties.isTestServer(), () -> InvalidDataException.onlyAllowedOnTestServers("Cannot set user creation time")); LocalDateTime creationTime = user.getCreationTime().get(); userEntity.setCreationTime(creationTime); userEntity.getBuddies().forEach(b -> b.setLastStatusChangeTime(creationTime)); } else { user.updateUser(userEntity); } }

Target:
private void updateUser(UserDto user, User userEntity, UserDto originalUser) { if (user.getCreationTime().isPresent() && !containsPropertyUpdate(originalUser, user)) { Require.that(yonaProperties.isTestServer(), () -> InvalidDataException.onlyAllowedOnTestServers("Cannot set user creation time")); LocalDateTime creationTime = user.getCreationTime().get(); userEntity.setCreationTime(creationTime); userEntity.getBuddies().forEach(b -> b.setLastStatusChangeTime(creationTime)); } else { Require.isNotPresent(user.getCreationTime(), () -> InvalidDataException.extraProperty("creationTime", "Creation time cannot be changed")); user.updateUser(userEntity); } }
Source:
private Object getEnvelopePartitionId(OutgoingMessageEnvelope envelope) { return envelope.getPartitionKey(); }

Target:
protected Object getEnvelopePartitionId(OutgoingMessageEnvelope envelope) { return envelope.getPartitionKey(); }
Source:
private String loginOnBehalf(DbUser dbUser) { if (dbUser == null) { throw new RuntimeException("User not found in database"); } Collection<ExtMap> principalRecords = AuthzUtils.findPrincipalsByIds( getAuthz(dbUser.getDomain()), dbUser.getNamespace(), Arrays.asList(dbUser.getExternalId()), true, true); if (principalRecords.isEmpty()) { throw new RuntimeException(String.format("Unable to find principal for user %s in domain '%s'", dbUser.getLoginName(), dbUser.getDomain())); } return attachUserToSession(dbUser.getDomain(), principalRecords.iterator().next()); }

Target:
private ExtMap loginOnBehalf(DbUser dbUser) { Collection<ExtMap> principalRecords = AuthzUtils.findPrincipalsByIds( EngineExtensionsManager.getInstance().getExtensionByName(dbUser.getDomain()), dbUser.getNamespace(), Arrays.asList(dbUser.getExternalId()), true, true); if (principalRecords.isEmpty()) { throw new RuntimeException(String.format("Unable to find principal for user %s in domain '%s'", dbUser.getLoginName(), dbUser.getDomain())); } return principalRecords.iterator().next(); }
Source:
private int getServicePort(Service service) { return version.matches(BEFORE_0_11) ? service.port : PORT; }

Target:
private int getServicePort(Service service) { return legacyMode ? service.port : PORT; }
Source:
public Builder from(int ... nums) { this.matchers.add((from, to, msg) -> Arrays.binarySearch(nums, from) >= 0); return this; }

Target:
public Builder from(int... nums) { from = nums; return this; }
Source:
private void iterateLocs(File localStorageFolder1, File localStorageFolder2, File localStorageFolder3, StorageLocationSelectorStrategy roundRobinStrategy) { Iterator<StorageLocation> locations; locations = roundRobinStrategy.getLocations(); StorageLocation loc1 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_1", localStorageFolder1, loc1.getPath()); StorageLocation loc2 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_1", localStorageFolder2, loc2.getPath()); StorageLocation loc3 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_1", localStorageFolder3, loc3.getPath()); }

Target:
private void iterateLocs(File localStorageFolder1, File localStorageFolder2, File localStorageFolder3, StorageLocationSelectorStrategy roundRobinStrategy) { Iterator<StorageLocation> locations = roundRobinStrategy.getLocations(); StorageLocation loc1 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_1", localStorageFolder1, loc1.getPath()); StorageLocation loc2 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_2", localStorageFolder2, loc2.getPath()); StorageLocation loc3 = locations.next(); Assert.assertEquals("The next element of the iterator should point to path local_storage_folder_3", localStorageFolder3, loc3.getPath()); }
Source:
void whenCreateLedger_thenSuccess() throws Exception { LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.MAC, ledgerPassword); assertNotNull(lh); assertNotNull(lh.getId()); log.info("[I33] Ledge created: id=" + lh.getId()); }

Target:
void whenCreateLedger_thenSuccess() throws Exception { LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.MAC, ledgerPassword); assertNotNull(lh); assertNotNull(lh.getId()); LOG.info("[I33] Ledge created: id=" + lh.getId()); }
Source:
public void testTranscriberWithNullProvider() { VaultTranscriber transcriber = new DefaultVaultTranscriber(null); try { transcriber.getRawSecret("${vault.id}"); Assert.fail(); } catch(IllegalStateException expected) { Assert.assertEquals("Required VaultProvider not found - check vault configuration", expected.getMessage()); } try (VaultRawSecret secret = transcriber.getRawSecret("non_vault_secret")) { Optional<ByteBuffer> optional = secret.getRawSecret(); Assert.assertTrue(optional.isPresent()); ByteBuffer secretBuffer = optional.get(); Assert.assertTrue(Arrays.equals("non_vault_secret".getBytes(StandardCharsets.UTF_8), secretBuffer.array())); } }

Target:
public void testTranscriberWithNullProvider() throws Exception { VaultTranscriber transcriber = new DefaultVaultTranscriber(null); for (String key : validExpressions.keySet()) { try (VaultRawSecret secret = transcriber.getRawSecret(key)) { Assert.assertFalse(secret.get().isPresent()); Assert.assertFalse(secret.getAsArray().isPresent()); } } for (String value : invalidExpressions) { try (VaultStringSecret secret = transcriber.getStringSecret(value)) { Optional<String> optional = secret.get(); Assert.assertTrue(optional.isPresent()); String secretString = optional.get(); Assert.assertEquals(value, secretString); } } }
Source:
public void getOutputFileToWrite_shouldNeverOverwritePreviousFiles() throws IOException { String content1 = "A"; String content2 = "B"; AbstractHandler handler = new AbstractHandler(); File previousFile = null; File currentFile = null; mockStatic(Context.class); when(Context.getAdministrationService()).thenReturn(administrationService); when(administrationService.getGlobalProperty(any())).thenReturn(complexObsTestFolder.newFolder().getAbsolutePath()); for (int i = 0; i <= 101; i++) { String currentData; String previousData; if (i % 2 == 0) { currentData = content1; previousData = content2; } else { currentData = content2; previousData = content1; } ComplexData complexData = new ComplexData(FILENAME, currentData); Obs obs = new Obs(); obs.setComplexData(complexData); currentFile = handler.getOutputFileToWrite(obs); try (BufferedWriter fout = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(currentFile), StandardCharsets.UTF_8))) { fout.write(currentData); } try (BufferedReader fin = new BufferedReader( new InputStreamReader(new FileInputStream(currentFile), StandardCharsets.UTF_8))) { String readData = fin.readLine(); assertEquals(readData, currentData); } if (i > 0) { try (BufferedReader fin = new BufferedReader( new InputStreamReader(new FileInputStream(previousFile), StandardCharsets.UTF_8))) { String readData = fin.readLine(); assertEquals(readData, previousData); } } previousFile = currentFile; } }

Target:
public void getOutputFileToWrite_shouldNeverOverwritePreviousFiles() throws IOException { String content1 = "A"; String content2 = "B"; File previousFile = null; File currentFile = null; for (int i = 0; i <= 101; i++) { String currentData = (i % 2 == 0) ? content1 : content2; ComplexData complexData = new ComplexData(FILENAME, currentData); Obs obs = new Obs(); obs.setComplexData(complexData); currentFile = handler.getOutputFileToWrite(obs); try (BufferedWriter fout = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(currentFile), StandardCharsets.UTF_8))) { fout.write(currentData); } try (BufferedReader fin = new BufferedReader( new InputStreamReader(new FileInputStream(currentFile), StandardCharsets.UTF_8))) { String readData = fin.readLine(); assertEquals(readData, currentData); } if (i > 0) { assertFalse(FileUtils.contentEquals(previousFile, currentFile)); } previousFile = currentFile; } }
Source:
public List<AccountInfo> apply(TopLevelResource rsrc) throws OrmException, BadRequestException { if (Strings.isNullOrEmpty(query)) { throw new BadRequestException("missing query field"); } if (!suggest || query.length() < suggestFrom) { return Collections.emptyList(); } String a = query; String b = a + MAX_SUFFIX; Map<Account.Id, AccountInfo> matches = new LinkedHashMap<>(); Map<Account.Id, String> queryEmail = new HashMap<>(); for (Account p : db.accounts().suggestByFullName(a, b, limit)) { addSuggestion(matches, p.getId()); } if (matches.size() < limit) { for (Account p : db.accounts() .suggestByPreferredEmail(a, b, limit - matches.size())) { addSuggestion(matches, p.getId()); } } if (matches.size() < limit) { for (AccountExternalId e : db.accountExternalIds() .suggestByEmailAddress(a, b, limit - matches.size())) { queryEmail.put(e.getAccountId(), e.getEmailAddress()); addSuggestion(matches, e.getAccountId()); } } accountLoader.fill(); for (Map.Entry<Account.Id, String> p : queryEmail.entrySet()) { AccountInfo info = matches.get(p.getKey()); if (info != null) { info.email = p.getValue(); } } return new ArrayList<>(matches.values()); }

Target:
public List<AccountInfo> apply(TopLevelResource rsrc) throws OrmException, BadRequestException { if (Strings.isNullOrEmpty(query)) { throw new BadRequestException("missing query field"); } if (!suggest || query.length() < suggestFrom) { return Collections.emptyList(); } String a = query; String b = a + MAX_SUFFIX; Map<Account.Id, AccountInfo> matches = new LinkedHashMap<>(); Map<Account.Id, String> queryEmail = new HashMap<>(); for (Account p : db.accounts().suggestByFullName(a, b, limit)) { addSuggestion(matches, p.getId()); } if (matches.size() < limit) { for (Account p : db.accounts() .suggestByPreferredEmail(a, b, limit - matches.size())) { addSuggestion(matches, p.getId()); } } if (matches.size() < limit) { for (AccountExternalId e : db.accountExternalIds() .suggestByEmailAddress(a, b, limit - matches.size())) { if (addSuggestion(matches, e.getAccountId())) { queryEmail.put(e.getAccountId(), e.getEmailAddress()); } } } accountLoader.fill(); for (Map.Entry<Account.Id, String> p : queryEmail.entrySet()) { AccountInfo info = matches.get(p.getKey()); if (info != null) { info.email = p.getValue(); } } List<AccountInfo> m = new ArrayList<>(matches.values()); Collections.sort(m, new Comparator<AccountInfo>() { @Override public int compare(AccountInfo a, AccountInfo b) { return ComparisonChain.start() .compare(a.name, b.name, Ordering.natural().nullsLast()) .compare(a.email, b.email, Ordering.natural().nullsLast()) .result(); } }); return m; }
Source:
HttpSolrServer getAnatomyCore() { return new HttpSolrServer("http://localhost:8090/solr" + "/anatomy"); }

Target:
HttpSolrServer getAnatomyCore() { return new HttpSolrServer(solrBaseUrl + "/anatomy"); }
Source:
public Object doReceive() { Assert.isTrue(this.initialized, "This class is not yet initialized. Invoke its afterPropertiesSet() method"); Assert.notNull(this.queryExpression, "'queryExpression' must not be null"); Object value = this.queryExpression.getValue(this.evaluationContext); Object result; if (value instanceof Query) { result = executeQuery(((Query) value)); } else if (value instanceof String) { result = executeQuery((String) value); } else { throw new IllegalStateException("'queryExpression' must evaluate to String " + "or org.springframework.data.relational.core.query.Query, but not: " + value); } return getMessageBuilderFactory() .withPayload(result); }

Target:
protected Object doReceive() { Assert.isTrue(this.initialized, "This class is not yet initialized. Invoke its afterPropertiesSet() method"); Mono<?> queryMono = Mono.fromSupplier(() -> this.queryExpression.getValue(this.evaluationContext)); if (this.expectSingleResult) { return queryMono.flatMap(this::selectOne); } return queryMono.flatMapMany(this::select); }
Source:
public Optional<PassengerData> from(DataHolder dataHolder) { if (dataHolder instanceof EntityLivingBase) { final SpongePassengerData passengerData = new SpongePassengerData(); final Entity vehicle = (Entity) ((EntityLivingBase) dataHolder).ridingEntity; final Entity baseVehicle = (Entity) ((EntityLivingBase) dataHolder).ridingEntity; return Optional.<PassengerData>of(passengerData.setVehicle(vehicle).setBaseVehicle(baseVehicle)); } else { return Optional.absent(); } }

Target:
public Optional<PassengerData> from(DataHolder dataHolder) { if (supports(dataHolder)) { final SpongePassengerData passengerData = new SpongePassengerData(); final Entity vehicle = (Entity) ((net.minecraft.entity.Entity) dataHolder).ridingEntity; net.minecraft.entity.Entity currentEntity = (net.minecraft.entity.Entity) vehicle; while (currentEntity != null && currentEntity.isRiding()) { currentEntity = currentEntity.ridingEntity; } final Entity baseVehicle = (Entity) currentEntity; return Optional.<PassengerData>of(passengerData.setVehicle(vehicle).setBaseVehicle(baseVehicle)); } else { return Optional.absent(); } }
Source:
private boolean isEmulator() { String fingerprint = Build.FINGERPRINT; if (fingerprint == null) { return false; } return fingerprint.startsWith("unknown") || fingerprint.contains("generic") || fingerprint.contains("vbox"); }

Target:
private boolean isEmulator() { String fingerprint = buildInfo.getFingerprint(); return fingerprint.startsWith("unknown") || fingerprint.contains("generic") || fingerprint.contains("vbox"); }
Source:
protected Application getApplicationOr404(Map<String, Application> registry, String application) { if (!registry.containsKey(application)) throw new WebApplicationException(Response.Status.NOT_FOUND); Application current = registry.get(application); if (current.getStatus() != Application.Status.RUNNING) throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE); return current; }

Target:
protected Application getApplicationOr404(Map<String, Application> registry, String application) { if (!registry.containsKey(application)) throw notFound("Application '%s' not found.", application); return registry.get(application); }
Source:
public void testMultiMapPutAllAsyncMap() throws InterruptedException { Map<String, Collection<? extends Integer>> expectedMultiMap1 = new HashMap<>(); expectedMultiMap1.put("A", new ArrayList<Integer>(Arrays.asList(1, 1, 1, 1, 2))); expectedMultiMap1.put("B", new ArrayList<Integer>(Arrays.asList(6, 6, 6, 9))); expectedMultiMap1.put("C", new ArrayList<Integer>(Arrays.asList(10, 10, 10, 10, 10, 15))); testMultiMapPutAllTemplate(testMultiMapPutAllSetup(), expectedMultiMap1, (o) -> { o.putAllAsync(expectedMultiMap1); } ); }

Target:
public void testMultiMapPutAllAsyncMap() throws InterruptedException { Map<String, Collection<? extends Integer>> expectedMultiMap = new HashMap<>(); expectedMultiMap.put("A", new ArrayList<>(Arrays.asList(1, 1, 1, 1, 2))); expectedMultiMap.put("B", new ArrayList<>(Arrays.asList(6, 6, 6, 9))); expectedMultiMap.put("C", new ArrayList<>(Arrays.asList(10, 10, 10, 10, 10, 15))); testMultiMapPutAllTemplate(testMultiMapPutAllSetup(), expectedMultiMap, (o) -> { o.putAllAsync(expectedMultiMap); } ); }
Source:
public boolean isSupported() { boolean supported = false; if (!daos.isEmpty()) { for (I18NDAO<?> dao : daos.values()) { if (dao.isSupported()) { supported = dao.isSupported(); } } } return supported; }

Target:
public boolean isSupported() { if (!daos.isEmpty()) { for (I18NDAO<?> dao : daos.values()) { if (dao.isSupported()) { return true; } } } return false; }
Source:
public static int getCdDeviceIndex(String cdInterface) { if ("scsi".equals(cdInterface)) { return 0; } else if ("ide".equals(cdInterface)) { return 2; } else if ("sata".equals(cdInterface)) { return 0; } return -1; }

Target:
public static int getCdDeviceIndex(String cdInterface) { switch (cdInterface) { case "scsi": return 0; case "ide": return 2; case "sata": return 0; default: return -1; } }
Source:
private void addMessage(Message message) { StringBuilder line = new StringBuilder(127); line.append(message.getMessage()); String subMessage = message.getSubMessage(); if (subMessage != null) { line.append(": "); line.append(subMessage); } messages.add(line.toString()); long offset = message.getOffset(); if (offset > -1) { messages.add("Offset: " + offset); } }

Target:
private void addMessage(Message message) { StringBuilder line = new StringBuilder(127); line.append(message.getMessage()); String subMessage = message.getSubMessage(); if (Objects.nonNull(subMessage)) { line.append(": "); line.append(subMessage); } messages.add(line.toString()); long offset = message.getOffset(); if (offset > -1) { messages.add("Offset: " + offset); } }
Source:
private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); MetricRegistry metrics = SharedMetricRegistries.getOrCreate(_namespace); Counter requestsTotal = metrics.counter(CUSTOM_INSTANCE_CHECK_HTTP_REQUESTS_TOTAL); Counter errorRequestsTotal = metrics.counter(CUSTOM_INSTANCE_CHECK_HTTP_REQUESTS_ERROR_TOTAL); try (final Timer.Context timer = metrics.timer(CUSTOM_INSTANCE_CHECK_HTTP_REQUEST_DURATION) .time()) { requestsTotal.inc(); Map<String, Boolean> instanceStoppableCheck = _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads); return new StoppableCheck(instanceStoppableCheck, StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException ex) { LOG.error("Custom client side instance level health check for {}/{} failed.", clusterId, instanceName, ex); errorRequestsTotal.inc(); return new StoppableCheck(false, Collections.singletonList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } }

Target:
private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); MetricRegistry metrics = SharedMetricRegistries.getOrCreate(_namespace); try (final Timer.Context timer = metrics.timer(CUSTOM_INSTANCE_CHECK_HTTP_REQUESTS_DURATION) .time()) { Map<String, Boolean> instanceStoppableCheck = _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads); return new StoppableCheck(instanceStoppableCheck, StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException ex) { LOG.error("Custom client side instance level health check for {}/{} failed.", clusterId, instanceName, ex); metrics.counter(CUSTOM_INSTANCE_CHECK_HTTP_REQUESTS_ERROR_TOTAL).inc(); return new StoppableCheck(false, Collections.singletonList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } }
Source:
public Request authenticate(Route route, final Response response) throws IOException { logger.warn(response.toString()); if (!response.peekBody(200).string().contains("token_expired")) { return null; } PrefManager pref = new PrefManager(context, PrefManager.Pref.LOGIN); refreshAccessToken(pref); return response.request().newBuilder() .header("Authorization", "Bearer " + pref.getCurrentAuth().access_token) .build(); }

Target:
public Request authenticate(Route route, final Response response) throws IOException { logger.warn(response.toString()); if (!isTokenExpired(response.peekBody(200).string())) { return null; } PrefManager pref = new PrefManager(context, PrefManager.Pref.LOGIN); refreshAccessToken(pref); return response.request().newBuilder() .header("Authorization", pref.getCurrentAuth().token_type + " " + pref.getCurrentAuth().access_token) .build(); }
Source:
public void testDontOverwriteSessionTokenForCurrentUser() throws Exception { ParseUser.State sessionTokenState = new ParseUser.State.Builder() .sessionToken("sessionToken") .build(); ParseUser.State emptyState = new ParseUser.State.Builder().build(); ParseUser user = ParseObject.from(sessionTokenState); user.setIsCurrentUser(true); Assert.assertEquals(user.getSessionToken(), "sessionToken"); user.setState(emptyState); Assert.assertEquals(user.getSessionToken(), "sessionToken"); user.setIsCurrentUser(false); user.setState(emptyState); Assert.assertNull(user.getSessionToken()); }

Target:
public void testDontOverwriteSessionTokenForCurrentUser() throws Exception { ParseUser.State sessionTokenState = new ParseUser.State.Builder() .sessionToken("sessionToken") .put("key0", "value0") .put("key1", "value1") .isComplete(true) .build(); ParseUser.State newState = new ParseUser.State.Builder() .put("key0", "newValue0") .put("key2", "value2") .isComplete(true) .build(); ParseUser.State emptyState = new ParseUser.State.Builder().isComplete(true).build(); ParseUser user = ParseObject.from(sessionTokenState); user.setIsCurrentUser(true); assertEquals(user.getSessionToken(), "sessionToken"); assertEquals(user.getString("key0"), "value0"); assertEquals(user.getString("key1"), "value1"); user.setState(newState); assertEquals(user.getSessionToken(), "sessionToken"); assertEquals(user.getString("key0"), "newValue0"); assertNull(user.getString("key1")); assertEquals(user.getString("key2"), "value2"); user.setIsCurrentUser(false); user.setState(emptyState); assertNull(user.getSessionToken()); assertNull(user.getString("key0")); assertNull(user.getString("key1")); assertNull(user.getString("key2")); }
Source:
protected TestMemorySmoke() { super(MemoryQueryRunner::createQueryRunner); }

Target:
public TestMemorySmoke() { super(MemoryQueryRunner::createQueryRunner); }
Source:
public List<TreeNode> getTreeNodesForParentKey(String searchParentKey) { String wikiName = getWikiName(searchParentKey); LOGGER.trace("getNotMappedMenuItemsFromDatabase: for cacheKey [{}].", wikiName); if (!menuItems.containsKey(wikiName)) { loadMenuForWiki(wikiName); } if (menuItems.containsKey(wikiName) && (menuItems.get(wikiName) != null) && (menuItems.get(wikiName).get(searchParentKey) != null)){ return menuItems.get(wikiName).get(searchParentKey); } return Collections.emptyList(); }

Target:
public List<TreeNode> getTreeNodesForParentKey(String searchParentKey) { String wikiName = getWikiName(searchParentKey); LOGGER.trace("getNotMappedMenuItemsFromDatabase: for cacheKey [{}].", wikiName); Map<String, List<TreeNode>> wikiMenu = internalGetMenuItemsForWiki(wikiName); if (wikiMenu == null) { wikiMenu = loadMenuForWiki(wikiName); } if (wikiMenu.containsKey(searchParentKey)) { return wikiMenu.get(searchParentKey); } return Collections.emptyList(); }
Source:
public boolean decide(final Attributes attributes) { Serializable value = attributes.getOrDefault(attribute, 0); if (!(value instanceof Number)) { throw new RuntimeException("Expecting a number as the value of "+attribute+" but got "+value +" of type "+value.getClass().getSimpleName()); } final double valueAsDouble = ((Number) value).doubleValue(); return valueAsDouble > threshold; }

Target:
public boolean decide(final Attributes attributes) { Serializable value = attributes.get(attribute); if (value == null) value = 0; if (!(value instanceof Number)) { throw new RuntimeException("Expecting a number as the value of "+attribute+" but got "+value +" of type "+value.getClass().getSimpleName()); } final double valueAsDouble = ((Number) value).doubleValue(); return valueAsDouble > threshold; }