auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public TaskRepositoryManager() { <START> INSTANCE = this; <END> this.migrators = Collections.emptyList(); Category catTasks = new Category(TaskRepository.CATEGORY_TASKS, "Tasks", 0); repositoryCategories.put(catTasks.getId(), catTasks); Category catBugs = new Category(TaskRepository.CATEGORY_BUGS, "Bugs", 100); repositoryCategories.put(catBugs.getId(), catBugs); Category catBuild = new Category(TaskRepository.CATEGORY_BUILD, "Builds", 200); repositoryCategories.put(catBuild.getId(), catBuild); Category catReview = new Category(TaskRepository.CATEGORY_REVIEW, "Reviews", 300); repositoryCategories.put(catReview.getId(), catReview); Category catOther = new Category(IRepositoryConstants.CATEGORY_OTHER, "Other", 400); repositoryCategories.put(catOther.getId(), catOther); }</code><technical_language>dangerous change a static variable a non-static constructor. making constructor private instantiating getDefault method. (Or support public constructor, set instance in getDefault method.)</technical_language>

Target:
public TaskRepositoryManager() { this.migrators = Collections.emptyList(); Category catTasks = new Category(TaskRepository.CATEGORY_TASKS, "Tasks", 0); repositoryCategories.put(catTasks.getId(), catTasks); Category catBugs = new Category(TaskRepository.CATEGORY_BUGS, "Bugs", 100); repositoryCategories.put(catBugs.getId(), catBugs); Category catBuild = new Category(TaskRepository.CATEGORY_BUILD, "Builds", 200); repositoryCategories.put(catBuild.getId(), catBuild); Category catReview = new Category(TaskRepository.CATEGORY_REVIEW, "Reviews", 300); repositoryCategories.put(catReview.getId(), catReview); Category catOther = new Category(IRepositoryConstants.CATEGORY_OTHER, "Other", 400); repositoryCategories.put(catOther.getId(), catOther); }
Source:
<code>private void runParallelDataLoad(HttpServletRequest req, HttpServletResponse resp, final Properties props, final String namespace, int masTmpStatementsSize, int fileReadersCount, int mergersCount, int tmpQueueLimit) { try { submitApiTask( new ParallelDataLoaderTask(req, resp, namespace, ITx.UNISOLATED, props, masTmpStatementsSize, fileReadersCount, mergersCount, tmpQueueLimit)) .get(); } catch <START> (Throwable t) { <END> BigdataRDFServlet.launderThrowable( t, resp, "DATALOADER-SERVLET: " + namespace); } }</code><technical_language>dangerous! if catch ThreadDeath, OutOfMemoryError</technical_language>

Target:
private void runParallelDataLoad(HttpServletRequest req, HttpServletResponse resp, final Properties props, final String namespace, int masTmpStatementsSize, int fileReadersCount, int mergersCount, int tmpQueueLimit) { try { submitApiTask( new ParallelDataLoaderTask(req, resp, namespace, ITx.UNISOLATED, props, masTmpStatementsSize, fileReadersCount, mergersCount, tmpQueueLimit)) .get(); } catch (RuntimeException | DatasetNotFoundException | ExecutionException | InterruptedException | IOException | TimeoutException t) { BigdataRDFServlet.launderThrowable( t, resp, "DATALOADER-SERVLET: " + namespace); } }
Source:
<code>public List<List<String>> getSummaryTableAsList() { summaryTableAsList = new ArrayList<List<String>>(); sessionNames = new ArrayList<String>(); sortedSessionsSet.clear(); <START> sortedSessionsSet.addAll(chosenSessions); <END> for (SessionDataDto sdDto : sortedSessionsSet) { sessionNames.add(sdDto.getName()); } List<String> sessions = new ArrayList<String>(sessionNames); sessions.add(0, ""); summaryTableAsList.add(sessions); for (TreeItem rootItem : treeStore.getRootItems()) { collectInfoFromTree(rootItem); } return summaryTableAsList; }</code><technical_language>do need clear sortedSessionSet add chsenSessions</technical_language>

Target:
public SummaryTableDto getSummaryTableAsList() { summaryTableDto = new SummaryTableDto(); sessionNames = new ArrayList<String>(); for (SessionDataDto sdDto : sortedSessionsSet) { sessionNames.add(sdDto.getName()); } List<String> sessions = new ArrayList<String>(sessionNames); sessions.add(0, ""); summaryTableDto.insertRow(sessions); for (TreeItem rootItem : treeStore.getRootItems()) { collectInfoFromTree(rootItem); } return summaryTableDto; }
Source:
<code>public void initialise() { ownedVillagesList = find(Constants.OWNED_VILLAGES_LIST_ID, UIList.class); managedVillagesList = find(Constants.MANAGED_VILLAGES_LIST_ID, UIList.class); selectedVillageNameLabel = find(Constants.SELECTED_VILLAGE_NAME_LABEL_ID, UILabel.class); selectedVillageInfoLabel = find(Constants.SELECTED_VILLAGE_INFO_LABEL_ID, UILabel.class); <START> List<String> cityNames = new ArrayList<String>(); <END> cityNames.add("Lordaeron"); cityNames.add("Prague"); cityNames.add("Kategad"); cityNames.add("London"); cityNames.add("Berlin"); cityNames.add("Helsinki"); cityNames.add("Viena"); cityNames.add("NewYork"); cityNames.add("Brno"); cityNames.add("Katowice"); debugOwnedVillages = new ArrayList<VillageEntity>(); for (int i = 0; i < 6; i++) { VillageEntity city = new VillageEntity(cityNames.get(i),"nightmaredev"); debugOwnedVillages.add(city); } debugManagedVillages = new ArrayList<VillageEntity>(); for (int i = 6; i < 10; i++) { VillageEntity city = new VillageEntity(cityNames.get(i),"xXxSlayer1337"); debugManagedVillages.add(city); } ownedVillagesList.subscribeSelection((widget, item) -> { DisplayVillageInfo((VillageEntity)item); }); managedVillagesList.subscribeSelection((widget, item) -> { DisplayVillageInfo((VillageEntity)item); }); populateLists(); }</code><technical_language>Check out NameGenerator module. a list of city names in well</technical_language>

Target:
public void initialise() { ownedVillagesList = find(Constants.OWNED_VILLAGES_LIST_ID, UIList.class); managedVillagesList = find(Constants.MANAGED_VILLAGES_LIST_ID, UIList.class); selectedVillageNameLabel = find(Constants.SELECTED_VILLAGE_NAME_LABEL_ID, UILabel.class); selectedVillageInfoLabel = find(Constants.SELECTED_VILLAGE_INFO_LABEL_ID, UILabel.class); selectedVillageNameLabel.setText(""); selectedVillageInfoLabel.setText(""); CreateDebugData(); ownedVillagesList.subscribeSelection((widget, item) -> { DisplayVillageInfo((UIList)widget, (VillageEntity)item); }); managedVillagesList.subscribeSelection((widget, item) -> { DisplayVillageInfo((UIList)widget, (VillageEntity)item); }); populateLists(); }
Source:
<code>public void setup(final Optional<HasName> hasName) { this.metaData = new NameAndDataTypeHeaderMetaData(hasExpression, hasName, clearDisplayNameConsumer, setDisplayNameConsumer, setTypeRefConsumer, cellEditorControls, headerEditor, EDITOR_TITLE) { @Override public String getColumnGroup() { return NAME_DATA_TYPE_COLUMN_GROUP; } <START> @Override <END> public Optional<String> getPlaceHolder() { return Optional.of("placeholder"); } }; }</code><technical_language>is this explicitly needed? super class returns Optional.empty()</technical_language>

Target:
public void setup(final Optional<HasName> hasName) { this.metaData = new NameAndDataTypeHeaderMetaData(hasExpression, hasName, clearDisplayNameConsumer, setDisplayNameConsumer, setTypeRefConsumer, cellEditorControls, headerEditor, EDITOR_TITLE) { @Override public String getColumnGroup() { return NAME_DATA_TYPE_COLUMN_GROUP; } @Override public Optional<String> getPlaceHolder() { return Optional.of(PLACEHOLDER); } }; }
Source:
<code><START> Map<StoreKey, StoreKey> createConversionKeyMap(File[] replicas, <END> Map<File, DumpIndexTool.IndexProcessingResults> results) throws Exception { Set<StoreKey> storeKeys = new HashSet<>(); for (File replica : replicas) { DumpIndexTool.IndexProcessingResults result = results.get(replica); for (Map.Entry<StoreKey, DumpIndexTool.Info> entry : result.getKeyToState().entrySet()) { storeKeys.add(entry.getKey()); } } logger.info("Converting store keys...", storeKeys.size()); Map<StoreKey, StoreKey> ans = storeKeyConverter.convert(storeKeys); logger.info("Store keys converted!"); return ans; }</code><technical_language>this public</technical_language>

Target:
public Map<StoreKey, StoreKey> createConversionKeyMap(File[] replicas, Map<File, DumpIndexTool.IndexProcessingResults> results) throws Exception { Set<StoreKey> storeKeys = new HashSet<>(); for (File replica : replicas) { DumpIndexTool.IndexProcessingResults result = results.get(replica); for (Map.Entry<StoreKey, DumpIndexTool.Info> entry : result.getKeyToState().entrySet()) { storeKeys.add(entry.getKey()); } } logger.info("Converting store keys...", storeKeys.size()); Map<StoreKey, StoreKey> ans = storeKeyConverter.convert(storeKeys); logger.info("Store keys converted!"); return ans; }
Source:
<code>public static int getInternalInboundPort() { File synapseProperties = Paths.get(CarbonUtils.getCarbonConfigDirPath(), "synapse.properties").toFile(); Properties properties = new Properties(); InputStream inputStream; try { inputStream = new FileInputStream(synapseProperties); properties.load(inputStream); <START> inputStream.close(); <END> } catch (FileNotFoundException e) { handleException("synapse.properties file not found", e); } catch (IOException e) { handleException("Error while reading synapse.properties file", e); } int internalInboundPort = Constants.DEFAULT_INTERNAL_HTTP_API_PORT; String internalInboundEnabledProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_ENABLED); if (internalInboundEnabledProperty == null) { return -1; } boolean internalInboundEnabled = Boolean.parseBoolean(internalInboundEnabledProperty); if (!internalInboundEnabled) { return -1; } String internalInboundPortProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_PORT); if (internalInboundPortProperty != null) { try { internalInboundPort = Integer.parseInt(internalInboundPortProperty); } catch (Exception ex) { handleException(Constants.INTERNAL_HTTP_API_PORT + " is not in proper format", ex); } } return internalInboundPort; }</code><technical_language>close this in finally block instantiate in try block</technical_language>

Target:
public static int getInternalInboundPort() { File synapseProperties = Paths.get(CarbonUtils.getCarbonConfigDirPath(), "synapse.properties").toFile(); Properties properties = new Properties(); InputStream inputStream = null; try { inputStream = new FileInputStream(synapseProperties); properties.load(inputStream); } catch (FileNotFoundException e) { handleException("synapse.properties file not found", e); } catch (IOException e) { handleException("Error while reading synapse.properties file", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ignored) { } } } int internalInboundPort = Constants.DEFAULT_INTERNAL_HTTP_API_PORT; String internalInboundEnabledProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_ENABLED); if (internalInboundEnabledProperty == null) { return -1; } boolean internalInboundEnabled = Boolean.parseBoolean(internalInboundEnabledProperty); if (!internalInboundEnabled) { return -1; } String internalInboundPortProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_PORT); if (internalInboundPortProperty != null) { try { internalInboundPort = Integer.parseInt(internalInboundPortProperty); } catch (Exception ex) { handleException(Constants.INTERNAL_HTTP_API_PORT + " is not in proper format", ex); } } return internalInboundPort; }
Source:
<code>public EventHubClientManager getEventHubClientManager(String systemName, String streamName, EventHubConfig config) { String eventHubNamespace = config.getStreamNamespace(systemName, streamName); String entityPath = config.getStreamEntityPath(systemName, streamName); String sasKeyName = config.getStreamSasKeyName(systemName, streamName); String sasToken = config.getStreamSasToken(systemName, streamName); <START> return new SamzaEventHubClientManager(eventHubNamespace, entityPath, sasKeyName, sasToken, config.getNumClientThreads(systemName)); <END> }</code><technical_language>Minor: extract field for consistency</technical_language>

Target:
public EventHubClientManager getEventHubClientManager(String systemName, String streamName, EventHubConfig config) { String eventHubNamespace = config.getStreamNamespace(systemName, streamName); String entityPath = config.getStreamEntityPath(systemName, streamName); String sasKeyName = config.getStreamSasKeyName(systemName, streamName); String sasToken = config.getStreamSasToken(systemName, streamName); int numClientThreads = config.getNumClientThreads(systemName); return new SamzaEventHubClientManager(eventHubNamespace, entityPath, sasKeyName, sasToken, numClientThreads); }
Source:
<code>public WriteInfo getPartitionWriteInfo(LocationHandle locationHandle, Optional<Partition> partition, String partitionName) { if (partition.isPresent()) { WriteMode writeMode = locationHandle.getWriteMode(); Path targetPath = new Path(partition.get().getStorage().getLocation()); Path writePath; <START> if (writeMode.isWritePathSameAsTargetPath()) { <END> writePath = targetPath; } else { writePath = new Path(locationHandle.getWritePath(), partitionName); } return new WriteInfo(targetPath, writePath, writeMode); } else { return new WriteInfo( new Path(locationHandle.getTargetPath(), partitionName), new Path(locationHandle.getWritePath(), partitionName), locationHandle.getWriteMode()); } }</code><technical_language>Change this section switch. Throw for DIRECT_TO_TARGET_NEW_PATH</technical_language>

Target:
public WriteInfo getPartitionWriteInfo(LocationHandle locationHandle, Optional<Partition> partition, String partitionName) { if (partition.isPresent()) { WriteMode writeMode = locationHandle.getWriteMode(); Path targetPath = new Path(partition.get().getStorage().getLocation()); Path writePath; switch (writeMode) { case STAGE_AND_MOVE_TO_TARGET_DIRECTORY: writePath = new Path(locationHandle.getWritePath(), partitionName); break; case DIRECT_TO_TARGET_EXISTING_DIRECTORY: writePath = targetPath; break; case DIRECT_TO_TARGET_NEW_DIRECTORY: default: throw new UnsupportedOperationException(format("inserting into existing partition is not supported for %s", writeMode)); } return new WriteInfo(targetPath, writePath, writeMode); } else { return new WriteInfo( new Path(locationHandle.getTargetPath(), partitionName), new Path(locationHandle.getWritePath(), partitionName), locationHandle.getWriteMode()); } }
Source:
<code>public StatisticsResource getStatisticsResource() { EntityIdResolver<Guid> resolver = new EntityIdResolver<Guid>() { @Override public org.ovirt.engine.core.common.businessentities.Disk lookupEntity( <START> Guid id) throws BackendFailureException { <END> return collection.lookupEntity(guid); } }; DiskStatisticalQuery query = new DiskStatisticalQuery(resolver, newModel(id)); return inject(new BackendStatisticsResource<Disk, org.ovirt.engine.core.common.businessentities.Disk>(entityType, guid, query)); }</code><technical_language>renamed guid arg in id, places is used, - i suggest revert this chnage</technical_language>

Target:
public StatisticsResource getStatisticsResource() { EntityIdResolver<Guid> resolver = new EntityIdResolver<Guid>() { @Override public org.ovirt.engine.core.common.businessentities.Disk lookupEntity( Guid guid) throws BackendFailureException { return collection.lookupEntity(guid); } }; DiskStatisticalQuery query = new DiskStatisticalQuery(resolver, newModel(id)); return inject(new BackendStatisticsResource<Disk, org.ovirt.engine.core.common.businessentities.Disk>(entityType, guid, query)); }
Source:
<code>public void addConnector(String connectorType, Connector connector, AssignmentStrategy strategy, boolean customCheckpointing) { _log.info("Add new connector of type " + connectorType + " to coordinator"); if (_connectors.containsKey(connectorType)) { String err = "A connector of type " + connectorType + " already exists."; _log.error(err); <START> _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "addConnector", NUM_ERRORS, 1); <END> throw new IllegalArgumentException(err); } Optional<Map<String, Metric>> connectorMetrics = Optional.ofNullable(connector.getMetrics()); connectorMetrics.ifPresent(m -> _metrics.putAll(m)); ConnectorWrapper connectorWrapper = new ConnectorWrapper(connectorType, connector); _connectors.put(connectorType, connectorWrapper); _strategies.put(connectorWrapper, strategy); if (customCheckpointing) { _customCheckpointingConnectorTypes.add(connectorType); } }</code><technical_language>I this result in server starting up, Correct? If Do need a metric for this</technical_language>

Target:
public void addConnector(String connectorType, Connector connector, AssignmentStrategy strategy, boolean customCheckpointing) { _log.info("Add new connector of type " + connectorType + " to coordinator"); if (_connectors.containsKey(connectorType)) { String err = "A connector of type " + connectorType + " already exists."; _log.error(err); throw new IllegalArgumentException(err); } Optional<Map<String, Metric>> connectorMetrics = Optional.ofNullable(connector.getMetrics()); connectorMetrics.ifPresent(m -> _metrics.putAll(m)); ConnectorWrapper connectorWrapper = new ConnectorWrapper(connectorType, connector); _connectors.put(connectorType, connectorWrapper); _strategies.put(connectorWrapper, strategy); if (customCheckpointing) { _customCheckpointingConnectorTypes.add(connectorType); } }
Source:
<code>public void equalsTest() { SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL); SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL); SequenceDeclaration c = new SequenceDeclaration("Hi", new StringDeclaration()); SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL); assertNotEquals(a, null); assertNotEquals(a, new Object()); assertNotEquals(a, b); assertNotEquals(a, c); assertEquals(a, d); assertEquals(a, a); assertFalse(a.isBinaryEquivalent(b)); assertFalse(a.isBinaryEquivalent(c)); <START> assertTrue(a.isBinaryEquivalent(d)); <END> assertTrue(a.isBinaryEquivalent(a)); }</code><technical_language>assertTrue(d.isBinaryEquivalent(a));</technical_language>

Target:
public void equalsTest() { SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL); SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL); SequenceDeclaration c = new SequenceDeclaration("Hi", new StringDeclaration()); SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL); assertNotEquals(a, null); assertNotEquals(a, new Object()); assertNotEquals(a, b); assertNotEquals(a, c); assertEquals(a, d); assertNotEquals(b, a); assertNotEquals(c, a); assertEquals(d, a); assertEquals(a, a); assertFalse(a.isBinaryEquivalent(b)); assertFalse(a.isBinaryEquivalent(c)); assertTrue(a.isBinaryEquivalent(d)); assertTrue(a.isBinaryEquivalent(a)); }
Source:
<code>private void startActionMode(@ActionModeType int type) { if (adapter.getItems().isEmpty()) { <START> ToastUtil.showError(getActivity(), getString(R.string.am_empty_list)); <END> resetActionModeParameters(); } else { actionModeType = type; actionMode = getActivity().startActionMode(this); BottomBar.hideBottomBar(getActivity()); } }</code><technical_language>For works fine getString(..) (i.e. string id only). change it</technical_language>

Target:
private void startActionMode(@ActionModeType int type) { if (adapter.getItems().isEmpty()) { ToastUtil.showError(getActivity(), R.string.am_empty_list); resetActionModeParameters(); } else { actionModeType = type; actionMode = getActivity().startActionMode(this); BottomBar.hideBottomBar(getActivity()); } }
Source:
<code>public static void showZeroBanner(@NonNull Activity activity, @NonNull String text, @ColorInt int foreColor, @ColorInt int backColor) { Snackbar snackbar = Snackbar.make(activity.findViewById(R.id.page_contents_container), text, Snackbar.LENGTH_LONG); ViewGroup rootView = (ViewGroup) snackbar.getView(); TextView textView = (TextView) rootView.findViewById(R.id.snackbar_text); rootView.setBackgroundColor(backColor); textView.setTextColor(foreColor); textView.setTextSize(BANNER_TEXT_SIZE); textView.setGravity(Gravity.CENTER_HORIZONTAL); <START> rootView.setMinimumHeight((int) (BANNER_HEIGHT <END> * WikipediaApp.getInstance().getScreenDensity())); snackbar.show(); }</code><technical_language>I recommend moving this initialization time</technical_language>

Target:
public static void showZeroBanner(@NonNull Activity activity, @NonNull String text, @ColorInt int foreColor, @ColorInt int backColor) { Snackbar snackbar = Snackbar.make(activity.findViewById(R.id.page_contents_container), text, Snackbar.LENGTH_LONG); ViewGroup rootView = (ViewGroup) snackbar.getView(); TextView textView = (TextView) rootView.findViewById(R.id.snackbar_text); rootView.setBackgroundColor(backColor); textView.setTextColor(foreColor); textView.setTextSize(BANNER_TEXT_SIZE); textView.setGravity(Gravity.CENTER_HORIZONTAL); rootView.setMinimumHeight(BANNER_HEIGHT); snackbar.show(); }
Source:
<code>static Bindable getBindable(ClassDeclaration expr, String s, int fieldCount) throws CompileException, IOException, ExecutionException { ICompilerFactory compilerFactory; try { compilerFactory = CompilerFactoryFactory.getDefaultCompilerFactory(); } catch (Exception e) { throw new IllegalStateException( "Unable to instantiate java compiler", e); } final IClassBodyEvaluator cbe = compilerFactory.newClassBodyEvaluator(); cbe.setClassName(expr.name); cbe.setExtendedClass(Utilities.class); cbe.setImplementedInterfaces( fieldCount == 1 ? new Class[] {Bindable.class, Typed.class} : new Class[] {ArrayBindable.class}); cbe.setParentClassLoader(EnumerableInterpretable.class.getClassLoader()); if (CalcitePrepareImpl.DEBUG) { cbe.setDebuggingInformation(true, true, true); } if (BINDABLE_CACHE_MAX_SIZE != 0) { StaticFieldDetector detector = new StaticFieldDetector(); expr.accept(detector); if (!detector.containsStaticField) { return BINDABLE_CACHE.get(s, () -> (Bindable) cbe.createInstance(new StringReader(s))); } <START> } <END> return (Bindable) cbe.createInstance(new StringReader(s)); }</code><technical_language>Do intend cache classes instances? If cache instances, rule out non-static fields threads happen mutate object concurrently. ensure generated objects reusable, (which I better) cache class factory for bindable classes. In other words, if generated class implements Supplier<Binable> a factory method, cache "factory" in BINDABLE_CACHE, call BINDABLE_CACHE.get(...).get() create unshared objects</technical_language>

Target:
static Bindable getBindable(ClassDeclaration expr, String s, int fieldCount) throws CompileException, IOException, ExecutionException { ICompilerFactory compilerFactory; try { compilerFactory = CompilerFactoryFactory.getDefaultCompilerFactory(); } catch (Exception e) { throw new IllegalStateException( "Unable to instantiate java compiler", e); } final IClassBodyEvaluator cbe = compilerFactory.newClassBodyEvaluator(); cbe.setClassName(expr.name); cbe.setExtendedClass(Utilities.class); cbe.setImplementedInterfaces( fieldCount == 1 ? new Class[] {Bindable.class, Typed.class} : new Class[] {ArrayBindable.class}); cbe.setParentClassLoader(EnumerableInterpretable.class.getClassLoader()); if (CalciteSystemProperty.DEBUG.value()) { cbe.setDebuggingInformation(true, true, true); } if (CalciteSystemProperty.BINDABLE_CACHE_MAX_SIZE.value() != 0) { StaticFieldDetector detector = new StaticFieldDetector(); expr.accept(detector); if (!detector.containsStaticField) { return BINDABLE_CACHE.get(s, () -> (Bindable) cbe.createInstance(new StringReader(s))); } } return (Bindable) cbe.createInstance(new StringReader(s)); }
Source:
<code>public void endTurn(UserBean user, String gameIdString) throws PlayException, GameException { log.debug("User tries to end his turn of game id {}", user == null ? "<EMPTY>" : user.getUsername(), gameIdString); GameBean game = gameUtil.getGameById(gameIdString, ERROR_CODE_ERROR); validateGameStatusIsPlaying(game); validateUserNotEmpty(user); validateCurrentTurnOfUser(game, user); validateActionIsAllowed(user, game, GameUserActions.END_TURN); playUtil.updateNextMoveOrder(game); <START> playUtil.updateCurrentCycleBuildingNumber(game); <END> playUtil.updateAvailableUserActions(game); gameDao.updateGame(game); }</code><technical_language>fixed, a piece of govnocoding generated. TODO for refactoring added</technical_language>

Target:
public void endTurn(UserBean user, String gameIdString) throws PlayException, GameException { log.debug("{} tries to end his turn of game id {}", user, gameIdString); GameBean game = gameUtil.getGameById(gameIdString, ERROR_CODE_ERROR); validateUserNotEmpty(user); validateGameStatusIsPlaying(game); validateActionIsAllowed(user, game, GameUserActionCode.END_TURN); boolean shouldUpdateNextMove = true; if (game.getStage().equals(GameStage.PREPARATION)) { Integer currentPreparationCycle = game.getPreparationCycle(); preparationStageUtil.updateGameStageToMain(game); preparationStageUtil.updateCurrentCycleBuildingNumber(game); preparationStageUtil.updatePreparationCycle(game); shouldUpdateNextMove = currentPreparationCycle.equals(game.getPreparationCycle()); } if (shouldUpdateNextMove) { playUtil.updateNextMove(game); } playUtil.updateAvailableUserActions(game); gameDao.updateGame(game); log.debug("User successfully ended his turn", user.getUsername(), gameIdString); }
Source:
<code>public void test() { TimeZoneKey.getTimeZoneKey("GMT-13:00"); TreeSet<String> jodaZones = new TreeSet<>(DateTimeZone.getAvailableIDs()); TreeSet<String> jdkZones = new TreeSet<>(Arrays.asList(TimeZone.getAvailableIDs())); for (String zoneId : new TreeSet<>(Sets.intersection(jodaZones, jdkZones))) { if (zoneId.toLowerCase(ENGLISH).startsWith("etc/") || zoneId.toLowerCase(ENGLISH).startsWith("gmt")) { continue; } DateTimeZone dateTimeZone = DateTimeZone.forID(zoneId); DateTimeZone indexedZone = getDateTimeZone(TimeZoneKey.getTimeZoneKey(zoneId)); <START> if (!java.util.TimeZone.getTimeZone(zoneId).hasSameRules(dateTimeZone.toTimeZone())) { <END> continue; } assertDateTimeZoneEquals(zoneId, indexedZone); assertTimeZone(zoneId, dateTimeZone); } for (int offsetHours = -13; offsetHours < 14; offsetHours++) { for (int offsetMinutes = 0; offsetMinutes < 60; offsetMinutes++) { DateTimeZone dateTimeZone = DateTimeZone.forOffsetHoursMinutes(offsetHours, offsetMinutes); assertTimeZone(dateTimeZone.getID(), dateTimeZone); } } }</code><technical_language>@haozhun, do allowing this for timezone compatible</technical_language>

Target:
public void test() { TimeZoneKey.getTimeZoneKey("GMT-13:00"); TreeSet<String> jodaZones = new TreeSet<>(DateTimeZone.getAvailableIDs()); TreeSet<String> jdkZones = new TreeSet<>(Arrays.asList(TimeZone.getAvailableIDs())); for (String zoneId : new TreeSet<>(Sets.intersection(jodaZones, jdkZones))) { if (zoneId.toLowerCase(ENGLISH).startsWith("etc/") || zoneId.toLowerCase(ENGLISH).startsWith("gmt")) { continue; } if (JavaVersion.current().getMajor() == 8 && JavaVersion.current().getUpdate().orElse(0) < 121 && zoneId.equals("Asia/Rangoon")) { continue; } DateTimeZone dateTimeZone = DateTimeZone.forID(zoneId); DateTimeZone indexedZone = getDateTimeZone(TimeZoneKey.getTimeZoneKey(zoneId)); assertDateTimeZoneEquals(zoneId, indexedZone); assertTimeZone(zoneId, dateTimeZone); } for (int offsetHours = -13; offsetHours < 14; offsetHours++) { for (int offsetMinutes = 0; offsetMinutes < 60; offsetMinutes++) { DateTimeZone dateTimeZone = DateTimeZone.forOffsetHoursMinutes(offsetHours, offsetMinutes); assertTimeZone(dateTimeZone.getID(), dateTimeZone); } } }
Source:
<code>public void onEnchant(EnchantItemEvent e) { Random random = ThreadLocalRandom.current(); if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MAGICIAN)) { List<String> enchantments = new LinkedList<>(); for (Enchantment en : Enchantment.values()) { for (int i = 1; i <= en.getMaxLevel(); i++) { if ((en.canEnchantItem(e.getItem()) || e.getItem().getType() == Material.BOOK) && (boolean) Slimefun.getItemValue("MAGICIAN_TALISMAN", "allow-enchantments." + en.getKey().getKey() + ".level." + i)) { enchantments.add(en.getKey().getKey() + '-' + i); } } } String enchant = enchantments.get(random.nextInt(enchantments.size())); <START> String[] enchantSplit = PatternUtils.SLASH_SEPARATOR.split(enchant); <END> e.getEnchantsToAdd().put(Enchantment.getByKey(NamespacedKey.minecraft(enchantSplit[0])), Integer.parseInt(enchantSplit[1])); } if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) { Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet(); for (Enchantment en : enchantments) { if (random.nextInt(100) < 40) { e.getEnchantsToAdd().put(en, random.nextInt(3) + 1); } } e.getEnchantsToAdd().put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); } }</code><technical_language>This DASH SLASH right</technical_language>

Target:
public void onEnchant(EnchantItemEvent e) { Random random = ThreadLocalRandom.current(); if (Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MAGICIAN)) { List<String> enchantments = new LinkedList<>(); for (Enchantment en : Enchantment.values()) { for (int i = 1; i <= en.getMaxLevel(); i++) { if ((en.canEnchantItem(e.getItem()) || e.getItem().getType() == Material.BOOK) && (boolean) Slimefun.getItemValue("MAGICIAN_TALISMAN", "allow-enchantments." + en.getKey().getKey() + ".level." + i)) { enchantments.add(en.getKey().getKey() + '-' + i); } } } String enchant = enchantments.get(random.nextInt(enchantments.size())); String[] enchantSplit = PatternUtils.DASH.split(enchant); e.getEnchantsToAdd().put(Enchantment.getByKey(NamespacedKey.minecraft(enchantSplit[0])), Integer.parseInt(enchantSplit[1])); } if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) { Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet(); for (Enchantment en : enchantments) { if (random.nextInt(100) < 40) { e.getEnchantsToAdd().put(en, random.nextInt(3) + 1); } } e.getEnchantsToAdd().put(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); } }
Source:
<code>public SamzaHistogram(MetricsRegistry registry, String group, String name, List<Double> percentiles) { this.histogram = new Histogram(new ExponentiallyDecayingReservoir()); this.percentiles = percentiles; this.gauges = this.percentiles.stream() .filter(x -> x > 0 && x <= 100) .collect(Collectors.toMap(Function.identity(), <START> x -> registry.newGauge(group, new HistogramGauge(name + "_" + String.valueOf(0), 0D)))); <END> }</code><technical_language>gauge names suffixed _0? this percentile name (e.g. 50, 90)</technical_language>

Target:
public SamzaHistogram(MetricsRegistry registry, String group, String name, List<Double> percentiles) { this.histogram = new Histogram(new ExponentiallyDecayingReservoir()); this.percentiles = percentiles; this.gauges = this.percentiles.stream() .filter(x -> x > 0 && x <= 100) .collect(Collectors.toMap(Function.identity(), x -> registry.newGauge(group, new HistogramGauge(x, name + "_" + String.valueOf(x), 0D)))); }
Source:
<code>private void externalLibraryNullChecks(MethodInvocationTree tree) { if (isNonNullUsed(tree)) { <START> contentResources.replace(tree.arguments().get(0).toString(), true); <END> } else if (isAllNonNullUsed(tree)) { tree.arguments().forEach(contentResource -> contentResources.replace(contentResource.toString(), true)); } else if (insideIfStatement && isThisIsNullMethod(tree)) { insideEqualNullCheck = true; } }</code><technical_language>0 is a magic number please provide constant for this</technical_language>

Target:
private void externalLibraryNullChecks(MethodInvocationTree tree) { if (isNonNullUsed(tree)) { contentResources.replace(tree.arguments().get(METHOD_FIRST_ARGUMENT).toString(), true); } else if (isAllNonNullUsed(tree)) { tree.arguments().forEach(contentResource -> contentResources.replace(contentResource.toString(), true)); } else if (insideIfStatement && isThisIsNullMethod(tree)) { insideEqualNullCheck = true; } }
Source:
<code>protected String[][] formatTableContents() { final ArrayList<String[]> formatArray = new ArrayList<String[]>(); int lineCount = 0; for (final DetailedS3Object detailedObject : this.objects) { if((detailedObject.getBlobs() != null) && !Guard.isNullOrEmpty(detailedObject.getBlobs().getObjects())) { for (final BulkObject object : detailedObject.getBlobs().getObjects()) { if (object.getPhysicalPlacement() != null) { if (!Guard.isNullOrEmpty(object.getPhysicalPlacement().getTapes())) { for (final Tape tape : object.getPhysicalPlacement().getTapes()) { final String[] bucketArray = new String[this.columnCount]; bucketArray[0] = nullGuard(detailedObject.getName()); bucketArray[1] = nullGuardToString(detailedObject.getBucketId()); bucketArray[2] = nullGuardToString(detailedObject.getOwner()); bucketArray[3] = nullGuardToString(detailedObject.getSize()); bucketArray[4] = nullGuardToString(detailedObject.getType()); bucketArray[5] = nullGuardToDate(detailedObject.getCreationDate(), DATE_FORMAT); bucketArray[6] = nullGuard(tape.getBarCode()); bucketArray[7] = nullGuardToString(tape.getState()); formatArray.add(bucketArray); lineCount++; } } } } } } <START> String[][] ret = new String[lineCount][this.columnCount]; <END> return formatArray.toArray(ret); }</code><technical_language>missing final</technical_language>

Target:
protected String[][] formatTableContents() { final ArrayList<String[]> formatArray = new ArrayList<String[]>(); int lineCount = 0; for (final DetailedS3Object detailedObject : this.objects) { if((detailedObject.getBlobs() != null) && !Guard.isNullOrEmpty(detailedObject.getBlobs().getObjects())) { for (final BulkObject object : detailedObject.getBlobs().getObjects()) { if (object.getPhysicalPlacement() != null) { if (!Guard.isNullOrEmpty(object.getPhysicalPlacement().getTapes())) { for (final Tape tape : object.getPhysicalPlacement().getTapes()) { formatArray.add(writeLine(tape, detailedObject)); lineCount++; } } } } } } final String[][] ret = new String[lineCount][this.columnCount]; return formatArray.toArray(ret); }
Source:
<code>public void write( final int b ) throws IOException { <START> if ( nanos < 0 ) <END> { nanos = System.nanoTime(); } super.write( b ); }</code><technical_language>Java doc mentioned: returned nanoTime() represents nanoseconds some fixed arbitrary origin time (perhaps in future, values negative). is safe -1L. A boolean flag better</technical_language>

Target:
public void write( final int b ) throws IOException { if ( nanos == null ) { nanos = System.nanoTime(); timer = timerProvider.apply( RAW_IO_WRITE ); } super.write( b ); }
Source:
<code><START> UnicastProcessor(int capacityHint) { <END> this(capacityHint, true); }</code><technical_language>Is this necessary</technical_language>

Target:
UnicastProcessor(int capacityHint) { this(capacityHint,null, true); }
Source:
<code>default boolean matches(ItemStack stack) { <START> return Preconditions.checkNotNull(stack, "stack").getItem().equals(this); <END> }</code><technical_language>Preconditions imported statically</technical_language>

Target:
default boolean matches(ItemStack stack) { return checkNotNull(stack, "stack").getItem().equals(this); }
Source:
<code>private static void insertAccount(SQLiteDatabase arg0, String name, int enabled, int flags) { ContentValues arg1 = new ContentValues(); arg1.put(DB.ACCOUNT.NAME, name); if (enabled >= 0) { arg1.put(DB.ACCOUNT.ENABLED, enabled); } if (flags >= 0) { arg1.put(DB.ACCOUNT.FLAGS, flags); } <START> arg1.put(DB.ACCOUNT.FORMAT, FileFormats.GPX.getValue()); <END> arg1.put(DB.ACCOUNT.AUTH_METHOD, "dummy"); long newId = arg0.insertWithOnConflict(DB.ACCOUNT.TABLE, null, arg1, SQLiteDatabase.CONFLICT_IGNORE); if (newId == -1 && arg1.size() > 1) { String arr[] = { arg1.getAsString(DB.ACCOUNT.NAME) }; arg1.remove(DB.ACCOUNT.FORMAT); arg1.remove(DB.ACCOUNT.AUTH_METHOD); arg0.update(DB.ACCOUNT.TABLE, arg1, DB.ACCOUNT.NAME + " = ?", arr); Log.v("DBhelper", "update: " + arg1); } }</code><technical_language>DEFAULT_FORMAT</technical_language>

Target:
private static void insertAccount(SQLiteDatabase arg0, String name, int enabled, int flags) { ContentValues arg1 = new ContentValues(); arg1.put(DB.ACCOUNT.NAME, name); if (enabled >= 0) { arg1.put(DB.ACCOUNT.ENABLED, enabled); } if (flags >= 0) { arg1.put(DB.ACCOUNT.FLAGS, flags); } arg1.put(DB.ACCOUNT.FORMAT, FileFormats.DEFAULT_FORMATS.toString()); arg1.put(DB.ACCOUNT.AUTH_METHOD, "dummy"); long newId = arg0.insertWithOnConflict(DB.ACCOUNT.TABLE, null, arg1, SQLiteDatabase.CONFLICT_IGNORE); if (newId == -1 && arg1.size() > 1) { String arr[] = { arg1.getAsString(DB.ACCOUNT.NAME) }; arg1.remove(DB.ACCOUNT.FORMAT); arg1.remove(DB.ACCOUNT.AUTH_METHOD); arg0.update(DB.ACCOUNT.TABLE, arg1, DB.ACCOUNT.NAME + " = ?", arr); Log.v("DBhelper", "update: " + arg1); } }
Source:
<code>public void testDeleteNonExistingPodBeforeWatch() { <START> System.out.println( <END> "Start the test of testDeleteNonExistingPodBeforeWatch testDeleteNonExistingPodBeforeWatch testDeleteNonExistingPodBeforeWatch"); final MixedOperation mixedOperation = mock(MixedOperation.class); final NonNamespaceOperation namespaceOperation = mock(NonNamespaceOperation.class); final PodResource podResource = mock(PodResource.class); doReturn(mixedOperation).when(kubernetesClient).pods(); when(mixedOperation.inNamespace(anyString())).thenReturn(namespaceOperation); when(namespaceOperation.withName(anyString())).thenReturn(podResource); doReturn(Boolean.FALSE).when(podResource).delete(); Watch watch = mock(Watch.class); doReturn(watch).when(podResource).watch(any()); try { new KubernetesPods("", "", clientFactory).doDelete("nonExistingPod").get(5, TimeUnit.SECONDS); } catch (InfrastructureException | InterruptedException | ExecutionException | TimeoutException e) { e.printStackTrace(); } verify(watch).close(); }</code><technical_language>Is debug info removed merge</technical_language>

Target:
public void testDeleteNonExistingPodBeforeWatch() throws Exception { final MixedOperation mixedOperation = mock(MixedOperation.class); final NonNamespaceOperation namespaceOperation = mock(NonNamespaceOperation.class); final PodResource podResource = mock(PodResource.class); doReturn(mixedOperation).when(kubernetesClient).pods(); when(mixedOperation.inNamespace(anyString())).thenReturn(namespaceOperation); when(namespaceOperation.withName(anyString())).thenReturn(podResource); doReturn(Boolean.FALSE).when(podResource).delete(); Watch watch = mock(Watch.class); doReturn(watch).when(podResource).watch(any()); new KubernetesPods("", "", clientFactory).doDelete("nonExistingPod").get(5, TimeUnit.SECONDS); verify(watch).close(); }
Source:
<code>protected abstract void attemptRegistration(Context context) throws Throwable; <START> protected boolean matchesPhone(String phoneEmail) <END> { Pattern p = Pattern.compile("\n"); Matcher m = p.matcher(phoneEmail.substring(0, 1)); return m.matches(); }</code><technical_language>TODO: This working for numbers, returns true for 5555555555</technical_language>

Target:
protected abstract void attemptRegistration(Context context) throws Throwable; protected boolean matchesEmail(String phoneEmail) { return Patterns.EMAIL_ADDRESS.matcher(phoneEmail).matches(); }
Source:
<code>protected void choiceDestroy(GQuery link) { choices--; showSearchFieldDefault(defaultText); if (isMultiple() && choices > 0 && searchField.val() != null && searchField.val().length() < 1) { resultsHide(); } <START> resultDeselect(Integer.parseInt(link.attr("rel")), link.attr("data-chosensample-value")); <END> link.parents("li").first().remove(); }</code><technical_language>revert</technical_language>

Target:
protected void choiceDestroy(GQuery link) { choices--; showSearchFieldDefault(defaultText); if (isMultiple() && choices > 0 && searchField.val() != null && searchField.val().length() < 1) { resultsHide(); } resultDeselect(Integer.parseInt(link.attr("rel")), link.attr("data-chosen-value")); link.parents("li").first().remove(); }
Source:
<code>public void runFailedAutoStartVM(Guid vmId) { final AuditLogableBase event = new AuditLogableBase(); event.setVmId(vmId); AuditLogDirector.log(event, AuditLogType.HA_VM_FAILED); <START> log.infoFormat("Restart of the Highly Available VM was initiated due to failure. VM Name:{0}, VM Id:{1}", <END> event.getVmName(), vmId); final VdcReturnValueBase result = Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(vmId), ExecutionHandler.createInternalJobContext()); if (!result.getSucceeded()) { AuditLogDirector.log(event, AuditLogType.HA_VM_RESTART_FAILED); } }</code><technical_language>improve message "Failed start Highly VM. Attempting restart. VM Name: {0}, VM Id:{1}", event.getVmName(), vmId);</technical_language>

Target:
public void runFailedAutoStartVM(Guid vmId) { final AuditLogableBase event = new AuditLogableBase(); event.setVmId(vmId); AuditLogDirector.log(event, AuditLogType.HA_VM_FAILED); log.infoFormat("Failed to start Highly Available VM. Attempting to restart. VM Name: {0}, VM Id:{1}", event.getVmName(), vmId); final VdcReturnValueBase result = Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(vmId), ExecutionHandler.createInternalJobContext()); if (!result.getSucceeded()) { AuditLogDirector.log(event, AuditLogType.HA_VM_RESTART_FAILED); } }
Source:
<code>protected boolean canDoAction() { ProviderValidator validator = new ProviderValidator(getProvider()); <START> return validate(validator.providerIsSet()) && super.canDoAction(); <END> }</code><technical_language>point in calling super.canDoAction() if return true</technical_language>

Target:
protected boolean canDoAction() { ProviderValidator validator = new ProviderValidator(getProvider()); return validate(validator.providerIsSet()); }
Source:
<code>public void startBucket(String bucketKey) { BulkCommand command = getCurrentCommand(); Serializable auditParam = command.getParam(NXAuditEventsService.DISABLE_AUDIT_LOGGER); disableAudit = auditParam != null && Boolean.parseBoolean(auditParam.toString()); retentionManager = Framework.getService(RetentionManager.class); <START> ruleId = (String) command.getParam(PARAM_RULE_ID); <END> }</code><technical_language>need cast String, getParam is a generic method public <T> T getParam(String key)</technical_language>

Target:
public void startBucket(String bucketKey) { BulkCommand command = getCurrentCommand(); Serializable auditParam = command.getParam(NXAuditEventsService.DISABLE_AUDIT_LOGGER); disableAudit = auditParam != null && Boolean.parseBoolean(auditParam.toString()); retentionManager = Framework.getService(RetentionManager.class); ruleId = command.getParam(PARAM_RULE_ID); }
Source:
<code><START> public Form() { <END> }</code><technical_language>Do need empty constructor</technical_language>

Target:
public Form() { this(FormType.DEFAULT); }
Source:
<code>public ValidationResult validate() { Collection<NetworkAttachment> attachmentsToConfigure = getAttachmentsToConfigure(); ValidationResult vr = ValidationResult.VALID; vr = skipValidation(vr) ? vr : new NicLabelValidator(params, existingInterfacesMap, bondsMap, hostSetupNetworksValidatorHelper).validate(); vr = skipValidation(vr) ? vr : validNewOrModifiedNetworkAttachments(); vr = skipValidation(vr) ? vr : validRemovedNetworkAttachments(); vr = skipValidation(vr) ? vr : validNewOrModifiedBonds(); vr = skipValidation(vr) ? vr : validRemovedBonds(attachmentsToConfigure); vr = skipValidation(vr) ? vr : attachmentsDontReferenceSameNetworkDuplicately(attachmentsToConfigure); vr = skipValidation(vr) ? vr : networksUniquelyConfiguredOnHost(attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateNetworkExclusiveOnNics(attachmentsToConfigure); vr = skipValidation(vr) ? vr : new NetworkMtuValidator(networkBusinessEntityMap).validateMtu( attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateCustomProperties(); vr = skipValidation(vr) ? vr : validateQos(attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateBondModeVsNetworksAttachedToIt(attachmentsToConfigure); <START> vr = skipValidation(vr) ? vr : networkAttachmentIpConfigurationValidator.validateNetworkAttachmentIpConfiguration(params.getNetworkAttachments()); <END> return vr; }</code><technical_language>part of- 'validNewOrModifiedNetworkAttachments'</technical_language>

Target:
public ValidationResult validate() { Collection<NetworkAttachment> attachmentsToConfigure = getAttachmentsToConfigure(); ValidationResult vr = ValidationResult.VALID; vr = skipValidation(vr) ? vr : new NicLabelValidator(params, existingInterfacesMap, bondsMap, hostSetupNetworksValidatorHelper).validate(); vr = skipValidation(vr) ? vr : validNewOrModifiedNetworkAttachments(); vr = skipValidation(vr) ? vr : validRemovedNetworkAttachments(); vr = skipValidation(vr) ? vr : validNewOrModifiedBonds(); vr = skipValidation(vr) ? vr : validRemovedBonds(attachmentsToConfigure); vr = skipValidation(vr) ? vr : attachmentsDontReferenceSameNetworkDuplicately(attachmentsToConfigure); vr = skipValidation(vr) ? vr : networksUniquelyConfiguredOnHost(attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateNetworkExclusiveOnNics(attachmentsToConfigure); vr = skipValidation(vr) ? vr : new NetworkMtuValidator(networkBusinessEntityMap).validateMtu( attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateCustomProperties(); vr = skipValidation(vr) ? vr : validateQos(attachmentsToConfigure); vr = skipValidation(vr) ? vr : validateBondModeVsNetworksAttachedToIt(attachmentsToConfigure); return vr; }
Source:
<code>protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); if (result.getFetchResult() != null) { FetchResultDialog dlg = new FetchResultDialog(getParentShell(), repo, result.getFetchResult(), result.getFetchedFrom()); dlg.createDialogArea(main); } if (result.getMergeResult() != null) { MergeResultDialog dlg = new MergeResultDialog(getParentShell(), repo, result.getMergeResult()); dlg.createDialogArea(main); <START> } <END> return main; }</code><technical_language>if if this reuse of dialogs problems</technical_language>

Target:
protected Control createDialogArea(Composite parent) { Composite main = new Composite(parent, SWT.VERTICAL); main.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); Group fetchResultGroup = new Group(main, SWT.SHADOW_ETCHED_IN); fetchResultGroup .setText(UIText.PullResultDialog_FetchResultGroupHeader); fetchResultGroup.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo( fetchResultGroup); if (result.getFetchResult() != null) { FetchResultDialog dlg = new FetchResultDialog(getParentShell(), repo, result.getFetchResult(), result.getFetchedFrom()); Control fresult = dlg.createDialogArea(fetchResultGroup); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 130).applyTo(fresult); } Group mergeResultGroup = new Group(main, SWT.SHADOW_ETCHED_IN); mergeResultGroup .setText(UIText.PullResultDialog_MergeResultGroupHeader); mergeResultGroup.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo( mergeResultGroup); if (result.getMergeResult() != null) { MergeResultDialog dlg = new MergeResultDialog(getParentShell(), repo, result.getMergeResult()); dlg.createDialogArea(mergeResultGroup); } return main; }