auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ArgumentMatcher<RefundGatewayRequest> aRefundRequestWith(ChargeEntity capturedCharge, long amountInPence) { return (RefundGatewayRequest object) -> object.getGatewayAccount().equals(capturedCharge.getGatewayAccount()) && object.getTransactionId().equals(capturedCharge.getGatewayTransactionId()) && <START> object.getAmount().equals(String.valueOf(amountInPence)); <END> }</code><technical_language>Please rename object refundGatewayRequest</technical_language>

Target:
private ArgumentMatcher<RefundGatewayRequest> aRefundRequestWith(ChargeEntity capturedCharge, long amountInPence) { return (RefundGatewayRequest refundGatewayRequest) -> refundGatewayRequest.getGatewayAccount().equals(capturedCharge.getGatewayAccount()) && refundGatewayRequest.getTransactionId().equals(capturedCharge.getGatewayTransactionId()) && refundGatewayRequest.getAmount().equals(String.valueOf(amountInPence)); }
Source:
<code>public void addTask(Runnable task) { taskQueue.add(task); if (parked) { <START> parked = false; <END> LockSupport.unpark(thread); } }</code><technical_language>I feel a race condition in this parked boolean, basically false checked add task, flipped in run function, causing a task stuck in queue w/o running it</technical_language>

Target:
public void addTask(Runnable task) { taskQueue.add(task); if (parked) { parked = false; LockSupport.unpark(thread); } else if (wakupNeighborWorker.parked) { wakupNeighborWorker.parked = false; LockSupport.unpark(wakupNeighborWorker.thread); } }
Source:
<code>public void logHtmlWriterFreestyleBenchmark(JenkinsState state, Blackhole blackhole) throws Exception { AnnotatedLargeText logText = state.freestyleBuild.getLogText(); <START> long r = logText.writeHtmlTo(0, new BlackholeWriter(blackhole)); <END> blackhole.consume(r); }</code><technical_language>move BlackholeWriter JenkinsState avoid creating instance for benchmark iteration</technical_language>

Target:
public void logHtmlWriterFreestyleBenchmark(JenkinsState state, Blackhole blackhole) throws Exception { AnnotatedLargeText logText = state.freestyleBuild.getLogText(); long r = logText.writeHtmlTo(0, state.blackholeWriter); blackhole.consume(r); }
Source:
<code>public void testCreateTableAsync() throws Exception{ CreateTableRequest request = CreateTableRequest.of(TABLE_ID); when(mockAdminClient.createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID))) .thenReturn(immediateFuture(createTableData())); <START> ApiFuture<Table> response = clientWrapper.createTableAsync(request); <END> assertEquals(Table.fromProto(createTableData()), response.get()); verify(mockAdminClient).createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID)); }</code><technical_language>Please Future instead for of tests. tests care ListenableFuture vs. ApiFuture</technical_language>

Target:
public void testCreateTableAsync() throws Exception{ CreateTableRequest request = CreateTableRequest.of(TABLE_ID); when(mockAdminClient.createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID))) .thenReturn(immediateFuture(createTableData())); Future<Table> response = clientWrapper.createTableAsync(request); assertEquals(Table.fromProto(createTableData()), response.get()); verify(mockAdminClient).createTableAsync(request.toProto(PROJECT_ID, INSTANCE_ID)); }
Source:
<code>public Mutable clear() { _uri = null; _scheme = null; _host = null; _port = -1; _path = null; _param = null; _query = null; _decodedPath = null; _user = null; return this; <START> } <END></code><technical_language>order field declarations</technical_language>

Target:
public Mutable clear() { _scheme = null; _user = null; _host = null; _port = -1; _path = null; _param = null; _query = null; _fragment = null; _uri = null; _decodedPath = null; return this; }
Source:
<code>private List<DeveloperEntity> getEntitiesByCertificationBodyId(final List<Long> certificationBodyIds) { String hql = "SELECT DISTINCT dev " + "FROM CertifiedProductEntity cp " + "JOIN FETCH cp.productVersion pv " + "JOIN FETCH pv.product prod " + "JOIN FETCH prod.developer dev " <START> + "WHERE cp.certificationBody.id IN :certificationBodyIds"; <END> return entityManager.createQuery(hql, DeveloperEntity.class) .setParameter("certificationBodyIds", certificationBodyIds) .getResultList(); }</code><technical_language>I I put parenthesis parameters in "IN" clause, "IN (:certificationBodyIds)" if necessary not. hibernate handle for if left out. If this HQL runs bother, wanted note in case</technical_language>

Target:
private List<DeveloperEntity> getEntitiesByCertificationBodyId(final List<Long> certificationBodyIds) { String hql = "SELECT DISTINCT dev " + "FROM CertifiedProductEntity cp " + "JOIN FETCH cp.productVersion pv " + "JOIN FETCH pv.product prod " + "JOIN FETCH prod.developer dev " + "WHERE cp.certificationBody.id IN (:certificationBodyIds)"; return entityManager.createQuery(hql, DeveloperEntity.class) .setParameter("certificationBodyIds", certificationBodyIds) .getResultList(); }
Source:
<code>public void processElement(DoFn<T, KV<T, Integer>>.ProcessContext c) throws Exception { <START> c.output( KV.of(c.element(), 42)); <END> }</code><technical_language>a nit, move 42 a DUMMY_VALUE constant? add a link <LINK_0></technical_language>

Target:
public void processElement(DoFn<T, KV<T, Integer>>.ProcessContext c) throws Exception { c.output( KV.of(c.element(), DUMMY_VALUE)); }
Source:
<code>String read(HttpServletRequest servletRequest, String key) { HttpHeaders headers = new HttpHeaders(); String token = servletRequest.getHeader(TOKEN_HEADER); if (!StringUtils.hasLength(token)) { throw new IllegalArgumentException( "Missing required header: " + TOKEN_HEADER); } headers.add(VAULT_TOKEN, token); <START> System.out.println("Namespace : " + this.namespace); <END> if (this.namespace != null && !this.namespace.isEmpty()) { headers.add(VAULT_NAMESPACE, this.namespace); } return this.accessStrategy.getData(headers, this.backend, key); }</code><technical_language>remove this log debug</technical_language>

Target:
String read(HttpServletRequest servletRequest, String key) { HttpHeaders headers = new HttpHeaders(); String token = servletRequest.getHeader(TOKEN_HEADER); if (!StringUtils.hasLength(token)) { throw new IllegalArgumentException( "Missing required header: " + TOKEN_HEADER); } headers.add(VAULT_TOKEN, token); if (this.namespace != null && !this.namespace.isEmpty()) { headers.add(VAULT_NAMESPACE, this.namespace); } return this.accessStrategy.getData(headers, this.backend, key); }
Source:
<code>public String rotate(String data, int shiftKey){ <START> String cipherText = ""; <END> for(int i = 0;i < data.length(); i++){ if(data.charAt(i) >= 'A' && data.charAt(i) <= 'Z'){ char replacementCharacter = (char) (data.charAt(i) + shiftKey); if(replacementCharacter > 'Z'){ replacementCharacter = (char)(64 + (replacementCharacter % 90)); } cipherText += replacementCharacter; } else if(data.charAt(i) >= 'a' && data.charAt(i) <= 'z'){ char replacementCharacter = (char) (data.charAt(i) + shiftKey); if(replacementCharacter > 'z'){ replacementCharacter = (char)(96 + (replacementCharacter % 122)); } cipherText += replacementCharacter; } else cipherText += data.charAt(i); } return cipherText; }</code><technical_language>a [string builder](<LINK_0> :)</technical_language>

Target:
public String rotate(String data, int shiftKey) { StringBuilder dataStringBuilder = new StringBuilder(); for (char c : data.toCharArray()) { if (Character.isUpperCase(c)) { dataStringBuilder.append(replacementCharacter(c, 'A', 'Z', shiftKey)); } else if (Character.isLowerCase(c)) { dataStringBuilder.append(replacementCharacter(c, 'a', 'z', shiftKey)); } else { dataStringBuilder.append(c); } } return dataStringBuilder.toString(); }
Source:
<code>private Set<AttributeDefinition> findAttributeDefinitionsForDependencies(PerunSession sess, List<String> dependenciesNames) throws InternalErrorException { Set<AttributeDefinition> strongDepSet = new HashSet<>(); for (String s : dependenciesNames) { if (!s.endsWith("*")) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, s); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { <START> log.error("For attribute dependency name can't be found attributeDefinition.", s); <END> } } else { List<String> allVariantOfDependence = getAllSimilarAttributeNames(sess, s.substring(0, s.length() - 2)); for (String variant : allVariantOfDependence) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, variant); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("For attribute dependency name can't be found attributeDefinition.", variant); } } } } return strongDepSet; }</code><technical_language>I prefer like: AttributeDefinition for dependency {}. for else branch</technical_language>

Target:
private Set<AttributeDefinition> findAttributeDefinitionsForDependencies(PerunSession sess, List<String> dependenciesNames) throws InternalErrorException { Set<AttributeDefinition> strongDepSet = new HashSet<>(); for (String s : dependenciesNames) { if (!s.endsWith("*")) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, s); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("AttributeDefinition can't be found for dependency {}", s); } } else { List<String> allVariantOfDependence = getAllSimilarAttributeNames(sess, s.substring(0, s.length() - 2)); for (String variant : allVariantOfDependence) { try { AttributeDefinition attrDef = getAttributeDefinition(sess, variant); strongDepSet.add(attrDef); } catch (AttributeNotExistsException ex) { log.error("For attribute dependency name can't be found attributeDefinition.", variant); } } } } return strongDepSet; }
Source:
<code>private void showAddViaUrlDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.add_podcast_by_url); View content = View.inflate(getContext(), R.layout.edit_text_dialog, null); alertViewBinding = EditTextDialogBinding.bind(content); alertViewBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : ""; if (clipboardContent.trim().startsWith("http")) { alertViewBinding.urlEditText.setText(clipboardContent.trim()); } <START> builder.setView(content); <END> builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(alertViewBinding.urlEditText.getText().toString())); builder.setNegativeButton(R.string.cancel_label, null); builder.show(); }</code><technical_language>I line alertViewBinding.getRoot() instead</technical_language>

Target:
private void showAddViaUrlDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(R.string.add_podcast_by_url); View content = View.inflate(getContext(), R.layout.edit_text_dialog, null); EditTextDialogBinding alertViewBinding = EditTextDialogBinding.bind(content); alertViewBinding.urlEditText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : ""; if (clipboardContent.trim().startsWith("http")) { alertViewBinding.urlEditText.setText(clipboardContent.trim()); } builder.setView(alertViewBinding.getRoot()); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(alertViewBinding.urlEditText.getText().toString())); builder.setNegativeButton(R.string.cancel_label, null); builder.show(); }
Source:
<code>public final void initialize(final URL location, final ResourceBundle resources) { final int initialCapacity = 10; this.notifications = new PriorityQueue<>(initialCapacity, <START> (n1, n2) -> n1.getPriority() - n2.getPriority()); <END> hide(); listen(NOTIFY, (controller, args) -> { assert (args.length == 1 && args[0] instanceof Notification); Notification notification = (Notification) args[0]; notifications.add(notification); if (!displaying) { displayNext(); } }); }</code><technical_language>Comparable needs consistent equals. return 0 iff equals returns true (and hashmap returns objects)</technical_language>

Target:
public final void initialize(final URL location, final ResourceBundle resources) { final int initialCapacity = 10; this.notifications = new PriorityQueue<>(initialCapacity, ( notification1, notification2) -> { if (notification1.getPriority() == notification2.getPriority()) { return Boolean.compare(notification1.equals(notification2), true); } else { return notification1.getPriority() - notification2.getPriority(); } }); hide(); listen(NOTIFY, (controller, args) -> { assert args.length == 1 && args[0] instanceof AbstractNotification; AbstractNotification notification = (AbstractNotification) args[0]; if (!notifications.contains(notification)) { notifications.add(notification); } if (!displaying) { displayNext(); } }); }
Source:
<code>public void testTransformNativeRserveSingleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); <START> Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); <END> }</code><technical_language>check for newcol in newDdf4</technical_language>

Target:
public void testTransformNativeRserveSingleExpressionInPlaceFalse() throws DDFException { Boolean inPlace = Boolean.FALSE; DDF newDdf3 = ddf.copy(); DDF newDdf4 = newDdf3.Transform.transformNativeRserve("newcol = deptime / arrtime", inPlace); Assert.assertNotNull(newDdf3); Assert.assertNotNull(newDdf4); Assert.assertEquals("transformed DDF newDdf4 should have newcol added", "newcol", newDdf4.getColumnName(8)); Assert.assertFalse("With inPlace being false, two DDF should have different UUID", newDdf3.getUUID().equals(newDdf4.getUUID())); }
Source:
<code><START> private double countCurrentNumberOfCrossings(final GraphInfoHolder currentGraph) { <END> double totalCrossings = 0; Deque<GraphInfoHolder> countCrossingsIn = new ArrayDeque<>(); countCrossingsIn.push(currentGraph); while (!countCrossingsIn.isEmpty()) { GraphInfoHolder gD = countCrossingsIn.pop(); double modelOrderInfluence = 0; if (currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY) != OrderingStrategy.NONE) { modelOrderInfluence += currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_NODE_INFLUENCE) * countModelOrderNodeChanges(gD.currentNodeOrder(), currentGraph.lGraph().getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY)); modelOrderInfluence += currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_PORT_INFLUENCE) * countModelOrderPortChanges(gD.currentNodeOrder()); } totalCrossings += gD.crossCounter().countAllCrossings(gD.currentNodeOrder()) + modelOrderInfluence; for (LGraph childLGraph : gD.childGraphs()) { GraphInfoHolder child = graphInfoHolders.get(childLGraph.id); if (!child.dontSweepInto()) { totalCrossings += countCurrentNumberOfCrossings(child); } } } return totalCrossings; }</code><technical_language>Do a chance preserve int here? reasons: 1) int feels more natural for a _count_ 2) int avoids floating point equality</technical_language>

Target:
private double countCurrentNumberOfCrossings(final GraphInfoHolder currentGraph) { double totalCrossings = 0; Deque<GraphInfoHolder> countCrossingsIn = new ArrayDeque<>(); countCrossingsIn.push(currentGraph); while (!countCrossingsIn.isEmpty()) { GraphInfoHolder gD = countCrossingsIn.pop(); double modelOrderInfluence = 0; OrderingStrategy modelOrderStrategy = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_STRATEGY); double crossingCounterNodeInfluence = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_NODE_INFLUENCE); double crossingCounterPortInfluence = currentGraph.lGraph() .getProperty(LayeredOptions.CONSIDER_MODEL_ORDER_CROSSING_COUNTER_PORT_INFLUENCE); if (modelOrderStrategy != OrderingStrategy.NONE) { modelOrderInfluence += crossingCounterNodeInfluence * countModelOrderNodeChanges(gD.currentNodeOrder(), modelOrderStrategy); modelOrderInfluence += crossingCounterPortInfluence * countModelOrderPortChanges(gD.currentNodeOrder()); } totalCrossings += gD.crossCounter().countAllCrossings(gD.currentNodeOrder()) + modelOrderInfluence; for (LGraph childLGraph : gD.childGraphs()) { GraphInfoHolder child = graphInfoHolders.get(childLGraph.id); if (!child.dontSweepInto()) { totalCrossings += countCurrentNumberOfCrossings(child); } } } return totalCrossings; }
Source:
<code>public void testLoadDataObjectsWithNonNullWorkspaceProject() { <START> assertTrue(dataObjectsService.loadDataObjects(workspaceProject).isEmpty()); <END> }</code><technical_language>Please assertj assertion. In case of fail error message explaining list sizes. Current implementation print assertion error, expected true false reference list size</technical_language>

Target:
public void testLoadDataObjectsWithNonNullWorkspaceProject() { assertThat(dataObjectsService.loadDataObjects(workspaceProject)).isEmpty(); }
Source:
<code>public AffinityLabelListModel(VdcQueryType queryType) { this.queryType = queryType; setTitle(ConstantsManager.getInstance().getConstants().affinityLabelsTitle()); setHelpTag(HelpTag.affinity_groups); setHashName("affinity_labels"); setNewCommand(new UICommand("New", this)); setEditCommand(new UICommand("Edit", this)); setRemoveCommand(new UICommand("Remove", this)); entitiesNameMap.setEntity(new HashMap<>()); updateActionAvailability(); loadEntitiesNameMap(); getItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); getSelectedItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); <START> getEntityChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); <END> }</code><technical_language>overriding onEntityChanged, is a need for this listener? in super.onEntityChanged entityChangeEvent is fired,which call this listener. call loadEntitiesNameMap(), call method in onEntityChanged()</technical_language>

Target:
public AffinityLabelListModel(VdcQueryType queryType) { this.queryType = queryType; setTitle(ConstantsManager.getInstance().getConstants().affinityLabelsTitle()); setHelpTag(HelpTag.affinity_groups); setHashName("affinity_labels"); setNewCommand(new UICommand("New", this)); setEditCommand(new UICommand("Edit", this)); setRemoveCommand(new UICommand("Remove", this)); entitiesNameMap.setEntity(new HashMap<>()); updateActionAvailability(); loadEntitiesNameMap(); getItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); getSelectedItemsChangedEvent().addListener((ev, sender, args) -> loadEntitiesNameMap()); }
Source:
<code>public void testLineColumnAfterCopyConstructor() throws IOException { final String charsetName = StandardCharsets.ISO_8859_1.name(); final FileText fileText = new FileText(new File(getPath("InputFileTextImportControl.xml")), charsetName); final FileText copy = new FileText(fileText); assertNull("LineBreaks not null", Whitebox.getInternalState(copy, "lineBreaks")); final LineColumn lineColumn = copy.lineColumn(100); assertEquals("Invalid line", 3, lineColumn.getLine()); <START> if (fileText.getFullText().chars().anyMatch(character -> character == '\r')) { <END> assertEquals("Invalid column", 44, lineColumn.getColumn()); } else { assertEquals("Invalid column", 46, lineColumn.getColumn()); } }</code><technical_language>I is need wrapped some util method explain meaning of it. reused other part of code do 44 + lineSeparator.size() in similar way</technical_language>

Target:
public void testLineColumnAfterCopyConstructor() throws IOException { final Charset charset = StandardCharsets.ISO_8859_1; final String filepath = getPath("InputFileTextImportControl.xml"); final FileText fileText = new FileText(new File(filepath), charset.name()); final FileText copy = new FileText(fileText); assertNull("LineBreaks not null", Whitebox.getInternalState(copy, "lineBreaks")); final LineColumn lineColumn = copy.lineColumn(100); assertEquals("Invalid line", 3, lineColumn.getLine()); if (CheckUtil.CRLF.equals(CheckUtil.getLineSeparatorForFile(filepath, charset))) { assertEquals("Invalid column", 44, lineColumn.getColumn()); } else { assertEquals("Invalid column", 46, lineColumn.getColumn()); } }
Source:
<code>@Override protected final FilePath write(FileCredentials credentials, FilePath dir) throws IOException, InterruptedException { FilePath secret = dir.child(credentials.getFileName()); copy(secret, credentials); <START> if (secret.isDirectory()) { <END> secret.chmod(0700); } else { secret.chmod(0400); } return secret; }</code><technical_language>sense get rid of copy ZipFileBinding direct extend AbstractOnDiskBinding</technical_language>

Target:
@Override protected final FilePath write(FileCredentials credentials, FilePath dir) throws IOException, InterruptedException { FilePath secret = dir.child(credentials.getFileName()); secret.copyFrom(credentials.getContent()); secret.chmod(0400); return secret; }
Source:
<code>public void update(InventoryScreen inventoryScreen, SolApplication solApplication) { Hero hero = solApplication.getGame().getHero(); SolItem selectedItem = inventoryScreen.getSelectedItem(); boolean itemPurchasable = (selectedItem != null && hero.getMoney() >= selectedItem.getPrice() && hero.getItemContainer().canAdd(selectedItem)); inventoryScreen.getInteractButton().setEnabled(itemPurchasable); <START> inventoryScreen.setInteractText("Buy"); <END> }</code><technical_language>setting (static) button text in Update()</technical_language>

Target:
public void update(InventoryScreen inventoryScreen, SolApplication solApplication) { Hero hero = solApplication.getGame().getHero(); SolItem selectedItem = inventoryScreen.getSelectedItem(); boolean itemPurchasable = (selectedItem != null && hero.getMoney() >= selectedItem.getPrice() && hero.getItemContainer().canAdd(selectedItem)); inventoryScreen.getInteractButton().setEnabled(itemPurchasable); }
Source:
<code>public static void cleanup() throws DotDataException, DotSecurityException, AlreadyExistException { if (null != schemeStepActionResult1 && null != schemeStepActionResult1.getScheme()) { final WorkflowScheme wfScheme = schemeStepActionResult1.getScheme(); <START> wfScheme.setArchived(true); <END> workflowAPI.saveScheme(wfScheme, user); try { Future<WorkflowScheme> result = workflowAPI.deleteScheme(wfScheme, user); result.get(); }catch (InterruptedException | ExecutionException e){ assertTrue(e.getMessage(),false); } } if (null != schemeStepActionResult2 && null != schemeStepActionResult2.getScheme()) { final WorkflowScheme wfScheme2 = schemeStepActionResult2.getScheme(); wfScheme2.setArchived(true); workflowAPI.saveScheme(wfScheme2, user); try { Future<WorkflowScheme> result = workflowAPI.deleteScheme(wfScheme2, user); result.get(); }catch (InterruptedException | ExecutionException e){ assertTrue(e.getMessage(),false); } } }</code><technical_language>**archive** method in **WorkflowAPI**</technical_language>

Target:
public static void cleanup() throws DotDataException, DotSecurityException, AlreadyExistException { if (null != schemeStepActionResult1 && null != schemeStepActionResult1.getScheme()) { final WorkflowScheme wfScheme = schemeStepActionResult1.getScheme(); workflowAPI.archive(wfScheme, user); workflowAPI.deleteScheme(wfScheme, user); } if (null != schemeStepActionResult2 && null != schemeStepActionResult2.getScheme()) { final WorkflowScheme wfScheme2 = schemeStepActionResult2.getScheme(); workflowAPI.archive(wfScheme2, user); workflowAPI.deleteScheme(wfScheme2, user); } }
Source:
<code>protected double invertPosition(double value) { <START> return -1 * value + 1; <END> }</code><technical_language>So... return 1 - value;? I missing here? floating point multiplication</technical_language>

Target:
protected static double invertPosition(double value) { return 1 - value; }
Source:
<code>private void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, VMSnapshotVO vmSnapshotVo) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId()); if (serviceOfferingVO.isDynamic()) { List<VMSnapshotDetailsVO> vmSnapshotDetails = _vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId()); <START> for (VMSnapshotDetailsVO detail : vmSnapshotDetails) { <END> UserVmDetailVO userVmDetail = _userVmDetailsDao.findDetail(userVm.getId(), detail.getName()); if (userVmDetail != null) { userVmDetail.setValue(detail.getValue()); _userVmDetailsDao.update(userVmDetail.getId(), userVmDetail); } else { _userVmDetailsDao.addDetail(userVm.getId(), detail.getName(), detail.getValue(), detail.isDisplay()); } } } }</code><technical_language>Check if saveDetails() individual calls update details need wrapped in transaction</technical_language>

Target:
protected void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, VMSnapshotVO vmSnapshotVo) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId()); if (serviceOfferingVO.isDynamic()) { List<VMSnapshotDetailsVO> vmSnapshotDetails = _vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId()); List<UserVmDetailVO> userVmDetails = new ArrayList<UserVmDetailVO>(); for (VMSnapshotDetailsVO detail : vmSnapshotDetails) { userVmDetails.add(new UserVmDetailVO(userVm.getId(), detail.getName(), detail.getValue(), detail.isDisplay())); } _userVmDetailsDao.saveDetails(userVmDetails); } }
Source:
<code>public String call() throws IOException { <START> HttpURLConnection.setFollowRedirects(false); <END> HttpURLConnection connection = (HttpURLConnection)url.openConnection(); int statusCode = connection.getResponseCode(); if (statusCode != 200) { throw new IOException("Got status code: " + statusCode + " while downloading schema"); } InputStream urlStream = connection.getInputStream(); try { return Util.readAsUTF8(urlStream); } finally { urlStream.close(); } }</code><technical_language>follow redirects</technical_language>

Target:
public String call() throws IOException { HttpURLConnection connection = (HttpURLConnection)url.openConnection(); int statusCode = connection.getResponseCode(); if (statusCode != 200) { throw new IOException("Got status code: " + statusCode + " while downloading " + "schema with url: " + url.toString()); } InputStream urlStream = connection.getInputStream(); try { return Util.readAsUTF8(urlStream); } finally { urlStream.close(); } }
Source:
<code>public void testSplitBrainProtectionNotChecked_whenIsNotEnabled() { String disabledSBPName = "disabled-quorum"; SplitBrainProtectionConfig disabledSBPConfig = new SplitBrainProtectionConfig() .setName(disabledSBPName) .setMinimumClusterSize(3); MapConfig mapConfig = new MapConfig(randomMapName()) .setSplitBrainProtectionName(disabledSBPName); Config config = new Config() .addSplitBrainProtectionConfig(disabledSBPConfig) .addMapConfig(mapConfig); HazelcastInstance instance = createHazelcastInstance(config); <START> SplitBrainProtectionService quorumService = instance.getSplitBrainProtectionService(); <END> quorumService.ensureNoSplitBrain(disabledSBPName, disabledSBPConfig.getProtectOn()); instance.getMap(mapConfig.getName()).put("key", "value"); }</code><technical_language>Uber-minor: naming splitBrainProtectionService simply extracting local variable a alternative called QuorumService anymore</technical_language>

Target:
public void testSplitBrainProtectionNotChecked_whenIsNotEnabled() { String disabledSBPName = "disabled-quorum"; SplitBrainProtectionConfig disabledSBPConfig = new SplitBrainProtectionConfig() .setName(disabledSBPName) .setMinimumClusterSize(3); MapConfig mapConfig = new MapConfig(randomMapName()) .setSplitBrainProtectionName(disabledSBPName); Config config = new Config() .addSplitBrainProtectionConfig(disabledSBPConfig) .addMapConfig(mapConfig); HazelcastInstance instance = createHazelcastInstance(config); instance.getSplitBrainProtectionService().ensureNoSplitBrain(disabledSBPName, disabledSBPConfig.getProtectOn()); instance.getMap(mapConfig.getName()).put("key", "value"); }
Source:
<code>private void updateExportDialogAutoScaleSettings(boolean value) { IDialogSettings settings = getExportDialogSettings(); settings.put(AbstractExportRepresentationsAsImagesDialog.AUTO_SCALE_SETTING_PROPERTY, value); if (value) { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, <START> 100); <END> } else { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 0); } }</code><technical_language>10</technical_language>

Target:
private void updateExportDialogAutoScaleSettings(boolean value) { IDialogSettings settings = getExportDialogSettings(); settings.put(AbstractExportRepresentationsAsImagesDialog.AUTO_SCALE_SETTING_PROPERTY, value); if (value) { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 10); } else { settings.put(AbstractExportRepresentationsAsImagesDialog.SCALE_LEVEL_SETTING_PROPERTY, 0); } }
Source:
<code>public DateUiColumn(final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final DatePickerSingletonDOMElementFactory factory) { super(headerMetaData, new CellRenderer<Date, DatePicker, DatePickerDOMElement>(factory) { @Override protected void doRenderCellContent(final Text t, final Date value, final GridBodyCellRenderContext context) { t.setText(format(value)); } }, width, isResizable, isVisible, access, factory); <START> } <END></code><technical_language>I reuse GWTDateConverter java static String format(final Date value) { return GWTDateConverter.getInstance().format(value); }</technical_language>

Target:
public DateUiColumn( final List<HeaderMetaData> headerMetaData, final double width, final boolean isResizable, final boolean isVisible, final GuidedDecisionTablePresenter.Access access, final DatePickerSingletonDOMElementFactory factory ) { super( headerMetaData, makeColumnRenderer(factory), width, isResizable, isVisible, access, factory ); }
Source:
<code>private File newFile(int index) { createDirectoryIfDoesNotExist(); File fresh = new File(diagnostics.directory, format(fileName, index)); <START> logger.info("Current diagnostics log file is " + fresh.getAbsolutePath()); <END> return fresh; }</code><technical_language>I print directory. Diagnostics log directory is [....]</technical_language>

Target:
private File newFile(int index) { createDirectoryIfDoesNotExist(); logger.info("Diagnostics log directory is [" + diagnostics.directory + "]"); return new File(diagnostics.directory, format(fileName, index)); }
Source:
<code>public Enumerable<Object[]> scan(DataContext root) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); final Access stateAccess = AuthorizationUtils.authorizeAllResourceActions( authenticationResult, Collections.singletonList(new ResourceAction(new Resource("STATE", ResourceType.STATE), Action.READ)), authorizerMapper ); if (!stateAccess.isAllowed()) { <START> throw new ForbiddenException("Insufficient permission to view servers :" + stateAccess); <END> } final List<Object[]> rows = new ArrayList<>(); final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final int serverSegmentsTableSize = SERVER_SEGMENTS_SIGNATURE.getRowOrder().size(); for (ImmutableDruidServer druidServer : druidServers) { final Iterable<DataSegment> authorizedServerSegments = AuthorizationUtils.filterAuthorizedResources( authenticationResult, druidServer.getLazyAllSegments(), SEGMENT_RA_GENERATOR, authorizerMapper ); for (DataSegment segment : authorizedServerSegments) { Object[] row = new Object[serverSegmentsTableSize]; row[0] = druidServer.getHost(); row[1] = segment.getId(); rows.add(row); } } return Linq4j.asEnumerable(rows); }</code><technical_language>Whitespace colon here</technical_language>

Target:
public Enumerable<Object[]> scan(DataContext root) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); checkStateReadAccessForServers(authenticationResult, authorizerMapper); final List<Object[]> rows = new ArrayList<>(); final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final int serverSegmentsTableSize = SERVER_SEGMENTS_SIGNATURE.getRowOrder().size(); for (ImmutableDruidServer druidServer : druidServers) { final Iterable<DataSegment> authorizedServerSegments = AuthorizationUtils.filterAuthorizedResources( authenticationResult, druidServer.getLazyAllSegments(), SEGMENT_RA_GENERATOR, authorizerMapper ); for (DataSegment segment : authorizedServerSegments) { Object[] row = new Object[serverSegmentsTableSize]; row[0] = druidServer.getHost(); row[1] = segment.getId(); rows.add(row); } } return Linq4j.asEnumerable(rows); }
Source:
<code>void solve(Class<?> in) throws InvalidChainException { InvokableMethod[] methods = typeof.getMethodsMatchingInput(in); if (methods.length == 0) { throw new InvalidChainException( "Cannot find any valid path in operation chain - no method found for operation '" + typeof.getId() + "' and for first input type '" + in.getName() + "'"); } if (next == null) { method = methods[0]; return; } for (InvokableMethod m : methods) { Class<?> nextIn = m.getOutputType(); if (nextIn == Void.TYPE || nextIn.equals(Object.class)) { nextIn = in; } try { next.solve(nextIn); method = m; return; } catch (InvalidChainException cause) { <START> log.error(cause, cause); <END> } } throw new InvalidChainException( "Cannot find any valid path in operation chain - no method found for operation '" + typeof.getId() + "' and for first input type '" + in.getName() + "'"); }</code><technical_language>this one, resolving chain backtracking if adequate I exception logged (it's flow control)</technical_language>

Target:
void solve(Class<?> in) throws InvalidChainException { InvokableMethod[] methods = typeof.getMethodsMatchingInput(in); if (methods.length == 0) { throw new InvalidChainException( "Cannot find any valid path in operation chain - no method found for operation '" + typeof.getId() + "' and for first input type '" + in.getName() + "'"); } if (next == null) { method = methods[0]; return; } for (InvokableMethod m : methods) { Class<?> nextIn = m.getOutputType(); if (nextIn == Void.TYPE || nextIn.equals(Object.class)) { nextIn = in; } try { next.solve(nextIn); method = m; return; } catch (InvalidChainException cause) { } } throw new InvalidChainException( "Cannot find any valid path in operation chain - no method found for operation '" + typeof.getId() + "' and for first input type '" + in.getName() + "'"); }
Source:
<code>public Map<Integer, GermplasmFolderMetadata> getSampleFolderMetadata(final List<Integer> folderIds) { if (folderIds.isEmpty()) { return Collections.emptyMap(); } <START> final String folderMetaDataQuery = "SELECT parent.list_id AS listId, COUNT(child.list_id) AS numberOfChildren " <END> + "FROM sample_list parent LEFT OUTER JOIN sample_list child ON child.hierarchy = parent.list_id " + "WHERE parent.list_id IN (:folderIds) GROUP BY parent.list_id"; final SQLQuery setResultTransformer = this.getSession().createSQLQuery(folderMetaDataQuery); setResultTransformer.setParameterList("folderIds", folderIds); setResultTransformer.addScalar("listId", new IntegerType()); setResultTransformer.addScalar("numberOfChildren", new IntegerType()); setResultTransformer.setResultTransformer(Transformers.aliasToBean(GermplasmFolderMetadata.class)); final List<GermplasmFolderMetadata> list = setResultTransformer.list(); return Maps.uniqueIndex(list, new Function<GermplasmFolderMetadata, Integer>() { @Override public Integer apply(final GermplasmFolderMetadata folderMetaData) { return folderMetaData.getListId(); } }); }</code><technical_language>@cuenyad HQL instead of SQL here</technical_language>

Target:
public Map<Integer, GermplasmFolderMetadata> getSampleFolderMetadata(final List<Integer> folderIds) { final List<GermplasmFolderMetadata> list; if (folderIds.isEmpty()) { return Collections.emptyMap(); } try { final String folderMetaDataQuery = "SELECT parent.list_id AS listId, COUNT(child.list_id) AS numberOfChildren " + "FROM sample_list parent LEFT OUTER JOIN sample_list child ON child.hierarchy = parent.list_id " + "WHERE parent.list_id IN (:folderIds) GROUP BY parent.list_id"; final SQLQuery setResultTransformer = this.getSession().createSQLQuery(folderMetaDataQuery); setResultTransformer.setParameterList("folderIds", folderIds); setResultTransformer.addScalar("listId", new IntegerType()); setResultTransformer.addScalar("numberOfChildren", new IntegerType()); setResultTransformer.setResultTransformer(Transformers.aliasToBean(GermplasmFolderMetadata.class)); list = setResultTransformer.list(); } catch (final HibernateException e) { throw new MiddlewareQueryException("Error with getSampleFolderMetadata(folderIds=" + folderIds.toString() + ") query from sample_list: " + e.getMessage(), e); } return Maps.uniqueIndex(list, new Function<GermplasmFolderMetadata, Integer>() { @Override public Integer apply(final GermplasmFolderMetadata folderMetaData) { return folderMetaData.getListId(); } }); }
Source:
<code>public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); ExpireBindingConfig config = new ExpireBindingConfig(); <START> Duration expiresAfter = parseDuration(bindingConfig); <END> config.expiresAfterMs = expiresAfter.toMillis(); config.expiresAfterAsText = formatDuration(expiresAfter); addBindingConfig(item, config); }</code><technical_language>more easy store string input here? convert get more original input</technical_language>

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); ExpireBindingConfig config = new ExpireBindingConfig(); String[] durationAndState = bindingConfig.split(",", 2); Duration expiresAfter = parseDuration(durationAndState[0].trim()); config.expiresAfterMs = expiresAfter.toMillis(); config.expiresAfterAsText = formatDuration(expiresAfter); if (durationAndState.length > 1) { String stateAsString = durationAndState[1].trim(); config.expiredState = TypeParser.parseState(item.getAcceptedDataTypes(), stateAsString); if (config.expiredState == null) { throw new BindingConfigParseException("The string '" + stateAsString + "' does not represent a valid state for item " + item.getName()); } } addBindingConfig(item, config); }
Source:
<code>public int leave(IASTDeclaration declaration) { if (getClassMethod(declaration) != null) { ContextInfo currentContext = methodsStack.peek(); switch (currentContext.checkerMode) { case MODE_CONST: if (!currentContext.classMembersAreUsed && !isVirtual(currentContext.method)) { <START> reportProblem(ER_ID_MethodShouldBeStatic, declaration, currentContext.method.getName()); <END> } break; case MODE_NON_CONST: if (!currentContext.classMembersAreUsed && !isVirtual(currentContext.method)) { reportProblem(ER_ID_MethodShouldBeStatic, declaration, currentContext.method.getName()); } else if (!currentContext.classMembersAreWritten && !isVirtual(currentContext.method)) { reportProblem(ER_ID_MethodShouldBeConst, declaration, currentContext.method.getName()); } break; case MODE_STATIC: break; } lastCachedContextInfo = methodsStack.pop(); } return PROCESS_CONTINUE; }</code><technical_language>Passing 'declaration' argument yellow squiggly drawn entire function definition. I suggest passing in IASTName for method name instead</technical_language>

Target:
public int leave(IASTDeclaration declaration) { if (getClassMethod(declaration) != null) { ContextInfo currentContext = methodsStack.peek(); if (currentContext.hasProblems) { lastCachedContextInfo = methodsStack.pop(); return PROCESS_CONTINUE; } switch (currentContext.checkerMode) { case MODE_CONST: if (!currentContext.classMembersAreUsed && !isVirtual(currentContext)) { reportProblem(ER_ID_MethodShouldBeStatic, getMethodName(declaration), currentContext.method.getName()); } break; case MODE_NON_CONST: if (!currentContext.classMembersAreUsed && !isVirtual(currentContext)) { reportProblem(ER_ID_MethodShouldBeStatic, getMethodName(declaration), currentContext.method.getName()); } else if (!currentContext.classMembersAreWritten && !isVirtual(currentContext)) { reportProblem(ER_ID_MethodShouldBeConst, getMethodName(declaration), currentContext.method.getName()); } break; case MODE_STATIC: break; } lastCachedContextInfo = methodsStack.pop(); } return PROCESS_CONTINUE; }
Source:
<code>public void resolveTest() { final String baseUri = "<LINK_0>"; final String pathToResolve = "picture.jpg"; String resolve = ""; try { resolve = JsonLdUrl.resolve(baseUri, pathToResolve); } catch (final Exception e) { <START> assertTrue(false); <END> } assertEquals(baseUri + "/" + pathToResolve, resolve); }</code><technical_language>usual pattern for this is a fail end, put assertEquals of try-catch block. I next method this way, ideal</technical_language>

Target:
public void resolveTest() { final String baseUri = "<LINK_0>"; final String pathToResolve = "picture.jpg"; String resolve = ""; try { resolve = JsonLdUrl.resolve(baseUri, pathToResolve); assertEquals(baseUri + "/" + pathToResolve, resolve); } catch (final Exception e) { assertTrue(false); } }
Source:
<code><START> private static boolean liesInRange(double point, double rangeStart, double rangeEnd) <END> { return point >= rangeStart && point <= rangeEnd; }</code><technical_language>inline this method for readability</technical_language>

Target:
private static boolean liesInRange(double point, double rangeStart, double rangeEnd) { return Double.compare(point, rangeStart) > 0 && Double.compare(point, rangeEnd) < 0; }
Source:
<code>public static boolean isMailReceivedBySubject(String emailSubject, String folder) throws ESBMailTransportIntegrationTestException { Store store = null; boolean emailReceived = false; try { store = getConnection(); long startTime = System.currentTimeMillis(); while (!emailReceived && (System.currentTimeMillis() - startTime) < WAIT_TIME_MS) { Folder mailFolder = store.getFolder(folder); mailFolder.open(Folder.READ_WRITE); SearchTerm searchTerm = new AndTerm(new SubjectTerm(emailSubject), new BodyTerm(emailSubject)); Message[] messages = mailFolder.search(searchTerm); for (Message message : messages) { if (message.getSubject().contains(emailSubject)) { log.info("Found the email emailSubject : " + emailSubject); emailReceived = true; break; } } } return emailReceived; } catch (MessagingException ex) { log.error("Error when getting mail count ", ex); throw new ESBMailTransportIntegrationTestException("Error when getting mail count ", ex); } finally { if (store != null) { try { store.close(); } catch (MessagingException e) { <START> log.error("Error when closing the store ", e); <END> } } } }</code><technical_language>Change log.error log.warn</technical_language>

Target:
public static boolean isMailReceivedBySubject(String emailSubject, String folder) throws ESBMailTransportIntegrationTestException { boolean emailReceived = false; Folder mailFolder; Store store = getConnection(); try { mailFolder = store.getFolder(folder); mailFolder.open(Folder.READ_WRITE); SearchTerm searchTerm = new AndTerm(new SubjectTerm(emailSubject), new BodyTerm(emailSubject)); Message[] messages = mailFolder.search(searchTerm); for (Message message : messages) { if (message.getSubject().contains(emailSubject)) { log.info("Found the email emailSubject : " + emailSubject); emailReceived = true; break; } } return emailReceived; } catch (MessagingException ex) { log.error("Error when getting the unread emails ", ex); throw new ESBMailTransportIntegrationTestException("Error when getting the unread emails ", ex); } finally { if (store != null) { try { store.close(); } catch (MessagingException e) { log.warn("Error when closing the store ", e); } } } }
Source:
<code>private static String getCpuAbi() { String cpuAbi = Build.CPU_ABI; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cpuAbi = SupportedAbiWrapper.getSupportedAbis(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { cpuAbi = Abi2Wrapper.getAbi1andAbi2(); } <START> return cpuAbi; <END> }</code><technical_language>This method simplified java if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return SupportedAbiWrapper.getSupportedAbis(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { return Abi2Wrapper.getAbi1andAbi2(); } return Build.CPU_ABI; is worth wrapping Build.CPU_ABI in array output format is consistent of API level</technical_language>

Target:
private static String[] getCpuAbi() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return SupportedAbiWrapper.getSupportedAbis(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { return Abi2Wrapper.getAbi1andAbi2(); } return new String[]{Build.CPU_ABI}; }
Source:
<code>public Response requestTranslatorStatus(@PathParam("code") String code, @HeaderParam("deviceId") String deviceIdHeader, @QueryParam("deviceId") String deviceIdParam) throws ParserConfigurationException, SAXException,IOException { DateTime currentTime = clock.currentDateTime(); AccessCodeRecord accessCodeRecord = authorizationService.getAccessCode(code); authorizationRecord.setAuthToken(authorizationService.createAuthToken()); String device = deviceIdHeader == null ? deviceIdParam : deviceIdHeader; authorizationRecord.setDeviceId(device); authorizationRecord.setId(authorizationService.createUUID()); if(accessCodeRecord != null && accessCodeRecord.isCurrentlyActive(currentTime)) { authorizationRecord.setDraftAccess(true); } else { authorizationRecord.setDraftAccess(false); } authorizationService.recordNewAuthorization(authorizationRecord); return Response.ok() <START> .header("authToken", authorizationRecord.getAuthToken()) <END> .build(); }</code><technical_language>I I put Response.ok() in a place holder. Response.noContent() a fit returning response body (no XML, HTML JSON..) For reference: <LINK_0></technical_language>

Target:
public Response requestTranslatorStatus(@PathParam("code") String code, @HeaderParam("deviceId") String deviceIdHeader, @QueryParam("deviceId") String deviceIdParam) throws ParserConfigurationException, SAXException,IOException { DateTime currentTime = clock.currentDateTime(); AccessCodeRecord accessCodeRecord = authorizationService.getAccessCode(code); AuthorizationRecord authorizationRecord = new AuthorizationRecord(); authorizationRecord.setAuthToken(AuthTokenGenerator.generate()); String device = deviceIdHeader == null ? deviceIdParam : deviceIdHeader; authorizationRecord.setDeviceId(device); authorizationRecord.setId(UUID.randomUUID()); if(accessCodeRecord != null && accessCodeRecord.isCurrentlyActive(currentTime)) { authorizationRecord.setDraftAccess(true); } else { authorizationRecord.setDraftAccess(false); } authorizationService.recordNewAuthorization(authorizationRecord); return Response.noContent() .header("authToken", authorizationRecord.getAuthToken()) .build(); }
Source:
<code>private void setCurrentTagFromEmptyViewButton(ActionableEmptyViewButtonType button) { <START> ReaderTag tag = ReaderUtils.getDefaultTag(); <END> switch (button) { case DISCOVER: tag = ReaderUtils.getTagFromEndpoint(ReaderTag.DISCOVER_PATH); break; case FOLLOWED: tag = ReaderUtils.getTagFromEndpoint(ReaderTag.FOLLOWING_PATH); break; } mRecyclerView.refreshFilterCriteriaOptions(); if (!ReaderTagTable.tagExists(tag)) { tag = ReaderTagTable.getFirstTag(); } setCurrentTag(tag); }</code><technical_language>a tiny nitpick - put this a default case of switch statement</technical_language>

Target:
private void setCurrentTagFromEmptyViewButton(ActionableEmptyViewButtonType button) { ReaderTag tag; switch (button) { case DISCOVER: tag = ReaderUtils.getTagFromEndpoint(ReaderTag.DISCOVER_PATH); break; case FOLLOWED: tag = ReaderUtils.getTagFromEndpoint(ReaderTag.FOLLOWING_PATH); break; default: tag = ReaderUtils.getDefaultTag(); } mRecyclerView.refreshFilterCriteriaOptions(); if (!ReaderTagTable.tagExists(tag)) { tag = ReaderTagTable.getFirstTag(); } setCurrentTag(tag); }