auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResourceBundle getResourcesBundle() { <START> List<ResourceBundle> bundleList = getBundle(RESOURCES_KEY, LocaleFilter.DEFAULT_LOCALE); <END> if (bundleList.size() >= 1) { return bundleList.get(0); } if (dummyResourceBundle == null) { log.warn("Branding theme " + this.getPath() + " is missing its resources.properties file. " + "Check branding.properties resources key. Check that the file referred to in " + "resources key exists."); dummyResourceBundle = new ListResourceBundle() { @Override protected Object[][] getContents() { return new Object[0][0]; } }; } return dummyResourceBundle; }</code><technical_language>do this? ResourceBundle result = null; List<ResourceBundle> bundleList = getBundle(RESOURCES_KEY, LocaleFilter.DEFAULT_LOCALE); if (bundleList.size() >= 1) { result = bundleList.get(0); } return result; check for null receiving end</technical_language>

Target:
public ResourceBundle getResourcesBundle() { List<ResourceBundle> bundleList = getBundle(RESOURCES_KEY, LocaleFilter.DEFAULT_LOCALE); if (bundleList.size() >= 1) { return bundleList.get(0); } throw new MissingResourceException("can't load resources bundle", null, null); }
Source:
<code>public void setup() throws Exception { storeKeyToMockStoreMap.clear(); helixNotifier = new HelixNotifier(getMockHelixStore(storeConfig)); helixNotifier2 = new HelixNotifier(getMockHelixStore(storeConfig)); resetReferenceTopicsAndMessages(); resetListeners(); <START> deleteStoreIfExists(); <END> }</code><technical_language>move this top</technical_language>

Target:
public void setup() throws Exception { deleteStoreIfExists(); storeKeyToMockStoreMap.clear(); helixNotifier = new HelixNotifier(getMockHelixStore(storeConfig)); resetReferenceTopicsAndMessages(); resetListeners(); }
Source:
<code>public static <T> T adapt(Object sourceObject, Class<T> adapter) { try { if (PlatformUiUtil.isNeonOrLater()) { Bundle bundle = Platform.getBundle("org.eclipse.platform"); Class<?> clazz = bundle.loadClass("org.eclipse.core.runtime.Adapters"); Method adaptMethod = clazz.getMethod("adapt", new Class[] { Object.class, Class.class }); Object result = adaptMethod.invoke(clazz, sourceObject, adapter); return (T) result; } else { Bundle bundle = Platform.getBundle("org.eclipse.ui.workbench"); Class<?> clazz = bundle.loadClass("org.eclipse.ui.internal.util.Util"); Method adaptMethod = clazz.getMethod("getAdapter", new Class[] { Object.class, Class.class }); Object result = adaptMethod.invoke(clazz, sourceObject, adapter); return (T) result; } <START> } catch (NoSuchMethodException e) { <END> e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; }</code><technical_language>catch Exception instead of catch blocks</technical_language>

Target:
public static <T> T adapt(Object sourceObject, Class<T> adapter) { try { if (PlatformUiUtil.isNeonOrLater()) { Bundle bundle = Platform.getBundle("org.eclipse.platform"); Class<?> clazz = bundle.loadClass("org.eclipse.core.runtime.Adapters"); Method adaptMethod = clazz.getMethod("adapt", new Class[] { Object.class, Class.class }); Object result = adaptMethod.invoke(clazz, sourceObject, adapter); return (T) result; } else { Bundle bundle = Platform.getBundle("org.eclipse.ui.workbench"); Class<?> clazz = bundle.loadClass("org.eclipse.ui.internal.util.Util"); Method adaptMethod = clazz.getMethod("getAdapter", new Class[] { Object.class, Class.class }); Object result = adaptMethod.invoke(clazz, sourceObject, adapter); return (T) result; } } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, RepositoriesUiPlugin.ID_PLUGIN, "Could not adapt", e)); } return null; }
Source:
<code>private void createTable(Connection conn, String table) throws SQLException { String ddl = "create table if not exists " + table + "( " + TRACE.columnName + " bigint not null, " + PARENT.columnName + " bigint not null, " + SPAN.columnName + " bigint not null, " + DESCRIPTION.columnName + " varchar, " + START.columnName + " bigint, " + END.columnName + " bigint, " + HOSTNAME.columnName + " varchar, " + TAG_COUNT + " smallint, " + ANNOTATION_COUNT + " smallint" + " CONSTRAINT pk PRIMARY KEY (" + TRACE.columnName + ", " + PARENT.columnName + ", " + SPAN.columnName + "))\n" + <START> PhoenixDatabaseMetaData.TRANSACTIONAL + "=" + Boolean.FALSE; <END> ; PreparedStatement stmt = conn.prepareStatement(ddl); stmt.execute(); this.table = table; }</code><technical_language>Is intent tracing table transactional? happen existing tracing table i.e. a cluster existing phoenix deployment tracing enabled? need some kind of upgrade path update metadata of existing tracing table mark transactional</technical_language>

Target:
private void createTable(Connection conn, String table) throws SQLException { String ddl = "create table if not exists " + table + "( " + TRACE.columnName + " bigint not null, " + PARENT.columnName + " bigint not null, " + SPAN.columnName + " bigint not null, " + DESCRIPTION.columnName + " varchar, " + START.columnName + " bigint, " + END.columnName + " bigint, " + HOSTNAME.columnName + " varchar, " + TAG_COUNT + " smallint, " + ANNOTATION_COUNT + " smallint" + " CONSTRAINT pk PRIMARY KEY (" + TRACE.columnName + ", " + PARENT.columnName + ", " + SPAN.columnName + "))\n"; PreparedStatement stmt = conn.prepareStatement(ddl); stmt.execute(); this.table = table; }
Source:
<code>public String getRealm() { String realmString = ""; final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (OAuth2Authentication.class.equals(authentication.getClass())) { final Object details = ((OAuth2Authentication) authentication).getUserAuthentication().getDetails(); <START> if (details instanceof Map) { <END> final Map<String, Object> map = (Map<String, Object>) details; final Object realm = map.get("realm"); if (realm != null && realm instanceof String) { realmString = (String) realm; } } } return realmString; }</code><technical_language>do avoid 2 additional inference of type here? is gonna done a lot of requests, necessary? instead cast types directly, is OAuth2Authentication object, additionally wrapping in try/catch</technical_language>

Target:
public String getRealm() { try { return Optional.of(SecurityContextHolder.getContext()) .map(SecurityContext::getAuthentication) .map(authentication -> (OAuth2Authentication) authentication) .map(OAuth2Authentication::getUserAuthentication) .map(Authentication::getDetails) .map(details -> (Map) details) .map(details -> details.get("realm")) .map(realm -> (String) realm) .orElse(""); } catch (final ClassCastException e) { return ""; } }
Source:
<code>protected void onStart() { super.onStart(); mUserEnterTimeMillis = SystemClock.elapsedRealtime(); mUserActions = MetricsWriter.USER_ACTION_NONE; mMetricsWriter.writeMetricsForEnter(); <START> ShortcutViewUtils.Config prevConfig = mShortcutViewConfig; mShortcutViewConfig = new ShortcutViewUtils.Config(this, prevConfig); if (mShortcutViewConfig.isEnabled() != prevConfig.isEnabled() || mSupportsDarkText != isDarkTextSupported()) { recreate(); return; } <END> if (mShortcutViewConfig.isEnabled()) { updateLocationAndEccInfo(); } else { mColorExtractor.addOnColorsChangedListener(this); } }</code><technical_language>Is add a "refresh" method update config ShortcutViewUtils.Config class instead of re-creating config here? For example: boolean isPrevEnabled = mShortcutViewConfig.isEnabled(); mShortcutViewConfig.refresh(); // update config if (mShortcutViewConfig.isEnabled() != isPrevEnabled) ..</technical_language>

Target:
protected void onStart() { super.onStart(); mUserEnterTimeMillis = SystemClock.elapsedRealtime(); mUserActions = MetricsWriter.USER_ACTION_NONE; mMetricsWriter.writeMetricsForEnter(); boolean isEnabledPreviously = mShortcutViewConfig.isEnabled(); mShortcutViewConfig.refresh(this); if (mShortcutViewConfig.isEnabled() != isEnabledPreviously || mSupportsDarkText != isDarkTextSupported()) { recreate(); return; } if (mShortcutViewConfig.isEnabled()) { updateLocationAndEccInfo(); } else { mColorExtractor.addOnColorsChangedListener(this); } }
Source:
<code>public String currentAuthorizationHeader() { if (token == null) { synchronized (lock) { try { <START> token = renewAuthorizationHeader(null).get(); <END> } catch (InterruptedException | ExecutionException e) { log.error("Failed to complete crtauth handshake."); throw Throwables.propagate(e); } } } return token; }</code><technical_language>understanding of initial interface this method for returning token-stored-on-disk, if in general, I need locking here</technical_language>

Target:
public String currentAuthorizationHeader() { return tokenRef.get(); }
Source:
<code>public HostUpgradeManagerResult checkForUpdates(final VDS host) { try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(host.getHostName()) .checkMode(true) .enableLogging(false) .playbook(AnsibleConstants.HOST_UPGRADE_PLAYBOOK); AnsibleReturnValue ansibleReturnValue = new AnsibleExecutor().runCommand( command, new Pair<>("ANSIBLE_STDOUT_CALLBACK", "hostupgradeplugin") ); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { log.error("Failed to run check-update of host '{}'.", host.getName()); throw new RuntimeException("Failed to run check-update of host '{}'."); } <START> boolean updatesAvailable = Boolean.valueOf(ansibleReturnValue.getStdout()); <END> HostUpgradeManagerResult hostUpgradeManagerResult = new HostUpgradeManagerResult(); hostUpgradeManagerResult.setUpdatesAvailable(updatesAvailable); if (updatesAvailable) { AuditLogable auditLog = new AuditLogableImpl(); auditLog.setVdsId(host.getId()); auditLog.setVdsName(host.getName()); auditLogDirector.log(auditLog, AuditLogType.HOST_UPDATES_ARE_AVAILABLE); } return hostUpgradeManagerResult; } catch (final Exception e) { throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>Hmm, is way, pass packages upgraded</technical_language>

Target:
public HostUpgradeManagerResult checkForUpdates(final VDS host) { try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hostnames(host.getHostName()) .checkMode(true) .enableLogging(false) .playbook(AnsibleConstants.HOST_UPGRADE_PLAYBOOK); AnsibleReturnValue ansibleReturnValue = new AnsibleExecutor().runCommand( command, new Pair<>("ANSIBLE_STDOUT_CALLBACK", AnsibleConstants.HOST_UPGRADE_CALLBACK_PLUGIN) ); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { log.error("Failed to run check-update of host '{}'.", host.getName()); throw new RuntimeException("Failed to run check-update of host '{}'."); } List<String> availablePackages = JsonHelper.jsonToList(ansibleReturnValue.getStdout()); boolean updatesAvailable = !availablePackages.isEmpty(); HostUpgradeManagerResult hostUpgradeManagerResult = new HostUpgradeManagerResult(); hostUpgradeManagerResult.setUpdatesAvailable(updatesAvailable); if (updatesAvailable) { hostUpgradeManagerResult.setAvailablePackages(availablePackages); log.info("There are available packages ({}) for host '{}'", StringUtils.join(availablePackages, ", "), host.getName()); AuditLogable auditLog = new AuditLogableImpl(); auditLog.setVdsId(host.getId()); auditLog.setVdsName(host.getName()); auditLogDirector.log(auditLog, AuditLogType.HOST_UPDATES_ARE_AVAILABLE); } return hostUpgradeManagerResult; } catch (final Exception e) { throw new RuntimeException(e.getMessage(), e); } }
Source:
<code>protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY) { throw new DeveloperError("This view only supports EXACTLY for the widthMeasureSpec"); } int availableWidth = MeasureSpec.getSize(widthMeasureSpec) - getPaddingStart() - getPaddingEnd(); measureAndUpdateFirstRowContent(availableWidth); <START> int totalHeight = getPaddingTop() + timeView.getMeasuredHeight() + getVerticalMarginsFor(timeView); <END> measureChildWithMargins(titleView, availableWidth); totalHeight += titleView.getMeasuredHeight() + getVerticalMarginsFor(titleView); measureAndUpdateThirdRowContent(availableWidth); totalHeight += speakersView.getMeasuredHeight() + getVerticalMarginsFor(speakersView); totalHeight += getPaddingBottom(); int measuredHeight; int heightMode = MeasureSpec.getMode(heightMeasureSpec); if (heightMode == MeasureSpec.EXACTLY) { measuredHeight = MeasureSpec.getSize(heightMeasureSpec); } else if (heightMode == MeasureSpec.AT_MOST) { measuredHeight = Math.min(MeasureSpec.getSize(heightMeasureSpec), totalHeight); } else { measuredHeight = totalHeight; } setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), measuredHeight); }</code><technical_language>This be: java Math.max( timeView.getMeasuredHeight() + getVerticalMarginsFor(timeView), trackView.getMeasuredHeight() + getVerticalMarginsFor(trackView)) ...but for another PR</technical_language>

Target:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY) { throw new DeveloperError("This view only supports EXACTLY for the widthMeasureSpec"); } int availableWidth = MeasureSpec.getSize(widthMeasureSpec) - getPaddingStart() - getPaddingEnd(); measureAndUpdateFirstRowContent(availableWidth); int totalHeight = getPaddingTop() + Math.max( timeView.getMeasuredHeight() + getVerticalMarginsFor(timeView), trackView.getMeasuredHeight() + getVerticalMarginsFor(trackView) ); measureChildWithMargins(titleView, availableWidth); totalHeight += titleView.getMeasuredHeight() + getVerticalMarginsFor(titleView); measureAndUpdateThirdRowContent(availableWidth); totalHeight += speakersView.getMeasuredHeight() + getVerticalMarginsFor(speakersView); totalHeight += getPaddingBottom(); int measuredHeight = getMeasuredHeightFor(heightMeasureSpec, totalHeight); setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), measuredHeight); }
Source:
<code>public DataHandler(Context context) { IntentFilter intentFilter = new IntentFilter(MainActivity.LOAD_OVER); context.getApplicationContext().registerReceiver(this, intentFilter); Intent i = new Intent(MainActivity.START_LOAD); context.sendBroadcast(i); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); appProvider = new AppProvider(context); providers.add(appProvider); if (prefs.getBoolean("enable-contacts", true)) { contactProvider = new ContactProvider(context); providers.add(contactProvider); } else { contactProvider = null; } if (prefs.getBoolean("enable-search", true)) { providers.add(new SearchProvider(context)); } if (prefs.getBoolean("enable-phone", true)) { providers.add(new PhoneProvider(context)); } if (prefs.getBoolean("enable-toggles", true)) { providers.add(new ToggleProvider(context)); } if (prefs.getBoolean("enable-settings", true)) { providers.add(new SettingProvider(context)); } if (prefs.getBoolean("enable-alias", true)) { providers.add(new AliasProvider(context, appProvider)); } <START> shortcutProvider = (new ShortcutProvider(context)); <END> if (prefs.getBoolean("enable-shortcuts", true)) { providers.add(shortcutProvider); } }</code><technical_language>also, unneeded parens</technical_language>

Target:
public DataHandler(Context context) { IntentFilter intentFilter = new IntentFilter(MainActivity.LOAD_OVER); context.getApplicationContext().registerReceiver(this, intentFilter); Intent i = new Intent(MainActivity.START_LOAD); context.sendBroadcast(i); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); appProvider = new AppProvider(context); providers.add(appProvider); if (prefs.getBoolean("enable-contacts", true)) { contactProvider = new ContactProvider(context); providers.add(contactProvider); } else { contactProvider = null; } if (prefs.getBoolean("enable-search", true)) { providers.add(new SearchProvider(context)); } if (prefs.getBoolean("enable-phone", true)) { providers.add(new PhoneProvider(context)); } if (prefs.getBoolean("enable-toggles", true)) { providers.add(new ToggleProvider(context)); } if (prefs.getBoolean("enable-settings", true)) { providers.add(new SettingProvider(context)); } if (prefs.getBoolean("enable-alias", true)) { providers.add(new AliasProvider(context, appProvider)); } if (prefs.getBoolean("enable-shortcuts", true)) { shortcutProvider = new ShortcutProvider(context); providers.add(shortcutProvider); } else { shortcutProvider = null; } }
Source:
<code>private void addListenersToInputButtons() { MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar(); inputToolBarButtons = toolBar.getButtons(); beforeCommandListenerForInputButtons = new IExtendedButtonListener() { public void handleEvent(ExtendedButtonEvent event) { TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedInputTableView() .getTableViewerCreatorForColumns(); if (tableViewerCreator != null) { tableViewerCreator.applyActivatedCellEditor(); } } }; <START> final List<InputTable> inputTables = mapperManager.getInputTables(); <END> IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() { public void handleEvent(ExtendedButtonEvent event) { for (InputTable inputTable : inputTables) { DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(inputTable); view.getTableViewerCreatorForColumns().getTableViewer().refresh(); } } }; for (ExtendedPushButton extendedPushButton : inputToolBarButtons) { extendedPushButton.addListener(beforeCommandListenerForInputButtons, true); extendedPushButton.addListener(afterCommandListener, false); } this.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for (ExtendedPushButton extendedPushButton : inputToolBarButtons) { extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true); } } }); }</code><technical_language>put inputTables handleEvent function? add NPE check</technical_language>

Target:
private void addListenersToInputButtons() { MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar(); inputToolBarButtons = toolBar.getButtons(); beforeCommandListenerForInputButtons = new IExtendedButtonListener() { public void handleEvent(ExtendedButtonEvent event) { TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedInputTableView() .getTableViewerCreatorForColumns(); if (tableViewerCreator != null) { tableViewerCreator.applyActivatedCellEditor(); } } }; IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() { public void handleEvent(ExtendedButtonEvent event) { List<InputTable> inputTablesList = mapperManager.getInputTables(); for (InputTable inputTable : inputTablesList) { DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(inputTable); view.getTableViewerCreatorForColumns().getTableViewer().refresh(); } } }; for (ExtendedPushButton extendedPushButton : inputToolBarButtons) { extendedPushButton.addListener(beforeCommandListenerForInputButtons, true); extendedPushButton.addListener(afterCommandListener, false); } this.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for (ExtendedPushButton extendedPushButton : inputToolBarButtons) { extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true); } } }); }
Source:
<code>public TooltipImpl(Element element, TooltipOptions options) { this.$element = $(element); this.options = getOptions(options); if (options.getResources() != null){ this.style = options.getResources().css(); } else{ this.style = getDefaultResources().css(); } <START> <END> init(); }</code><technical_language>a good question I answer, this pattern is commonly gwt widgets. remove If if more ctor I in case, prune used</technical_language>

Target:
public TooltipImpl(Element element, TooltipOptions options) { this(element, options, getDefaultResources()); }
Source:
<code>private void onCheckAll() { boolean all = mCheckedCardPositions.size() < getCards().size(); if (all) { <START> for (int i = 0; i < mCards.size(); i++) <END> mCheckedCardPositions.add(i); } else { mCheckedCardPositions.clear(); } updateMultiselectMenu(); mActionBarTitle.setText(Integer.toString(mCheckedCardPositions.size())); mCardsAdapter.notifyDataSetChanged(); }</code><technical_language>braces</technical_language>

Target:
private void onCheckAll() { boolean all = mCheckedCardPositions.size() < getCards().size(); if (all) { for (int i = 0; i < mCards.size(); i++) { mCheckedCardPositions.add(i); } } else { mCheckedCardPositions.clear(); } updateMultiselectMenu(); mActionBarTitle.setText(Integer.toString(mCheckedCardPositions.size())); mCardsAdapter.notifyDataSetChanged(); }
Source:
<code>public List<FolderItem> getAssetsRecursively( final Package pkg, final ActiveOptions options ) { final List<FolderItem> items = new ArrayList<>(); <START> getItems( pkg, options ).forEach( item -> { <END> if ( item.getType().equals( FolderItemType.FOLDER ) ) { final Set<Package> childPackages = projectService.resolvePackages( pkg ); childPackages.forEach( childPkg -> items.addAll( getAssetsRecursively( childPkg, options ) ) ); } else { items.add( item ); } } ); return items; }</code><technical_language>collect folder items a list creating new ArrayList recursive step. This achieved flatMap in this way. return getItems(pkg, options).stream().flatMap((FolderItem item) -> { if (item.getType().equals(FolderItemType.FOLDER)) { final Set<Package> childPackages = projectService.resolvePackages(pkg); return childPackages.stream().map(childPkg -> getAssetsRecursively(childPkg, options)); } else { return Stream.of(item); } }).collect(toList()); wondering. Is this recursive traversal necessary? Pardon ignorance of existing backend services, Is method implemented return assets/packages for project? E.g. I ProjectResourceResolver resolvePackages(Project) this reused here</technical_language>

Target:
public List<FolderItem> getAssetsRecursively( final Package pkg, final ActiveOptions options ) { return getItems( pkg, options ).stream().flatMap( ( FolderItem item ) -> { if ( item.getType().equals( FolderItemType.FOLDER ) ) { final Set<Package> childPackages = projectService.resolvePackages( pkg ); return childPackages.stream().flatMap( childPkg -> getAssetsRecursively( childPkg, options ).stream() ); } else { return Stream.of( item ); } } ).collect( Collectors.toList() ); }
Source:
<code>public void InitializeSerial() { <START> mPhysicaloid = new Physicaloid(context); <END> Log.d(LOG_TAG, "Initialized"); }</code><technical_language>sense call setBaudrate in case default changes in a future version</technical_language>

Target:
public void InitializeSerial() { mPhysicaloid = new Physicaloid(context); BaudRate(this.baudRate); Log.d(LOG_TAG, "Initialized"); }
Source:
<code>public void testReviewsWithSameChangeId() throws Exception { String branchName = "test_side_branch"; createBranchIfNonExistent(branchName); ReviewHarness reviewHarness2 = reviewHarness.duplicate(); reviewHarness2.init("HEAD:refs/for/" + branchName, PrivilegeLevel.USER, "otherTestFile.txt", true); <START> reviewHarness.retrieve(); <END> assertEquals(reviewHarness.getReview().getKey(), reviewHarness2.getReview().getKey()); assertThat(reviewHarness.getReview().getId(), is(not(reviewHarness2.getReview().getId()))); assertThat(reviewHarness.getReview().getSets().size(), is(1)); assertThat(reviewHarness.getReview().getSets().get(0).getId(), is("1")); PatchSetDetail detail = retrievePatchSetDetail(reviewHarness, "1"); assertThat(detail.getPatches().size(), is(2)); assertThat(detail.getPatches().get(0).getFileName(), is("/COMMIT_MSG")); assertThat(detail.getPatches().get(1).getFileName(), is("testFile1.txt")); assertThat(reviewHarness2.getReview().getSets().size(), is(1)); assertThat(reviewHarness2.getReview().getSets().get(0).getId(), is("1")); PatchSetDetail detail2 = retrievePatchSetDetail(reviewHarness2, "1"); assertThat(detail2.getPatches().size(), is(2)); assertThat(detail2.getPatches().get(0).getFileName(), is("/COMMIT_MSG")); assertThat(detail2.getPatches().get(1).getFileName(), is("otherTestFile.txt")); }</code><technical_language>Need call reviewHarness2.retrieve();</technical_language>

Target:
public void testReviewsWithSameChangeId() throws Exception { String branchName = "test_side_branch"; createBranchIfNonExistent(branchName); ReviewHarness reviewHarness2 = reviewHarness.duplicate(); reviewHarness2.init("HEAD:refs/for/" + branchName, PrivilegeLevel.USER, "otherTestFile.txt", true); reviewHarness.retrieve(); reviewHarness2.retrieve(); assertEquals(reviewHarness.getReview().getKey(), reviewHarness2.getReview().getKey()); assertThat(reviewHarness.getReview().getId(), is(not(reviewHarness2.getReview().getId()))); assertThat(reviewHarness.getReview().getSets().size(), is(1)); assertThat(reviewHarness.getReview().getSets().get(0).getId(), is("1")); PatchSetDetail detail = retrievePatchSetDetail(reviewHarness, "1"); assertThat(detail.getPatches().size(), is(2)); assertThat(detail.getPatches().get(0).getFileName(), is("/COMMIT_MSG")); assertThat(detail.getPatches().get(1).getFileName(), is("testFile1.txt")); assertThat(reviewHarness2.getReview().getSets().size(), is(1)); assertThat(reviewHarness2.getReview().getSets().get(0).getId(), is("1")); PatchSetDetail detail2 = retrievePatchSetDetail(reviewHarness2, "1"); assertThat(detail2.getPatches().size(), is(2)); assertThat(detail2.getPatches().get(0).getFileName(), is("/COMMIT_MSG")); assertThat(detail2.getPatches().get(1).getFileName(), is("otherTestFile.txt")); }
Source:
<code>private JSONObject getTopology(StartAction startAction, Map<Integer, ExtensibleGroupTag> hostGroups, JoinCoordinator joinCoordinator) { JSONObject topo = null; int sitesperhost = m_catalogContext.getDeployment().getCluster().getSitesperhost(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); topo = joinCoordinator.getTopology(); } else { final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); ClusterConfig clusterConfig = new ClusterConfig(hostcount, sitesperhost, kfactor); if (!startAction.doesRejoin() && !clusterConfig.validate()) { VoltDB.crashLocalVoltDB(clusterConfig.getErrorMsg(), false, null); } try { final Multimap<Integer, Long> replicas = m_cartographer.getReplicasForPartitions(m_cartographer.getPartitions()); final Map<Integer, Long> masters = m_cartographer.getHSIdsForSinglePartitionMasters(); replicas.removeAll(MpInitiator.MP_INIT_PID); masters.remove(MpInitiator.MP_INIT_PID); topo = clusterConfig.getTopology(hostGroups, replicas, masters); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to calculate topology", false, e); } if (!startAction.doesRejoin()) { topo = registerClusterConfig(topo); <START> } <END> } return topo; }</code><technical_language>if (!startAction.doesRejoin()) { topo = registerClusterConfig(topo); } else { block line 1584 1592 moved ? }</technical_language>

Target:
private JSONObject getTopology(StartAction startAction, Map<Integer, ExtensibleGroupTag> hostGroups, JoinCoordinator joinCoordinator) { JSONObject topo = null; int sitesperhost = m_catalogContext.getDeployment().getCluster().getSitesperhost(); int kfactor = m_catalogContext.getDeployment().getCluster().getKfactor(); if (startAction == StartAction.JOIN) { assert(joinCoordinator != null); topo = joinCoordinator.getTopology(); } else { final Set<Integer> liveHostIds = m_messenger.getLiveHostIds(); Preconditions.checkArgument(hostGroups.keySet().equals(liveHostIds)); int hostcount = liveHostIds.size(); ClusterConfig clusterConfig = new ClusterConfig(hostcount, sitesperhost, kfactor); if (!startAction.doesRejoin() && !clusterConfig.validate()) { VoltDB.crashLocalVoltDB(clusterConfig.getErrorMsg(), false, null); } try { final Multimap<Integer, Long> replicas = m_cartographer.getReplicasForPartitions(m_cartographer.getPartitions()); final Map<Integer, Long> masters = m_cartographer.getHSIdsForSinglePartitionMasters(); replicas.removeAll(MpInitiator.MP_INIT_PID); masters.remove(MpInitiator.MP_INIT_PID); topo = clusterConfig.getTopology(hostGroups, replicas, masters, Lists.newArrayList()); m_messenger.registerGroupTags(hostGroups); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to calculate topology", false, e); } if (!startAction.doesRejoin()) { topo = registerClusterConfig(topo); } } return topo; }
Source:
<code>public String toUri() { <START> return UriComponentsBuilder <END> .newInstance() .scheme(getProtocol()) .host(getHostname()) .port(getPort()) .toUriString(); }</code><technical_language>needed more</technical_language>

Target:
public String toUri() { return new HttpHost(hostname, port, protocol).toURI(); }
Source:
<code>public Iterable<Edge> getEdges(final Vertex otherVertex, Direction direction, String[] labels, FetchHints fetchHints, Authorizations authorizations) { <START> getFetchHints().validateHasEdgeFetchHints(direction); <END> return getGraph().getEdges(getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, labels, authorizations), fetchHints, authorizations); }</code><technical_language>checking labels</technical_language>

Target:
public Iterable<Edge> getEdges(final Vertex otherVertex, Direction direction, String[] labels, FetchHints fetchHints, Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction, labels); return getGraph().getEdges(getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, labels, authorizations), fetchHints, authorizations); }
Source:
<code><START> private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { <END> if(volumeEntity == null) { return; } boolean isNewSessionAvailable = true; boolean isRemoveSessionCommandAvailable = false; boolean isStartSessionCommandAvailable = false; boolean isStopSessionCommandAvailable = false; boolean sessionOptionsCommandAvailable = true; boolean isViewSessionDetailsCommandAvailable = false; if (getSelectedItems() != null) { isStopSessionCommandAvailable = true; isViewSessionDetailsCommandAvailable = true; isStartSessionCommandAvailable = true; isRemoveSessionCommandAvailable = true; } getNewSessionCommand().setIsAvailable(isNewSessionAvailable); getRemoveSessionCommand().setIsAvailable(isRemoveSessionCommandAvailable); getStartSessionCommand().setIsAvailable(isStartSessionCommandAvailable); getStopSessionCommand().setIsAvailable(isStopSessionCommandAvailable); getSessionOptionsCommand().setIsAvailable(sessionOptionsCommandAvailable); getViewSessionDetailsCommand().setIsAvailable(isViewSessionDetailsCommandAvailable); }</code><technical_language>I suggest actions disabled respective features implemented</technical_language>

Target:
private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { if(volumeEntity == null) { return; } getNewSessionCommand().setIsAvailable(true); getRemoveSessionCommand().setIsAvailable(false); getStartSessionCommand().setIsAvailable(false); getStopSessionCommand().setIsAvailable(false); getSessionOptionsCommand().setIsAvailable(false); getViewSessionDetailsCommand().setIsAvailable(false); }
Source:
<code>private RequestContext BuildDummyRequestContextForOperationTest(OperationEnum operation) { RequestContext rc = new RequestContext(); <START> rc.setRequest(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()); <END> switch (operation) { case get: rc.setLimit(1); } return rc; }</code><technical_language>instance of spring's MockHttpServletRequest</technical_language>

Target:
private RequestContext BuildDummyRequestContextForOperationTest(OperationEnum operation) { RequestContext rc = new RequestContext(); rc.setRequest(new MockHttpServletRequest()); switch (operation) { case get: case getSubresource: rc.setLimit(1); break; case getWithUUID: case getSubresourceWithUUID: case postCreate: case postSubresource: } return rc; }
Source:
<code>public Authenticator getAuthenticator(String name) { for (AuthenticatorSpi implementation : implementations) { for (Authenticator authenticator : implementation.getAuthenticators()) { if (StringUtils.equals(authenticator.getName(), name)) { return authenticator; } } <START> } <END> log.warn( "There is no instance to manage authenticator \"" + name + "\", will return null." ); return null; }</code><technical_language>I missing profile management... in directory. Authenticator is implementation instantiate some configuration. I missing something</technical_language>

Target:
public Authenticator getAuthenticator(String name) { Authenticator authenticator = instances.get(name); if (authenticator != null) { return authenticator; } log.warn( "There is no authenticator for name \"" + name + "\", will " + "return null." ); return null; }
Source:
<code>public IOContainer(DriverType driver) { <START> if ( driver == DriverType.DATASTAX ) { <END> boolean stringMetricsDropped = configuration.getBooleanProperty(CoreConfig.STRING_METRICS_DROPPED); List<String> tenantIdsKept = configuration.getListProperty(CoreConfig.TENANTIDS_TO_KEEP); metadataIO = new DMetadataIO(); shardStateIO = new DShardStateIO(); locatorIO = new DLocatorIO(); excessEnumIO = new DExcessEnumIO(); enumReaderIO = new DEnumIO(); basicMetricsRW = new DBasicMetricsRW(stringMetricsDropped, tenantIdsKept); preAggregatedMetricsRW = new DPreaggregatedMetricsRW(); } else { metadataIO = new AMetadataIO(); shardStateIO = new AShardStateIO(); locatorIO = new ALocatorIO(); excessEnumIO = new AExcessEnumIO(); enumReaderIO = new AEnumIO(); basicMetricsRW = new ABasicMetricsRW(); preAggregatedMetricsRW = new APreaggregatedMetricsRW(); } }</code><technical_language>this constructor private</technical_language>

Target:
private IOContainer(DriverType driver) { if ( driver == DriverType.DATASTAX ) { boolean stringMetricsDropped = configuration.getBooleanProperty(CoreConfig.STRING_METRICS_DROPPED); List<String> tenantIdsKept = configuration.getListProperty(CoreConfig.TENANTIDS_TO_KEEP); metadataIO = new DMetadataIO(); shardStateIO = new DShardStateIO(); locatorIO = new DLocatorIO(); excessEnumIO = new DExcessEnumIO(); enumReaderIO = new DEnumIO(); basicMetricsRW = new DBasicMetricsRW(stringMetricsDropped, tenantIdsKept); preAggregatedMetricsRW = new DPreaggregatedMetricsRW(); } else { metadataIO = new AMetadataIO(); shardStateIO = new AShardStateIO(); locatorIO = new ALocatorIO(); excessEnumIO = new AExcessEnumIO(); enumReaderIO = new AEnumIO(); basicMetricsRW = new ABasicMetricsRW(); preAggregatedMetricsRW = new APreaggregatedMetricsRW(); } }
Source:
<code>private void addDirectory( String path, File dir, List<DiagnosticsReportSource> sources ) { <START> String currentLevel = path + "/" + dir.getName(); <END> if ( fs.isDirectory( dir ) ) { File[] files = fs.listFiles( dir ); if ( files != null ) { for ( File file : files ) { addDirectory( currentLevel, file, sources ); } } } else { sources.add( DiagnosticsReportSources.newDiagnosticsFile( currentLevel, fs, dir ) ); } }</code><technical_language>File.separator instead of "/"</technical_language>

Target:
private void addDirectory( String path, File dir, List<DiagnosticsReportSource> sources ) { String currentLevel = path + File.separator + dir.getName(); if ( fs.isDirectory( dir ) ) { File[] files = fs.listFiles( dir ); if ( files != null ) { for ( File file : files ) { addDirectory( currentLevel, file, sources ); } } } else { sources.add( DiagnosticsReportSources.newDiagnosticsFile( currentLevel, fs, dir ) ); } }
Source:
<code>public BridgeAPI bridgeAPI() { <START> logger.error("bridgeAPI({}) called. Should NEVER occur."); <END> return null; }</code><technical_language>If this method called, exist</technical_language>

Target:
public BridgeAPI bridgeAPI() { logger.debug( "bridgeAPI({}) called. Should NEVER occur as it seems to be a lack of protocol-specific implementation of this bridge API."); return null; }
Source:
<code>public AbstractRefreshManager(ModelProvider<? extends GridController> modelProvider, EventBus eventBus, ClientStorage clientStorage) { this.modelProvider = modelProvider; this.clientStorage = clientStorage; this.eventBus = eventBus; this.refreshPanel = createRefreshPanel(); listenOnManualRefresh(); eventBus.addHandler(UiCommonInitEvent.getType(), new UiCommonInitHandler() { @Override public void onUiCommonInit(UiCommonInitEvent event) { updateController(); } }); updateController(); <START> getModelTimer().setRefreshRate(readRefreshRate()); <END> eventBus.addHandler(ApplicationFocusChangeEvent.getType(), new ApplicationFocusChangeHandler() { @Override public void onApplicationFocusChange(ApplicationFocusChangeEvent event) { onWindowFocusChange(event.isInFocus()); } }); }</code><technical_language>Small thing: getModelTimer().setRefreshRate(readRefreshRate()); appears in code, i.e. called (in constructor, right updateController calls updateTimer) in setCurrentRefreshRate (right updateTimer). In other words, consider removing change doing: private void updateTimer() { // existing code getModelTimer().setRefreshRate(readRefreshRate()); } public void setCurrentRefreshRate(int newRefreshRate) { // existing code // remove line: getModelTimer().setRefreshRate(readRefreshRate()); }</technical_language>

Target:
public AbstractRefreshManager(ModelProvider<? extends GridController> modelProvider, EventBus eventBus, ClientStorage clientStorage) { this.modelProvider = modelProvider; this.clientStorage = clientStorage; this.eventBus = eventBus; this.refreshPanel = createRefreshPanel(); listenOnManualRefresh(); eventBus.addHandler(UiCommonInitEvent.getType(), new UiCommonInitHandler() { @Override public void onUiCommonInit(UiCommonInitEvent event) { updateController(); } }); updateController(); eventBus.addHandler(ApplicationFocusChangeEvent.getType(), new ApplicationFocusChangeHandler() { @Override public void onApplicationFocusChange(ApplicationFocusChangeEvent event) { onWindowFocusChange(event.isInFocus()); } }); }
Source:
<code>private void processNextPeriodicMeterReadsForInterval(final List<PeriodicMeterReadsGas> periodicMeterReads, final List<DataObject> bufferedObjects, final DateTime bufferedDateTime, final List<GetResult> results) throws ProtocolAdapterException { final AmrProfileStatusCode amrProfileStatusCode = this.readAmrProfileStatusCode(bufferedObjects .get(BUFFER_INDEX_AMR_STATUS)); final DataObject gasValue = bufferedObjects.get(BUFFER_INDEX_MBUS_VALUE_INT); LOGGER.debug("gasValue: {}", this.dlmsHelperService.getDebugInfo(gasValue)); final DataObject gasCaptureTime = bufferedObjects.get(BUFFER_INDEX_MBUS_CAPTURETIME_INT); LOGGER.debug("gasCaptureTime: {}", this.dlmsHelperService.getDebugInfo(gasCaptureTime)); final CosemDateTime cosemDateTime = this.dlmsHelperService.fromDateTimeValue((byte[]) gasCaptureTime.value()); final Date captureTime; if (cosemDateTime.isDateTimeSpecified()) { captureTime = cosemDateTime.asDateTime().toDate(); } else { throw new ProtocolAdapterException("Unexpected null/unspecified value for Gas Capture Time"); } final PeriodicMeterReadsGas nextPeriodicMeterReads = new PeriodicMeterReadsGas(bufferedDateTime.toDate(), this.dlmsHelperService.getScaledMeterValue(gasValue, <START> results.get(RESULT_INDEX_SCALER_UNIT).resultData(), "gasValue"), captureTime, <END> amrProfileStatusCode); periodicMeterReads.add(nextPeriodicMeterReads); }</code><technical_language>![MINOR](<LINK_0> Define a constant instead of duplicating this literal "gasValue" 3 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private void processNextPeriodicMeterReadsForInterval(final List<PeriodicMeterReadsGas> periodicMeterReads, final List<DataObject> bufferedObjects, final DateTime bufferedDateTime, final List<GetResult> results) throws ProtocolAdapterException { final AmrProfileStatusCode amrProfileStatusCode = this.readAmrProfileStatusCode(bufferedObjects .get(BUFFER_INDEX_AMR_STATUS)); final DataObject gasValue = bufferedObjects.get(BUFFER_INDEX_MBUS_VALUE_INT); LOGGER.debug("gasValue: {}", this.dlmsHelperService.getDebugInfo(gasValue)); final CosemDateTime cosemDateTime = this.dlmsHelperService.readDateTime( bufferedObjects.get(BUFFER_INDEX_MBUS_CAPTURETIME_INT), "Clock from mbus interval extended register"); final Date captureTime; if (cosemDateTime.isDateTimeSpecified()) { captureTime = cosemDateTime.asDateTime().toDate(); } else { throw new ProtocolAdapterException("Unexpected null/unspecified value for Gas Capture Time"); } final PeriodicMeterReadsGas nextPeriodicMeterReads = new PeriodicMeterReadsGas(bufferedDateTime.toDate(), this.dlmsHelperService.getScaledMeterValue(gasValue, results.get(RESULT_INDEX_SCALER_UNIT).resultData(), "gasValue"), captureTime, amrProfileStatusCode); periodicMeterReads.add(nextPeriodicMeterReads); }
Source:
<code>public SolrQuery propertyIsEqualTo(String propertyName, String literal, boolean isCaseSensitive) { if (!isCaseSensitive) { throw new UnsupportedOperationException("Case insensitive exact searches are not supported."); } verifyInputData(propertyName, literal); String mappedPropertyName = getMappedPropertyName(propertyName, AttributeFormat.STRING, true); if (literal.isEmpty()) { return new SolrQuery("-" + mappedPropertyName + ":[\"\" TO *]"); } if (Metacard.ID.equals(propertyName)) { isIdQuery = true; ids.add(literal); } String searchPhrase = QUOTE + escapeSpecialCharacters(literal) + QUOTE; if (searchPhrase.contains(SOLR_WILDCARD_CHAR) || searchPhrase.contains(SOLR_SINGLE_WILDCARD_CHAR)) { <START> return new SolrQuery(wildcardSolrQuery(searchPhrase, propertyName, true)); <END> } else if (Metacard.ANY_TEXT.equals(propertyName)) { String solrQuery = resolver .anyTextFields() .map(field -> field + ":" + searchPhrase) .collect(Collectors.joining(" ")); return new SolrQuery("(" + solrQuery + ")"); } else { return new SolrQuery(mappedPropertyName + ":" + searchPhrase); } }</code><technical_language>Nit: wildcardSolrQuery method refactored part of method need duplicated for this special case? I easier differences propertyIsInProximityTo, propertyIsFuzzy, propertyIsLike, propertyIsEqualTo</technical_language>

Target:
public SolrQuery propertyIsEqualTo(String propertyName, String literal, boolean isCaseSensitive) { if (!isCaseSensitive) { throw new UnsupportedOperationException("Case insensitive exact searches are not supported."); } verifyInputData(propertyName, literal); String mappedPropertyName = getMappedPropertyName(propertyName, AttributeFormat.STRING, true); if (literal.isEmpty()) { return new SolrQuery("-" + mappedPropertyName + ":[\"\" TO *]"); } if (Metacard.ID.equals(propertyName)) { isIdQuery = true; ids.add(literal); } String searchPhrase = QUOTE + escapeSpecialCharacters(literal) + QUOTE; if (!(searchPhrase.contains(SOLR_WILDCARD_CHAR) || searchPhrase.contains(SOLR_SINGLE_WILDCARD_CHAR)) && Metacard.ANY_TEXT.equals(propertyName)) { return new SolrQuery(wildcardSolrQuery(searchPhrase, propertyName, true, true)); } else if (searchPhrase.contains(SOLR_WILDCARD_CHAR) || searchPhrase.contains(SOLR_SINGLE_WILDCARD_CHAR) || Metacard.ANY_TEXT.equals(propertyName)) { return new SolrQuery(wildcardSolrQuery(searchPhrase, propertyName, true, false)); } else { return new SolrQuery(mappedPropertyName + ":" + searchPhrase); } }
Source:
<code>protected String doInBackground() { LOGGER.info("loading " + name ); AtomCache cache = new AtomCache(config.getPdbFilePath(),config.getCacheFilePath()); Structure s = null; try { if ( showBiolAssembly) { s= StructureIO.getBiologicalAssembly(name); int atomCount = StructureTools.getNrAtoms(s); if ( atomCount > 200000){ <START> LOGGER.error("Structure very large. Reducing display to C alpha atoms only"); <END> s = BioAssemblyTools.getReducedStructure(s); } } else { s = cache.getStructure(name); } LOGGER.info("done loading structure..."); StructureAlignmentJmol jmol = new StructureAlignmentJmol(); jmol.setStructure(s); jmol.evalString("set antialiasDisplay on; select all;spacefill off; wireframe off; backbone off; cartoon;color cartoon chain; select ligand;wireframe 0.16;spacefill 0.5; select all; color cartoon structure;"); jmol.evalString("save STATE state_1"); } catch (Exception e){ e.printStackTrace(); JOptionPane.showMessageDialog(null, "Error while loading " + name + ":" + e.getMessage()); s = new StructureImpl(); } hideProgressBar(); return "Done."; }</code><technical_language>this is warn</technical_language>

Target:
protected String doInBackground() { LOGGER.info("loading " + name ); AtomCache cache = new AtomCache(config.getPdbFilePath(),config.getCacheFilePath()); Structure s = null; try { if ( showBiolAssembly) { s= StructureIO.getBiologicalAssembly(name); int atomCount = StructureTools.getNrAtoms(s); if ( atomCount > 200000){ LOGGER.warn("Structure very large. Reducing display to C alpha atoms only"); s = BioAssemblyTools.getReducedStructure(s); } } else { s = cache.getStructure(name); } LOGGER.info("done loading structure..."); StructureAlignmentJmol jmol = new StructureAlignmentJmol(); jmol.setStructure(s); jmol.evalString("set antialiasDisplay on; select all;spacefill off; wireframe off; backbone off; cartoon;color cartoon chain; select ligand;wireframe 0.16;spacefill 0.5; select all; color cartoon structure;"); jmol.evalString("save STATE state_1"); } catch (Exception e){ e.printStackTrace(); JOptionPane.showMessageDialog(null, "Error while loading " + name + ":" + e.getMessage()); s = new StructureImpl(); } hideProgressBar(); return "Done."; }
Source:
<code>private InputTransformer getInputTransformer(InputStream inputStream) { XMLStreamReader xmlStreamReader = null; try { xmlStreamReader = xmlInputFactory.createXMLStreamReader(inputStream); Bundle bundle = FrameworkUtil.getBundle(this.getClass()); if (bundle == null) { return defaultInputTransformer; } <START> BundleContext bundleContext = bundle.getBundleContext(); <END> Collection<ServiceReference<InputTransformer>> serviceReferences = bundleContext .getServiceReferences(InputTransformer.class, null); while (xmlStreamReader.hasNext()) { int next = xmlStreamReader.next(); if (next == XMLStreamConstants.START_ELEMENT) { String namespaceUri = xmlStreamReader.getNamespaceURI(); for (ServiceReference<InputTransformer> serviceReference : serviceReferences) { if (StringUtils.equals(namespaceUri, (String) serviceReference.getProperty("schema"))) { return bundleContext.getService(serviceReference); } } } } } catch (XMLStreamException | InvalidSyntaxException e) { LOGGER.error("Failed to parse transformer namespace", e); } finally { try { if (xmlStreamReader != null) { xmlStreamReader.close(); } } catch (XMLStreamException e) { LOGGER.error("failed to close namespace reader", e); } } return null; }</code><technical_language>bundleContext null in some cases, check for it</technical_language>

Target:
private InputTransformer getInputTransformer(InputStream inputStream) { XMLStreamReader xmlStreamReader = null; try { xmlStreamReader = xmlInputFactory.createXMLStreamReader(inputStream); while (xmlStreamReader.hasNext()) { int next = xmlStreamReader.next(); if (next == XMLStreamConstants.START_ELEMENT) { String namespaceUri = xmlStreamReader.getNamespaceURI(); InputTransformer transformerReference = lookupTransformerReference( namespaceUri); if (transformerReference != null) return transformerReference; } } } catch (XMLStreamException | InvalidSyntaxException e) { LOGGER.error("Failed to parse transformer namespace", e); } finally { try { if (xmlStreamReader != null) { xmlStreamReader.close(); } } catch (XMLStreamException e) { LOGGER.error("failed to close namespace reader", e); } } return null; }
Source:
<code>public DnsConfigurationWidget() { setDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); WidgetIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); <START> setDnsConfigurationEditor.setLabel(constants.setDnsConfigurationLabel()); <END> }</code><technical_language>Please prefered declarative approach - attribute in *.ui.xml</technical_language>

Target:
public DnsConfigurationWidget() { setDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); WidgetIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }