auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void FBButton_004_ForcedLoginButton_Visible() { WikiBasePageObject base = new WikiBasePageObject(driver); <START> SpecialNewFilesPageObject specialPage = base <END> .openSpecialNewFiles(wikiURL); specialPage.verifySpecialPage(); specialPage.addPhoto(); specialPage.verifyModalLoginAppeared(); base.verifyFBButtonVisible(); }</code><technical_language>this in line</technical_language>

Target:
public void FBButton_004_ForcedLoginButton_Visible() { WikiBasePageObject base = new WikiBasePageObject(driver); SpecialNewFilesPageObject specialPage = base.openSpecialNewFiles(wikiURL); specialPage.verifySpecialPage(); specialPage.addPhoto(); specialPage.verifyModalLoginAppeared(); specialPage.verifyModalFBButtonVisible(); }
Source:
<code>public void freeTicketWhenExists(TicketsInteractor mockedTicketsInteractor) throws RecordNotFoundException, UpdateTicketStateUnauthorizedException { long ticketId = 1; ObjectNode json = Json.newObject(); ArrayNode node = json.putArray(ConstantsManager.TICKET_IDS_FIELD_NAME); node.add(ticketId); when(mockedBody.asJson()).thenReturn(json); Result result = ticketsController.free(); assertEquals(Helpers.OK, Helpers.status(result)); <START> verify(mockedTicketsInteractor, times(1)).freeATicket(ticketId); <END> }</code><technical_language>times(1) is default in verify</technical_language>

Target:
public void freeTicketWhenExists(TicketsInteractor mockedTicketsInteractor) throws RecordNotFoundException, UpdateTicketStateUnauthorizedException { long ticketId = 1; ObjectNode json = Json.newObject(); ArrayNode node = json.putArray(ConstantsManager.TICKET_IDS_FIELD_NAME); node.add(ticketId); when(mockedBody.asJson()).thenReturn(json); Result result = ticketsController.free(); assertEquals(Helpers.OK, Helpers.status(result)); verify(mockedTicketsInteractor).freeATicket(ticketId); }
Source:
<code>public final Loader<? extends BenchmarkModule> loadDatabase() { Loader<? extends BenchmarkModule> loader = null; try { loader = this.makeLoaderImpl(); if (loader != null) { List<? extends LoaderThread> loaderThreads = loader.createLoaderThreads(); if (loaderThreads != null) { int maxConcurrent = workConf.getLoaderThreads(); assert (maxConcurrent > 0); if (LOG.isDebugEnabled()) LOG.debug(String.format("Starting %d %s.LoaderThreads [maxConcurrent=%d]", loaderThreads.size(), loader.getClass().getSimpleName(), maxConcurrent)); ThreadUtil.runNewPool(loaderThreads, maxConcurrent); if (loader.getTableCounts().isEmpty() == false) { LOG.info("Table Counts:\n" + loader.getTableCounts()); } } <START> for (LoaderThread t : loaderThreads) { t.getConn().close(); } <END> } } catch (SQLException ex) { String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } if (LOG.isDebugEnabled()) LOG.debug(String.format("Finished loading the %s database", this.getBenchmarkName().toUpperCase())); return (loader); }</code><technical_language>Move this finalize clause for this try statement</technical_language>

Target:
public final Loader<? extends BenchmarkModule> loadDatabase() { Loader<? extends BenchmarkModule> loader = null; try { loader = this.makeLoaderImpl(); if (loader != null) { List<? extends LoaderThread> loaderThreads = loader.createLoaderThreads(); if (loaderThreads != null) { try{ int maxConcurrent = workConf.getLoaderThreads(); assert (maxConcurrent > 0); if (LOG.isDebugEnabled()) LOG.debug(String.format("Starting %d %s.LoaderThreads [maxConcurrent=%d]", loaderThreads.size(), loader.getClass().getSimpleName(), maxConcurrent)); ThreadUtil.runNewPool(loaderThreads, maxConcurrent); if (loader.getTableCounts().isEmpty() == false) { LOG.info("Table Counts:\n" + loader.getTableCounts()); } } catch (Exception ex){ String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } finally { for (LoaderThread t : loaderThreads) { t.getConnection().close(); } } } } } catch (SQLException ex) { String msg = String.format("Unexpected error when trying to load the %s database", this.benchmarkName.toUpperCase()); throw new RuntimeException(msg, ex); } if (LOG.isDebugEnabled()) LOG.debug(String.format("Finished loading the %s database", this.getBenchmarkName().toUpperCase())); return (loader); }
Source:
<code>private long getNumInstancesWithAttribute(List<SingularityTaskId> taskIds, String attrKey, String attrValue) { return taskIds.stream() <START> .map(id -> slaveManager.getSlave(taskManager.getTask(id).get().getMesosTask().getSlaveId().getValue()).get().getAttributes().get(attrKey)) <END> .filter(Objects::nonNull) .filter(x -> x.equals(attrValue)) .count(); }</code><technical_language>I fetch a full list of slaves this. of a zk call currently. So, either: - Add slaveManager stuff leader cache this is in memory - Pass a list of slave data read zk for</technical_language>

Target:
private long getNumInstancesWithAttribute(List<SingularityTaskId> taskIds, String attrKey, String attrValue) { return taskIds.stream() .map(id -> leaderCache.getSlave(taskManager.getTask(id).get().getMesosTask().getSlaveId().getValue()).get().getAttributes().get(attrKey)) .filter(Objects::nonNull) .filter(x -> x.equals(attrValue)) .count(); }
Source:
<code>public LiveData<List<Provider>> getProviders(RestApi restApi) { final MutableLiveData<List<Provider>> providerLiveData = new MutableLiveData<>(); if (NetworkUtils.isOnline()) { restApi.getProviderList().enqueue(new Callback<Results<Provider>>() { @Override <START> public void onResponse(@NotNull Call<Results<Provider>> call, Response<Results<Provider>> response) { <END> if (response.isSuccessful()) { if (!response.body().getResults().isEmpty()) { providerLiveData.setValue(response.body().getResults()); } else { providerLiveData.setValue(null); } } else { Log.d(TAG, "Response Unsuccessful!" + response.errorBody()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } } @Override public void onFailure(@NotNull Call<Results<Provider>> call, @NotNull Throwable t) { Log.d(TAG, "Call Failed! Error: " + t.getMessage()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } }); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.device_offline_msg)); } return providerLiveData; }</code><technical_language>Fix warning annotated parameter overrides @ParametersAreNonnullByDefault parameter</technical_language>

Target:
public LiveData<List<Provider>> getProviders(RestApi restApi) { final MutableLiveData<List<Provider>> providerLiveData = new MutableLiveData<>(); if (NetworkUtils.isOnline()) { restApi.getProviderList().enqueue(new Callback<Results<Provider>>() { @Override public void onResponse(@NotNull Call<Results<Provider>> call, @NotNull Response<Results<Provider>> response) { if (response.isSuccessful()) { if (!response.body().getResults().isEmpty()) { providerLiveData.setValue(response.body().getResults()); } else { providerLiveData.setValue(null); } } else { Log.d(TAG, "Response Unsuccessful!" + response.errorBody()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } } @Override public void onFailure(@NotNull Call<Results<Provider>> call, @NotNull Throwable t) { Log.d(TAG, "Call Failed! Error: " + t.getMessage()); ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_providers)); providerLiveData.setValue(null); } }); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.device_offline_msg)); } return providerLiveData; }
Source:
<code>public static void restartAlarmManagerTimeOfDay(Context context, Calendar alarm) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent updateIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, FeedUpdateReceiver.class), 0); if (alarmManager == null) { Log.d(TAG, "AlarmManager was null"); return; } <START> alarmManager.cancel(updateIntent); <END> Log.d(TAG, "Alarm set for: " + alarm.toString() + " : " + alarm.getTimeInMillis()); alarmManager.set(AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(), updateIntent); Log.d(TAG, "Changed alarm to new time of day " + alarm.get(Calendar.HOUR_OF_DAY) + ":" + alarm.get(Calendar.MINUTE)); }</code><technical_language>this shares a lot of code restartAlarmManagerInterval refactor this further, in this PR</technical_language>

Target:
private static void restartAlarmManagerTimeOfDay(Context context, Calendar alarm) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager == null) { Log.d(TAG, "AlarmManager was null"); return; } PendingIntent updateIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, FeedUpdateReceiver.class), 0); alarmManager.cancel(updateIntent); Log.d(TAG, "Alarm set for: " + alarm.toString() + " : " + alarm.getTimeInMillis()); alarmManager.set(AlarmManager.RTC_WAKEUP, alarm.getTimeInMillis(), updateIntent); Log.d(TAG, "Changed alarm to new time of day " + alarm.get(Calendar.HOUR_OF_DAY) + ":" + alarm.get(Calendar.MINUTE)); }
Source:
<code>public static PointValue fromMap( MapValue map ) { <START> AnyValue[] fields = new Value[PointValueField.__MAX_VALUE__.ordinal()]; <END> for ( PointValueField f : PointValueField.values() ) { if ( f != PointValueField.__MAX_VALUE__ ) { AnyValue fieldValue = map.get( f.name().toLowerCase() ); fields[f.ordinal()] = fieldValue != Values.NO_VALUE ? fieldValue : null; } } return fromInputFields( fields ); }</code><technical_language>feels PointValueField.values().length get rid of this __MAX_VALUE__ altogether</technical_language>

Target:
public static PointValue fromMap( MapValue map ) { AnyValue[] fields = new Value[PointValueField.values().length]; for ( PointValueField f : PointValueField.values() ) { AnyValue fieldValue = map.get( f.name().toLowerCase() ); fields[f.ordinal()] = fieldValue != Values.NO_VALUE ? fieldValue : null; } return fromInputFields( fields ); }
Source:
<code>private void getCorrelationTypesFromCr() throws CentralRepoException { typeCache.invalidateAll(); Connection conn = connect(); PreparedStatement preparedStatement = null; <START> ResultSet resultSet = null; <END> String sql = "SELECT * FROM correlation_types"; try { preparedStatement = conn.prepareStatement(sql); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { CorrelationAttributeInstance.Type aType = getCorrelationTypeFromResultSet(resultSet); typeCache.put(aType.getId(), aType); } } catch (SQLException ex) { throw new CentralRepoException("Error getting correlation types.", ex); } finally { CentralRepoDbUtil.closeStatement(preparedStatement); CentralRepoDbUtil.closeResultSet(resultSet); CentralRepoDbUtil.closeConnection(conn); } }</code><technical_language>do try-with-resources this cleaner</technical_language>

Target:
private void getCorrelationTypesFromCr() throws CentralRepoException { typeCache.invalidateAll(); String sql = "SELECT * FROM correlation_types"; try ( Connection conn = connect(); PreparedStatement preparedStatement = conn.prepareStatement(sql); ResultSet resultSet = preparedStatement.executeQuery();) { while (resultSet.next()) { CorrelationAttributeInstance.Type aType = getCorrelationTypeFromResultSet(resultSet); typeCache.put(aType.getId(), aType); } } catch (SQLException ex) { throw new CentralRepoException("Error getting correlation types.", ex); } }
Source:
<code>protected Collection<JcloudsLocationCustomizer> getCustomizers(ConfigBag setup) { JcloudsLocationCustomizer customizer = setup.get(JCLOUDS_LOCATION_CUSTOMIZER); Collection<JcloudsLocationCustomizer> customizers = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS); String customizerType = setup.get(JCLOUDS_LOCATION_CUSTOMIZER_TYPE); String customizersSupplierType = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS_SUPPLIER_TYPE); List<JcloudsLocationCustomizer> result = new ArrayList<JcloudsLocationCustomizer>(); if (customizer != null) result.add(customizer); if (customizers != null) result.addAll(customizers); if (Strings.isNonBlank(customizerType)) { Optional<JcloudsLocationCustomizer> customizerByType = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizerType, setup); if (customizerByType.isPresent()) { result.add(customizerByType.get()); } else { LOG.warn("Cannot load JcloudsLocationCustomizer: " + customizersSupplierType); } } if (Strings.isNonBlank(customizersSupplierType)) { Optional<Supplier<Collection<JcloudsLocationCustomizer>>> supplier = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizersSupplierType, setup); if (supplier.isPresent()) { result.addAll(supplier.get().get()); } else { <START> LOG.warn("Cannot load JcloudsLocationCustomizer supplier: " + customizersSupplierType); <END> } } return result; }</code><technical_language>A LOG.warn good enough for - I need this fail abort creation of machines if security group customiser loaded</technical_language>

Target:
protected Collection<JcloudsLocationCustomizer> getCustomizers(ConfigBag setup) { JcloudsLocationCustomizer customizer = setup.get(JCLOUDS_LOCATION_CUSTOMIZER); Collection<JcloudsLocationCustomizer> customizers = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS); String customizerType = setup.get(JCLOUDS_LOCATION_CUSTOMIZER_TYPE); String customizersSupplierType = setup.get(JCLOUDS_LOCATION_CUSTOMIZERS_SUPPLIER_TYPE); List<JcloudsLocationCustomizer> result = new ArrayList<JcloudsLocationCustomizer>(); if (customizer != null) result.add(customizer); if (customizers != null) result.addAll(customizers); if (Strings.isNonBlank(customizerType)) { Optional<JcloudsLocationCustomizer> customizerByType = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizerType, setup); if (customizerByType.isPresent()) { result.add(customizerByType.get()); } else { throw new IllegalStateException("Failed to load JcloudsLocationCustomizer "+customizersSupplierType+" for location "+this); } } if (Strings.isNonBlank(customizersSupplierType)) { Optional<Supplier<Collection<JcloudsLocationCustomizer>>> supplier = Reflections.invokeConstructorWithArgs(getManagementContext().getCatalog().getRootClassLoader(), customizersSupplierType, setup); if (supplier.isPresent()) { result.addAll(supplier.get().get()); } else { throw new IllegalStateException("Failed to load JcloudsLocationCustomizer supplier "+customizersSupplierType+" for location "+this); } } return result; }
Source:
<code>public static Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> getTypeVariableBindings(Class<?> type) { Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings = new HashMap<>(); Map<TypeVariable<?>, TypeVariable<?>> currentBindings = new HashMap<>(); TypeVariable<?>[] subTypeParameters = type.getTypeParameters(); for ( TypeVariable<?> typeVariable : subTypeParameters ) { currentBindings.put( typeVariable, typeVariable ); } allBindings.put( type, currentBindings ); collectTypeBindings( type, allBindings, currentBindings ); allBindings.put( Object.class, Collections.emptyMap() ); <START> return allBindings; <END> }</code><technical_language>unmodifiable</technical_language>

Target:
public static Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> getTypeVariableBindings(Class<?> type) { Map<Class<?>, Map<TypeVariable<?>, TypeVariable<?>>> allBindings = new HashMap<>(); Map<TypeVariable<?>, TypeVariable<?>> currentBindings = new HashMap<>(); TypeVariable<?>[] subTypeParameters = type.getTypeParameters(); for ( TypeVariable<?> typeVariable : subTypeParameters ) { currentBindings.put( typeVariable, typeVariable ); } allBindings.put( type, currentBindings ); collectTypeBindings( type, allBindings, currentBindings ); allBindings.put( Object.class, Collections.emptyMap() ); return Collections.unmodifiableMap( allBindings ); }
Source:
<code>public void storeSettings() { <START> preferencesService.storeEntryEditorPreferences(new EntryEditorPreferences( <END> initialEntryEditorPreferences.getEntryEditorTabList(), openOnNewEntryProperty.getValue(), enableRelatedArticlesTabProperty.getValue(), acceptRecommendationsProperty.getValue(), enableLatexCitationsTabProperty.getValue(), defaultSourceProperty.getValue(), enableValidationProperty.getValue())); AutoCompletePreferences.onlyCompleteNameFormat nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.BOTH; if (autoCompleteFirstLastProperty.getValue()) { nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.FIRST_LAST; } else if (autoCompleteLastFirstProperty.getValue()) { nameFormat = AutoCompletePreferences.onlyCompleteNameFormat.LAST_FIRST; } AutoCompleteFirstNameMode firstNameMode = AutoCompleteFirstNameMode.BOTH; if (firstNameModeAbbreviatedProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_ABBREVIATED; } else if (firstNameModeFullProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_FULL; } preferencesService.storeAutoCompletePreferences(new AutoCompletePreferences( enableAutoCompleteProperty.getValue(), firstNameMode, nameFormat, FieldFactory.parseFieldList(autoCompleteFieldsProperty.getValue()), preferencesService.getJournalAbbreviationPreferences())); }</code><technical_language>constants JabRefPreferences.AUTO_OPEN_FORM private</technical_language>

Target:
public void storeSettings() { preferencesService.storeEntryEditorPreferences(new EntryEditorPreferences( initialEntryEditorPreferences.getEntryEditorTabList(), openOnNewEntryProperty.getValue(), enableRelatedArticlesTabProperty.getValue(), acceptRecommendationsProperty.getValue(), enableLatexCitationsTabProperty.getValue(), defaultSourceProperty.getValue(), enableValidationProperty.getValue())); AutoCompletePreferences.NameFormat nameFormat = AutoCompletePreferences.NameFormat.BOTH; if (autoCompleteFirstLastProperty.getValue()) { nameFormat = AutoCompletePreferences.NameFormat.FIRST_LAST; } else if (autoCompleteLastFirstProperty.getValue()) { nameFormat = AutoCompletePreferences.NameFormat.LAST_FIRST; } AutoCompleteFirstNameMode firstNameMode = AutoCompleteFirstNameMode.BOTH; if (firstNameModeAbbreviatedProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_ABBREVIATED; } else if (firstNameModeFullProperty.getValue()) { firstNameMode = AutoCompleteFirstNameMode.ONLY_FULL; } preferencesService.storeAutoCompletePreferences(new AutoCompletePreferences( enableAutoCompleteProperty.getValue(), firstNameMode, nameFormat, FieldFactory.parseFieldList(autoCompleteFieldsProperty.getValue()), preferencesService.getJournalAbbreviationPreferences())); }
Source:
<code>protected void populateManager(final IContributionManager manager, final Collection actions, final String contributionID) { if (actions != null) { List<IAction> sortedActions = Lists.newArrayList(Iterables.filter(actions, IAction.class)); Comparator<IAction> comparator = new Comparator<IAction>() { @Override public int compare(IAction a1, IAction a2) { int returnedInt; if (!priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = 0; } else if (!priorityMap.containsKey(a1)) { returnedInt = 1; } else if (!priorityMap.containsKey(a2)) { returnedInt = -1; } else { returnedInt = priorityMap.get(a1) - priorityMap.get(a2); } return returnedInt; } }; Collections.sort(sortedActions, comparator); for (final IAction action : sortedActions) { <START> if (action instanceof CreateChildAction) { ((CreateChildAction) action).getMenuCreator(); } <END> if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } manager.update(true); }</code><technical_language>is this call a getter, ignoring result, needed here</technical_language>

Target:
protected void populateManager(final IContributionManager manager, final Collection actions, final String contributionID) { if (actions != null) { List<IAction> sortedActions = Lists.newArrayList(Iterables.filter(actions, IAction.class)); Comparator<IAction> comparator = new Comparator<IAction>() { @Override public int compare(IAction a1, IAction a2) { int returnedInt; if (!priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = 0; } else if (!priorityMap.containsKey(a1) && priorityMap.containsKey(a2)) { returnedInt = 1; } else if (priorityMap.containsKey(a1) && !priorityMap.containsKey(a2)) { returnedInt = -1; } else { returnedInt = priorityMap.get(a1) - priorityMap.get(a2); } if (returnedInt == 0) { returnedInt = Collator.getInstance().compare(a1.getText(), a2.getText()); } return returnedInt; } }; Collections.sort(sortedActions, comparator); for (final IAction action : sortedActions) { if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } manager.update(true); }
Source:
<code>public EventType getEventType(final String name) throws NoSuchEventTypeException, InternalNakadiException { <START> return getCached(name).map(CachedValue::getEventType).orElse(null); <END> }</code><technical_language>If return null - method declared @Nullable, properly handled in places is called. other possibility orElseThrow(...) instead</technical_language>

Target:
public EventType getEventType(final String name) throws NoSuchEventTypeException, InternalNakadiException { return getCached(name).map(CachedValue::getEventType) .orElseThrow(() -> new NoSuchEventTypeException("Event type " + name + " does not exists")); }
Source:
<code>boolean systemConditionsAvailable() { if (ActivityLifecycleHandler.curActivity == null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver curActivity null"); return false; } try { if (isDialogFragmentShowing(ActivityLifecycleHandler.curActivity)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver dialog fragment detected"); return false; } } catch (NoClassDefFoundError exception) { <START> OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "isDialogFragmentShowing AppCompatActivity not imported either used: " + exception); <END> } boolean keyboardUp = OSViewUtils.isKeyboardUp(new WeakReference<>(ActivityLifecycleHandler.curActivity)); if (keyboardUp) { ActivityLifecycleHandler.setSystemConditionObserver(TAG, systemConditionObserver); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver keyboard up detected"); } return !keyboardUp; }</code><technical_language>This info, error if class in app</technical_language>

Target:
boolean systemConditionsAvailable() { if (ActivityLifecycleHandler.curActivity == null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver curActivity null"); return false; } try { if (isDialogFragmentShowing(ActivityLifecycleHandler.curActivity)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver dialog fragment detected"); return false; } } catch (NoClassDefFoundError exception) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.INFO, "AppCompatActivity is not used in this app, skipping 'isDialogFragmentShowing' check: " + exception); } boolean keyboardUp = OSViewUtils.isKeyboardUp(new WeakReference<>(ActivityLifecycleHandler.curActivity)); if (keyboardUp) { ActivityLifecycleHandler.setSystemConditionObserver(TAG, systemConditionObserver); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.WARN, "OSSystemConditionObserver keyboard up detected"); } return !keyboardUp; }
Source:
<code>public WebSocketMessagesViewPayloadFilterVo getPayloadFilter() { if (payloadFilter != null) { return payloadFilter; } <START> return null; <END> }</code><technical_language>this turn out return payloadFilter</technical_language>

Target:
public WebSocketMessagesPayloadFilter getPayloadFilter() { return payloadFilter; }
Source:
<code>@Override public void sourceConfInit(FlowProcess<JobConf> fp, Tap<JobConf, RecordReader, OutputCollector> tap, JobConf conf) { MultiInputFormat.setClassConf(byte[].class, conf); if (conf.getBoolean(DelegateCombineFileInputFormat.USE_COMBINED_INPUT_FORMAT, false)) { DeprecatedInputFormatWrapper.setInputFormat(DelegateCombineFileInputFormat.class, conf); <START> DelegateCombineFileInputFormat.setCombinedInputFormatDelegate(conf, MultiInputFormat.class); <END> } else { DeprecatedInputFormatWrapper.setInputFormat(MultiInputFormat.class, conf); } }</code><technical_language>args reversed previous call, reason? (conf class, other around)</technical_language>

Target:
@Override public void sourceConfInit(FlowProcess<JobConf> fp, Tap<JobConf, RecordReader, OutputCollector> tap, JobConf conf) { MultiInputFormat.setClassConf(byte[].class, conf); DelegateCombineFileInputFormat.setDelegateInputFormat(conf, MultiInputFormat.class); }
Source:
<code>public void testSlotAllocationTimeout() throws Exception { final CompletableFuture<Void> secondSlotRequestFuture = new CompletableFuture<>(); final AtomicInteger slotRequestsCount = new AtomicInteger(); final TaskExecutorConnection taskManagerConnection = createTaskExecutorConnection(new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(ignored -> { <START> if (slotRequestsCount.getAndAdd(1) == 1) { secondSlotRequestFuture.complete(null); } else { return FutureUtils.completedExceptionally(new AskTimeoutException("timeout")); } return new CompletableFuture<>(); <END> }) .createTestingTaskExecutorGateway()); final SlotReport slotReport = createSlotReport(taskManagerConnection.getResourceID(), 2); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (DeclarativeSlotManager slotManager = createDeclarativeSlotManagerBuilder() .build()) { slotManager.start(ResourceManagerId.generate(), mainThreadExecutor, new TestingResourceActionsBuilder().build()); CompletableFuture.runAsync(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport), mainThreadExecutor) .thenRun(() -> slotManager.processResourceRequirements(createResourceRequirementsForSingleSlot())) .get(5, TimeUnit.SECONDS); secondSlotRequestFuture.get(); } }</code><technical_language>A slightly easier express this logic a queue pop populate queue answers want have</technical_language>

Target:
public void testSlotAllocationTimeout() throws Exception { final CompletableFuture<Void> secondSlotRequestFuture = new CompletableFuture<>(); final BlockingQueue<Supplier<CompletableFuture<Acknowledge>>> responseQueue = new ArrayBlockingQueue<>(2); responseQueue.add(() -> FutureUtils.completedExceptionally(new AskTimeoutException("timeout"))); responseQueue.add(() -> { secondSlotRequestFuture.complete(null); return new CompletableFuture<>(); }); final TaskExecutorConnection taskManagerConnection = createTaskExecutorConnection(new TestingTaskExecutorGatewayBuilder() .setRequestSlotFunction(ignored -> responseQueue.remove().get()) .createTestingTaskExecutorGateway()); final SlotReport slotReport = createSlotReport(taskManagerConnection.getResourceID(), 2); final Executor mainThreadExecutor = TestingUtils.defaultExecutor(); try (DeclarativeSlotManager slotManager = createDeclarativeSlotManagerBuilder() .build()) { slotManager.start(ResourceManagerId.generate(), mainThreadExecutor, new TestingResourceActionsBuilder().build()); CompletableFuture.runAsync(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport), mainThreadExecutor) .thenRun(() -> slotManager.processResourceRequirements(createResourceRequirementsForSingleSlot())) .get(5, TimeUnit.SECONDS); secondSlotRequestFuture.get(); } }
Source:
<code>public static ConfigDef enrich(ConfigDef baseConfigDef, Map<String, String> props, AbstractConfig defaultGroupConfig) { List<Object> topicCreationGroups = new ArrayList<>(); Object aliases = ConfigDef.parseType(TOPIC_CREATION_GROUPS_CONFIG, props.get(TOPIC_CREATION_GROUPS_CONFIG), ConfigDef.Type.LIST); if (aliases instanceof List) { topicCreationGroups.addAll((List<?>) aliases); } ConfigDef newDef = new ConfigDef(baseConfigDef); String defaultGroupPrefix = TOPIC_CREATION_PREFIX + DEFAULT_TOPIC_CREATION_GROUP + "."; topicCreationGroups.stream().distinct().forEach(group -> { if (!(group instanceof String)) { throw new ConfigException("Item in " + TOPIC_CREATION_GROUPS_CONFIG + " property is not of type String"); } String alias = (String) group; String prefix = TOPIC_CREATION_PREFIX + alias + "."; String configGroup = TOPIC_CREATION_GROUP + ": " + alias; newDef.embed(prefix, configGroup, 0, TopicCreationConfig.configDef( configGroup, <START> defaultGroupConfig.getShort(defaultGroupPrefix + REPLICATION_FACTOR_CONFIG), defaultGroupConfig.getInt(defaultGroupPrefix + PARTITIONS_CONFIG))); <END> }); return newDef; }</code><technical_language>for topicCreationGroups, WDYT pulling out of this lambda? I readability</technical_language>

Target:
public static ConfigDef enrich(ConfigDef baseConfigDef, Map<String, String> props, AbstractConfig defaultGroupConfig) { List<Object> topicCreationGroups = new ArrayList<>(); Object aliases = ConfigDef.parseType(TOPIC_CREATION_GROUPS_CONFIG, props.get(TOPIC_CREATION_GROUPS_CONFIG), ConfigDef.Type.LIST); if (aliases instanceof List) { topicCreationGroups.addAll((List<?>) aliases); } ConfigDef newDef = new ConfigDef(baseConfigDef); String defaultGroupPrefix = TOPIC_CREATION_PREFIX + DEFAULT_TOPIC_CREATION_GROUP + "."; short defaultGroupReplicationFactor = defaultGroupConfig.getShort(defaultGroupPrefix + REPLICATION_FACTOR_CONFIG); int defaultGroupPartitions = defaultGroupConfig.getInt(defaultGroupPrefix + PARTITIONS_CONFIG); topicCreationGroups.stream().distinct().forEach(group -> { if (!(group instanceof String)) { throw new ConfigException("Item in " + TOPIC_CREATION_GROUPS_CONFIG + " property is not of type String"); } String alias = (String) group; String prefix = TOPIC_CREATION_PREFIX + alias + "."; String configGroup = TOPIC_CREATION_GROUP + ": " + alias; newDef.embed(prefix, configGroup, 0, TopicCreationConfig.configDef(configGroup, defaultGroupReplicationFactor, defaultGroupPartitions)); }); return newDef; }
Source:
<code>protected void createTableWidget(final EObject sourceElement, final EStructuralFeature feature, final Collection<?> rows){ final Table table = createTable(sourceElement, feature, rows); if (table == null) { displayError("Cannot initialize the table"); return; } nattableManager = NattableModelManagerFactory.INSTANCE.createNatTableModelManager(table, new EObjectSelectionExtractor()); natTableWidget = nattableManager.createNattable(self, SWT.NONE, null); if (nattableManager instanceof TreeNattableModelManager) { ((TreeNattableModelManager) nattableManager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); } <START> self.addDisposeListener(getDisposeListener()); <END> natTableWidget.setBackground(self.getBackground()); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); int headerHeight = natTableWidget.getPreferredHeight() - nattableManager.getBodyLayerStack().getRowHideShowLayer().getPreferredHeight(); int bodyHeight = nattableManager.getBodyLayerStack().getRowHideShowLayer().getHeight(); int extra = 20; data.minimumHeight = headerHeight + bodyHeight + extra; self.setLayoutData(data); self.layout(); natTableWidget.layout(); }</code><technical_language>extract a part of code create a new method</technical_language>

Target:
protected void createTableWidget(final EObject sourceElement, final EStructuralFeature feature, final Collection<?> rows) { final Table table = createTable(sourceElement, feature, rows); if (table == null) { displayError("Cannot initialize the table"); return; } nattableManager = NattableModelManagerFactory.INSTANCE.createNatTableModelManager(table, new EObjectSelectionExtractor()); natTableWidget = nattableManager.createNattable(self, SWT.NONE, null); if (nattableManager instanceof TreeNattableModelManager) { configureTreeTable((TreeNattableModelManager) nattableManager, sourceElement, feature, rows); ((TreeNattableModelManager) nattableManager).doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); } self.addDisposeListener(getDisposeListener()); natTableWidget.setBackground(self.getBackground()); configureLayout(); }
Source:
<code>public CompletableFuture<List<Player>> getPlayerObjectsById(@NotNull String id) { <START> System.out.println(id); <END> return fafService.getPlayersByIds(Collections.singletonList(Integer.parseInt(id))); }</code><technical_language>do a system out print line</technical_language>

Target:
public CompletableFuture<List<Player>> getPlayerObjectsById(@NotNull String id) { return fafService.getPlayersByIds(Collections.singletonList(Integer.parseInt(id))); }
Source:
<code>protected abstract void addResource(XAResource resource, URI uri) throws SystemException; protected abstract void removeResource(XAResource resource) throws XAException; protected abstract void resourceInDoubt(XAResource resource); protected XAResource reloadInDoubtResource(URI uri, String nodeName) { <START> return new SubordinateXAResource(uri, nodeName, this); <END> }</code><technical_language>This set flags argument FL_COMMITTED | FL_CONFIRMED</technical_language>

Target:
protected abstract void addResource(XAResource resource, URI uri) throws SystemException; protected abstract void removeResource(XAResource resource) throws XAException; protected abstract void resourceInDoubt(XAResource resource); protected XAResource reloadInDoubtResource(URI uri, String nodeName) { return new SubordinateXAResource(uri, nodeName, FL_COMMITTED | FL_CONFIRMED, this); }
Source:
<code>public String cropOverflowString( String text, IStyle style, String fontFamily, int cellWidth ) <START> { END> Font font = new Font( fontFamily, Font.PLAIN, WordUtil.parseFontSize( PropertyUtil .getDimensionValue( style.getProperty( StyleConstants.STYLE_FONT_SIZE ) ) ) ); Canvas c = new Canvas( ); FontMetrics fm = c.getFontMetrics( font ); int cellWidthInPointAdv = (cellWidth * (int) WordUtil.PT_TWIPS - 27) / 11; StringBuilder sb = new StringBuilder( text.length( ) + 1 ); int wordEnd = -1; do { wordEnd = text.indexOf( SPACE ); if ( wordEnd != -1 ) { String word = text.substring( 0, wordEnd ); word = cropOverflowWord( word, fm, cellWidthInPointAdv ); sb.append( word ); sb.append( SPACE ); text = text.substring( wordEnd + 1 ); } } while ( wordEnd != -1 && !EMPTY_STRING.equals( text ) ); sb.append( cropOverflowWord( text, fm, cellWidthInPointAdv ) ); return sb.toString( ); }</code><technical_language>format code</technical_language>

Target:
public String cropOverflowString( String text, IStyle style, String fontFamily, int cellWidth ) { Font font = new Font( fontFamily, Font.PLAIN, WordUtil.parseFontSize( PropertyUtil.getDimensionValue( style .getProperty( StyleConstants.STYLE_FONT_SIZE ) ) ) ); Canvas c = new Canvas( ); FontMetrics fm = c.getFontMetrics( font ); int cellWidthInPointAdv = ( cellWidth * (int) WordUtil.PT_TWIPS - 27 ) / 11; StringBuilder sb = new StringBuilder( text.length( ) + 1 ); int wordEnd = INDEX_NOTFOUND; do { wordEnd = text.indexOf( SPACE ); if ( wordEnd != INDEX_NOTFOUND ) { String word = text.substring( 0, wordEnd ); word = cropOverflowWord( word, fm, cellWidthInPointAdv ); sb.append( word ); sb.append( SPACE ); text = text.substring( wordEnd + 1 ); } } while ( wordEnd != INDEX_NOTFOUND && !EMPTY_STRING.equals( text ) ); sb.append( cropOverflowWord( text, fm, cellWidthInPointAdv ) ); return sb.toString( ); }
Source:
<code>public byte[] put(ByteBuffer key, byte[] value) { numBytes.addAndGet(key.remaining() + value.length); <START> if (numBytes.get() > sizeInBytes) { <END> Iterator<Map.Entry<ByteBuffer, byte[]>> it = entrySet().iterator(); while (numBytes.get() > sizeInBytes && it.hasNext()) { evictionCount.incrementAndGet(); if (logEvictions && evictionCount.get() % logEvictionCount == 0) { log.info( "Evicting %,dth element. Size[%,d], numBytes[%,d], averageSize[%,d]", evictionCount, size(), numBytes.get(), numBytes.get() / size() ); } Map.Entry<ByteBuffer, byte[]> next = it.next(); long entrySize = next.getKey().remaining() + next.getValue().length; numBytes.addAndGet(-entrySize); it.remove(); } } return super.put(key, value); }</code><technical_language>Remove "if" condition covered "while"</technical_language>

Target:
public byte[] put(ByteBuffer key, byte[] value) { numBytes.addAndGet(key.remaining() + value.length); Iterator<Map.Entry<ByteBuffer, byte[]>> it = entrySet().iterator(); List<ByteBuffer> keysToRemove = new ArrayList<>(); long totalEvictionSize = 0L; while (numBytes.get() - totalEvictionSize > sizeInBytes && it.hasNext()) { evictionCount.incrementAndGet(); if (logEvictions && evictionCount.get() % logEvictionCount == 0) { log.info( "Evicting %,dth element. Size[%,d], numBytes[%,d], averageSize[%,d]", evictionCount, size(), numBytes.get(), numBytes.get() / size() ); } Map.Entry<ByteBuffer, byte[]> next = it.next(); totalEvictionSize += next.getKey().remaining() + next.getValue().length; keysToRemove.add(next.getKey()); } for (ByteBuffer keyToRemove : keysToRemove) { remove(keyToRemove); } return super.put(key, value); }
Source:
<code>public String getAuthMethod() { <START> return "DDF"; <END> }</code><technical_language>sense a common constant for this</technical_language>

Target:
public String getAuthMethod() { return DDF_AUTH_METHOD; }
Source:
<code>ProgressManager() { Dialog.setBlockedHandler(new WorkbenchDialogBlockedHandler()); setUpImages(); changeListener = createChangeListener(); notificationListener = createNotificationListener(); Job.getJobManager().setProgressProvider(this); Job.getJobManager().addJobChangeListener(this.changeListener); StatusManager.getManager().addListener(notificationListener); display = PlatformUI.getWorkbench().getDisplay(); refreshJobs = new Throttler(display, Duration.ofMillis(100), () -> { Iterator<JobInfo> iterator = pendingJobUpdates.iterator(); while (iterator.hasNext()) { JobInfo info = iterator.next(); if (!pendingJobUpdates.remove(info)) { return; } GroupInfo group = info.getGroupInfo(); if (group != null) { doRefreshGroup(group); } Object[] listenersArray = listeners.getListeners(); for (int i = 0; i < listenersArray.length; i++) { IJobProgressManagerListener listener = (IJobProgressManagerListener) listenersArray[i]; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } } }); refreshGroups = new <START> Throttler(display, <END> Duration.ofMillis(100), () -> { Iterator<GroupInfo> iterator = pendingGroupUpdates.iterator(); while (iterator.hasNext()) { GroupInfo groupInfo = iterator.next(); if (!pendingGroupUpdates.remove(groupInfo)) { return; } doRefreshGroup(groupInfo); } }); }</code><technical_language>throttler do job of refreshGroups refreshJobs</technical_language>

Target:
ProgressManager() { Dialog.setBlockedHandler(new WorkbenchDialogBlockedHandler()); setUpImages(); changeListener = createChangeListener(); notificationListener = createNotificationListener(); Job.getJobManager().setProgressProvider(this); Job.getJobManager().addJobChangeListener(this.changeListener); StatusManager.getManager().addListener(notificationListener); display = PlatformUI.getWorkbench().getDisplay(); uiRefreshThrottler = new Throttler(display, Duration.ofMillis(100), () -> { Iterator<JobInfo> jobUpdatesIterator = pendingJobUpdates.iterator(); while (jobUpdatesIterator.hasNext()) { JobInfo info = jobUpdatesIterator.next(); if (!pendingJobUpdates.remove(info)) { continue; } GroupInfo group = info.getGroupInfo(); if (group != null) { pendingGroupUpdates.remove(group); doRefreshGroup(group); } Object[] listenersArray = listeners.getListeners(); for (int i = 0; i < listenersArray.length; i++) { IJobProgressManagerListener listener = (IJobProgressManagerListener) listenersArray[i]; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } } Iterator<GroupInfo> groupUpdatesIterator = pendingGroupUpdates.iterator(); while (groupUpdatesIterator.hasNext()) { GroupInfo groupInfo = groupUpdatesIterator.next(); if (!pendingGroupUpdates.remove(groupInfo)) { continue; } doRefreshGroup(groupInfo); } }); }
Source:
<code>public boolean isDirectory () { if (type == FileType.Classpath) return false; if (type == FileType.Internal) { for (String indexpath : assetIndex()) { <START> if (indexpath == path() + "/") <END> return true; } } return file().isDirectory(); }</code><technical_language>This [never return true](<LINK_0> generates a lot of garbage. indexpath.length() + 1 == path && indexpath.startsWith(path) && indexpath.endsWith("/") do comparison allocations, caching path() + "/" comparison equals() work</technical_language>

Target:
public boolean isDirectory () { if (type == FileType.Classpath) return false; if (type == FileType.Internal) { if (assetIndex.size == 0) loadAssetIndex(); if (assetIndex.get(path()) != null) return true; } return file().isDirectory(); }
Source:
<code>private Optional<ConstrainedTerm> addStuckFlagIfNotThere(ConstrainedTerm subject) { Optional<K> theStrategy = ((KApply) subject.term()).klist().stream() <START> .filter(t -> t instanceof KApply && ((KApply) t).klabel().name().contains(" ")) <END> .findFirst(); if (!theStrategy.isPresent()) return Optional.empty(); KApply topOfStrategyCell = (KApply) ((KApply) theStrategy.get()).klist().items().get(0); if (topOfStrategyCell.klabel().name().equals("#sseq")) { topOfStrategyCell = (KApply) topOfStrategyCell.klist().items().get(0); } boolean isStuck = topOfStrategyCell.klabel().name().equals(Att.stuck()); if (isStuck) { return Optional.empty(); } Att emptyAtt = Att.apply(); K stuck = constructor.KApply1(constructor.KLabel(Att.stuck()), constructor.KList(), emptyAtt); List<K> items = new LinkedList<K>(((KApply) theStrategy.get()).klist().items()); items.add(0, stuck); K sContent = constructor.KApply1(constructor.KLabel("#sseq"), constructor.KList(items), emptyAtt); K s = constructor.KApply1(((KApply) theStrategy.get()).klabel(), constructor.KList(sContent), emptyAtt); K entireConf = constructor.KApply1(((KApply) subject.term()).klabel(), constructor.KList(((KApply) subject.term()).klist().stream().map(k -> k instanceof KApply && ((KApply) k).klabel().name().contains(" ") ? s : k).collect(Collectors.toList())), emptyAtt); return Optional.of(new ConstrainedTerm((Term) entireConf, subject.termContext())); }</code><technical_language>I if privilege cell do name attribute "strategycell" production similar "maincell" attribute</technical_language>

Target:
private Optional<ConstrainedTerm> addStuckFlagIfNotThere(ConstrainedTerm subject) { Optional<K> theStrategy = ((KApply) subject.term()).klist().stream() .filter(t -> t instanceof KApply && ((KApply) t).klabel().name().contains(Strategy.strategyCellName())) .findFirst(); if (!theStrategy.isPresent()) return Optional.empty(); K topOfStrategyCell = ((KApply) theStrategy.get()).klist().items().get(0); if ((topOfStrategyCell instanceof KApply) && ((KApply) topOfStrategyCell).klabel().name().equals(KLabels.KSEQ)) { topOfStrategyCell = ((KApply) topOfStrategyCell).klist().items().get(0); } boolean isStuck = !(topOfStrategyCell instanceof KApply) || ((KApply) topOfStrategyCell).klabel().name().equals(Att.stuck()); if (isStuck) { return Optional.empty(); } Att emptyAtt = Att.apply(); K stuck = constructor.KApply1(constructor.KLabel(Att.stuck()), constructor.KList(), emptyAtt); List<K> items = new LinkedList<K>(((KApply) theStrategy.get()).klist().items()); items.add(0, stuck); K sContent = constructor.KApply1(constructor.KLabel(KLabels.KSEQ), constructor.KList(items), emptyAtt); K s = constructor.KApply1(((KApply) theStrategy.get()).klabel(), constructor.KList(sContent), emptyAtt); K entireConf = constructor.KApply1(((KApply) subject.term()).klabel(), constructor.KList(((KApply) subject.term()).klist().stream().map(k -> k instanceof KApply && ((KApply) k).klabel().name().contains(Strategy.strategyCellName()) ? s : k).collect(Collectors.toList())), emptyAtt); return Optional.of(new ConstrainedTerm((Term) entireConf, subject.termContext())); }
Source:
<code>public Tuple<Table> table(final String tableName, HiveConf conf) throws HiveException { <START> boolean getColStats = !conf.getBoolVar(HiveConf.ConfVars.REPL_DUMP_METADATA_ONLY); <END> return new Tuple<>(functionForSpec, () -> db.getTable(dbName, tableName, false, false, getColStats)); }</code><technical_language>If is metadata dump, need reset table parameters related stats false</technical_language>

Target:
public Tuple<Table> table(final String tableName, HiveConf conf) throws HiveException { boolean getColStats = !conf.getBoolVar(HiveConf.ConfVars.REPL_DUMP_METADATA_ONLY); return new Tuple<>(functionForSpec, () -> db.getTable(dbName, tableName, true, false, getColStats)); }
Source:
<code>protected void executeVmCommand() { <START> if (getVm().getStatus() == VMStatus.Up || getVm().getStatus() == VMStatus.Paused) { <END> performPlugCommand(getPlugAction(), disk, oldVmDevice); } final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); for (VmDevice device:devices) { if (device.getDeviceId().equals(oldVmDevice.getDeviceId())) { device.setIsPlugged(!oldVmDevice.getIsPlugged()); break; } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk", devices); VmHandler.updateDisksFromDb(getVm()); return null; } }); setSucceeded(true); }</code><technical_language>VmStatus.isUpOrPaused(vm.getStatus()) instead</technical_language>

Target:
protected void executeVmCommand() { if (getVm().getStatus().isUpOrPaused()) { performPlugCommand(getPlugAction(), disk, oldVmDevice); } final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); for (VmDevice device:devices) { if (device.getDeviceId().equals(oldVmDevice.getDeviceId())) { device.setIsPlugged(!oldVmDevice.getIsPlugged()); break; } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk", devices); VmHandler.updateDisksFromDb(getVm()); return null; } }); setSucceeded(true); }
Source:
<code>private void updateChangeset() { <START> changesetLabel.setText(tr("{0} Images changed", MapillaryLayer.hasInstance() ? MapillaryLayer.getInstance().getLocationChangeset().size() : 0)); <END> submitButton.setEnabled(!isUploadPending && MapillaryLayer.hasInstance() && !MapillaryLayer.getInstance().getLocationChangeset().isEmpty()); uploadProgress.setVisible(isUploadPending); }</code><technical_language>"1 Images changed" -- I18n.trn for a number change a sentence, is (more) grammatically correct. a big issue, nice have. :)</technical_language>

Target:
private void updateChangeset() { int imgChanged = MapillaryLayer.hasInstance() ? MapillaryLayer.getInstance().getLocationChangeset().size() : 0; changesetLabel.setText(trn("{0} Image changed", "{0} Images changed", imgChanged, imgChanged)); submitButton.setEnabled(!isUploadPending && MapillaryLayer.hasInstance() && !MapillaryLayer.getInstance().getLocationChangeset().isEmpty()); uploadProgress.setVisible(isUploadPending); }
Source:
<code>private static void getSegmentNameValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue) { <START> ITmfStateValue value; <END> try { value = xmlStateValue.getValue(event); switch (value.getType()) { case DOUBLE: builder.append(value.unboxDouble()); break; case INTEGER: builder.append(value.unboxInt()); break; case LONG: builder.append(value.unboxLong()); break; case NULL: builder.append(UNKNOWN_STRING); break; case STRING: builder.append(value.unboxStr()); break; default: throw new StateValueTypeException(); } } catch (AttributeNotFoundException e) { Activator.logInfo("Impossible to get the state value", e); } }</code><technical_language>initialize in try</technical_language>

Target:
private static void getSegmentNameValue(ITmfEvent event, StringBuilder builder, ITmfXmlStateValue xmlStateValue) { try { ITmfStateValue value; value = xmlStateValue.getValue(event); switch (value.getType()) { case DOUBLE: builder.append(value.unboxDouble()); break; case INTEGER: builder.append(value.unboxInt()); break; case LONG: builder.append(value.unboxLong()); break; case NULL: builder.append(UNKNOWN_STRING); break; case STRING: builder.append(value.unboxStr()); break; default: throw new StateValueTypeException(); } } catch (AttributeNotFoundException e) { Activator.logInfo("Impossible to get the state value", e); } }