auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void configureChannels() { Thing thing = callback.getThing(); Channel humidityChannel = thing.getChannel(CHANNEL_HUMIDITY); if (humidityChannel != null) { Configuration channelConfiguration = humidityChannel.getConfiguration(); if (channelConfiguration.get(CONFIG_HUMIDITY) != null) { HUMIDITY_PARAMETER.replace(THING_TYPE_OWSERVER, channelConfiguration.get(CONFIG_HUMIDITY)); } else { HUMIDITY_PARAMETER.replace(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/humidity")); } } Channel temperatureChannel = thing.getChannel(CHANNEL_TEMPERATURE); if (temperatureChannel != null) { Configuration channelConfiguration = temperatureChannel.getConfiguration(); <START> if (channelConfiguration.get(CONFIG_OFFSET) != null) { <END> temperatureOffset = new QuantityType<Temperature>((String) channelConfiguration.get(CONFIG_OFFSET)); } else { temperatureOffset = new QuantityType<Temperature>("0 K"); } } isConfigured = true; }</code><technical_language>offset handling</technical_language>

Target:
public void configureChannels() { Thing thing = callback.getThing(); Channel humidityChannel = thing.getChannel(CHANNEL_HUMIDITY); if (humidityChannel != null) { Configuration channelConfiguration = humidityChannel.getConfiguration(); if (channelConfiguration.get(CONFIG_HUMIDITY) != null) { HUMIDITY_PARAMETER.set(THING_TYPE_OWSERVER, channelConfiguration.get(CONFIG_HUMIDITY)); } else { HUMIDITY_PARAMETER.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/humidity")); } } isConfigured = true; }
Source:
<code>private AdminMonitors getAdminMonitors(Map<String, AdministrativeMonitor> activated) { AdminMonitors monitors = new AdminMonitors(); for (AdministrativeMonitor monitor : activated.values()) { if (monitor instanceof OldDataMonitor) { AdminMonitors.OldDataMonitor olddm = new AdminMonitors.OldDataMonitor(); OldDataMonitor odm = (OldDataMonitor) monitor; for (Map.Entry<Saveable,OldDataMonitor.VersionRange> entry : odm.getData().entrySet()) { AdminMonitors.OldDataMonitor.OldData data = new AdminMonitors.OldDataMonitor.OldData(); data.setProblematicObject(entry.getKey().toString()); OldDataMonitor.VersionRange value = entry.getValue(); data.setRange(value.toString()); <START> data.setExtra(value.extra); <END> } olddm.setActive(true); monitors.addMonitor(olddm); } else { AdminMonitors.AdminMonitor mon = new AdminMonitors.AdminMonitor(); mon.setId(monitor.id); mon.setActive(true); monitors.addMonitor(mon); } } return monitors; }</code><technical_language>Missing StringUtils.isBlank call original. I suppose YAMLFactory care of possibility of a multiline stack trace</technical_language>

Target:
private AdminMonitors getAdminMonitors(Map<String, AdministrativeMonitor> activated) { AdminMonitors monitors = new AdminMonitors(); for (AdministrativeMonitor monitor : activated.values()) { if (monitor instanceof OldDataMonitor) { AdminMonitors.OldDataMonitor olddm = new AdminMonitors.OldDataMonitor(); OldDataMonitor odm = (OldDataMonitor) monitor; for (Map.Entry<Saveable,OldDataMonitor.VersionRange> entry : odm.getData().entrySet()) { AdminMonitors.OldDataMonitor.OldData data = new AdminMonitors.OldDataMonitor.OldData(); data.setProblematicObject(entry.getKey().toString()); OldDataMonitor.VersionRange value = entry.getValue(); data.setRange(value.toString()); data.setExtra(StringUtils.isNotBlank(value.extra) ? value.extra : ""); olddm.addOldData(data); } olddm.setActive(true); monitors.addMonitor(olddm); } else { AdminMonitors.AdminMonitor mon = new AdminMonitors.AdminMonitor(); mon.setId(monitor.id); mon.setActive(true); monitors.addMonitor(mon); } } return monitors; }
Source:
<code>protected Warning createWarning(final Matcher matcher) { <START> String category = matcher.group(1).trim(); <END> String message = matcher.group(3).trim(); Priority priority = Priority.NORMAL; if (category.equals("FATAL")) priority = Priority.HIGH; return createWarning("Nil", 0, category, message, priority); }</code><technical_language>safer StringUtils if group is null</technical_language>

Target:
protected Warning createWarning(final Matcher matcher) { String category = StringUtils.trim(matcher.group(1)); String message = StringUtils.trim(matcher.group(3)); Priority priority = Priority.NORMAL; if (category == null | message == null) { return FALSE_POSITIVE; } if ("FATAL".equals(category)) { priority = Priority.HIGH; } return createWarning("Nil", 0, category, message, priority); }
Source:
<code>private List<DirectoryUser> searchDirectoryUsers() { String searchPattern = getParameters().getSearchPattern(); int atIndex = searchPattern.lastIndexOf("@"); int eqIndex = searchPattern.indexOf("="); if (atIndex > eqIndex) { searchPattern = searchPattern.substring(0, atIndex); } <START> getParameters().setSearchPattern(searchPattern); <END> QueryData data = initQueryData(true); if (data == null) { return Collections.emptyList(); } ExtensionProxy authz = AuthenticationProfileRepository.getInstance().getProfile(data.getDomain()).getAuthz(); List<DirectoryUser> results = new ArrayList<>(); for (String namespace : authz.getContext().<List<String>> get(Authz.ContextKeys.AVAILABLE_NAMESPACES)) { results.addAll(AuthzUtils.findPrincipalsByQuery(authz, namespace, data.getQuery())); } return results; }</code><technical_language>again, I do understand profile is transmitted</technical_language>

Target:
private List<DirectoryUser> searchDirectoryUsers() { QueryData data = initQueryData(true); if (data == null) { return Collections.emptyList(); } ExtensionProxy authz = AuthenticationProfileRepository.getInstance().getProfile(data.getDomain()).getAuthz(); List<DirectoryUser> results = new ArrayList<>(); for (String namespace : authz.getContext().<List<String>> get(Authz.ContextKeys.AVAILABLE_NAMESPACES)) { results.addAll(AuthzUtils.findPrincipalsByQuery(authz, namespace, data.getQuery())); } return results; }
Source:
<code>private static InstallerData parse() { Properties properties = readProperties(); if (properties == null) { return null; } return new InstallerData(getIfExists(properties, "jdk.dir"), getIfExists(properties, "androidsdk.repo"), <START> new File(properties.getProperty("androidsdk.dir"))); <END> }</code><technical_language>is this proprerty (androidsdk.dir) guaranteed set? File passed null a constructor parameter. I guess getIfExists() instead</technical_language>

Target:
private static InstallerData parse() { Properties properties = readProperties(); if (properties == null) { return null; } String androidSdkPath = properties.getProperty("androidsdk.dir"); File androidDest = StringUtil.isEmptyOrSpaces(androidSdkPath) ? null : new File(androidSdkPath); return new InstallerData(getIfExists(properties, "jdk.dir"), getIfExists(properties, "androidsdk.repo"), androidDest); }
Source:
<code>public void doNonBlindForcesBatch() { Assert.assertTrue(batcher.isEmpty()); List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); <START> ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null, new OnFinishedHandler() { <END> @Override public void onFinished() { } })); for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } Assert.assertEquals(4, ((ArrayList<CommandAndHandler>) list).size()); try { Assert.assertEquals(((ArrayList<CommandAndHandler>) list).subList(0, 3), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } try { Assert.assertEquals(Collections.singletonList(((ArrayList<CommandAndHandler>) list).get(3)), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }</code><technical_language>Do require typecasting</technical_language>

Target:
public void doNonBlindForcesBatch() { Assert.assertTrue(batcher.isEmpty()); List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null, new OnFinishedHandler() { @Override public void onFinished() { } })); for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } Assert.assertEquals(4, ((ArrayList<CommandAndHandler>) list).size()); try { Assert.assertEquals(list.subList(0, 3), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } try { Assert.assertEquals(Collections.singletonList(list.get(3)), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
Source:
<code>private List<PrintLayer> getLayers(ActionParameters params) throws ActionException { String mapLayers = params.getRequiredParam(PARM_MAPLAYERS); User user = params.getUser(); LayerProperties[] requestedLayers = parseLayersProperties(mapLayers); List<PrintLayer> printLayers = new ArrayList<>(); int zIndex = 0; for (LayerProperties requestedLayer : requestedLayers) { try { printLayers.add(getPrintLayer(zIndex++, requestedLayer, user)); } catch (ActionException ex) { LOG.debug("Failed to add print layer:", requestedLayer.id); } } printLayers.removeIf(layer -> layer.getOpacity() <= 0); <START> if (params.getRequest().getMethod().equals("POST")) { <END> JSONObject payload = params.getPayLoadJSON(); JSONObject customStyles = payload.optJSONObject(PARM_CUSTOM_STYLES); if (customStyles != null) { printLayers.forEach(l -> { String id = l.getLayerId(); if (customStyles.has(id)) { l.setCustomStyle(JSONHelper.getJSONObject(customStyles, id)); } }); } } return printLayers; }</code><technical_language>add a method accepts param payload returns value? merge this decide frontend. /** * Returns custom styles param payload null if present. */ private JSONObject getCustomStyles(ActionParameters params) { JSONObject customStyles = params.getHttpParamAsJSON(PARM_CUSTOM_STYLES); if (customStyles != null) { return customStyles; } if ("POST".equals(params.getRequest().getMethod())) { try { JSONObject payload = params.getPayLoadJSON(); return payload.optJSONObject(PARM_CUSTOM_STYLES); } catch(ActionParamsException ignored) { LOG.ignored(ignored, "Payload included in request"); } } return null; }</technical_language>

Target:
private List<PrintLayer> getLayers(ActionParameters params) throws ActionException { String mapLayers = params.getRequiredParam(PARM_MAPLAYERS); User user = params.getUser(); LayerProperties[] requestedLayers = parseLayersProperties(mapLayers); List<PrintLayer> printLayers = new ArrayList<>(); int zIndex = 0; for (LayerProperties requestedLayer : requestedLayers) { try { printLayers.add(getPrintLayer(zIndex++, requestedLayer, user)); } catch (ActionException ex) { LOG.debug("Failed to add print layer:", requestedLayer.id); } } printLayers.removeIf(layer -> layer.getOpacity() <= 0); JSONObject customStyles = getCustomStyles(params); if (customStyles != null) { printLayers.forEach(l -> { String id = l.getLayerId(); if (customStyles.has(id)) { l.setCustomStyle(JSONHelper.getJSONObject(customStyles, id)); } }); } return printLayers; }
Source:
<code>public void testApplicationWithPortEndpoint() throws Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new KafkaPortApplication(kafka.getBroker(), testTopicData0, testTopicResult), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); kafka.publish(testTopicData0, Arrays.asList("15/02/2016 10:15:00 +0000,1,paint1,11", "15/02/2016 10:16:00 +0000,2,paint2,12", "15/02/2016 10:17:00 +0000,3,paint3,13", "15/02/2016 10:18:00 +0000,4,paint4,14", "15/02/2016 10:19:00 +0000,5,paint5,15", "15/02/2016 10:10:00 +0000,6,abcde6,16")); String[] expectedLines = new String[] {"15/02/2016 10:18:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT4\r\n", "15/02/2016 10:19:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT5\r\n"}; List<String> consume = kafka.consume(testTopicResult, 30000); Assert.assertTrue(Arrays.deepEquals(consume.toArray(new String[consume.size()]), expectedLines)); lc.shutdown(); } catch (Exception e) { <START> e.printStackTrace(); <END> Assert.fail("constraint violations: " + e); } }</code><technical_language>remove this</technical_language>

Target:
public void testApplicationWithPortEndpoint() { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new KafkaPortApplication(kafka.getBroker(), testTopicData0, testTopicResult), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); kafka.publish(testTopicData0, Arrays.asList("15/02/2016 10:15:00 +0000,1,paint1,11", "15/02/2016 10:16:00 +0000,2,paint2,12", "15/02/2016 10:17:00 +0000,3,paint3,13", "15/02/2016 10:18:00 +0000,4,paint4,14", "15/02/2016 10:19:00 +0000,5,paint5,15", "15/02/2016 10:10:00 +0000,6,abcde6,16")); String[] expectedLines = new String[] {"15/02/2016 10:18:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT4\r\n", "15/02/2016 10:19:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT5\r\n"}; List<String> consume = kafka.consume(testTopicResult, 30000); Assert.assertTrue(Arrays.deepEquals(consume.toArray(new String[consume.size()]), expectedLines)); lc.shutdown(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } catch (Exception e) { Assert.fail("Exception: " + e); } }
Source:
<code>public static <T> T create(Class<T> serviceClass, String userAgent, ServiceConfiguration config) { ClientBuilder client = jaxrs().ssl(config.security()); <START> if (config.connectTimeout().isPresent()) { <END> client.connectTimeout(config.connectTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } if (config.readTimeout().isPresent()) { client.readTimeout(config.readTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } return client.build(serviceClass, userAgent, config.uris()); }</code><technical_language>do this if statement in ClientBuilder</technical_language>

Target:
public static <T> T create(Class<T> serviceClass, String userAgent, ServiceConfiguration config) { ClientBuilder client = builder().ssl(config.security()); if (config.connectTimeout().isPresent()) { client.connectTimeout(config.connectTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } if (config.readTimeout().isPresent()) { client.readTimeout(config.readTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } return client.build(serviceClass, userAgent, config.uris()); }
Source:
<code>private String getResourcePath() { <START> String serverUrl = "<LINK_0>"; <END> return serverUrl + String.format(FormConstants.URL_TEMPLATE, formInstanceId); }</code><technical_language>server server_context.xml</technical_language>

Target:
private String getResourcePath() { String serverUrl = getResources().getString(R.string.liferay_server); Long formInstanceId = Long.valueOf(getResources().getString(R.string.liferay_form_instance_id)); return serverUrl + String.format(FormConstants.URL_TEMPLATE, formInstanceId); }
Source:
<code>private static void showOfflineMenu(final Geocache cache, final Activity activity) { final LogEntry currentLog = DataStore.loadLogOffline(cache.getGeocode()); final LogType currentLogType = currentLog == null ? null : currentLog.type; final List<LogType> logTypes = cache.getPossibleLogTypes(); final ArrayList<LogTypeEntry> list = new ArrayList<>(); for (final LogType logType : logTypes) { list.add(new LogTypeEntry(logType, null, logType == currentLogType)); } if (cache.isLogOffline()) { list.add(new LogTypeEntry(null, SpecialLogType.CLEAR_LOG, false)); } list.add(new LogTypeEntry(null, SpecialLogType.LOG_CACHE, false)); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_visit_offline); final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, list); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { final LogTypeEntry logTypeEntry = adapter.getItem(item); if (logTypeEntry.logType == null) { switch (logTypeEntry.specialLogType) { case LOG_CACHE: cache.logVisit(activity); break; case CLEAR_LOG: cache.clearOfflineLog(); break; } } else { cache.logOffline(activity, logTypeEntry.logType); } if (selectedView != null) { final ViewHolder holder; <START> holder = (ViewHolder) selectedView.getTag(); <END> if (holder != null) { CacheListAdapter.updateViewHolder(holder, cache, res); } } } }); builder.create().show(); }</code><technical_language>Please initialize while declaring</technical_language>

Target:
private static void showOfflineMenu(final Geocache cache, final Activity activity) { final LogEntry currentLog = DataStore.loadLogOffline(cache.getGeocode()); final LogType currentLogType = currentLog == null ? null : currentLog.type; final List<LogType> logTypes = cache.getPossibleLogTypes(); final ArrayList<LogTypeEntry> list = new ArrayList<>(); for (final LogType logType : logTypes) { list.add(new LogTypeEntry(logType, null, logType == currentLogType)); } if (cache.isLogOffline()) { list.add(new LogTypeEntry(null, SpecialLogType.CLEAR_LOG, false)); } list.add(new LogTypeEntry(null, SpecialLogType.LOG_CACHE, false)); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_visit_offline); final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, list); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { final LogTypeEntry logTypeEntry = adapter.getItem(item); if (logTypeEntry.logType == null) { switch (logTypeEntry.specialLogType) { case LOG_CACHE: cache.logVisit(activity); break; case CLEAR_LOG: cache.clearOfflineLog(); break; } } else { cache.logOffline(activity, logTypeEntry.logType); } if (selectedView != null) { final ViewHolder holder = (ViewHolder) selectedView.getTag(); if (holder != null) { CacheListAdapter.updateViewHolder(holder, cache, res); } } } }); builder.create().show(); }
Source:
<code>private boolean handleUncommittedChanges(final Repository repository, final List<String> files, Shell shell) { CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.AbstractRebaseCommandHandler_cleanupDialog_title, UIText.AbstractRebaseCommandHandler_cleanupDialog_text, repository, files); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { final PullOperationUI outerThis = this; PullOperationUI pullOperationUI = new PullOperationUI( Collections.singleton(repository)) { <START> public void done(IJobChangeEvent event) { <END> outerThis.results.putAll(this.results); int missing = outerThis.tasksToWaitFor.decrementAndGet(); if (missing == 0) outerThis.showResults(); } }; pullOperationUI.start(); return true; } else return false; }</code><technical_language>instead of overriding done here, adding a variant of start method pass a custom IJobChangeListener? way, need overriden is separate</technical_language>

Target:
private void handleUncommittedChanges(final Repository repository, final List<String> files, Shell shell) { CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.AbstractRebaseCommandHandler_cleanupDialog_title, UIText.AbstractRebaseCommandHandler_cleanupDialog_text, repository, files); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { final PullOperationUI parentOperation = this; final PullOperationUI pullOperationUI = new PullOperationUI( Collections.singleton(repository)); tasksToWaitFor.incrementAndGet(); pullOperationUI.start(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { parentOperation.results.putAll(pullOperationUI.results); int missing = parentOperation.tasksToWaitFor.decrementAndGet(); if (missing == 0) parentOperation.showResults(); } }); } }
Source:
<code>public long findPosition(long nOccurrence) { updateCount(); <START> long ret = RankedBitVector.NOT_FOUND; <END> if (nOccurrence > 0) { int findPos = getBlockNumber(nOccurrence); if (findPos < this.positionArray.length) { long pos0 = this.positionArray[findPos]; long leftOccurrences = nOccurrence - (findPos * this.blockSize); if (leftOccurrences == 0) { ret = pos0; } else { for (long index = pos0 + 1; (leftOccurrences > 0) && (index < this.bitVector.size()); index++) { if (this.bitVector.getBit(index) == this.bit) { leftOccurrences--; } if (leftOccurrences == 0) { ret = index; } } } } } return ret; }</code><technical_language>Instead of computing a ret value, return result soon find it. This code more readable need local variable conditions in for-loops simplified (they need check if result already)</technical_language>

Target:
public long findPosition(long nOccurrence) { updateCount(); if (nOccurrence <= 0) { return RankedBitVector.NOT_FOUND; } int findPos = (int) (nOccurrence / this.blockSize); if (findPos < this.positionArray.length) { long pos0 = this.positionArray[findPos]; long leftOccurrences = nOccurrence - (findPos * this.blockSize); if (leftOccurrences == 0) { return pos0; } for (long index = pos0 + 1; index < this.bitVector.size(); index++) { if (this.bitVector.getBit(index) == this.bit) { leftOccurrences--; } if (leftOccurrences == 0) { return index; } } } return RankedBitVector.NOT_FOUND; }
Source:
<code>private Timestamp parseTimeStamp(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); Date parsedDate = dateFormat.parse(date); return new java.sql.Timestamp(parsedDate.getTime()); } catch (ParseException e) { <START> e.printStackTrace(); <END> return null; } }</code><technical_language>print errors standard output. StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e));</technical_language>

Target:
private Timestamp parseTimeStamp(String date) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); Date parsedDate = dateFormat.parse(date); return new java.sql.Timestamp(parsedDate.getTime()); } catch (ParseException e) { StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e)); return null; } }
Source:
<code>private void removeVmsFromCache() { if (dbVm != null && !stable) { proceedVmBeforeDeletion(); boolean migrating = dbVm.getStatus() == VMStatus.MigratingFrom; if (migrating) { handOverVM(dbVm); <START> } else if (dbVm.getStatus() == VMStatus.PoweringDown) { <END> clearVm(VmExitStatus.Normal, String.format("VM %s shutdown complete", dbVm.getName()), VmExitReason.Success); } else { clearVm(VmExitStatus.Error, String.format("Could not find VM %s on host, assuming it went down unexpectedly", dbVm.getName()), VmExitReason.GenericError); } log.info("VM '{}({}) is running in db and not running in VDS '{}'", dbVm.getId(), dbVm.getName(), getVdsManager().getVdsName()); if (!migrating && !rerun && vmsMonitoring.getResourceManager().IsVmInAsyncRunningList(dbVm.getId())) { rerun = true; log.info("add VM '{}' to rerun treatment", dbVm.getName()); } else if (dbVm.isAutoStartup() && !autoVmToRun && (vdsmVm == null || vdsmVm.getVmDynamic().getExitStatus() != VmExitStatus.Normal)) { autoVmToRun = true; log.info("add VM '{}' to HA rerun treatment", dbVm.getName()); } } }</code><technical_language>do need - get event...and IIUC this method is for case vdsm stops reporting a VM. Also, if dbVm == null this raises NPE</technical_language>

Target:
private void removeVmsFromCache() { if (dbVm != null && !stable) { boolean poweredDown = false; proceedVmBeforeDeletion(); boolean migrating = dbVm.getStatus() == VMStatus.MigratingFrom; if (migrating) { handOverVM(dbVm); } else if (dbVm.getStatus() == VMStatus.PoweringDown) { poweredDown = true; clearVm(VmExitStatus.Normal, String.format("VM %s shutdown complete", dbVm.getName()), VmExitReason.Success); } else { clearVm(VmExitStatus.Error, String.format("Could not find VM %s on host, assuming it went down unexpectedly", dbVm.getName()), VmExitReason.GenericError); } log.info("VM '{}({}) is running in db and not running in VDS '{}'", dbVm.getId(), dbVm.getName(), getVdsManager().getVdsName()); if (!migrating && !rerun && vmsMonitoring.getResourceManager().IsVmInAsyncRunningList(dbVm.getId())) { rerun = true; log.info("add VM '{}' to rerun treatment", dbVm.getName()); } else if (dbVm.isAutoStartup() && !autoVmToRun && (vdsmVm == null || vdsmVm.getVmDynamic().getExitStatus() != VmExitStatus.Normal) && !poweredDown) { autoVmToRun = true; log.info("add VM '{}' to HA rerun treatment", dbVm.getName()); } } }
Source:
<code>public void executeBatch(JSONObject batch) { <START> emitter.evaluateBatch(batch, qry -> enhanceQuery(qry, false), this::executeTask); <END> }</code><technical_language>qry -> query</technical_language>

Target:
public void executeBatch(JSONObject batch) { emitter.evaluateBatch(batch, query -> filterOnExecutableTasks(query, false), this::executeTask); }
Source:
<code>public void emailConsentAgreement(Study study, SubpopulationGuid subpopGuid, StudyParticipant participant) { checkNotNull(study); checkNotNull(subpopGuid); checkNotNull(participant); ConsentSignature consentSignature = getConsentSignature(study, subpopGuid, participant.getId()); SharingScope sharingScope = participant.getSharingScope(); Subpopulation subpop = subpopService.getSubpopulation(study.getStudyIdentifier(), subpopGuid); String htmlTemplate = studyConsentService.getActiveConsent(subpop).getDocumentContent(); <START> String participantEmail = subpop.isAutoSendConsentSuppressed() ? null : participant.getEmail(); <END> ConsentEmailProvider consentEmail = new ConsentEmailProvider(study, participant.getTimeZone(), participantEmail, consentSignature, sharingScope, htmlTemplate, consentTemplate); if (!consentEmail.getRecipients().isEmpty()) { sendMailService.sendEmail(consentEmail); } }</code><technical_language>apply suppress flag here. If user requests consent email, need send them</technical_language>

Target:
public void emailConsentAgreement(Study study, SubpopulationGuid subpopGuid, StudyParticipant participant) { checkNotNull(study); checkNotNull(subpopGuid); checkNotNull(participant); ConsentSignature consentSignature = getConsentSignature(study, subpopGuid, participant.getId()); SharingScope sharingScope = participant.getSharingScope(); Subpopulation subpop = subpopService.getSubpopulation(study.getStudyIdentifier(), subpopGuid); String htmlTemplate = studyConsentService.getActiveConsent(subpop).getDocumentContent(); ConsentEmailProvider consentEmail = new ConsentEmailProvider(study, participant.getTimeZone(), participant.getEmail(), consentSignature, sharingScope, htmlTemplate, consentTemplate); if (!consentEmail.getRecipients().isEmpty()) { sendMailService.sendEmail(consentEmail); } }
Source:
<code>private <T extends Entity> boolean collisionsImpl$allowEntityCollision(final List<T> listToFill) { if (this.world instanceof WorldServerBridge) { if (!PhaseTracker.getInstance().getCurrentState().isCollision()) { return true; } final PhaseContext<?> phaseContext = PhaseTracker.getInstance().getCurrentContext(); final Object source = phaseContext.getSource(); if (source == null) { return true; } <START> CollisionsCapability capability; <END> if (source instanceof LocatableBlock) { final LocatableBlock locatable = (LocatableBlock) source; final BlockType blockType =locatable.getLocation().getBlockType(); capability = (CollisionsCapability) blockType; } else if (source instanceof CollisionsCapability) { capability = (CollisionsCapability) source; } else { return true; } if (capability.collision$requiresCollisionsCacheRefresh()) { capability.collision$initializeCollisionState(this.world); capability.collision$requiresCollisionsCacheRefresh(false); } return capability.collision$getMaxCollisions() < 0 || listToFill.size() < capability.collision$getMaxCollisions() || listToFill.size() < this.world.getGameRules().getInt("maxEntityCramming"); } return true; }</code><technical_language>final</technical_language>

Target:
private <T extends Entity> boolean collisionsImpl$allowEntityCollision(final List<T> listToFill) { if (this.world instanceof WorldServerBridge) { if (!PhaseTracker.getInstance().getCurrentState().isCollision()) { return true; } final PhaseContext<?> phaseContext = PhaseTracker.getInstance().getCurrentContext(); final Object source = phaseContext.getSource(); if (!(source instanceof CollisionsCapability)) { return true; } final CollisionsCapability capability = (CollisionsCapability) source; if (capability.collision$requiresCollisionsCacheRefresh()) { capability.collision$initializeCollisionState(this.world); capability.collision$requiresCollisionsCacheRefresh(false); } return capability.collision$getMaxCollisions() < 0 || listToFill.size() < capability.collision$getMaxCollisions() || listToFill.size() < this.world.getGameRules().getInt("maxEntityCramming"); } return true; }
Source:
<code>private String mapActionStatus(String status) { if (CoordinatorAction.Status.READY.toString().equals(status)) { return InstancesResult.WorkflowStatus.READY.name(); } else if (CoordinatorAction.Status.WAITING.toString().equals(status) || CoordinatorAction.Status.SUBMITTED.toString().equals(status)) { return InstancesResult.WorkflowStatus.WAITING.name(); } else if (CoordinatorAction.Status.IGNORED.toString().equals(status)) { <START> return InstancesResult.WorkflowStatus.KILLED.name(); <END> } else if (CoordinatorAction.Status.TIMEDOUT.toString().equals(status)) { return InstancesResult.WorkflowStatus.FAILED.name(); } else if (WorkflowJob.Status.PREP.toString().equals(status)) { return InstancesResult.WorkflowStatus.RUNNING.name(); } else { return status; } }</code><technical_language>This change is reversing a patch ensure manually killed instances retried</technical_language>

Target:
private String mapActionStatus(String status) { if (CoordinatorAction.Status.READY.toString().equals(status)) { return InstancesResult.WorkflowStatus.READY.name(); } else if (CoordinatorAction.Status.WAITING.toString().equals(status) || CoordinatorAction.Status.SUBMITTED.toString().equals(status)) { return InstancesResult.WorkflowStatus.WAITING.name(); } else if (CoordinatorAction.Status.KILLED.toString().equals(status)) { return InstancesResult.WorkflowStatus.KILLED.name(); } else if (CoordinatorAction.Status.IGNORED.toString().equals(status)) { return InstancesResult.WorkflowStatus.KILLED_OR_IGNORED.name(); } else if (CoordinatorAction.Status.TIMEDOUT.toString().equals(status)) { return InstancesResult.WorkflowStatus.TIMEDOUT.name(); } else if (WorkflowJob.Status.PREP.toString().equals(status)) { return InstancesResult.WorkflowStatus.RUNNING.name(); } else { return status; } }
Source:
<code>private static Details getDetailsForTryCatchFinally(DetailAST ast) { boolean shouldCheckLastRcurly = false; final DetailAST rcurly; final DetailAST lcurly; DetailAST nextToken; final int tokenType = ast.getType(); if (tokenType == TokenTypes.LITERAL_TRY) { if (ast.getFirstChild().getType() == TokenTypes.RESOURCE_SPECIFICATION) { lcurly = ast.getFirstChild().getNextSibling(); } else { lcurly = ast.getFirstChild(); } nextToken = lcurly.getNextSibling(); rcurly = lcurly.getLastChild(); if (nextToken == null) { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); } } else if (tokenType == TokenTypes.LITERAL_CATCH) { <START> nextToken = ast.getNextSibling(); <END> lcurly = ast.getLastChild(); rcurly = lcurly.getLastChild(); if (nextToken == null) { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); } } else { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); lcurly = ast.getFirstChild(); rcurly = lcurly.getLastChild(); } final Details details = new Details(); details.rcurly = rcurly; details.lcurly = lcurly; details.nextToken = nextToken; details.shouldCheckLastRcurly = shouldCheckLastRcurly; return details; }</code><technical_language>I separation new for method, I dislike some of code copy around. I of 2 ideas change this to: 1) drop default constructor a new takes fields arguments, fields of class final rename getDetails getInstance. 2) transform getDetails a constructor, methods populate fields directly. Problem point 2 is assignments overlooked split methods. Problem point 1 is stuck getDetails a wrapper for constructor. do think</technical_language>

Target:
private static Details getDetailsForTryCatchFinally(DetailAST ast) { boolean shouldCheckLastRcurly = false; final DetailAST rcurly; final DetailAST lcurly; DetailAST nextToken; final int tokenType = ast.getType(); if (tokenType == TokenTypes.LITERAL_TRY) { if (ast.getFirstChild().getType() == TokenTypes.RESOURCE_SPECIFICATION) { lcurly = ast.getFirstChild().getNextSibling(); } else { lcurly = ast.getFirstChild(); } nextToken = lcurly.getNextSibling(); rcurly = lcurly.getLastChild(); if (nextToken == null) { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); } } else if (tokenType == TokenTypes.LITERAL_CATCH) { nextToken = ast.getNextSibling(); lcurly = ast.getLastChild(); rcurly = lcurly.getLastChild(); if (nextToken == null) { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); } } else { shouldCheckLastRcurly = true; nextToken = getNextToken(ast); lcurly = ast.getFirstChild(); rcurly = lcurly.getLastChild(); } return new Details(lcurly, rcurly, nextToken, shouldCheckLastRcurly); }
Source:
<code>protected static String getEngineSSHPublicKey() { final String keystoreFile = Config.<String>GetValue(ConfigValues.keystoreUrl); final String alias = Config.<String>GetValue(ConfigValues.CertAlias); final char[] password = Config.<String>GetValue(ConfigValues.keystorePass).toCharArray(); InputStream in = null; try { in = new FileInputStream(keystoreFile); KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(in, password); final Certificate cert = ks.getCertificate(alias); if (cert == null) { Enumeration<String> aliases = ks.aliases(); log.info("Alias with name '"+alias+"' not found in "+keystoreFile); StringBuilder aliaslist = new StringBuilder(); while(aliases.hasMoreElements()) { if(aliaslist.length() != 0) { aliaslist.append(", "); } aliaslist.append(aliases.nextElement()); <START> } <END> log.info("aliases: " + aliaslist.toString()); throw new KeyStoreException( String.format( "Failed to find certificate store '%1$s' using alias '%2$s'", keystoreFile, alias ) ); } return OpenSSHUtils.getKeyString( cert.getPublicKey(), Config.<String>GetValue(ConfigValues.SSHKeyAlias) ); } catch (Exception e) { throw new RuntimeException( String.format( "Failed to decode own public key from store '%1$s' using alias '%2$s'", keystoreFile, alias ), e ); } finally { Arrays.fill(password, '*'); if (in != null) { try { in.close(); } catch(IOException e) { log.error("Cannot close key store", e); } } } }</code><technical_language>put this entire block if (log.isInfoEnabled()). Moreover, this: String aliasList = StringUtils.join(EnumarationUtils.toList(aliases), ", ")</technical_language>

Target:
protected static String getEngineSSHPublicKey() { final String keystoreFile = Config.<String>GetValue(ConfigValues.keystoreUrl); final String alias = Config.<String>GetValue(ConfigValues.CertAlias); final char[] password = Config.<String>GetValue(ConfigValues.keystorePass).toCharArray(); InputStream in = null; try { in = new FileInputStream(keystoreFile); KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(in, password); final Certificate cert = ks.getCertificate(alias); if (cert == null) { log.info("Alias with name '"+alias+"' not found in "+keystoreFile); log.info("aliases: " + StringUtils.join(EnumerationUtils.toList(ks.aliases()), ',')); throw new KeyStoreException( String.format( "Failed to find certificate store '%1$s' using alias '%2$s'", keystoreFile, alias ) ); } return OpenSSHUtils.getKeyString( cert.getPublicKey(), Config.<String>GetValue(ConfigValues.SSHKeyAlias) ); } catch (Exception e) { throw new RuntimeException( String.format( "Failed to decode own public key from store '%1$s' using alias '%2$s'", keystoreFile, alias ), e ); } finally { Arrays.fill(password, '*'); if (in != null) { try { in.close(); } catch(IOException e) { log.error("Cannot close key store", e); } } } }
Source:
<code>private void bind(SymbolStyleSearchResult symbol, OnSymbolPreviewTapListener onSymbolPreviewTapListener) { ListenableFuture<Bitmap> bitmapFuture = symbol.getSymbol().createSwatchAsync(itemView.getContext(), Color.TRANSPARENT); try { Bitmap bitmap = bitmapFuture.get(); mImageView.setImageBitmap(bitmap); } catch (InterruptedException | ExecutionException e) { logErrorToUser(itemView.getContext(), getString(R.string.error_loading_symbol_bitmap_failed, e.getMessage())); } <START> itemView.setOnClickListener(v -> { <END> onSymbolPreviewTapListener.onSymbolPreviewTap(symbol); }); }</code><technical_language>moved a 1 line lambda</technical_language>

Target:
private void bind(SymbolStyleSearchResult symbol, OnSymbolPreviewTapListener onSymbolPreviewTapListener) { ListenableFuture<Bitmap> bitmapFuture = symbol.getSymbol().createSwatchAsync(itemView.getContext(), Color.TRANSPARENT); try { Bitmap bitmap = bitmapFuture.get(); mImageView.setImageBitmap(bitmap); } catch (InterruptedException | ExecutionException e) { logErrorToUser(itemView.getContext(), getString(R.string.error_loading_symbol_bitmap_failed, e.getMessage())); } itemView.setOnClickListener(v -> onSymbolPreviewTapListener.onSymbolPreviewTap(symbol)); }
Source:
<code>public void testSuccessfullIdx() throws Exception { MatcherAssert.assertThat( new PsAll( Arrays.asList( new PsFake(true), new PsFake(true), new PsFake(true), new PsFake(true) ), Tv.THREE ).enter(new RqFake()).has(), <START> Matchers.is(true) <END> ); }</code><technical_language>@Suseika check PsAll.enter() returns Identity 3-rd Pass</technical_language>

Target:
public void testSuccessfullIdx() throws Exception { final Pass resulting = new PsFixed( new Identity.Simple("urn:foo:test") ); final RqFake request = new RqFake(); MatcherAssert.assertThat( new PsAll( Arrays.asList( new PsFake(true), new PsFake(true), new PsFake(true), resulting ), Tv.THREE ).enter(request).get().urn(), Matchers.equalTo(resulting.enter(request).get().urn()) ); }
Source:
<code>public Mono<ResponseEntity<Map<SortedEntry, Result>>> getHealth(@RequestParam(name="all", defaultValue="false") boolean all) { <START> final Pair<Map<String, Result>, CheckState> result = controller.runHealthChecks(); <END> return Mono.just(ResponseEntity.status(result.getRight().getHttpStatus()).body(render(all, result.getLeft()))); }</code><technical_language>result null</technical_language>

Target:
public Mono<ResponseEntity<Map<SortedEntry, Result>>> getHealth(@RequestParam(name="all", defaultValue="false") boolean all) { final Pair<Map<String, Result>, CheckState> result = controller.runHealthChecks(); return Mono.just(ResponseEntity.status(result.getRight().getHttpStatus()).body(SortedEntry.render(all, result.getLeft()))); }
Source:
<code>private void generateExecutableIndexExpression() throws StandardException{ if (!onExpression) return; assert compiledExpressions.length == expressionList.size(); assert compiledExpressionClassNames.length == expressionList.size(); for (int i = 0; i < expressionList.size(); i++) { ExecutableIndexExpressionClassBuilder ieb = new ExecutableIndexExpressionClassBuilder(getCompilerContext()); MethodBuilder mb = ieb.getExecuteMethod(); expressionList.elementAt(i).expression.generateExpression(ieb, mb); ieb.finishRunExpressionMethod(i + 1); compiledExpressions[i] = new ByteArray(); GeneratedClass gc = ieb.getGeneratedClass(compiledExpressions[i]); compiledExpressionClassNames[i] = gc.getName(); <START> } <END> }</code><technical_language>remove. ie.isAscending now, "space end" logic anymore, right</technical_language>

Target:
private void generateExecutableIndexExpression() throws StandardException{ if (!onExpression) return; assert exprBytecode.length == expressionList.size(); assert generatedClassNames.length == expressionList.size(); for (int i = 0; i < expressionList.size(); i++) { ExecutableIndexExpressionClassBuilder ieb = new ExecutableIndexExpressionClassBuilder(getCompilerContext()); MethodBuilder mb = ieb.getExecuteMethod(); expressionList.elementAt(i).expression.generateExpression(ieb, mb); ieb.finishRunExpressionMethod(i + 1); exprBytecode[i] = new ByteArray(); GeneratedClass gc = ieb.getGeneratedClass(exprBytecode[i]); generatedClassNames[i] = gc.getName(); } }
Source:
<code>public CpuVendor getVendor() { final CpuVendor cpuVendor = CpuVendor.fromFlags(privateFlags); if (cpuVendor != null) { return cpuVendor; } <START> throw new RuntimeException("Unknown processor vendor. Flags: " + privateFlags); <END> }</code><technical_language>I find similar ask 'null' architecture - in scenario get #101? want prevent in validate method instead of throwing exception happens</technical_language>

Target:
public CpuVendor getVendor() { return CpuVendor.fromFlags(privateFlags); }
Source:
<code>public static byte[] serializeConfidentialData(OptionSet options, byte[] payload, int realCode) { if (options != null) { if (realCode > 0) { DatagramWriter writer = new DatagramWriter(); writeOptions(writer, options, true, false, realCode); <START> if (payload != null && payload.length > 0) { <END> writePayload(writer, payload); } return writer.toByteArray(); } else { LOGGER.severe(OSExceptionHandler.COAP_CODE_INVALID); throw new IllegalArgumentException(OSExceptionHandler.COAP_CODE_INVALID); } } else { LOGGER.severe(OSExceptionHandler.OPTIONSET_NULL); throw new IllegalArgumentException(OSExceptionHandler.OPTIONSET_NULL); } }</code><technical_language>checked in writePayload. DataSerializer.serializeOptionsAndPayload public add DatagramWriter new OptionFilter parameter for reuse code copy there</technical_language>

Target:
public static byte[] serializeConfidentialData(OptionSet options, byte[] payload, int realCode) { if (options != null) { DatagramWriter writer = new DatagramWriter(); if (realCode > 0) { OptionSet filteredOptions = OptionJuggle.prepareEoptions(options); writer.write(realCode, CoAP.MessageFormat.CODE_BITS); DataSerializer.serializeOptionsAndPayload(writer, filteredOptions, payload); return writer.toByteArray(); } else { LOGGER.error(Error.COAP_CODE_INVALID); throw new IllegalArgumentException(Error.COAP_CODE_INVALID); } } else { LOGGER.error(Error.OPTIONSET_NULL); throw new NullPointerException(Error.OPTIONSET_NULL); } }
Source:
<code>public void testNoTime() throws IOException { <START> String str = "time:null, before:20170101, after:20120101,timeFormat:YYYYMMDD"; <END> try { BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, str); fail("Expected exception: time field is required"); } catch(JsonMappingException jme) { assertThat(jme.getMessage(), containsString("marked as required")); } }</code><technical_language>time:null left out</technical_language>

Target:
public void testNoTime() throws IOException { String str = "before:20170101, after:20120101,timeFormat:YYYYMMDD"; BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, str); }
Source:
<code>public String getName() { <START> return null; <END> }</code><technical_language>Is this supposed <code>return "Bump"</code></technical_language>

Target:
public String getName() { return "Bump"; }
Source:
<code>public DAG<MISTStream, MISTEdge> getOptimizedDAG() { final Set<MISTStream> visited = new HashSet<>(); for (final MISTStream source : dag.getRootVertices()) { final Map<MISTStream, MISTEdge> rootEdges = dag.getEdges(source); visited.add(source); <START> for (final Map.Entry<MISTStream, MISTEdge> entry : rootEdges.entrySet()) { <END> final MISTStream nextVertex = entry.getKey(); optimizing(nextVertex, visited); } } return dag; }</code><technical_language>If key of entry, final MISTStream nextVertex : rootEdges.keySet() instead</technical_language>

Target:
public DAG<MISTStream, MISTEdge> getOptimizedDAG() { final Set<MISTStream> visited = new HashSet<>(); for (final MISTStream source : dag.getRootVertices()) { final Map<MISTStream, MISTEdge> rootEdges = dag.getEdges(source); visited.add(source); for (final MISTStream nextVertex : rootEdges.keySet()) { optimizeSubDag(nextVertex, visited); } } return dag; }
Source:
<code>public void test_getExpandHorizontal() { boolean defaultFlag = scrolledComposite.getExpandHorizontal(); boolean setFlag = !defaultFlag; scrolledComposite.setExpandHorizontal(setFlag); <START> if (setFlag) <END> assertTrue(scrolledComposite.getExpandHorizontal()); else assertFalse(scrolledComposite.getExpandHorizontal()); setFlag = !setFlag; scrolledComposite.setExpandHorizontal(setFlag); if (setFlag) assertTrue(scrolledComposite.getExpandHorizontal()); else assertFalse(scrolledComposite.getExpandHorizontal()); scrolledComposite.setExpandHorizontal(defaultFlag); }</code><technical_language>{} for blocks</technical_language>

Target:
public void test_getExpandHorizontal() { boolean defaultFlag = scrolledComposite.getExpandHorizontal(); boolean setFlag = !defaultFlag; scrolledComposite.setExpandHorizontal(setFlag); if (setFlag){ assertTrue(scrolledComposite.getExpandHorizontal()); } else{ assertFalse(scrolledComposite.getExpandHorizontal()); } setFlag = !setFlag; scrolledComposite.setExpandHorizontal(setFlag); if (setFlag){ assertTrue(scrolledComposite.getExpandHorizontal()); } else{ assertFalse(scrolledComposite.getExpandHorizontal()); } scrolledComposite.setExpandHorizontal(defaultFlag); }
Source:
<code>public static ExchangeRate getExchangeRate(final Cursor cursor) { final String currencyCode = cursor .getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_CURRENCY_CODE)); final Coin rateCoin = Coin .valueOf(cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE_COIN))); final Fiat rateFiat = Fiat.valueOf(currencyCode, cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE_FIAT))); final String source = cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_SOURCE)); ExchangeRate exchangeRate = new ExchangeRate(new org.bitcoinj.utils.ExchangeRate(rateCoin, rateFiat), source); <START> WalletApplication.getInstance().setExchangeRate(exchangeRate); <END> return exchangeRate; }</code><technical_language>@sambarboza initiate _WalletApplication.exchangeRate_ field here, smell good... ;) I a closer try propose more reliable</technical_language>

Target:
public static ExchangeRate getExchangeRate(final Cursor cursor) { final String currencyCode = cursor .getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_CURRENCY_CODE)); final Coin rateCoin = Coin .valueOf(cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE_COIN))); final Fiat rateFiat = Fiat.valueOf(currencyCode, cursor.getLong(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_RATE_FIAT))); final String source = cursor.getString(cursor.getColumnIndexOrThrow(ExchangeRatesProvider.KEY_SOURCE)); return new ExchangeRate(new org.bitcoinj.utils.ExchangeRate(rateCoin, rateFiat), source); }