auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CacheResource parse(ConfigResource parent, IdString id) throws AuthException, ResourceNotFoundException { final CurrentUser user = self.get(); if (user instanceof AnonymousUser) { throw new AuthException("Authentication required"); } else <START> if(!(user.isIdentifiedUser())) { <END> throw new ResourceNotFoundException(); } if (!user.getCapabilities().canViewCaches()) { throw new AuthException("not allowed to view caches"); } String cacheName = id.get(); String pluginName = "gerrit"; int i = cacheName.lastIndexOf('-'); if (i != -1) { pluginName = cacheName.substring(0, i); cacheName = cacheName.length() > i + 1 ? cacheName.substring(i + 1) : ""; } Provider<Cache<?, ?>> cacheProvider = cacheMap.byPlugin(pluginName).get(cacheName); if (cacheProvider == null) { throw new ResourceNotFoundException(id); } return new CacheResource(pluginName, cacheName, cacheProvider); }</code><technical_language>() is unnecessary</technical_language>

Target:
public CacheResource parse(ConfigResource parent, IdString id) throws AuthException, ResourceNotFoundException { CurrentUser user = self.get(); if (user instanceof AnonymousUser) { throw new AuthException("Authentication required"); } else if (!user.isIdentifiedUser()) { throw new ResourceNotFoundException(); } else if (!user.getCapabilities().canViewCaches()) { throw new AuthException("not allowed to view caches"); } String cacheName = id.get(); String pluginName = "gerrit"; int i = cacheName.lastIndexOf('-'); if (i != -1) { pluginName = cacheName.substring(0, i); cacheName = cacheName.length() > i + 1 ? cacheName.substring(i + 1) : ""; } Provider<Cache<?, ?>> cacheProvider = cacheMap.byPlugin(pluginName).get(cacheName); if (cacheProvider == null) { throw new ResourceNotFoundException(id); } return new CacheResource(pluginName, cacheName, cacheProvider); }
Source:
<code>public <T> T service(String name) { if (!enterBusy()) return null; try { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); <START> Collection<ServiceContextImpl> ctxs = Optional.ofNullable(lookupDeployedServiceId(name)) <END> .map(locServices::get).orElse(null); if (F.isEmpty(ctxs)) return null; for (ServiceContextImpl ctx : ctxs) { Service svc = ctx.service(); if (svc != null) return (T)svc; } return null; } finally { leaveBusy(); } }</code><technical_language>This two-liner is evil. I need spend more time understanding if a long code block if statements</technical_language>

Target:
@Override public <T> T service(String name) { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); Collection<ServiceContextImpl> ctxs; synchronized (locSvcs) { ctxs = locSvcs.get(name); } if (ctxs == null) return null; synchronized (ctxs) { if (ctxs.isEmpty()) return null; for (ServiceContextImpl ctx : ctxs) { Service svc = ctx.service(); if (svc != null) return (T)svc; } return null; } }
Source:
<code>void notifyException(Exception exception) { this.exception = exception; <START> interruptTestThread(); <END> }</code><technical_language>code simplified if please. If calling Thread.interrupt() interrupted thread is a no-op, suggest instead... if (exception != null && !currentThread().equals(testThread)) { testThread.interrupt(); } ...and remove testThreadInterrupted field separate interruptTestThread() method. Note: this is common practice move possibly-null variable argument of equals a null returns false for equals requiring extra != null check. For example: "nonNullString".equals(nullableString) instead of nullableString != null && nullableString.equals("nonNullString") Note: common practice put cheap-check in if condition: if (exception != null && !currentThread().equals(testThread)) ... instead of if (!currentThread().equals(testThread) && exception != null) ..</technical_language>

Target:
void notifyException(Exception exception) { this.exception = Objects.requireNonNull(exception); if (! Thread.currentThread().equals(testThread) && testThreadInterrupted.compareAndSet(false, true)) { testThread.interrupt(); } }
Source:
<code><START> public void initPlugin(final BRLConditionColumn brlConditionColumn) { <END> plugin.setOriginalColumnConfig52(brlConditionColumn); final NewGuidedDecisionTableColumnWizard wizard = new NewGuidedDecisionTableColumnWizard(mock(WizardView.class), mock(SummaryPage.class), mock(TranslationService.class), mock(DecisionTablePopoverUtils.class)); doReturn(EXTENDED_ENTRY).when(model).getTableFormat(); doReturn(model).when(presenter).getModel(); doReturn(mock(EventBus.class)).when(presenter).getEventBus(); wizard.init(presenter); plugin.init(wizard); }</code><technical_language>this private</technical_language>

Target:
private void initPlugin(final BRLConditionColumn brlConditionColumn) { plugin.setOriginalColumnConfig52(brlConditionColumn); final NewGuidedDecisionTableColumnWizard wizard = new NewGuidedDecisionTableColumnWizard(mock(WizardView.class), mock(SummaryPage.class), mock(TranslationService.class), mock(DecisionTablePopoverUtils.class)); doReturn(EXTENDED_ENTRY).when(model).getTableFormat(); doReturn(model).when(presenter).getModel(); doReturn(mock(EventBus.class)).when(presenter).getEventBus(); wizard.init(presenter); plugin.init(wizard); }
Source:
<code>public Change perform(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 1); final INamedElementEditor editor = ModelUtils .findEditor(element); boolean isDirtyInEditor = false; if (editor != null && editor.isDirty()) { isDirtyInEditor = true; } IQ7NamedElement elementWc = element.getWorkingCopy(pm); try { elementWc.setTags(elementTags); if (!isDirtyInEditor) { if (editor != null) { final IProgressMonitor monitor = pm; Display.getDefault().syncExec(new Runnable() { public void run() { editor.doSave(monitor); } }); } else { WriteAccessChecker writeAccessChecker = new WriteAccessChecker(); <START> if (writeAccessChecker.makeResourceWritable(elementWc)) { <END> elementWc.commitWorkingCopy(true, pm); } } } } catch (Exception e) { Q7UIPlugin.log(e); } finally { elementWc.discardWorkingCopy(); } Tag restoredTag = tag; TagsRegistry registry = Q7UIPlugin.getDefault().getTags(); synchronized (registry) { for (Tag currentTag : registry.getTags()) { if (currentTag.getPath().equals(tag.getPath())) { restoredTag = currentTag; break; } } } return new DeleteTagReferenceChange(element, restoredTag); } finally { pm.done(); } }</code><technical_language>questions refactoring progress</technical_language>

Target:
public Change perform(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 1); final INamedElementEditor editor = ModelUtils .findEditor(element); boolean isDirtyInEditor = false; if (editor != null && editor.isDirty()) { isDirtyInEditor = true; } IQ7NamedElement elementWc = element.getWorkingCopy(pm); try { elementWc.setTags(elementTags); if (!isDirtyInEditor) { if (editor != null) { final IProgressMonitor monitor = pm; Display.getDefault().syncExec(new Runnable() { public void run() { editor.doSave(monitor); } }); } else { elementWc.commitWorkingCopy(true, pm); } } } catch (Exception e) { Q7UIPlugin.log(e); } finally { elementWc.discardWorkingCopy(); } Tag restoredTag = tag; TagsRegistry registry = Q7UIPlugin.getDefault().getTags(); synchronized (registry) { for (Tag currentTag : registry.getTags()) { if (currentTag.getPath().equals(tag.getPath())) { restoredTag = currentTag; break; } } } return new DeleteTagReferenceChange(element, restoredTag); } finally { pm.done(); } }
Source:
<code>protected VariablesDropSupport(TreeViewer viewer, TestSuiteModel model) { super(viewer); <START> fTreeViewer = viewer; <END> fModel = model; }</code><technical_language>if super() is storing viewer, do need store copy</technical_language>

Target:
protected VariablesDropSupport(TreeViewer viewer, TestSuiteModel model) { super(viewer); fModel = model; }
Source:
<code>public void close() { for (Map.Entry<TopicPartition, TopicPartitionWriter> ent : topicPartitionWriters.entrySet()) { try { TopicPartitionWriter writer = ent.getValue(); if (writer != null) { writer.close(); } } catch (ConnectException e) { log.warn( "Unable to close writer for topic partition {}: {}", ent.getKey(), <START> e.getMessage(), <END> e ); } } topicPartitionWriters.clear(); assignment.clear(); }</code><technical_language>nit: this print message twice</technical_language>

Target:
public void close() { for (TopicPartitionWriter writer : topicPartitionWriters.values()) { try { if (writer != null) { writer.close(); } } catch (ConnectException e) { log.warn("Unable to close writer for topic partition {}: ", writer.topicPartition(), e); } } topicPartitionWriters.clear(); assignment.clear(); }
Source:
<code>private static String normaliseTypeName(String dataType) { <START> if (dataType.indexOf("(")<=0) <END> dataType = dataType.toUpperCase().trim(); else dataType = dataType.toUpperCase().trim().substring(0,dataType.indexOf("(")); return dataType; }</code><technical_language>whitespace <=. - good enclose blocks of if/else in {}</technical_language>

Target:
private static String normaliseTypeName(String dataType) { if (dataType.indexOf("(") <= 0) { dataType = dataType.toUpperCase().trim(); } else { dataType = dataType.toUpperCase().trim().substring(0,dataType.indexOf("(")); } return dataType; }
Source:
<code>protected void execute() { try { final InfoResponse response = createProtocol().info(); if (response == null) { <START> logger.error("Failed to connect to neohub [host '{}' port '{}']", <END> new Object[] { hostname, port }); return; } for (NeoHubBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { final String device = provider.getNeoStatDevice(itemName); final NeoStatProperty property = provider.getNeoStatProperty(itemName); final State result = mapResponseToState(response, device, property); if (eventPublisher != null) { eventPublisher.postUpdate(itemName, result); } } } } catch (final RuntimeException e) { logger.warn("Failed to fetch info from neo hub.", e); } }</code><technical_language>this lead ERROR messages in log for polling cycle failed connect, of [this line](<LINK_0></technical_language>

Target:
protected void execute() { try { final InfoResponse response = createProtocol().info(); if (response == null) { return; } for (NeoHubBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { final String device = provider.getNeoStatDevice(itemName); final NeoStatProperty property = provider.getNeoStatProperty(itemName); final State result = mapResponseToState(response, device, property); if (eventPublisher != null) { eventPublisher.postUpdate(itemName, result); } } } } catch (final RuntimeException e) { logger.warn("Failed to fetch info from neo hub.", e); } }
Source:
<code>void updateInfo() { DirectionsGenerator gen = new DirectionsGenerator(itinerary.legs, getActivity().getApplicationContext()); List<Direction> directions = gen.getDirections(); Direction direction_data[] = directions.toArray(new Direction[directions.size()]); DirectionExpandableListAdapter adapter = new DirectionExpandableListAdapter( getActivity(), R.layout.list_direction_item, R.layout.list_subdirection_item, direction_data); mDirectionsListView.setAdapter(adapter); mDirectionsListView.setGroupIndicator(null); Context context = Application.get().getApplicationContext(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel channel = manager.getNotificationChannel(Application.CHANNEL_REALTIME_ID); if(channel.getImportance() != NotificationManager.IMPORTANCE_NONE){ RealtimeService.start(getActivity(), getArguments()); } <START> } <END> else{ if (Application.getPrefs() .getBoolean(getString(R.string.preference_key_trip_plan_notifications), true)) { RealtimeService.start(getActivity(), getArguments()); } } }</code><technical_language>please put else brackets line add a space? } else {</technical_language>

Target:
void updateInfo() { DirectionsGenerator gen = new DirectionsGenerator(itinerary.legs, getActivity().getApplicationContext()); List<Direction> directions = gen.getDirections(); Direction direction_data[] = directions.toArray(new Direction[directions.size()]); DirectionExpandableListAdapter adapter = new DirectionExpandableListAdapter( getActivity(), R.layout.list_direction_item, R.layout.list_subdirection_item, direction_data); mDirectionsListView.setAdapter(adapter); mDirectionsListView.setGroupIndicator(null); Context context = Application.get().getApplicationContext(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel channel = manager.getNotificationChannel(Application.CHANNEL_TRIP_PLAN_UPDATES_ID); if(channel.getImportance() != NotificationManager.IMPORTANCE_NONE){ RealtimeService.start(getActivity(), getArguments()); } } else { if (Application.getPrefs() .getBoolean(getString(R.string.preference_key_trip_plan_notifications), true)) { RealtimeService.start(getActivity(), getArguments()); } } }
Source:
<code>public void eventFilterApplied(TmfFilterAppliedSignal signal) { if (signal.getSource() == this) { return; } Runnable runnable = () -> { <START> ITmfFilter eventFilter = signal.getFilter().getEventFilter(); <END> if (eventFilter == null) { fTable.setData(Key.SEARCH_OBJ, null); fTable.refresh(); } else { fTable.setData(Key.SEARCH_OBJ, eventFilter); fTable.refresh(); searchNext(); } }; Display display = PlatformUI.getWorkbench().getDisplay(); if (display == Display.getCurrent()) { runnable.run(); } else { Display.getDefault().asyncExec(runnable); } }</code><technical_language>check table disposed</technical_language>

Target:
public void eventFilterApplied(TmfFilterAppliedSignal signal) { if (signal.getSource() == this) { return; } Runnable runnable = () -> { if (fTable.isDisposed()) { return; } ITmfFilter eventFilter = signal.getFilter().getEventFilter(); if (eventFilter == null) { fTable.setData(Key.SEARCH_OBJ, null); fTable.refresh(); } else { fTable.setData(Key.SEARCH_OBJ, eventFilter); fTable.refresh(); searchNext(); } }; Display display = PlatformUI.getWorkbench().getDisplay(); if (display == Display.getCurrent()) { runnable.run(); } else { Display.getDefault().asyncExec(runnable); } }
Source:
<code>private static CodeableConcept buildCode(Allergy allergy) { if (allergy.getAllergen() != null) { return FHIRUtils.createCodeableConcept(allergy.getAllergen()); } <START> return null; <END> }</code><technical_language>do in line</technical_language>

Target:
private static CodeableConcept buildCode(Allergy allergy) { return (allergy.getAllergen() != null) ? FHIRUtils.createCodeableConcept(allergy.getAllergen()) : null; }
Source:
<code>public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { supportRequestWindowFeature(Window.FEATURE_NO_TITLE); } catch (final AndroidRuntimeException ex) { <START> Log.e("Error requesting indeterminate progress", ex); <END> } this.setTheme(ActivityMixin.getDialogTheme()); final Bundle extras = getIntent().getExtras(); if (extras != null) { geocode = extras.getString(Intents.EXTRA_GEOCODE); } if (StringUtils.isBlank(geocode)) { showToast(res.getString(R.string.err_detail_cache_find)); finish(); return; } showDialog(); }</code><technical_language>log "Error requesting Window.FEATURE_NO_TITLE"</technical_language>

Target:
public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { supportRequestWindowFeature(Window.FEATURE_NO_TITLE); } catch (final AndroidRuntimeException ex) { Log.e("Error requesting no title feature", ex); } this.setTheme(ActivityMixin.getDialogTheme()); final Bundle extras = getIntent().getExtras(); if (extras != null) { geocode = extras.getString(Intents.EXTRA_GEOCODE); } if (StringUtils.isBlank(geocode)) { showToast(res.getString(R.string.err_detail_cache_find)); finish(); return; } showDialog(); }
Source:
<code>public void samMetricsProvider() { final File[] files = new File[]{ simpleSamWithBaseErrors1, simpleSamWithBaseErrors2, simpleSingleStrandConsensusSamWithBaseErrors, simpleDuplexConsensusSamWithBaseErrors, chrMReadsWithClips}; <START> OUTPUT_DATA_PATH = IOUtil.createTempDir("CollectSamErrorMetricsTest", null); <END> for (final File file : files) { final File vcf = new File(TEST_DIR, "NIST.selected.vcf"); final File outputBaseFileName = new File(OUTPUT_DATA_PATH, file.getName()); outputBaseFileName.deleteOnExit(); final String[] args = { "INPUT=" + file, "OUTPUT=" + outputBaseFileName, "REFERENCE_SEQUENCE=" + CHR_M_REFERENCE.getAbsolutePath(), "ERROR_METRICS=" + "ERROR:TWO_BASE_PADDED_CONTEXT", "ERROR_METRICS=" + "ERROR:CONSENSUS", "ERROR_METRICS=" + "ERROR:NS_IN_READ", "ERROR_METRICS=" + "ERROR:BINNED_CYCLE", "VCF=" + vcf.getAbsolutePath() }; Assert.assertEquals(new CollectSamErrorMetrics().instanceMain(args), 0); errorMetrics.put(file, outputBaseFileName); } }</code><technical_language>This is run test, this create a new temp dir for test, store in a static field. Is want do here? If test temp dir, a non-static field clearer</technical_language>

Target:
public void samMetricsProvider() { final File[] files = new File[]{ simpleSamWithBaseErrors1, simpleSamWithBaseErrors2, simpleSingleStrandConsensusSamWithBaseErrors, simpleDuplexConsensusSamWithBaseErrors, chrMReadsWithClips}; if (OUTPUT_DATA_PATH != null) { throw new PicardException("This should only be called once!"); } OUTPUT_DATA_PATH = IOUtil.createTempDir("CollectSamErrorMetricsTest", null); for (final File file : files) { final File vcf = new File(TEST_DIR, "NIST.selected.vcf"); final File outputBaseFileName = new File(OUTPUT_DATA_PATH, file.getName()); outputBaseFileName.deleteOnExit(); final String[] args = { "INPUT=" + file, "OUTPUT=" + outputBaseFileName, "REFERENCE_SEQUENCE=" + CHR_M_REFERENCE.getAbsolutePath(), "ERROR_METRICS=" + "ERROR:TWO_BASE_PADDED_CONTEXT", "ERROR_METRICS=" + "ERROR:CONSENSUS", "ERROR_METRICS=" + "ERROR:NS_IN_READ", "ERROR_METRICS=" + "ERROR:BINNED_CYCLE", "VCF=" + vcf.getAbsolutePath() }; Assert.assertEquals(new CollectSamErrorMetrics().instanceMain(args), 0); errorMetrics.put(file, outputBaseFileName); } }
Source:
<code>public boolean check() { try { <START> Integer exitCode = hub.getQueryService().getMandatoryContainer(containerId).getExitCode(); <END> if (exitCode == null) { return false; } return exitCode == this.exitCode; } catch (DockerAccessException e) { return false; } }</code><technical_language>Please a local variable name a field. ok for a constructor please in a method</technical_language>

Target:
public boolean check() { try { Integer exitCodeActual = hub.getQueryService().getMandatoryContainer(containerId).getExitCode(); return exitCodeActual != null && exitCodeActual == exitCodeExpected; } catch (DockerAccessException e) { return false; } }
Source:
<code>public SpongeItemStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); String args = new ItemStack(item).getDisplayName(); <START> translation = new SpongeTranslation(statId.substring(0, statId.length() - 1), args); <END> }</code><technical_language>this</technical_language>

Target:
public SpongeItemStatistic(String statId, String itemName, ITextComponent statName, Item item) { super(statId, itemName, statName, item); }
Source:
<code>protected void onCreate(Bundle arg0) { super.onCreate(arg0); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setDisplayShowHomeEnabled(true); bar.setDisplayHomeAsUpEnabled(true); bar.setIcon(android.R.color.transparent); } <START> errorNotification = new OverlayErrorNotification(progressWheel); <END> snackbarErrorNotification = new SnackbarErrorNotification(progressWheel); Bundle bundle = arg0; if ( bundle == null ) { if ( getIntent() != null ) bundle = getIntent().getBundleExtra(Router.EXTRA_BUNDLE); } restore(bundle); blockDrawerFromOpening(); }</code><technical_language>In places name errorNotification for a field is initializing OverlayErrorNotification, overlayErrorNotification name more clean easy understand purpose</technical_language>

Target:
protected void onCreate(Bundle arg0) { super.onCreate(arg0); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setDisplayShowHomeEnabled(true); bar.setDisplayHomeAsUpEnabled(true); bar.setIcon(android.R.color.transparent); } errorNotification = new FullScreenErrorNotification(contentLayout); snackbarErrorNotification = new SnackbarErrorNotification(contentLayout); Bundle bundle = arg0; if ( bundle == null ) { if ( getIntent() != null ) bundle = getIntent().getBundleExtra(Router.EXTRA_BUNDLE); } restore(bundle); blockDrawerFromOpening(); }
Source:
<code>public static TACmiMeasureType fromInt(int type) { if (type >= 0 && type <= 21) { return measureTypes[type]; } else { logger.warn("Received unexpected measure type {}", type); <START> return TACmiMeasureType.UNSUPPORTED; <END> } }</code><technical_language>leave this enum ignorant of used, instead throw exception is done in fromString above, for consistency keeping concerns separated? user of this enum catch exception log layer</technical_language>

Target:
public static TACmiMeasureType fromInt(int type) { for (TACmiMeasureType mtype : TACmiMeasureType.values()) { if (mtype.getTypeValue() == type) { return mtype; } } logger.warn("Received unexpected measure type {}", type); return TACmiMeasureType.UNSUPPORTED; }
Source:
<code>private synchronized void processTableConfigurationItem(WatchedEvent event) { if (event.getPath() == null || event.getPath().isEmpty()) return; try { <START> Stat versionStat = getZooKeeper().exists(event.getPath(), watcher); <END> if (versionStat == null) { return; } byte[] configToRefresh = getZooKeeper().getData(event.getPath(), true, versionStat); if (configToRefresh == null) { return; } if ((versionStat != null) && (versionStat.getVersion() - lastTableConfigVersion == 1)) { lastTableConfigVersion = versionStat.getVersion(); refreshTableConfig(configToRefresh); if (log.isTraceEnabled()) { log.trace( "Successfully refreshed table single table config: " + new String(configToRefresh)); } } else { if (log.isTraceEnabled()) { log.trace("We have to update all table configs."); } if (versionStat != null) { lastTableConfigVersion = versionStat.getVersion(); updateAllTableConfigurations(); } } } catch (Exception e) { log.error("Error getting data from TABLE_CONFIGS zoonode " + e.getMessage()); } return; }</code><technical_language>this removed watcher passed getData</technical_language>

Target:
private synchronized void processTableConfigurationItem(WatchedEvent event) throws KeeperException, InterruptedException { if (event.getPath() == null || event.getPath().isEmpty()) return; Stat versionStat = new Stat(); byte[] configToRefresh = getZooKeeper().getData(event.getPath(), watcher, versionStat); if (configToRefresh == null) { throw new IllegalStateException("The table-config-version znode should have data in it."); } if ((versionStat != null) && (versionStat.getVersion() - lastTableConfigVersion == 1)) { lastTableConfigVersion = versionStat.getVersion(); refreshTableConfig(configToRefresh); if (log.isTraceEnabled()) { log.trace( "Successfully refreshed table single table config: " + new String(configToRefresh)); } } else { if (log.isTraceEnabled()) { log.trace("We have to update all table configs."); } if (versionStat != null) { lastTableConfigVersion = versionStat.getVersion(); updateAllTableConfigurations(); } } return; }
Source:
<code>public void obtainStyledAttributes_shouldExtractAttributesFromAttributeSet() throws Exception { <START> RoboAttributeSet roboAttributeSet = shadowOf(RuntimeEnvironment.application).createAttributeSet( <END> new Attribute(TEST_PACKAGE + ":attr/itemType", "ungulate", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/scrollBars", "horizontal|vertical", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/quitKeyCombo", "^q", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/aspectRatio", "1.5", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/aspectRatioEnabled", "true", TEST_PACKAGE) ); TypedArray a = context.obtainStyledAttributes(roboAttributeSet, R.styleable.CustomView); assertThat(a.getInt(R.styleable.CustomView_itemType, -1234)).isEqualTo(1 ); assertThat(a.getInt(R.styleable.CustomView_scrollBars, -1234)).isEqualTo(0x300); assertThat(a.getString(R.styleable.CustomView_quitKeyCombo)).isEqualTo("^q"); assertThat(a.getText(R.styleable.CustomView_quitKeyCombo).toString()).isEqualTo("^q"); assertThat(a.getFloat(R.styleable.CustomView_aspectRatio, 1f)).isEqualTo(1.5f); assertThat(a.getBoolean(R.styleable.CustomView_aspectRatioEnabled, false)).isTrue(); TypedArray typedArray = context.obtainStyledAttributes(roboAttributeSet, new int[]{R.attr.quitKeyCombo, R.attr.itemType}); assertThat(typedArray.getString(0)).isEqualTo("^q"); assertThat(typedArray.getInt(1, -1234)).isEqualTo(1 ); }</code><technical_language>ShadowApplication.getInstance()</technical_language>

Target:
public void obtainStyledAttributes_shouldExtractAttributesFromAttributeSet() throws Exception { RoboAttributeSet roboAttributeSet = ShadowApplication.getInstance().createAttributeSet( new Attribute(TEST_PACKAGE + ":attr/itemType", "ungulate", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/scrollBars", "horizontal|vertical", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/quitKeyCombo", "^q", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/aspectRatio", "1.5", TEST_PACKAGE), new Attribute(TEST_PACKAGE + ":attr/aspectRatioEnabled", "true", TEST_PACKAGE) ); TypedArray a = context.obtainStyledAttributes(roboAttributeSet, R.styleable.CustomView); assertThat(a.getInt(R.styleable.CustomView_itemType, -1234)).isEqualTo(1 ); assertThat(a.getInt(R.styleable.CustomView_scrollBars, -1234)).isEqualTo(0x300); assertThat(a.getString(R.styleable.CustomView_quitKeyCombo)).isEqualTo("^q"); assertThat(a.getText(R.styleable.CustomView_quitKeyCombo).toString()).isEqualTo("^q"); assertThat(a.getFloat(R.styleable.CustomView_aspectRatio, 1f)).isEqualTo(1.5f); assertThat(a.getBoolean(R.styleable.CustomView_aspectRatioEnabled, false)).isTrue(); TypedArray typedArray = context.obtainStyledAttributes(roboAttributeSet, new int[]{R.attr.quitKeyCombo, R.attr.itemType}); assertThat(typedArray.getString(0)).isEqualTo("^q"); assertThat(typedArray.getInt(1, -1234)).isEqualTo(1 ); }
Source:
<code>public static String createFlagIssue(JiraClient jiraClient, String principalId, String displayName, String dataObjectId) { Map<String,String> params = new HashMap<String,String>(); params.put(JIRA_PRINCIPAL_ID_ISSUE_FIELD_NAME, principalId); params.put(JIRA_USER_DISPLAY_NAME_ISSUE_FIELD_NAME, displayName); params.put(JIRA_SYNAPSE_ENTITY_ID_FIELD_NAME, dataObjectId); CreatedIssue createdIssue = createIssue(jiraClient, JIRA_FLAG_ISSUE_TYPE_NAME, FLAG_SUMMARY, params); <START> return (String) createdIssue.getKey(); <END> }</code><technical_language>Cast string removed</technical_language>

Target:
public static String createFlagIssue(JiraClient jiraClient, String principalId, String displayName, String dataObjectId) { Map<String,String> params = new HashMap<String,String>(); params.put(JIRA_PRINCIPAL_ID_ISSUE_FIELD_NAME, principalId); params.put(JIRA_USER_DISPLAY_NAME_ISSUE_FIELD_NAME, displayName); params.put(JIRA_SYNAPSE_ENTITY_ID_FIELD_NAME, dataObjectId); CreatedIssue createdIssue = createIssue(jiraClient, JIRA_FLAG_ISSUE_TYPE_NAME, FLAG_SUMMARY, params); return createdIssue.getKey(); }
Source:
<code>public void execute() throws MojoExecutionException { if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } List<String> list = new ArrayList<>(); for (File jsonFile : cucumberFiles(cucumberOutput)) { list.add(jsonFile.getAbsolutePath()); } list.addAll(jsonFiles); try { Configuration configuration = new Configuration(outputDirectory, projectName); configuration.setBuildNumber(buildNumber); configuration.setParallelTesting(parallelTesting); if (!MapUtils.isEmpty(classifications)) { for (Map.Entry<String, String> entry : classifications.entrySet()) { configuration.addClassifications(StringUtils.capitalise(entry.getKey()), entry.getValue()); } } ReportBuilder reportBuilder = new ReportBuilder(list, configuration); getLog().info("About to generate Cucumber report."); Reportable report = reportBuilder.generateReports(); if (checkBuildResult && null != report && report.getScenarios() > report.getPassedScenarios()) { float totalScenarios = report.getScenarios(); float passedScenarios = report.getPassedScenarios(); getLog().info("Total Scenarios : " + totalScenarios + " , Passed Scenarios : " + passedScenarios); <START> float percent = ((passedScenarios / totalScenarios) * 100); <END> getLog().info( "Test Pass percent : " + percent + "% , PassPercentThreshold : " + passPercentThreshold + "%"); if (passPercentThreshold > percent) { throw new MojoExecutionException("BUILD FAILED - Check Report For Details"); } } } catch (Exception e) { throw new MojoExecutionException("Error Found:", e); } }</code><technical_language>additional ( ) remove</technical_language>

Target:
public void execute() throws MojoExecutionException { if (!outputDirectory.exists()) { outputDirectory.mkdirs(); } List<String> list = new ArrayList<>(); for (File jsonFile : cucumberFiles(cucumberOutput)) { list.add(jsonFile.getAbsolutePath()); } list.addAll(jsonFiles); try { Configuration configuration = new Configuration(outputDirectory, projectName); configuration.setBuildNumber(buildNumber); configuration.setParallelTesting(parallelTesting); if (!MapUtils.isEmpty(classifications)) { for (Map.Entry<String, String> entry : classifications.entrySet()) { configuration.addClassifications(StringUtils.capitalise(entry.getKey()), entry.getValue()); } } ReportBuilder reportBuilder = new ReportBuilder(list, configuration); getLog().info("About to generate Cucumber report."); Reportable report = reportBuilder.generateReports(); if (checkBuildResult && null != report && report.getScenarios() > report.getPassedScenarios()) { float totalScenarios = report.getScenarios(); float passedScenarios = report.getPassedScenarios(); getLog().info("Total Scenarios : " + totalScenarios + " , Passed Scenarios : " + passedScenarios); float percent = (passedScenarios / totalScenarios) * 100; getLog().info( "Test Pass percent : " + percent + "% , PassPercentThreshold : " + passPercentThreshold + "%"); if (passPercentThreshold > percent) { throw new MojoFailureException("BUILD FAILED - Pass Percent of Tests is :" + percent + " which is less than defined Threshold of " + passPercentThreshold); } } } catch (Exception e) { throw new MojoExecutionException("Error Found:", e); } }
Source:
<code>public static final RESTException create(int code, String streamsMessage) { RESTErrorMessage error = null; RESTException rcException; try { error = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(streamsMessage, RESTErrorMessage.class); } catch (IllegalStateException e) { rcException = new RESTException(code, streamsMessage); <START> } <END> rcException = new RESTException(code, error); return rcException; }</code><technical_language>This code wrong, rcException is immediately overwritten line 44</technical_language>

Target:
public static final RESTException create(int code, String streamsMessage) { RESTErrorMessage error = null; RESTException rcException; try { error = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(streamsMessage, RESTErrorMessage.class); rcException = new RESTException(code, error); } catch (IllegalStateException e) { rcException = new RESTException(code, streamsMessage); } return rcException; }
Source:
<code>public void addRow( final TupleBatch from, final int fromRow, final MutableTupleBuffer to, final int toRow, final int offset) { Objects.requireNonNull(from, "from"); ReplaceableColumn toCol = to.getColumn(offset, toRow); final int inColumRow = to.getInColumnIndex(toRow); switch (aggOp) { <START> case COUNT: <END> toCol.replaceLong(toCol.getLong(inColumRow) + 1, inColumRow); break; default: throw new IllegalArgumentException(aggOp + " is invalid"); } }</code><technical_language>supporting trivial boolean ops I suggested</technical_language>

Target:
public void addRow( final TupleBatch from, final int fromRow, final MutableTupleBuffer to, final int toRow, final int offset) { Objects.requireNonNull(from, "from"); ReplaceableColumn toCol = to.getColumn(offset, toRow); final int inColumnRow = to.getInColumnIndex(toRow); switch (aggOp) { case COUNT: toCol.replaceLong(toCol.getLong(inColumnRow) + 1, inColumnRow); break; default: throw new IllegalArgumentException(aggOp + " is invalid"); } }
Source:
<code>public static boolean isNotNullAndNotEmpty(String string) { <START> return ( (string != null) && (! string.trim().isEmpty())); <END> }</code><technical_language>return !isNullOrEmpty(string); If trim logic is important, feel free update method</technical_language>

Target:
public static boolean isNotNullAndNotEmpty(String string) { return ! (isNullOrEmpty(string)); }
Source:
<code>public void applyToVertex(Vertex vertex) throws IOException { String[] vertexTypes = getEntityTypesOrDefault(vertex); String id = vertex.value("tim_id"); String adminVertexType = getAbstractType(vertexTypes); vertex.edges(Direction.BOTH).forEachRemaining(edge -> { if (edge.keys().contains("tim_id")) { String[] edgeTypes = getEntityTypesOrDefault(edge); for (String edgeType : edgeTypes) { Optional<Collection> collectionOptional = vres.getCollectionForType(edgeType); collectionOptional.ifPresent(collection -> { if (collection.getVre().getOwnType(vertexTypes) == null) { if (Objects.equals("language", adminVertexType) || Objects.equals("location", adminVertexType)) { duplicateDefaultInformationToMissingVariant(vertex, collection, adminVertexType); } else { List<String> types = Lists.newArrayList(edgeTypes); types.remove(edgeType); <START> edge.property(TYPES_PROP, types.toArray(new String[types.size()])); <END> } } }); } } }); processedTypes.clear(); }</code><technical_language>json encoded</technical_language>

Target:
public void applyToVertex(Vertex vertex) throws IOException { String[] vertexTypes = getEntityTypesOrDefault(vertex); String adminVertexType = getAbstractType(vertexTypes); vertex.edges(Direction.BOTH).forEachRemaining(edge -> { if (!Objects.equals(edge.label(), "VERSION_OF")) { String[] edgeTypes = getEntityTypesOrDefault(edge); for (String edgeType : edgeTypes) { Optional<Collection> collectionOptional = vres.getCollectionForType(edgeType); collectionOptional.ifPresent(collection -> { if (collection.getVre().getOwnType(vertexTypes) == null) { if (Objects.equals("language", adminVertexType) || Objects.equals("location", adminVertexType)) { duplicateDefaultInformationToMissingVariant(vertex, collection, adminVertexType); } else { List<String> types = Lists.newArrayList(edgeTypes); types.remove(edgeType); try { edge.property("types", objectMapper.writeValueAsString(types)); } catch (JsonProcessingException e) { throw new RuntimeException("Types could not be set to edge", e); } } } }); } } }); processedTypes.clear(); }
Source:
<code>public static void registerNodeType(Workspace workspace, String typeName, boolean referenceable, boolean orderable, boolean mixin) { try { NodeTypeManager manager = workspace.getNodeTypeManager(); if (manager.hasNodeType(typeName) == false) { logger.info("Registering node type: in workspace {}", typeName, workspace .getName()); String type; <START> if(manager.getClass().toString().contains("jackrabbit")) { <END> type = "[" + typeName + "] > nt:unstructured "; } else { type = "[" + typeName + "] > brix:unstructured "; } if (referenceable) { type += ", mix:referenceable "; } if (orderable) { type += "orderable "; } if (mixin) { type += " mixin"; } CndImporter.registerNodeTypes(new StringReader(type), workspace.getSession()); } else { logger.info("Type: already registered in workspace {}", typeName, workspace .getName()); } } catch (Exception e) { throw new RuntimeException("Could not register type: " + typeName, e); } }</code><technical_language>s/toString/getName/</technical_language>

Target:
public static void registerNodeType(Workspace workspace, String typeName, boolean referenceable, boolean orderable, boolean mixin) { try { NodeTypeManager manager = workspace.getNodeTypeManager(); if (manager.hasNodeType(typeName) == false) { logger.info("Registering node type: in workspace {}", typeName, workspace .getName()); String type; if(manager.getClass().getName().contains("jackrabbit")) { type = "[" + typeName + "] > nt:unstructured "; } else { type = "[" + typeName + "] > brix:unstructured "; } if (referenceable) { type += ", mix:referenceable "; } if (orderable) { type += "orderable "; } if (mixin) { type += " mixin"; } CndImporter.registerNodeTypes(new StringReader(type), workspace.getSession()); } else { logger.info("Type: already registered in workspace {}", typeName, workspace .getName()); } } catch (Exception e) { throw new RuntimeException("Could not register type: " + typeName, e); } }
Source:
<code>public Service getServiceInstance(String name) { Stack<Service> stack = null; synchronized (services) { stack = services.get(name); if (stack == null) { stack = new Stack<Service>(); services.put(name, stack); } } synchronized (stack) { if (stack.isEmpty()) { return newServiceInstance(name); } else { Service service = stack.pop(); <START> if (System.currentTimeMillis() - service.getLastUsed() > 10000) { <END> for (int i = 0; i < stack.size(); i++) { metrics.closeService(name); } stack.clear(); return newServiceInstance(name); } return service; } } }</code><technical_language>Minor one. 10000 a constant parametrized</technical_language>

Target:
public Service getServiceInstance(String name) { Stack<Service> stack = null; synchronized (services) { stack = services.get(name); if (stack == null) { stack = new Stack<Service>(); services.put(name, stack); } } synchronized (stack) { if (stack.isEmpty()) { return newServiceInstance(name); } else { Service service = stack.pop(); if (System.currentTimeMillis() - service.getLastUsed() > expiryInterval) { for (int i = 0; i < stack.size(); i++) { metrics.closeService(name); } stack.clear(); return newServiceInstance(name); } return service; } } }
Source:
<code>private <T> List<T> transform(JSONArray jsonList, Class<T> someClass) { List<T> result; try { <START> result = objectMapper.readValue(jsonList.toJSONString(), objectMapper.getTypeFactory().constructCollectionType(List.class, someClass)); <END> } catch (IOException e) { throw new StashException("Error parsing json strings to objects", e); } return result; }</code><technical_language>if extract try/catch method need result variable declaration assigment</technical_language>

Target:
private <T> List<T> transform(JSONArray jsonList, Class<T> someClass) { try { return objectMapper.readValue(jsonList.toJSONString(), objectMapper.getTypeFactory().constructCollectionType(List.class, someClass)); } catch (IOException e) { throw new StashException("Error parsing json strings to objects", e); } }
Source:
<code>private void loadStatistics() { if (disposable != null) { disposable.dispose(); } disposable = Observable.fromCallable(() -> { List<StatisticsItem> statisticsData = DBReader.getStatistics(); Collections.sort(statisticsData, (item1, item2) -> <START> CompareCompat.compareLong(item1.totalDownloadSize, item2.totalDownloadSize)); <END> return statisticsData; }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { for (StatisticsItem item : result) { if (item.feed.getId() == feed.getId()) { podcastStatistics = item; break; } } showFeed(); }, error -> Log.e(TAG, Log.getStackTraceString(error))); }</code><technical_language>of feeds, is necessary sort list</technical_language>

Target:
private void loadStatistics() { if (disposableStatistics != null) { disposableStatistics.dispose(); } disposableStatistics = Observable.fromCallable(() -> { List<StatisticsItem> statisticsData = DBReader.getStatistics(); for (StatisticsItem statisticsItem : statisticsData) { if (statisticsItem.feed.getId() == feed.getId()) { return statisticsItem; } } return null; }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { txtvPodcastTime.setText(Converter.shortLocalizedDuration( getContext(), result.timePlayed)); txtvPodcastSpace.setText(Formatter.formatShortFileSize( getContext(), result.totalDownloadSize)); txtvPodcastEpisodeCount.setText(String.format(Locale.getDefault(), "%d%s", result.episodesDownloadCount, getString(R.string.episodes_suffix))); }, error -> { Log.d(TAG, Log.getStackTraceString(error)); lblStatistics.setVisibility(View.GONE); txtvPodcastSpace.setVisibility(View.GONE); txtvPodcastTime.setVisibility(View.GONE); txtvPodcastEpisodeCount.setVisibility(View.GONE); btnvOpenStatistics.setVisibility(View.GONE); }); }
Source:
<code>protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { HttpRequest request = (HttpRequest) msg; JsonArray result = Json.createReader(new StringReader(request.getContent().toString(StandardCharsets.UTF_8))) .readArray(); List<Position> positions = new LinkedList<>(); <START> Log.debug(String.format("messages received msgs_count=%d", result.size())); <END> for (int i = 0; i < result.size(); i++) { JsonObject message = result.getJsonObject(i); String ident = message.getString("ident"); if (ident == null) { continue; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ident); if (deviceSession == null) { continue; } Position position = new Position(); position.setDeviceId(deviceSession.getDeviceId()); decodePosition(message, position); positions.add(position); } sendResponse(channel, HttpResponseStatus.OK); return positions; }</code><technical_language>Remove extra logging</technical_language>

Target:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { HttpRequest request = (HttpRequest) msg; JsonArray result = Json.createReader(new StringReader(request.getContent().toString(StandardCharsets.UTF_8))) .readArray(); List<Position> positions = new LinkedList<>(); for (int i = 0; i < result.size(); i++) { JsonObject message = result.getJsonObject(i); JsonString ident = message.getJsonString("ident"); if (ident == null) { continue; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ident.getString()); if (deviceSession == null) { continue; } Position position = new Position(); position.setDeviceId(deviceSession.getDeviceId()); decodePosition(message, position); positions.add(position); } sendResponse(channel, HttpResponseStatus.OK); return positions; }
Source:
<code>public void onAdapterItemSelected(int position) { if (mIsSelectOneItem) { Intent intent = new Intent(); int localId = mGridAdapter.getLocalMediaIdAtPosition(position); ArrayList<Long> remoteMediaIds = new ArrayList<>(); <START> remoteMediaIds.add(mMediaStore.getMediaWithLocalId(localId).getMediaId()); <END> intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); setResult(RESULT_OK, intent); finish(); } }</code><technical_language>getMediaWithLocalId returns null here</technical_language>

Target:
public void onAdapterItemSelected(int position) { if (mIsSelectOneItem) { Intent intent = new Intent(); int localId = mGridAdapter.getLocalMediaIdAtPosition(position); ArrayList<Long> remoteMediaIds = new ArrayList<>(); MediaModel media = mMediaStore.getMediaWithLocalId(localId); if (media != null) { remoteMediaIds.add(media.getMediaId()); intent.putExtra(RESULT_IDS, ListUtils.toLongArray(remoteMediaIds)); setResult(RESULT_OK, intent); finish(); } } }
Source:
<code>public void testLockHeldByThread() throws Exception { lockManager.lock("k", "aThread", 0, TimeUnit.MILLISECONDS).lock(); try { lockManager.lock("k", new DldGlobalTransaction(), 1000, TimeUnit.MILLISECONDS).lock(); fail("TimeoutException expected!"); } catch (TimeoutException e) { } <START> AssertJUnit.assertTrue(lockManager.getOverlapWithNotDeadlockAwareLockOwners() > 0); END> }</code><technical_language>Hmmm, I this JMX attribute kind of useless moment stopped allowing mix of tx non-tx operations in cache, more number of deadlock checks deterministic. deprecate attribute remove this check</technical_language>

Target:
public void testLockHeldByThread() throws Exception { lockManager.lock("k", "aThread", 0, TimeUnit.MILLISECONDS).lock(); try { LockPromise promise = lockManager.lock("k", new DldGlobalTransaction(), 1000, TimeUnit.MILLISECONDS); lockManager.run(); promise.lock(); fail("TimeoutException expected!"); } catch (TimeoutException e) { } AssertJUnit.assertEquals(1, lockManager.getOverlapWithNotDeadlockAwareLockOwners()); }
Source:
<code>private <E extends Entity> void updatePropertyData( Map<Long,Map<String,Object>> state, WritableFulltext index ) throws IOException { for ( Map.Entry<Long,Map<String,Object>> stateEntry : state.entrySet() ) { Set<String> indexedProperties = index.properties(); if ( !Collections.disjoint( indexedProperties, stateEntry.getValue().keySet() ) ) { long entityId = stateEntry.getKey(); Map<String,Object> allProperties = stateEntry.getValue().entrySet().stream().filter( entry -> indexedProperties.contains( entry.getKey() ) ).collect( <START> Collectors.toMap( entry -> entry.getKey(), entry -> entry.getValue() ) ); <END> if ( !allProperties.isEmpty() ) { Document document = LuceneFulltextDocumentStructure.documentRepresentingProperties( entityId, allProperties ); index.getIndexWriter().updateDocument( LuceneFulltextDocumentStructure.newTermForChangeOrRemove( entityId ), document ); } } } }</code><technical_language>entry -> entry.getKey(), entry -> entry.getValue() replaced method references</technical_language>

Target:
private <E extends Entity> void updatePropertyData( Map<Long,Map<String,Object>> state, WritableFulltext index ) throws IOException { for ( Map.Entry<Long,Map<String,Object>> stateEntry : state.entrySet() ) { Set<String> indexedProperties = index.properties(); if ( !Collections.disjoint( indexedProperties, stateEntry.getValue().keySet() ) ) { long entityId = stateEntry.getKey(); Map<String,Object> allProperties = stateEntry.getValue().entrySet().stream().filter( entry -> indexedProperties.contains( entry.getKey() ) ).collect( Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue ) ); if ( !allProperties.isEmpty() ) { Document document = LuceneFulltextDocumentStructure.documentRepresentingProperties( entityId, allProperties ); index.getIndexWriter().updateDocument( LuceneFulltextDocumentStructure.newTermForChangeOrRemove( entityId ), document ); } } } }
Source:
<code>public static String nameForItemType(Context context, ITEM_TYPE itemType) { String name = ""; switch (itemType) { case POST: name = context.getString(R.string.menu_item_type_post); break; case PAGE: name = context.getString(R.string.menu_item_type_page); break; case CATEGORY: name = context.getString(R.string.menu_item_type_category); break; case TAG: name = context.getString(R.string.menu_item_type_tag); break; case LINK: name = context.getString(R.string.menu_item_type_link); break; case JETPACK_TESTIMONIAL: name = context.getString(R.string.menu_item_type_testimonial); break; case JETPACK_PORTFOLIO: name = context.getString(R.string.menu_item_type_portfolio); break; case JETPACK_COMIC: name = context.getString(R.string.menu_item_type_comic); break; <START> case NULL: <END> name = ""; break; case CUSTOM: name = ""; break; } return name; }</code><technical_language>cases (NULL CUSTOM) essentially no-ops name is initialized empty string. remove a future for them</technical_language>

Target:
public static String nameForItemType(Context context, ITEM_TYPE itemType) { String name = ""; switch (itemType) { case POST: name = context.getString(R.string.menu_item_type_post); break; case PAGE: name = context.getString(R.string.menu_item_type_page); break; case CATEGORY: name = context.getString(R.string.menu_item_type_category); break; case TAG: name = context.getString(R.string.menu_item_type_tag); break; case LINK: name = context.getString(R.string.menu_item_type_link); break; case JETPACK_TESTIMONIAL: name = context.getString(R.string.menu_item_type_testimonial); break; case JETPACK_PORTFOLIO: name = context.getString(R.string.menu_item_type_portfolio); break; case JETPACK_COMIC: name = context.getString(R.string.menu_item_type_comic); break; default: break; } return name; }