auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void getMandatoryModules_shouldReturnMandatoryModuleIds() throws Exception { executeDataSet("org/openmrs/module/include/mandatoryModulesGlobalProperties.xml"); Assert.assertEquals(1, ModuleUtil.getMandatoryModules().size()); <START> Assert.assertEquals("firstmodule", ModuleUtil.getMandatoryModules().get(0)); <END> }</code><technical_language>Changes in 3 tests relevant either</technical_language>

Target:
public void getMandatoryModules_shouldReturnMandatoryModuleIds() throws Exception { GlobalProperty gp1 = new GlobalProperty("firstmodule.mandatory", "true"); GlobalProperty gp2 = new GlobalProperty("secondmodule.mandatory", "false"); when(administrationService.getGlobalPropertiesBySuffix(".mandatory")).thenReturn(Arrays.asList(gp1, gp2)); assertThat(ModuleUtil.getMandatoryModules(), contains("firstmodule")); }
Source:
<code>private AsyncTaskManager() { _tasks = new HashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAConfigurableDelayJob(this, "_timer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), <START> ConfigValues.AsyncTaskPollingRate.toString(), TimeUnit.SECONDS); <END> scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); }</code><technical_language>intend resolve property name, aligned this property name defined in enum itself, resolution of enum is done "ConfigValues.valueof(enumName). If name match, exception thrown. setting ConfigValues.AsyncTaskPollingRate.toString() toString() - some risk this method overridden, however, final method ConfigValues.AsyncTaskPollingRate.name() code is safer. Please replace toString() name() this patch</technical_language>

Target:
private AsyncTaskManager() { _tasks = new HashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAConfigurableDelayJob(this, "_timer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskPollingRate), ConfigValues.AsyncTaskPollingRate.name(), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[] {}, new Object[] {}, Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer> GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); }
Source:
<code>public static PartitionStatistics createEmptyPartitionStatistics(Map<String, Type> columnTypes, Map<String, Set<ColumnStatisticType>> columnStatisticsMetadataTypes) { Map<String, HiveColumnStatistics> columnStatistics = columnStatisticsMetadataTypes.entrySet().stream() <START> .peek(entry -> verify(columnTypes.containsKey(entry.getKey()))) <END> .collect(toImmutableMap(Entry::getKey, entry -> createColumnStatisticsForEmptyPartition(columnTypes.get(entry.getKey()), entry.getValue()))); return new PartitionStatistics(createZeroStatistics(), columnStatistics); }</code><technical_language>skip this peek add requireNonNull(columnType, "columnType is null"); in createColumnStatisticsForEmptyPartition instead</technical_language>

Target:
public static PartitionStatistics createEmptyPartitionStatistics(Map<String, Type> columnTypes, Map<String, Set<ColumnStatisticType>> columnStatisticsMetadataTypes) { Map<String, HiveColumnStatistics> columnStatistics = columnStatisticsMetadataTypes.entrySet().stream() .collect(toImmutableMap(Entry::getKey, entry -> createColumnStatisticsForEmptyPartition(columnTypes.get(entry.getKey()), entry.getValue()))); return new PartitionStatistics(createZeroStatistics(), columnStatistics); }
Source:
<code>protected void configure() { install(new IndexModule(1)); bind(ChangeIndex.class).to(DummyIndex.class); <START> listener().to(DummyIndex.class); <END> }</code><technical_language>Unnecessary</technical_language>

Target:
protected void configure() { install(new IndexModule(1)); bind(ChangeIndex.class).toInstance(new DummyIndex()); }
Source:
<code>private void createAmbiguousSymbols() { for (Scope scope : scopesByRootTree.values()) { Set<SymbolToUpdate> symbolsToUpdate = new HashSet<>(); for (Symbol symbol : scope.symbols()) { if (symbol.kind() == Symbol.Kind.OTHER) { List<Usage> bindingUsages = symbol.usages().stream().filter(Usage::isBindingUsage).collect(Collectors.toList()); <START> if (bindingUsages.size() > 1) { <END> Set<Symbol> alternativeDefinitions = getAlternativeDefinitions(symbol, bindingUsages); AmbiguousSymbol ambiguousSymbol = AmbiguousSymbolImpl.create(alternativeDefinitions); symbol.usages().forEach(usage -> ((SymbolImpl) ambiguousSymbol).addUsage(usage.tree(), usage.kind())); symbolsToUpdate.add(new SymbolToUpdate(symbol, ambiguousSymbol)); } } } symbolsToUpdate.forEach(symbolToUpdate -> scope.replaceSymbolWithAmbiguousSymbol(symbolToUpdate.symbol, symbolToUpdate.ambiguousSymbol)); } }</code><technical_language>I this condition is sufficient. end creating ambiguous symbol in case I suppose not: x = 42 x = 43</technical_language>

Target:
private void createAmbiguousSymbols() { for (Scope scope : scopesByRootTree.values()) { Set<SymbolToUpdate> symbolsToUpdate = new HashSet<>(); for (Symbol symbol : scope.symbols()) { if (symbol.kind() == Symbol.Kind.OTHER) { List<Usage> bindingUsages = symbol.usages().stream().filter(Usage::isBindingUsage).collect(Collectors.toList()); if (bindingUsages.size() > 1 && bindingUsages.stream().anyMatch(usage -> usage.kind() == Usage.Kind.FUNC_DECLARATION || usage.kind() == Usage.Kind.CLASS_DECLARATION)) { Set<Symbol> alternativeDefinitions = getAlternativeDefinitions(symbol, bindingUsages); AmbiguousSymbol ambiguousSymbol = AmbiguousSymbolImpl.create(alternativeDefinitions); symbol.usages().forEach(usage -> ((SymbolImpl) ambiguousSymbol).addUsage(usage.tree(), usage.kind())); symbolsToUpdate.add(new SymbolToUpdate(symbol, ambiguousSymbol)); } } } symbolsToUpdate.forEach(symbolToUpdate -> scope.replaceSymbolWithAmbiguousSymbol(symbolToUpdate.symbol, symbolToUpdate.ambiguousSymbol)); } }
Source:
<code>private Channel getChannel(ChannelCachingConnectionProxy connection, boolean transactional) { LinkedList<ChannelProxy> channelList; if (this.cacheMode == CacheMode.CHANNEL) { channelList = transactional ? this.cachedChannelsTransactional : this.cachedChannelsNonTransactional; } else { channelList = transactional ? this.openConnectionTransactionalChannels.get(connection) : this.openConnectionNonTransactionalChannels.get(connection); } <START> <END> Channel channel = null; synchronized (channelList) { if (!channelList.isEmpty()) { channel = channelList.removeFirst(); } } if (channel != null) { if (logger.isTraceEnabled()) { logger.trace("Found cached Rabbit Channel"); } } else { channel = getCachedChannelProxy(connection, channelList, transactional); } return channel; }</code><technical_language>Check for null - calling createChannel() while else is calling destroy()</technical_language>

Target:
private Channel getChannel(ChannelCachingConnectionProxy connection, boolean transactional) { LinkedList<ChannelProxy> channelList; if (this.cacheMode == CacheMode.CHANNEL) { channelList = transactional ? this.cachedChannelsTransactional : this.cachedChannelsNonTransactional; } else { channelList = transactional ? this.openConnectionTransactionalChannels.get(connection) : this.openConnectionNonTransactionalChannels.get(connection); } if (channelList == null) { channelList = new LinkedList<ChannelProxy>(); if (transactional) { this.openConnectionTransactionalChannels.put(connection, channelList); } else { this.openConnectionNonTransactionalChannels.put(connection, channelList); } } Channel channel = null; if (connection.isOpen()) { synchronized (channelList) { while (!channelList.isEmpty()) { channel = channelList.removeFirst(); if (channel.isOpen()) { break; } else { channel = null; } } } if (channel != null) { if (logger.isTraceEnabled()) { logger.trace("Found cached Rabbit Channel: " + channel.toString()); } } } if (channel == null) { channel = getCachedChannelProxy(connection, channelList, transactional); } return channel; }
Source:
<code><START> public static boolean handleError(@NonNull HelperActivityBase activity, @NonNull Exception e) { <END> if (e instanceof IntentRequiredException) { IntentRequiredException typed = (IntentRequiredException) e; activity.startActivityForResult(typed.getIntent(), typed.getRequestCode()); return true; } else if (e instanceof PendingIntentRequiredException) { PendingIntentRequiredException typed = (PendingIntentRequiredException) e; startIntentSenderForResult(activity, typed.getPendingIntent(), typed.getRequestCode()); return true; } else { return false; } }</code><technical_language>I totally fine this, do sense of Resources return a common exception class a code a switch code instead of instanceof</technical_language>

Target:
public static boolean handleError(@NonNull HelperActivityBase activity, @NonNull Exception e) { if (e instanceof IntentRequiredException) { IntentRequiredException typed = (IntentRequiredException) e; activity.startActivityForResult(typed.getIntent(), typed.getRequestCode()); return true; } else if (e instanceof PendingIntentRequiredException) { PendingIntentRequiredException typed = (PendingIntentRequiredException) e; startIntentSenderForResult(activity, typed.getPendingIntent(), typed.getRequestCode()); return true; } return false; }
Source:
<code><START> private void failValidationCannotPlugPassthroughVnicNoSuitableVf() { <END> failValidation(EngineMessage.CANNOT_PLUG_PASSTHROUGH_VNIC_NO_SUITABLE_VF, String.format("$vnicName %1$s", getInterfaceName())); }</code><technical_language>prefet return of method ? line 134-135 like: return failValidationCannotPlugPassthroughVnicNoSuitableVf (...);</technical_language>

Target:
private boolean failValidationCannotPlugPassthroughVnicNoSuitableVf() { return failValidation(EngineMessage.CANNOT_PLUG_PASSTHROUGH_VNIC_NO_SUITABLE_VF, String.format("$vnicName %1$s", getInterfaceName())); }
Source:
<code>public String updateStory(String storyJson) throws SQLException { StoryObject editStoryObj = new Gson().fromJson(storyJson, StoryObject.class); StoryObject newStoryObj = new StoryObject(mProductBacklogHelper.editStory(editStoryObj.toStoryInformation())); for (TagObject originTag : newStoryObj.tagList) { boolean isExist = false; for (TagObject editTag : editStoryObj.tagList) if (originTag.getName().equals(editTag.getName())) isExist = true; if (!isExist) { mProductBacklogHelper.removeStoryTag(newStoryObj.id, originTag.getId()); } else editStoryObj.tagList.remove(originTag); } for (TagObject editTag : editStoryObj.tagList) { System.out.println("editTag : " + editTag); mProductBacklogHelper.addStoryTag(editStoryObj.id, editTag.getId()); } <START> newStoryObj = new StoryObject(mProductBacklogHelper.getStory(Long.parseLong(newStoryObj.id))); <END> Gson gson = new Gson(); return gson.toJson(newStoryObj); }</code><technical_language>newStory</technical_language>

Target:
public String updateStory(String storyJson) throws SQLException { StoryObject editStoryObj = new Gson().fromJson(storyJson, StoryObject.class); StoryObject newStory = new StoryObject(mProductBacklogHelper.editStory(editStoryObj.toStoryInformation())); for (TagObject originTag : newStory.tagList) { boolean isExist = false; for (TagObject editTag : editStoryObj.tagList) if (originTag.getName().equals(editTag.getName())) isExist = true; if (!isExist) { mProductBacklogHelper.removeTagFromStory(newStory.id, originTag.getId()); } else editStoryObj.tagList.remove(originTag); } for (TagObject editTag : editStoryObj.tagList) { System.out.println("editTag : " + editTag); mProductBacklogHelper.addTagToStory(editStoryObj.id, editTag.getId()); } newStory = new StoryObject(mProductBacklogHelper.getStory(Long.parseLong(newStory.id))); Gson gson = new Gson(); return gson.toJson(newStory); }
Source:
<code>public void setWaterLevelIncrementScore(Score waterLevelIncrementScore) { this.waterLevelIncrementScore = waterLevelIncrementScore; <START> this.waterLevelIncrementRatio = null; <END> }</code><technical_language>a simple setter (notice setWaterLevelIncrementRatio this side effect) AcceptorConfig set default value, similar sets 400 for Late Acceptance</technical_language>

Target:
public void setWaterLevelIncrementScore(Score waterLevelIncrementScore) { this.waterLevelIncrementScore = waterLevelIncrementScore; }
Source:
<code>public NodeMaskingFigure(IFigure decorated) { this.decorated = decorated; setLayoutManager(new XYLayout()); setOpaque(true); setFill(true); setOutline(false); IGraphicalEditPart backgroundPart = getDecoratedInterestingParent(getEditPart()); if (backgroundPart instanceof ShapeNodeEditPart) { <START> setBackgroundColor(((IFigure) backgroundPart.getFigure().getChildren().get(0)).getBackgroundColor()); <END> } else { setBackgroundColor(backgroundPart.getFigure().getBackgroundColor()); } setAlpha(255); }</code><technical_language>I this White for a reason..</technical_language>

Target:
public NodeMaskingFigure(IFigure decorated) { this.decorated = decorated; setLayoutManager(new XYLayout()); setOpaque(true); setFill(true); setOutline(false); IGraphicalEditPart backgroundPart = getDecoratedInterestingParent(getEditPart()); setBackgroundColor(getBackgroundColor(backgroundPart)); setAlpha(255); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(request,response); } catch (ServletException e) { Throwable t = e.getRootCause(); while (t != null && !(t instanceof JellyTagException)) { if (t instanceof ServletException) { t = ((ServletException) t).getRootCause(); } else { t = t.getCause(); <START> } <END> } if (t != null) { JellyTagException jte = (JellyTagException) t; Throwable cause = jte.getCause(); if (cause instanceof AcegiSecurityException) { AcegiSecurityException se = (AcegiSecurityException) cause; throw new ServletException(se); } } throw e; } }</code><technical_language>possibly add this for safety prevent infinite loop, adding in while loop condition want for exception, do-while for reason, if this is a valid case, safety hurt ? suggestion } if (e == e.getCause()) { break; }</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(request,response); } catch (ServletException e) { Throwable t = e.getRootCause(); if (t != null && !(t instanceof JellyTagException)) { if (t instanceof ServletException) { t = ((ServletException) t).getRootCause(); } else { t = t.getCause(); } } if (t != null && t instanceof JellyTagException) { JellyTagException jte = (JellyTagException) t; Throwable cause = jte.getCause(); if (cause instanceof AcegiSecurityException) { AcegiSecurityException se = (AcegiSecurityException) cause; throw new ServletException(se); } } throw e; } }
Source:
<code>public void putMultiparts(List<MultipartAttachmentWriter> multiparts) { Log.v(LOG_TAG, "putMultiparts(), parts: " + multiparts); for (MultipartAttachmentWriter mpw : multiparts) { couchClient.putMultipart(mpw); } <START> } <END></code><technical_language>success/failure information get callee</technical_language>

Target:
public List<Response> putMultiparts(List<MultipartAttachmentWriter> multiparts) { Log.v(LOG_TAG, "putMultiparts(), parts: " + multiparts); ArrayList<Response> responses = new ArrayList<Response>(); for (MultipartAttachmentWriter mpw : multiparts) { Response r = couchClient.putMultipart(mpw); responses.add(r); } return responses; }
Source:
<code>private static PrivateKey readPrivateKey(File file) throws IOException, GeneralSecurityException { DataInputStream input = new DataInputStream(new FileInputStream(file)); try { byte[] bytes = new byte[(int) file.length()]; input.read(bytes); PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file); if (spec == null) { spec = new PKCS8EncodedKeySpec(bytes); } <START> @SuppressWarnings("resource") END> ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded())); PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject()); String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId(); return KeyFactory.getInstance(algOid).generatePrivate(spec); } finally { input.close(); } }</code><technical_language>more readable close - especially Java7 try-with-resources</technical_language>

Target:
private static PrivateKey readPrivateKey(File file) throws IOException, GeneralSecurityException { DataInputStream input = new DataInputStream(new FileInputStream(file)); try { byte[] bytes = new byte[(int) file.length()]; input.read(bytes); PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file); if (spec == null) { spec = new PKCS8EncodedKeySpec(bytes); } PrivateKeyInfo pki; try (ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded()))) { pki = PrivateKeyInfo.getInstance(bIn.readObject()); } String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId(); return KeyFactory.getInstance(algOid).generatePrivate(spec); } finally { input.close(); } }
Source:
<code>public void removeLaunches(ILaunch[] launches) { List<ILaunch> removed = new ArrayList<>(launches.length); for (ILaunch <START> launche : <END> launches) { if (internalRemoveLaunch(launche)) { removed.add(launche); } } if (!removed.isEmpty()) { ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]); fireUpdate(removedLaunches, REMOVED); for (ILaunch removedLaunche : removedLaunches) { fireUpdate(removedLaunche, REMOVED); } } }</code><technical_language>rename launch</technical_language>

Target:
public void removeLaunches(ILaunch[] launches) { List<ILaunch> removed = new ArrayList<>(launches.length); for (ILaunch launch : launches) { if (internalRemoveLaunch(launch)) { removed.add(launch); } } if (!removed.isEmpty()) { ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]); fireUpdate(removedLaunches, REMOVED); for (ILaunch launch : removedLaunches) { fireUpdate(launch, REMOVED); } } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); <START> EZ.setContext(this); <END> FileStatusNotificationsManager.get().showFilesLocking(); FileStatusNotificationsManager.get().showFilesUnlocking(); FileStatusNotificationsManager.get().showFilesUnlocked(); mSharing = new APSharing(this); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); PackageManager pm = getPackageManager(); ComponentName homeName = new ComponentName(this, HomeActivity.class); if (pm.getComponentEnabledSetting(homeName) == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT){ Log.w("Hiding: Disable", "Disabling app drawer icon."); pm.setComponentEnabledSetting(homeName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } }</code><technical_language>This kills app. seriously, keeping a reference activity context is a bad thing. getApplicationContext dont get Activity leaks (not friendly for memory usage). Also, if need entire Context static, need rework design, simply dont want static. for making code more readable, making application suck memory unfriendly for testing</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Utils.setContext(this); mSharing = new APSharing(this); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); PackageManager pm = getPackageManager(); ComponentName homeName = new ComponentName(this, HomeActivity.class); if (pm.getComponentEnabledSetting(homeName) == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT){ Log.w("Hiding: Disable", "Disabling app drawer icon."); pm.setComponentEnabledSetting(homeName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } }
Source:
<code>public SetDataRequestDto(final List<SetDataSystemIdentifierDto> setDataSystemIdentifiers) { <START> super(); <END> this.setDataSystemIdentifiers = setDataSystemIdentifiers; }</code><technical_language>call super() is superfluous removed. compiler care of this</technical_language>

Target:
public SetDataRequestDto(final List<SetDataSystemIdentifierDto> setDataSystemIdentifiers) { this.setDataSystemIdentifiers = new ArrayList<>(setDataSystemIdentifiers); }
Source:
<code>public void randomSleepDelay(){ try{ <START> TimeUnit.SECONDS.sleep((long)(Math.random() * range + offset)); <END> }catch(InterruptedException e){ e.printStackTrace(); } }</code><technical_language>offset frequency of cron job</technical_language>

Target:
public void randomSleepDelay(){ try{ TimeUnit.SECONDS.sleep((long)(Math.random() * range)); }catch(InterruptedException e){ e.printStackTrace(); } }
Source:
<code>public void writeAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) throws BulkCacheWritingException, Exception { <START> System.out.println("WriteAll " + entries); <END> lock.writeLock().lock(); try { for (Entry<? extends K, ? extends V> entry : entries) { data.put(entry.getKey(), new Pair<K, V>(entry.getKey(), entry.getValue())); if(latch != null) latch.countDown(); } } finally { lock.writeLock().unlock(); } }</code><technical_language>sysout</technical_language>

Target:
public void writeAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) throws BulkCacheWritingException, Exception { lock.writeLock().lock(); try { for (Entry<? extends K, ? extends V> entry : entries) { data.put(entry.getKey(), new Pair<K, V>(entry.getKey(), entry.getValue())); if(latch != null) latch.countDown(); } } finally { lock.writeLock().unlock(); } }
Source:
<code>public MobileSpecialUserLogin(WebDriver driver) { super(driver); <START> PageFactory.initElements(driver, this); <END> }</code><technical_language>remove this line</technical_language>

Target:
public MobileSpecialUserLogin(WebDriver driver) { super(driver); }
Source:
<code>private String formatProxyAddress(String consoleProxyUrlDomain, String proxyIpAddress) { StringBuffer sb = new StringBuffer(); <START> if (consoleProxyUrlDomain != null && consoleProxyUrlDomain.startsWith("*")) { <END> sb.append(proxyIpAddress.replaceAll("\\.", "-")); sb.append(consoleProxyUrlDomain.substring(1)); } else if (StringUtils.isNotBlank(consoleProxyUrlDomain)) { sb.append(consoleProxyUrlDomain); } else { sb.append(proxyIpAddress); } return sb.toString(); }</code><technical_language>reorder this if-then-else? To: if (StringUtils.isBlank(consoleProxyUrlDomain) { // Blank config, proxy IP sb.append(proxyIpAddress); } else if (consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress.replaceAll("\\.", "-")); sb.append(consoleProxyUrlDomain.substring(1)); // skip * } else { // assume a valid domain if config blank sb.append(consoleProxyUrlDomain); }</technical_language>

Target:
private String formatProxyAddress(String consoleProxyUrlDomain, String proxyIpAddress) { StringBuffer sb = new StringBuffer(); if (StringUtils.isBlank(consoleProxyUrlDomain)) { sb.append(proxyIpAddress); } else if (consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress.replaceAll("\\.", "-")); sb.append(consoleProxyUrlDomain.substring(1)); } else { sb.append(consoleProxyUrlDomain); } return sb.toString(); }
Source:
<code>public boolean equals(Object o) { if (o instanceof Vector2d) { Vector2d v = (Vector2d) o; <START> return (Math.abs(x - v.getX()) < .001) && (Math.abs(y - v.getY()) < .001); <END> } return false; }</code><technical_language>A proper float epsilon here. Flow-math a in GenericMath.java for this, copy paste it</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof Vector2d) { Vector2d v = (Vector2d) o; return (Math.abs(x - v.getX()) < DBL_EPSILON) && (Math.abs(y - v.getY()) < DBL_EPSILON); } return false; }
Source:
<code>protected Control createControl(Composite parent) { CTConfiguration config = new CTConfiguration(parent, CTConfiguration.STYLE_GRID); config.setHorizontalAlignment(SWT.CENTER); config.setCellSelectionEnabled(false); config.setColumnSelectionEnabled(false); config.setRowSelectionEnabled(false); config.setColumnHeaderLayout(CTConfiguration.COLUMN_HEADER_LAYOUT_FILL_EQUAL); config.setRowHeaderLayout(CTConfiguration.ROW_HEADER_LAYOUT_DEFAULT); <START> this.table = new ComponentTable(parent, SWT.FULL_SELECTION, config); <END> return this.table.getControl(); }</code><technical_language>Please here. This is a standard SWT table</technical_language>

Target:
protected Control createControl(Composite parent) { CTConfiguration config = new CTConfiguration(parent, CTConfiguration.STYLE_GRID); config.setHorizontalAlignment(SWT.CENTER); config.setCellSelectionEnabled(false); config.setColumnSelectionEnabled(false); config.setRowSelectionEnabled(false); config.setColumnHeaderLayout(CTConfiguration.COLUMN_HEADER_LAYOUT_FILL_EQUAL); config.setRowHeaderLayout(CTConfiguration.ROW_HEADER_LAYOUT_DEFAULT); this.table = new ComponentTable(parent, SWT.NONE, config); return this.table.getControl(); }
Source:
<code>public List<QuotaConsumptionParameter> getQuotaVdsConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); list.add(new QuotaVdsGroupConsumptionParameter( getParameters().getVmStaticData().getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, getParameters().getVmStaticData().getvds_group_id(), 0, <START> 0)); <END> return list; }</code><technical_language>zeros</technical_language>

Target:
public List<QuotaConsumptionParameter> getQuotaVdsConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); list.add(new QuotaSanityParameter(getParameters().getVmStaticData().getQuotaId(), null)); return list; }
Source:
<code><START> public OnePassDataIndexer(ObjectStream<Event> eventStream, int cutoff, boolean sort) <END> throws IOException { Map<String, Integer> predicateIndex = new HashMap<>(); LinkedList<Event> events; List<ComparableEvent> eventsToCompare; System.out.println("Indexing events using cutoff of " + cutoff + "\n"); System.out.print("\tComputing event counts... "); events = computeEventCounts(eventStream, predicateIndex, cutoff); System.out.println("done. " + events.size() + " events"); System.out.print("\tIndexing... "); eventsToCompare = index(events, predicateIndex); events = null; predicateIndex = null; System.out.println("done."); System.out.print("Sorting and merging events... "); sortAndMerge(eventsToCompare, sort); System.out.println("Done indexing."); }</code><technical_language>if Deprecated, do wanna add</technical_language>

Target:
public OnePassDataIndexer(ObjectStream<Event> eventStream, int cutoff, boolean sort) throws IOException { Map<String, Integer> predicateIndex = new HashMap<>(); List<Event> events; List<ComparableEvent> eventsToCompare; System.out.println("Indexing events using cutoff of " + cutoff + "\n"); System.out.print("\tComputing event counts... "); events = computeEventCounts(eventStream, predicateIndex, cutoff); System.out.println("done. " + events.size() + " events"); System.out.print("\tIndexing... "); eventsToCompare = index(events, predicateIndex); events = null; predicateIndex = null; System.out.println("done."); System.out.print("Sorting and merging events... "); sortAndMerge(eventsToCompare, sort); System.out.println("Done indexing."); }
Source:
<code>public String convertToNormalizedHTML(String inputHTML) { Document doc = Jsoup.parse(inputHTML); doc.quirksMode(QuirksMode.noQuirks); OutputSettings outputSettings = doc.outputSettings(); outputSettings.charset(CHARSET); outputSettings.escapeMode(EscapeMode.xhtml); outputSettings.prettyPrint(true); outputSettings.outline(true); outputSettings.indentAmount(INDENT_AMOUNT); <START> doc.outputSettings(outputSettings); <END> Elements bold = doc.select("b"); for (Element e : bold) { e.tagName("strong"); } Elements italic = doc.select("i"); for (Element e : italic) { e.tagName("em"); } Elements underline = doc.select("u"); for (Element e : underline) { e.tagName("span"); e.attr("style", "text-decoration: underline;"); } Elements strike = doc.select("strike"); for (Element e : strike) { e.tagName("span"); e.attr("style", "text-decoration: line-through;"); } processFontTags(doc); String output = processText(doc); return output; }</code><technical_language>FWIW, in case unaware, OutputSettings supports builder/fluent idiom chain calls referring a local variable over. In fact, I suspect call setter, do doc.outputSettings().charset(CHARSET).escapeMode(EscapeMode.xhtml) ... but, a subjective matter of taste. I literally mention in case realize it. I terseness of I more clear easier read/maintain ... wikipedia page claims does</technical_language>

Target:
public String convertToNormalizedHTML(String inputHTML) { Document doc = Jsoup.parse(inputHTML); doc.quirksMode(QuirksMode.noQuirks); OutputSettings outputSettings = doc.outputSettings(); outputSettings.charset(CHARSET); outputSettings.escapeMode(EscapeMode.xhtml); outputSettings.prettyPrint(true); outputSettings.outline(true); outputSettings.indentAmount(INDENT_AMOUNT); doc.outputSettings(outputSettings); Elements bold = doc.select("b"); for (Element e : bold) { e.tagName("strong"); } Elements italic = doc.select("i"); for (Element e : italic) { e.tagName("em"); } Elements underline = doc.select("u"); for (Element e : underline) { e.tagName("span"); e.attr("style", "text-decoration: underline;"); } Elements strike = doc.select("strike"); for (Element e : strike) { e.tagName("span"); e.attr("style", "text-decoration: line-through;"); } processFontTags(doc); return processText(doc); }
Source:
<code>private void emit(CodeWriter codeWriter) throws IOException { codeWriter.pushPackage(packageName); if (!fileComment.isEmpty()) { codeWriter.emitComment(fileComment); } if (!packageName.isEmpty()) { codeWriter.emit("package $L;\n", packageName); codeWriter.emit("\n"); } if (!staticImports.isEmpty()) { for (String signature : staticImports) { codeWriter.emit("import static $L;\n", signature); } codeWriter.emit("\n"); } int importedTypesCount = 0; for (ClassName className : new TreeSet<>(codeWriter.importedTypes().values())) { if (skipJavaLangImports && className.packageName().equals("java.lang")) continue; codeWriter.emit("import $L;\n", className.withoutAnnotations()); importedTypesCount++; } if (importedTypesCount > 0) { codeWriter.emit("\n"); } <START> for (TypeSpec ts : typeSpecs) { <END> ts.emit(codeWriter, null, Collections.emptySet()); } codeWriter.popPackage(); }</code><technical_language>ts -> typeSpec</technical_language>

Target:
private void emit(CodeWriter codeWriter) throws IOException { codeWriter.pushPackage(packageName); if (!fileComment.isEmpty()) { codeWriter.emitComment(fileComment); } if (!packageName.isEmpty()) { codeWriter.emit("package $L;\n", packageName); codeWriter.emit("\n"); } if (!staticImports.isEmpty()) { for (String signature : staticImports) { codeWriter.emit("import static $L;\n", signature); } codeWriter.emit("\n"); } int importedTypesCount = 0; for (ClassName className : new TreeSet<>(codeWriter.importedTypes().values())) { if (skipJavaLangImports && className.packageName().equals("java.lang")) continue; codeWriter.emit("import $L;\n", className.withoutAnnotations()); importedTypesCount++; } if (importedTypesCount > 0) { codeWriter.emit("\n"); } typeSpec.emit(codeWriter, null, Collections.emptySet()); for (TypeSpec additionalTypeSpec : additionalTypeSpecs) { additionalTypeSpec.emit(codeWriter, null, Collections.emptySet()); } codeWriter.popPackage(); }
Source:
<code>public HostJobsReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); Object temp = innerMap.get(JOBS_KEY); if (temp != null) { <START> hostJobsInfo = (Map<String, Object>) innerMap.get(JOBS_KEY); <END> } }</code><technical_language>hostJobsInfo = (Map<String, Object>) temp;</technical_language>

Target:
public HostJobsReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); hostJobsInfo = (Map<String, Object>) innerMap.get(JOBS_KEY); }
Source:
<code>public static boolean isConvertible(Aggregate input) { if (PhoenixAbstractAggregate.isSingleValueCheckAggregate(input)) return true; if (input.getGroupSets().size() > 1) return false; <START> if (input.getGroupType() != Group.SIMPLE) <END> return false; for (AggregateCall aggCall : input.getAggCallList()) { if (!CalciteUtils.isAggregateFunctionSupported(aggCall.getAggregation())) { return false; } } return true; }</code><technical_language>minor nit, mind add check for other distinct functions? coz support SUM DISTINCT yet</technical_language>

Target:
public static boolean isConvertible(Aggregate input) { if (PhoenixAbstractAggregate.isSingleValueCheckAggregate(input)) return true; if (input.getGroupSets().size() > 1) return false; if (input.getGroupType() != Group.SIMPLE) return false; for (AggregateCall aggCall : input.getAggCallList()) { if(!SqlKind.COUNT.equals(aggCall.getAggregation().getKind()) && aggCall.isDistinct()) { return false; } if (!CalciteUtils.isAggregateFunctionSupported(aggCall.getAggregation())) { return false; } } return true; }
Source:
<code>public void set(String name, String value) { String attribute = (name != null ? name.trim() : "") + ": " + (value != null ? value.trim() : ""); lines.clear(); while (attribute.indexOf(',') > 0 || attribute.length() > 71) { int split = attribute.indexOf(',') + 1; if (split == 0) { split = 70; <START> } <END> lines.add(attribute.substring(0, split)); attribute = " " + attribute.substring(split); } lines.add(attribute); }</code><technical_language>this split comma (or index 70), for commas e.g. in version ranges ? I thinking reuse ManifestElement.parseHeader() instead of this low-level (potentially error-prone) MANIFEST parsing. fill n elements total length > 70 render n-1 elements ManifestElement.toString() line. Wdyt</technical_language>

Target:
public void set(String name, String value) { lines.clear(); try { ManifestElement[] elements = ManifestElement.parseHeader(name, value); String firstLine = (name != null ? name.trim() : "") + ": " + elements[0]; if (elements.length > 1) { firstLine = firstLine + ","; } lines.add(firstLine); for (int i = 1; i < elements.length - 1; i++) { lines.add(" " + elements[i] + ","); } if (elements.length > 1) { lines.add(" " + elements[elements.length - 1]); } } catch (BundleException e) { throw new RuntimeException(e); } }
Source:
<code>private JsonNode parseRequestResponse (Response response) throws IOException { <START> response.bufferEntity(); <END> String body = response.readEntity(String.class); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readTree(body); }</code><technical_language>is this necessary</technical_language>

Target:
private JsonNode parseRequestResponse (Response response) throws IOException { String body = response.readEntity(String.class); ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readTree(body); }
Source:
<code>public void run() throws Exception { <START> CamusHourlySweeper.this.metrics.runnerStartTimeByTopic.put(this.topicAndHour, System.currentTimeMillis()); <END> job.getConfiguration().setBoolean(MAPRED_COMPRESS_MAP_OUTPUT, DEFAULT_MAPRED_COMPRESS_MAP_OUTPUT); ((CamusSweeperJob) Class.forName(props.getProperty(CAMUS_SWEEPER_IO_CONFIGURER_CLASS)).newInstance()).setLogger( LOG).configureJob(topicName, job); setNumOfReducersAndSplitSizes(); submitMrJob(); moveTmpPathToOutputPath(); CamusHourlySweeper.this.metrics.mrFinishTimeByTopic.put(this.topicAndHour, System.currentTimeMillis()); }</code><technical_language>accessing instance variables metrics class, clearer if a method as: reportHourlyRunnerStartTime(String topic, String hour, long startTime)</technical_language>

Target:
public void run() throws Exception { CamusHourlySweeper.this.metrics.recordRunnerStartTimeByTopic(this.topicAndHour, System.currentTimeMillis()); job.getConfiguration().setBoolean(MAPRED_COMPRESS_MAP_OUTPUT, DEFAULT_MAPRED_COMPRESS_MAP_OUTPUT); ((CamusSweeperJob) Class.forName(props.getProperty(CAMUS_SWEEPER_IO_CONFIGURER_CLASS)).newInstance()).setLogger( LOG).configureJob(topicName, job); setNumOfReducersAndSplitSizes(); submitMrJob(); moveTmpPathToOutputPath(); }
Source:
<code>public String loadPluginSettings(String pluginId) { GoPluginApiResponse response; try { response = submitTo(pluginId, new DefaultGoPluginApiRequest("", "", "load-settings")); <START> } catch (GoPluginFrameworkException e) { <END> throw new RuntimeException(format("Plugin %s does not support this operation", pluginId)); } if (SUCCESS_RESPONSE_CODE == response.responseCode()) { return response.responseBody(); } throw new RuntimeException(format("Error while loading settings for plugin %s. [%s]", pluginId, response.responseBody())); }</code><technical_language>this catch more generic Exception instead? If kind of exception thrown plugin, caught here. Also, GoPluginFrameworkException support for this operation. plugin ID is wrong other framework-level issues, right? I this load-settings is supported</technical_language>

Target:
public String loadPluginSettings(String pluginId) { GoPluginApiResponse response; try { response = submitTo(pluginId, new DefaultGoPluginApiRequest("", "", "load-settings")); } catch (Exception e) { LOGGER.warn(format("Could not load settings for Plugin %s", pluginId), e); throw new RuntimeException(format("Could not load settings for Plugin %s. %s", pluginId, e.getMessage())); } if (SUCCESS_RESPONSE_CODE == response.responseCode()) { return response.responseBody(); } throw new RuntimeException(format("Error while loading settings for plugin %s. [%s]", pluginId, response.responseBody())); }
Source:
<code>public ComponentQuery(@Nullable String nameOrKeyQuery, String... qualifiers) { this.nameOrKeyQuery = nameOrKeyQuery; this.qualifiers = Builder.validateQualifiers(qualifiers); this.language = null; this.componentIds = null; this.isPrivate = null; <START> this.lastAnalysisBefore = null; <END> }</code><technical_language>I rename analyzedBefore => a project search, sense search for project analyzed in : I put "last" word</technical_language>

Target:
public ComponentQuery(@Nullable String nameOrKeyQuery, String... qualifiers) { this.nameOrKeyQuery = nameOrKeyQuery; this.qualifiers = Builder.validateQualifiers(qualifiers); this.language = null; this.componentIds = null; this.isPrivate = null; this.analyzedBefore = null; }
Source:
<code><START> public boolean waitInvisibility(By elementLocator) { <END> return waitInvisibility(elementLocator, DEFAULT_TIMEOUT); }</code><technical_language>returning boolean type is useless return **true**, throw timeout exception</technical_language>

Target:
public void waitInvisibility(By elementLocator) { waitInvisibility(elementLocator, DEFAULT_TIMEOUT); }
Source:
<code>public WorkflowVersion addAliasesAndCheck(User user, Long id, String aliases, boolean blockFormat) { WorkflowVersion c = getAndCheckResource(user, id); Set<String> oldAliases = c.getAliases().keySet(); Set<String> newAliases = Sets.newHashSet(Arrays.stream(aliases.split(",")).map(String::trim).toArray(String[]::new)); AliasableResourceInterface.checkAliases(newAliases, user, blockFormat); Set<String> duplicateAliasesToAdd = Sets.intersection(newAliases, oldAliases); if (!duplicateAliasesToAdd.isEmpty()) { String dupAliasesString = String.join(", ", duplicateAliasesToAdd); throw new CustomWebApplicationException("Aliases " + dupAliasesString + " already exist; please use unique aliases", HttpStatus.SC_BAD_REQUEST); } newAliases.forEach(alias -> c.getAliases().put(alias, new Alias())); <START> return c; <END> }</code><technical_language>This is nitpicky, c is a readable name</technical_language>

Target:
public WorkflowVersion addAliasesAndCheck(User user, Long id, String aliases, boolean blockFormat) { WorkflowVersion workflowVersion = getAndCheckResource(user, id); Set<String> oldAliases = workflowVersion.getAliases().keySet(); Set<String> newAliases = Sets.newHashSet(Arrays.stream(aliases.split(",")).map(String::trim).toArray(String[]::new)); AliasableResourceInterface.checkAliases(newAliases, user, blockFormat); Set<String> duplicateAliasesToAdd = Sets.intersection(newAliases, oldAliases); if (!duplicateAliasesToAdd.isEmpty()) { String dupAliasesString = String.join(", ", duplicateAliasesToAdd); throw new CustomWebApplicationException("Aliases " + dupAliasesString + " already exist; please use unique aliases", HttpStatus.SC_BAD_REQUEST); } newAliases.forEach(alias -> workflowVersion.getAliases().put(alias, new Alias())); return workflowVersion; }
Source:
<code>public MonstrousStep(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); <START> this.getSpellAbility().addEffect(new BoostTargetEffect(7,7, Duration.EndOfTurn)); <END> this.getSpellAbility().addEffect(new MonstrousStepEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterMustBlock)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterToBeBlocked)); this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }</code><technical_language>need change text effect changing filter text</technical_language>

Target:
public MonstrousStep(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{G}"); this.getSpellAbility().addEffect(new BoostTargetEffect(7,7, Duration.EndOfTurn) .setText("Target creature gets +7/+7 until end of turn.")); this.getSpellAbility().addEffect(new MonstrousStepEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterMustBlock)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(filterToBeBlocked)); this.getSpellAbility().addWatcher(new BlockedAttackerWatcher()); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); }
Source:
<code>public String solveProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setFehlerMeldung("correctionSolveProblem"); <START> logger.error(e.getMessage(), e); <END> } } setSolution(serviceManager.getWorkflowService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }</code><technical_language>setErrorMessage</technical_language>

Target:
public String solveProblemForAll() { for (Task task : this.steps) { this.currentStep = task; this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowControllerService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowControllerService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setErrorMessage("correctionSolveProblem", logger, e); } } setSolution(serviceManager.getWorkflowControllerService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
<code>public boolean shouldTriggerOn(GerritTriggeredEvent event) { if (!super.shouldTriggerOn(event)) { return false; } if (excludeDrafts && ((PatchsetCreated)event).getPatchSet().isDraft()) { return false; } if (excludeTrivialRebase <START> && new String("TRIVIAL_REBASE").equals(((PatchsetCreated)event).getPatchSet().getKind())) { <END> return false; } if (excludeNoCodeChange && new String("NO_CODE_CHANGE").equals(((PatchsetCreated)event).getPatchSet().getKind())) { return false; } return true; }</code><technical_language>Add a class GerritEventKeys gerrit-events it</technical_language>

Target:
public boolean shouldTriggerOn(GerritTriggeredEvent event) { if (!super.shouldTriggerOn(event)) { return false; } if (excludeDrafts && ((PatchsetCreated)event).getPatchSet().isDraft()) { return false; } if (excludeTrivialRebase && GerritChangeKind.TRIVIAL_REBASE == ((PatchsetCreated)event).getPatchSet().getKind()) { return false; } if (excludeNoCodeChange && GerritChangeKind.NO_CODE_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind()) { return false; } return true; }
Source:
<code>public PartitionReleaseStrategy createInstance(final SchedulingTopology schedulingStrategy) { <START> final Set<? extends Set<? extends SchedulingExecutionVertex>> distinctRegions = <END> PipelinedRegionComputeUtil.computePipelinedRegions(schedulingStrategy); return new RegionPartitionReleaseStrategy( schedulingStrategy, PipelinedRegionComputeUtil.toPipelinedRegionsSet(distinctRegions)); }</code><technical_language>simplified Set<Set<SchedulingExecutionVertex>></technical_language>

Target:
public PartitionReleaseStrategy createInstance(final SchedulingTopology schedulingStrategy) { final Set<? extends Set<SchedulingExecutionVertex>> distinctRegions = PipelinedRegionComputeUtil.computePipelinedRegions(schedulingStrategy); return new RegionPartitionReleaseStrategy( schedulingStrategy, PipelinedRegionComputeUtil.toPipelinedRegionsSet(distinctRegions)); }