auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>boolean incrNumberRuns(List<KeyValue> column, HTable aggTable, AppAggregationKey appAggKey) throws IOException { <START> Long expectedValueBeforePut = null; <END> if (column.size() > 0) { try { expectedValueBeforePut = Bytes.toLong(column.get(0).getValue()); } catch (NumberFormatException e) { LOG.error("Could not read existing value for number of runs during aggregation" + appAggKey.toString()); return false; } } byte[] rowKey = aggConv.toBytes(appAggKey); long insertValue = 1L; byte[] expectedValueBeforePutBytes = null; if (expectedValueBeforePut != null) { insertValue = 1 + expectedValueBeforePut; expectedValueBeforePutBytes = Bytes.toBytes(expectedValueBeforePut); } byte[] insertValueBytes = Bytes.toBytes(insertValue); LOG.trace(" before statusCheckAndPut " + insertValue + " " + expectedValueBeforePut); return executeCheckAndPut(aggTable, rowKey, expectedValueBeforePutBytes, insertValueBytes, AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES); }</code><technical_language>Long ... = null -> long ... = 0;</technical_language>

Target:
boolean incrNumberRuns(List<KeyValue> column, HTable aggTable, AppAggregationKey appAggKey) throws IOException { long expectedValueBeforePut = 0L; if (column.size() > 0) { try { expectedValueBeforePut = Bytes.toLong(column.get(0).getValue()); } catch (NumberFormatException e) { LOG.error("Could not read existing value for number of runs during aggregation" + appAggKey.toString()); return false; } } byte[] rowKey = aggConv.toBytes(appAggKey); long insertValue = 1L; byte[] expectedValueBeforePutBytes = null; if (expectedValueBeforePut != 0L) { insertValue = 1 + expectedValueBeforePut; expectedValueBeforePutBytes = Bytes.toBytes(expectedValueBeforePut); } byte[] insertValueBytes = Bytes.toBytes(insertValue); if (LOG.isTraceEnabled()) { LOG.trace(" before statusCheckAndPut " + insertValue + " " + expectedValueBeforePut); } return executeCheckAndPut(aggTable, rowKey, expectedValueBeforePutBytes, insertValueBytes, AggregationConstants.INFO_FAM_BYTES, AggregationConstants.NUMBER_RUNS_BYTES); }
Source:
<code>private void parseProfile() throws IOException, XMLStreamException, WrongProfileEncodingException { XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = factory.createXMLStreamReader(new FileInputStream(profile)); <START> if (!"utf-8".equals(streamReader.getEncoding().toLowerCase())){ <END> streamReader.close(); throw new WrongProfileEncodingException("The given profile has not utf-8 encoding: " + profile.getCanonicalPath()); } else { while (streamReader.hasNext()) { streamReader.next(); if (streamReader.isStartElement() && streamReader.getLocalName().equals("hash")) { Location location = streamReader.getLocation(); startOfHash = location.getCharacterOffset(); currentHashAsString = streamReader.getElementText().trim(); } if (streamReader.isEndElement() && streamReader.getLocalName().equals("hash")) { Location location = streamReader.getLocation(); endOfHash = location.getCharacterOffset(); if (endOfHash != startOfHash) { startOfHash -= "<hash>".length(); } else { startOfHash -= "<hash/>".length(); } } } } }</code><technical_language>please move this string constant</technical_language>

Target:
private void parseProfile() throws IOException, XMLStreamException, WrongProfileEncodingException { XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader streamReader = factory.createXMLStreamReader(new FileInputStream(profile)); if (!UTF8.equals(streamReader.getEncoding().toLowerCase())){ streamReader.close(); throw new WrongProfileEncodingException("The given profile has not utf-8 encoding: " + profile.getCanonicalPath()); } else { while (streamReader.hasNext()) { streamReader.next(); if (streamReader.isStartElement() && streamReader.getLocalName().equals("hash")) { Location location = streamReader.getLocation(); startOfHash = location.getCharacterOffset(); currentHashAsString = streamReader.getElementText().trim(); } if (streamReader.isEndElement() && streamReader.getLocalName().equals("hash")) { Location location = streamReader.getLocation(); endOfHash = location.getCharacterOffset(); if (endOfHash != startOfHash) { startOfHash -= "<hash>".length(); } else { startOfHash -= "<hash/>".length(); } } } } }
Source:
<code>public void init() { <START> if (cacheContainer == null) { <END> log.fine("Using default cache"); propertyCache = InfinispanCacheManager.getDefaultCache(CACHE_NAME); } else { log.fine("Using container provided cache"); propertyCache = cacheContainer.getCache(CACHE_NAME); } propertyCache.addListener(eventListener); }</code><technical_language>want a guard this method, init method if propertyCache initialised. issue in tests, avoid provided in constructor overwritten mistake</technical_language>

Target:
public void init() { if (propertyCache != null) { return; } if (cacheContainer == null) { log.fine("Using default cache"); propertyCache = InfinispanCacheManager.getDefaultCache(CACHE_NAME); } else { log.fine("Using container provided cache"); propertyCache = cacheContainer.getCache(CACHE_NAME); } propertyCache.addListener(eventListener); }
Source:
<code>public void configure(JTable table, TableRowSorter<TableModel> sorter, ColumnTreeCellRenderer renderer) { TableColumn column = table.getColumn(myName); column.setPreferredWidth(myWidth); final TableCellRenderer tableCellRenderer = table.getTableHeader().getDefaultRenderer(); column.setHeaderRenderer(new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component component = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (component instanceof JLabel) { JLabel label = (JLabel)component; label.setHorizontalAlignment(myHeaderAlignment); return <START> label; <END> } return component; } }); if (myComparator != null) { sorter.setComparator(column.getModelIndex(), myComparator); } else { sorter.setSortable(column.getModelIndex(), false); } assert myRenderer != null; renderer.add(myRenderer); }</code><technical_language>nit: need this line, inline casting</technical_language>

Target:
public void configure(JTable table, TableRowSorter<TableModel> sorter, ColumnTreeCellRenderer renderer) { TableColumn column = table.getColumn(myName); column.setPreferredWidth(myWidth); final TableCellRenderer tableCellRenderer = table.getTableHeader().getDefaultRenderer(); column.setHeaderRenderer(new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component component = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (component instanceof JLabel) { ((JLabel)component).setHorizontalAlignment(myHeaderAlignment); } return component; } }); if (myComparator != null) { sorter.setComparator(column.getModelIndex(), myComparator); } else { sorter.setSortable(column.getModelIndex(), false); } assert myRenderer != null; renderer.add(myRenderer); }
Source:
<code>public void testBasic() { try { CliConfiguration.set(null); Assert.fail(); } catch (NullPointerException e) { } CliConfiguration.set(new HashMap<>()); Map<String,String> expected = new HashMap<>(); expected.put(Property.TRACE_USER.getKey(), "test"); expected.put(Property.TSERV_CLIENTPORT.getKey(), "123"); CliConfiguration.set(expected); Assert.assertEquals("test", CliConfiguration.get(Property.TRACE_USER)); Map<String,String> results = new HashMap<>(); CliConfiguration.getProperties(results, p -> p.startsWith("trace")); <START> Assert.assertEquals(1, results.size()); <END> }</code><technical_language>nice verify contents. I ImmutableMap.of(k,v) for this</technical_language>

Target:
public void testBasic() { try { CliConfiguration.set(null); Assert.fail(); } catch (NullPointerException e) { } CliConfiguration.set(new HashMap<>()); Map<String,String> expected = new HashMap<>(); expected.put(Property.TRACE_USER.getKey(), "test"); expected.put(Property.TSERV_CLIENTPORT.getKey(), "123"); CliConfiguration.set(expected); Assert.assertEquals("test", CliConfiguration.get(Property.TRACE_USER)); Map<String,String> results = new HashMap<>(); CliConfiguration.getProperties(results, p -> p.startsWith("trace")); Assert.assertEquals(ImmutableMap.of(Property.TRACE_USER.getKey(), "test"), results); }
Source:
<code>public void handle(Context withinContext) throws Exception { CreateTableMessage ctm = deserializer.getCreateTableMessage(event.getMessage()); LOG.info("Processing#{} CREATE_TABLE message : {}", fromEventId(), event.getMessage()); org.apache.hadoop.hive.metastore.api.Table tobj = ctm.getTableObj(); if (tobj == null) { LOG.debug("Event#{} was a CREATE_TABLE_EVENT with no table listed"); return; } Table qlMdTable = new Table(tobj); if (!Utils.shouldReplicate(withinContext.replicationSpec, qlMdTable, withinContext.hiveConf)) { return; } if (qlMdTable.isView()) { withinContext.replicationSpec.setIsMetadataOnly(true); } Path metaDataPath = new Path(withinContext.eventRoot, EximUtil.METADATA_NAME); EximUtil.createExportDump( metaDataPath.getFileSystem(withinContext.hiveConf), metaDataPath, qlMdTable, null, withinContext.replicationSpec, withinContext.hiveConf); Path dataPath = new Path(withinContext.eventRoot, "data"); Iterable<String> files = ctm.getFiles(); if (files != null) { try (BufferedWriter fileListWriter = writer(withinContext, dataPath)) { for (String file : files) { fileListWriter.write(file + "\n"); } } } DumpMetaData dmd = withinContext.createDmd(this); <START> dmd.setPayload(event.getMessage()); <END> dmd.write(); }</code><technical_language>this change needed? Truncate impact AlterTable/Partition flow right</technical_language>

Target:
public void handle(Context withinContext) throws Exception { CreateTableMessage ctm = deserializer.getCreateTableMessage(event.getMessage()); LOG.info("Processing#{} CREATE_TABLE message : {}", fromEventId(), event.getMessage()); org.apache.hadoop.hive.metastore.api.Table tobj = ctm.getTableObj(); if (tobj == null) { LOG.debug("Event#{} was a CREATE_TABLE_EVENT with no table listed"); return; } Table qlMdTable = new Table(tobj); if (!Utils.shouldReplicate(withinContext.replicationSpec, qlMdTable, withinContext.hiveConf)) { return; } if (qlMdTable.isView()) { withinContext.replicationSpec.setIsMetadataOnly(true); } Path metaDataPath = new Path(withinContext.eventRoot, EximUtil.METADATA_NAME); EximUtil.createExportDump( metaDataPath.getFileSystem(withinContext.hiveConf), metaDataPath, qlMdTable, null, withinContext.replicationSpec, withinContext.hiveConf); Path dataPath = new Path(withinContext.eventRoot, "data"); Iterable<String> files = ctm.getFiles(); if (files != null) { try (BufferedWriter fileListWriter = writer(withinContext, dataPath)) { for (String file : files) { fileListWriter.write(file + "\n"); } } } withinContext.createDmd(this).write(); }
Source:
<code>private void processResponse(@Nullable HttpResponse response) { <START> if (response != null) { <END> StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { printSuccessMessage(String.format("%nBackup of [%s] complete.%n", coreName)); } else { printErrorMessage(String.format("Error backing up Solr core: [%s]", coreName)); printErrorMessage( String.format( "Backup request failed: %d - %s %n", statusLine.getStatusCode(), statusLine.getReasonPhrase())); } } else { printErrorMessage(String.format("Could not communicate with Solr. %n")); } }</code><technical_language>inverting this if statement reduces complexity of this method a bit private void processResponse(@Nullable HttpResponse response) { if(response == null) { printErrorMessage(String.format("Could communicate Solr. %n")); return; } StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { printSuccessMessage(String.format("%nBackup of [%s] complete.%n", coreName)); return; } else { printErrorMessage(String.format("Error backing Solr core: [%s]", coreName)); printErrorMessage( String.format( "Backup request failed: %d - %s %n", statusLine.getStatusCode(), statusLine.getReasonPhrase())); } }</technical_language>

Target:
private void processResponse(@Nullable HttpResponse response) { if (response == null) { printErrorMessage(String.format("Could not communicate with Solr. %n")); return; } StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { printSuccessMessage(String.format("%nBackup of [%s] complete.%n", coreName)); } else { printErrorMessage(String.format("Error backing up Solr core: [%s]", coreName)); printErrorMessage( String.format( "Backup request failed: %d - %s %n", statusLine.getStatusCode(), statusLine.getReasonPhrase())); } }
Source:
<code>private AsyncJobStatus processJobFailure(AsyncJobStatus status, EventSink eventSink, Exception exception, boolean retry) { status.setEndTime(new Date()); eventSink.rollback(); if (retry) { status = this.updateJobStatus(status, JobState.FAILED_WITH_RETRY, exception); log.warn("Job \"{}\" failed in {}ms; retrying...", status.getName(), this.getJobRuntime(status), exception); try { JobMessage message = new JobMessage(status.getId(), status.getJobKey()); this.dispatcher.sendJobMessage(message); } catch (Exception e) { log.error("Job \"{}\" could not be requeued; failed to dispatch message:", status.getName(), e); <START> status = this.updateJobStatus(status, JobState.FAILED, exception); <END> } } else { status = this.updateJobStatus(status, JobState.FAILED, exception); log.error("Job \"{}\" failed in {}ms", status.getName(), this.getJobRuntime(status), exception); } return status; }</code><technical_language>clear, if attempt retry message sent, job is done? For example, lets artemis shut right moment, send message, more retry attempts. I suppose do some sort of retry send N times calling quits</technical_language>

Target:
private AsyncJobStatus processJobFailure(AsyncJobStatus status, EventSink eventSink, Exception exception, boolean retry) throws JobStateManagementException, JobMessageDispatchException { status.setEndTime(new Date()); eventSink.rollback(); if (retry) { status = this.updateJobStatus(status, JobState.FAILED_WITH_RETRY, exception); log.warn("Job \"{}\" failed in {}ms; retrying...", status.getName(), this.getJobRuntime(status), exception); this.postJobStatusMessage(status); } else { status = this.updateJobStatus(status, JobState.FAILED, exception); log.error("Job \"{}\" failed in {}ms", status.getName(), this.getJobRuntime(status), exception); } return status; }
Source:
<code>public void setLocale(@Nullable String languageCode, @Nullable String regionCode) { Locale locale = null; if (!Strings.isNullOrEmpty(languageCode) && !Strings.isNullOrEmpty(regionCode)) { <START> locale = Locale.forLanguageTag(String.join("/", languageCode, regionCode)); <END> } else if (!Strings.isNullOrEmpty(languageCode)) { locale = Locale.forLanguageTag(languageCode); } else if (!Strings.isNullOrEmpty(regionCode)) { locale = Locale.forLanguageTag(String.join("/", UNDEFINED_LANGUAGE, regionCode)); } this.locale = locale; }</code><technical_language>a static Guava Joiner</technical_language>

Target:
public void setLocale(@Nullable String languageCode, @Nullable String regionCode) { this.locale = new Locale.Builder().setLanguage(languageCode).setRegion(regionCode).build(); }
Source:
<code>public static ISideEffectFactory createFactory(Widget disposableWidget) { ICompositeSideEffect compositeSideEffect <START> = (ICompositeSideEffect) <END> disposableWidget .getData(ICompositeSideEffect.class.getName()); if (compositeSideEffect == null) { ICompositeSideEffect newCompositeSideEffect = ICompositeSideEffect.create(); disposableWidget.setData(ICompositeSideEffect.class.getName(), newCompositeSideEffect); disposableWidget.addDisposeListener(e -> newCompositeSideEffect.dispose()); compositeSideEffect = newCompositeSideEffect; } return ISideEffectFactory.createFactory(compositeSideEffect::add); }</code><technical_language>break =</technical_language>

Target:
public static ISideEffectFactory createFactory(Widget disposableWidget) { CompositeSideEffect compositeSideEffect = (CompositeSideEffect) disposableWidget .getData(CompositeSideEffect.class.getName()); if (compositeSideEffect == null) { CompositeSideEffect newCompositeSideEffect = new CompositeSideEffect(); disposableWidget.setData(CompositeSideEffect.class.getName(), newCompositeSideEffect); disposableWidget.addDisposeListener(e -> newCompositeSideEffect.dispose()); compositeSideEffect = newCompositeSideEffect; } return ISideEffectFactory.createFactory(compositeSideEffect::add); }
Source:
<code><START> public Achievements() { <END> }</code><technical_language>This private, public</technical_language>

Target:
private Achievements() { }
Source:
<code>public static double integrate(final DoubleFunction<Double> getIntegrand, final double lowerBound, final double upperBound, final int numPoints) { final GaussIntegrator integrator = integratorFactory.legendre(numPoints, lowerBound, upperBound); <START> final double[] gaussIntegrationWeights = IntStream.range(0, numPoints).mapToDouble(integrator::getWeight).toArray(); <END> final double[] gaussIntegrationAbscissas = IntStream.range(0, numPoints).mapToDouble(integrator::getPoint).toArray(); final double[] integrands = Arrays.stream(gaussIntegrationAbscissas).map(getIntegrand::apply).toArray(); return GATKProtectedMathUtils.dotProduct(gaussIntegrationWeights, integrands); }</code><technical_language>A faster do this (because Java streams expensive construct JVM recognize a simple map operation) is final double[] gaussIntegrationWeights = new IndexRange(0, numPoints).mapToDouble(integrator::getWeight)</technical_language>

Target:
public static double integrate(final DoubleFunction<Double> getIntegrand, final double lowerBound, final double upperBound, final int numPoints) { final GaussIntegrator integrator = integratorFactory.legendre(numPoints, lowerBound, upperBound); final double[] gaussIntegrationWeights = new IndexRange(0, numPoints).mapToDouble(integrator::getWeight); final double[] gaussIntegrationAbscissas = new IndexRange(0, numPoints).mapToDouble(integrator::getPoint); final double[] integrands = MathUtils.applyToArrayInPlace(gaussIntegrationAbscissas,getIntegrand::apply); return GATKProtectedMathUtils.dotProduct(gaussIntegrationWeights, integrands); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> if (getSucceeded()) <END> return AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT; else return errorType == null ? AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED : errorType; }</code><technical_language>default standard is curly braces</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { if (getSucceeded()) { return AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT; } else { return errorType == null ? AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED : errorType; } }
Source:
<code>public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String values, String displayType, String separators, String defaultValue, String freeText, boolean largeStorage) { if (get(fieldName) == null) { StaticListClass list_class = new StaticListClass(); list_class.setName(fieldName); list_class.setPrettyName(fieldPrettyName); list_class.setSize(size); list_class.setMultiSelect(multiSelect); list_class.setRelationalStorage(relationalStorage); list_class.setValues(values); if (displayType != null) { list_class.setDisplayType(displayType); } if (separators != null) { list_class.setSeparators(separators); list_class.setSeparator(separators.substring(0, 1)); } if (defaultValue != null) { list_class.setDefaultValue(defaultValue); } list_class.setFreeText(freeText); <START> if (!freeText.equals(ListClass.FREE_TEXT_FORBIDDEN)) { <END> list_class.setPicker(true); } list_class.setLargeStorage(largeStorage); list_class.setObject(this); put(fieldName, list_class); return true; } return false; }</code><technical_language>safer put *constant* left checking equality, prevent a NPE</technical_language>

Target:
public boolean addStaticListField(String fieldName, String fieldPrettyName, int size, boolean multiSelect, boolean relationalStorage, String values, String displayType, String separators, String defaultValue, String freeText, boolean largeStorage) { if (get(fieldName) == null) { StaticListClass list_class = new StaticListClass(); list_class.setName(fieldName); list_class.setPrettyName(fieldPrettyName); list_class.setSize(size); list_class.setMultiSelect(multiSelect); list_class.setRelationalStorage(relationalStorage); list_class.setValues(values); if (displayType != null) { list_class.setDisplayType(displayType); } if (separators != null) { list_class.setSeparators(separators); list_class.setSeparator(separators.substring(0, 1)); } if (defaultValue != null) { list_class.setDefaultValue(defaultValue); } list_class.setFreeText(freeText); if (!ListClass.FREE_TEXT_FORBIDDEN.equals(freeText)) { list_class.setPicker(true); } list_class.setLargeStorage(largeStorage); list_class.setObject(this); put(fieldName, list_class); return true; } return false; }
Source:
<code>public static int compareRanges(byte[] left, int leftOffset, int leftLength, byte[] right, int rightOffset, int rightLength) { long leftAddress = ARRAY_BYTE_BASE_OFFSET + leftOffset; long rightAddress = ARRAY_BYTE_BASE_OFFSET + rightOffset; <START> int compareLength = min(leftLength, rightLength); <END> while (compareLength >= SIZE_OF_LONG) { long leftLong = unsafe.getLong(left, leftAddress); long rightLong = unsafe.getLong(right, rightAddress); if (leftLong != rightLong) { return longBytesToLong(leftLong) < longBytesToLong(rightLong) ? -1 : 1; } leftAddress += SIZE_OF_LONG; rightAddress += SIZE_OF_LONG; compareLength -= SIZE_OF_LONG; } while (compareLength > 0) { byte leftByte = unsafe.getByte(left, leftAddress); byte rightByte = unsafe.getByte(right, rightAddress); int compareResult = compareUnsignedBytes(leftByte, rightByte); if (compareResult != 0) { return compareResult; } leftAddress++; rightAddress++; compareLength--; } return Integer.compare(leftLength, rightLength); }</code><technical_language>nit: compareLength sounds compared length. compareLength -> lengthToCompare</technical_language>

Target:
public static int compareRanges(byte[] left, int leftOffset, int leftLength, byte[] right, int rightOffset, int rightLength) { long leftAddress = ARRAY_BYTE_BASE_OFFSET + leftOffset; long rightAddress = ARRAY_BYTE_BASE_OFFSET + rightOffset; int lengthToCompare = min(leftLength, rightLength); while (lengthToCompare >= SIZE_OF_LONG) { long leftLong = unsafe.getLong(left, leftAddress); long rightLong = unsafe.getLong(right, rightAddress); if (leftLong != rightLong) { return longBytesToLong(leftLong) < longBytesToLong(rightLong) ? -1 : 1; } leftAddress += SIZE_OF_LONG; rightAddress += SIZE_OF_LONG; lengthToCompare -= SIZE_OF_LONG; } while (lengthToCompare > 0) { int compareResult = compareUnsignedBytes(unsafe.getByte(left, leftAddress), unsafe.getByte(right, rightAddress)); if (compareResult != 0) { return compareResult; } leftAddress++; rightAddress++; lengthToCompare--; } return Integer.compare(leftLength, rightLength); }
Source:
<code>public void init() { explorerMode = ( ( Window.Location.getParameterMap().containsKey( "explorer_mode" ) ) ? Window.Location.getParameterMap().get( "explorer_mode" ).get( 0 ) : "" ).trim(); projectPathString = ( ( ( Window.Location.getParameterMap().containsKey( "path" ) ) ? Window.Location.getParameterMap().get( "path" ).get( 0 ) : "" ) ).trim(); projectEditorDisableBuild = Window.Location.getParameterMap().containsKey( "no_build" ); final PlaceRequest placeRequest = generateProjectExplorerPlaceRequest(); <START> docks.setup("AuthoringPerspective", placeRequest); <END> }</code><technical_language>PerspectiveIds.AUTHORING. in scope, reuse it.</technical_language>

Target:
public void init() { explorerMode = ( ( Window.Location.getParameterMap().containsKey( "explorer_mode" ) ) ? Window.Location.getParameterMap().get( "explorer_mode" ).get( 0 ) : "" ).trim(); projectPathString = ( ( ( Window.Location.getParameterMap().containsKey( "path" ) ) ? Window.Location.getParameterMap().get( "path" ).get( 0 ) : "" ) ).trim(); projectEditorDisableBuild = Window.Location.getParameterMap().containsKey( "no_build" ); final PlaceRequest placeRequest = generateProjectExplorerPlaceRequest(); docks.setup(PerspectiveIds.AUTHORING, placeRequest); }
Source:
<code>public void emptySessionKeys() throws ConfigurationException { PipeForward forw = new PipeForward("lessthan", "/Users/apollo11/Desktop/iaf2/core/src/test/resources/Pipes"); pipe.registerForward(forw); pipe.setSessionKey1(""); pipe.setSessionKey2(""); <START> pipe.configure(); <END> }</code><technical_language>removed 2 tests</technical_language>

Target:
public void emptySessionKeys() throws ConfigurationException { pipe.setSessionKey1(""); pipe.setSessionKey2(""); pipe.configure(); }
Source:
<code><START> public void insertWorkerTransaction(long transactionId, long nodeId) <END> { ShardWriterDao dao = shardDbi.get(getNodeShard(nodeId)).onDemand(ShardWriterDao.class); dao.insertWorkerTransaction(transactionId, nodeId, System.currentTimeMillis()); }</code><technical_language>Add @Override</technical_language>

Target:
public void insertWorkerTransaction(long transactionId, long nodeId) { ShardWriterDao dao = shardDbi.get(getTableShard(nodeId)).onDemand(ShardWriterDao.class); dao.insertWorkerTransaction(transactionId, nodeId, System.currentTimeMillis()); }
Source:
<code>public boolean validateUuid(String uuid) { if (StringUtils.isEmpty(uuid)) { return false; } <START> if (useHyphens && uuid.length() == 32) { <END> return hexPattern.matcher(uuid).matches(); } else if (!useHyphens && uuid.length() == 36) { return hexPatternWithHypens.matcher(uuid).matches(); } return false; }</code><technical_language>I logic is reversed name !useHyphens here</technical_language>

Target:
public boolean validateUuid(String uuid) { if (StringUtils.isEmpty(uuid)) { return false; } if (!useHyphens && uuid.length() == 32) { return hexPattern.matcher(uuid).matches(); } else if (useHyphens && uuid.length() == 36) { return hexPatternWithHypens.matcher(uuid).matches(); } return false; }
Source:
<code><START> public void initializeWithProjectsTest() { <END> doReturn( true ).when( libraryService ).thereIsAProjectInTheWorkbench(); libraryMonitor.initialize(); assertTrue( libraryMonitor.thereIsAtLeastOneProjectAccessible() ); verify( workbench ).addStartupBlocker( LibraryMonitor.class ); verify( workbench ).removeStartupBlocker( LibraryMonitor.class ); }</code><technical_language>(optional, if feel changing) this test initializeWithoutProjectsTest() remarkably similar removal of duplicated code a shared method single isAProjectInTheWorkbench boolean parameter remove duplication</technical_language>

Target:
public void initializeWithProjectsTest() { thereIsAProjectInTheWorkbench( true ); }
Source:
<code><START> public NaiEntity() { <END> }</code><technical_language>remove public</technical_language>

Target:
NaiEntity() { }
Source:
<code>public Entity newInstance(World world) { try { return (Entity)this.ctr.newInstance(world); } catch (Exception e) { <START> FMLLog.log.error("Encountered an exception while constructing entity '" + this.getRegistryName() + '\'', e); <END> return null; } }</code><technical_language>{} for string formatting</technical_language>

Target:
public Entity newInstance(World world) { return this.factory.apply(world); }
Source:
<code><START> @Override public boolean isMergeEnabled() { <END> return true; }</code><technical_language>please put @Override line consistent Spring Security code conventions? suggestion @Override public boolean isMergeEnabled() {</technical_language>

Target:
public boolean isMergeEnabled() { return true; }
Source:
<code>public static final boolean isSingleColumnTreeTable(final TableConfiguration tableConfiguration) { <START> TableDisplayStyle style = (TableDisplayStyle) tableConfiguration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); <END> Assert.isNotNull(style); final DisplayStyle displayStyle = style.getDisplayStyle(); return DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle); }</code><technical_language>final</technical_language>

Target:
public static final boolean isSingleColumnTreeTable(final TableConfiguration tableConfiguration) { final TableDisplayStyle style = (TableDisplayStyle) tableConfiguration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); Assert.isNotNull(style); final DisplayStyle displayStyle = style.getDisplayStyle(); return DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle); }
Source:
<code>public PackFile openPack(final File pack) throws IOException { final String p = pack.getName(); if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack")) throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, pack)); <START> final List<PackExt> extensions = new ArrayList<PackExt>( <END> PackExt.values().length); extensions.add(PACK); extensions.add(INDEX); final String base = p.substring(0, p.length() - 4); for (PackExt ext : PackExt.values()) { if (ext != PACK && ext != INDEX) { final String name = base + ext.getExtension(); if (new File(pack.getParentFile(), name).exists()) extensions.add(ext); } } PackFile res = new PackFile(pack, extensions); insertPack(res); return res; }</code><technical_language>is this a List. bit form</technical_language>

Target:
public PackFile openPack(final File pack) throws IOException { final String p = pack.getName(); if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack")) throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, pack)); int extensions = 1 << PACK.getPosition() | 1 << INDEX.getPosition(); final String base = p.substring(0, p.length() - 4); for (PackExt ext : PackExt.values()) { int mask = 1 << ext.getPosition(); if ((extensions & mask) == 0) { final String name = base + ext.getExtension(); if (new File(pack.getParentFile(), name).exists()) extensions |= mask; } } PackFile res = new PackFile(pack, extensions); insertPack(res); return res; }
Source:
<code>public T next() { init(); try { final T retVal = objectCodec.readValue(jp, typeRef); jp.nextToken(); return retVal; } catch (IOException e) { <START> throw Throwables.propagate(e); <END> } }</code><technical_language>Please change new RuntimeException(e) (<LINK_0></technical_language>

Target:
public T next() { if (!hasNext()) { throw new NoSuchElementException("No more objects to read!"); } try { final T retVal = objectCodec.readValue(jp, typeRef); jp.nextToken(); return retVal; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>protected void onLoad() { enableForm(false); super.onLoad(); Util.PROJECT_SVC.projectDetail(projectName, new GerritCallback<ProjectDetail>() { public void onSuccess(final ProjectDetail result) { <START> com.google.gerrit.client.account.Util.ACCOUNT_SEC.myGroups(new GerritCallback<List<AccountGroup>>() { <END> public void onSuccess(List<AccountGroup> myGroups) { boolean hasOwnRights = Util.hasOwnRight(result, myGroups); enableForm(true); display(result, !hasOwnRights); addPanel.setVisible(hasOwnRights); delRight.setVisible(hasOwnRights); } }); } }); }</code><technical_language>Again, please recursive RPCs, data ProjectDetail object</technical_language>

Target:
protected void onLoad() { enableForm(false); super.onLoad(); Util.PROJECT_SVC.projectDetail(projectName, new GerritCallback<ProjectDetail>() { public void onSuccess(final ProjectDetail result) { enableForm(true); display(result); addPanel.setVisible(result.canModifyData); delRight.setVisible(result.canModifyData); } }); }
Source:
<code>public CompletableFuture<List<Multihash>> put(PublicSigningKey writer, List<byte[]> blocks) { return CompletableFuture.completedFuture(blocks.stream() .map(b -> { byte[] hash = hash(b); Multihash multihash = new Multihash(Multihash.Type.sha2_256, hash); <START> Cid cid = new Cid(1, Cid.Codec.DagCbor, multihash); <END> put(cid, b); return cid; }).collect(Collectors.toList())); }</code><technical_language>is 1? a static var describing this signifies</technical_language>

Target:
public CompletableFuture<List<Multihash>> put(PublicSigningKey writer, List<byte[]> blocks) { return CompletableFuture.completedFuture(blocks.stream() .map(b -> { byte[] hash = hash(b); Multihash multihash = new Multihash(Multihash.Type.sha2_256, hash); Cid cid = new Cid(CID_V1, Cid.Codec.DagCbor, multihash); put(cid, b); return cid; }).collect(Collectors.toList())); }
Source:
<code>public String retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); logger.trace("retrieve() About to query device status."); BCgetDeviceStatus.Response response = bridge.bridgeCommunicate(new BCgetDeviceStatus()); if ((response == null) || (!response.getResult())) { logger.trace("retrieve() finished with failure."); return null; <START> } else { <END> logger.trace("retrieve() finished successfully with result {}.", response.getDeviceStatus()); return response.getDeviceStatus(); } }</code><technical_language>"else" is redundant here. Consider dropping it</technical_language>

Target:
public String retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); logger.trace("retrieve() About to query device status."); BCgetDeviceStatus.Response response = bridge.bridgeCommunicate(new BCgetDeviceStatus()); if ((response == null) || (!response.getResult())) { logger.trace("retrieve() finished with failure."); return null; } logger.trace("retrieve() finished successfully with result {}.", response.getDeviceStatus()); return response.getDeviceStatus(); }
Source:
<code>public void refresh() { try { if (this.client == null) { SustainedConnectionWorker.this.totalMetadataConnections.incrementAndGet(); this.client = AdminClient.create(this.props); } this.client.describeCluster().nodes().get(); } catch (Throwable e) { this.closeQuietly(); SustainedConnectionWorker.this.totalMetadataConnections.decrementAndGet(); SustainedConnectionWorker.this.totalMetadataFailedConnections.incrementAndGet(); <START> SustainedConnectionWorker.log.error("Error while refreshing sustained AdminClient connection", e.getMessage()); <END> } this.nextUpdate = System.currentTimeMillis() + this.refreshRate; this.inUse = false; }</code><technical_language>This log error. want public void error(String msg, Throwable t); overload, need change e.getMessage() -> e</technical_language>

Target:
public void refresh() { try { if (this.client == null) { SustainedConnectionWorker.this.totalMetadataConnections.incrementAndGet(); this.client = AdminClient.create(this.props); } this.client.describeCluster().nodes().get(); } catch (Throwable e) { this.closeQuietly(); SustainedConnectionWorker.this.totalMetadataConnections.decrementAndGet(); SustainedConnectionWorker.this.totalMetadataFailedConnections.incrementAndGet(); SustainedConnectionWorker.log.error("Error while refreshing sustained AdminClient connection", e); } this.completeRefresh(); }
Source:
<code>private T invokeHandlerMethod(HandlerMethod handlerMethod, ParametersWrapper parameters) throws Exception { try { return (T) handlerMethod.invoke(parameters); } catch (MethodArgumentResolutionException | MessageConversionException | IllegalStateException e) { if (e instanceof MessageConversionException) { if (e.getCause() instanceof ConversionFailedException && !(e.getCause().getCause() instanceof ConverterNotFoundException)) { throw e; } } else if (e instanceof IllegalStateException) { if (e.getCause() instanceof IllegalArgumentException && (!"argument type mismatch".equals(e.getCause().getMessage()) && !e.getCause().getMessage().startsWith("java.lang.ClassCastException@"))) { throw e; } } Expression expression = handlerMethod.expression; <START> if (++handlerMethod.failedAttempts == FAILED_ATTEMPTS_THRESHOLD) { <END> handlerMethod.spelOnly = true; if (logger.isInfoEnabled()) { logger.info("Failed to invoke [ " + handlerMethod.invocableHandlerMethod + "] with provided arguments [ " + parameters + " ]. \n" + "Falling back to SpEL invocation for expression [ " + expression.getExpressionString() + " ]"); } } return invokeExpression(expression, parameters); } }</code><technical_language>= (race condition)</technical_language>

Target:
private T invokeHandlerMethod(HandlerMethod handlerMethod, ParametersWrapper parameters) throws Exception { try { return (T) handlerMethod.invoke(parameters); } catch (MethodArgumentResolutionException | MessageConversionException | IllegalStateException e) { if (e instanceof MessageConversionException) { if (e.getCause() instanceof ConversionFailedException && !(e.getCause().getCause() instanceof ConverterNotFoundException)) { throw e; } } else if (e instanceof IllegalStateException) { if (!(e.getCause() instanceof IllegalArgumentException) || !e.getStackTrace()[0].getClassName().equals(InvocableHandlerMethod.class.getName()) || (!"argument type mismatch".equals(e.getCause().getMessage()) && !e.getCause().getMessage().startsWith("java.lang.ClassCastException@"))) { throw e; } } Expression expression = handlerMethod.expression; if (++handlerMethod.failedAttempts >= FAILED_ATTEMPTS_THRESHOLD) { handlerMethod.spelOnly = true; if (logger.isInfoEnabled()) { logger.info("Failed to invoke [ " + handlerMethod.invocableHandlerMethod + "] with provided arguments [ " + parameters + " ]. \n" + "Falling back to SpEL invocation for expression [ " + expression.getExpressionString() + " ]"); } } return invokeExpression(expression, parameters); } }
Source:
<code>public String enqueueUpdateDeviceCdmaSettingsRequest(final String organisationIdentification, final String deviceIdentification, final CdmaSettings cdmaSettings) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.deviceDomainService.searchDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.UPDATE_DEVICE_CDMA_SETTINGS); LOGGER.debug( <START> "enqueueUpdateDeviceCdmaSettingsRequest called with organisation {}, deviceIdentifcation {}, and {}", <END> organisationIdentification, deviceIdentification, cdmaSettings); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisationIdentification, correlationUid, CommonRequestMessageType.UPDATE_DEVICE_CDMA_SETTINGS.name()); final CommonRequestMessage message = new CommonRequestMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata).request(cdmaSettings).build(); this.commonRequestMessageSender.send(message); return correlationUid; }</code><technical_language>deviceIdentifcation => deviceIdentification</technical_language>

Target:
public String enqueueUpdateDeviceCdmaSettingsRequest(final String organisationIdentification, final String deviceIdentification, final CdmaSettings cdmaSettings) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); final Device device = this.deviceDomainService.searchDevice(deviceIdentification); this.domainHelperService.isAllowed(organisation, device, DeviceFunction.UPDATE_DEVICE_CDMA_SETTINGS); LOGGER.debug( "enqueueUpdateDeviceCdmaSettingsRequest called with organisation {}, deviceIdentification {}, and {}", organisationIdentification, deviceIdentification, cdmaSettings); final String correlationUid = this.correlationIdProviderService.getCorrelationId(organisationIdentification, deviceIdentification); final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisationIdentification, correlationUid, CommonRequestMessageType.UPDATE_DEVICE_CDMA_SETTINGS.name()); final CommonRequestMessage message = new CommonRequestMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata).request(cdmaSettings).build(); this.commonRequestMessageSender.send(message); return correlationUid; }
Source:
<code>public int hashCode() { int result = _domainUuid != null ? _domainUuid.hashCode() : 0; result = 31 * result + (_networkUuid != null ? _networkUuid.hashCode() : 0); result = 31 * result + (_isL3Network ? 1 : 0); result = 31 * result + (_isSharedNetwork ? 1 : 0); result = 31 * result + (_vpcUuid != null ? _vpcUuid.hashCode() : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; <START> } <END></code><technical_language>Please implement toString() provide debugging state information for debugging purposes</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_domainUuid != null ? _domainUuid.hashCode() : 0); result = 31 * result + (_networkUuid != null ? _networkUuid.hashCode() : 0); result = 31 * result + (_isL3Network ? 1 : 0); result = 31 * result + (_isSharedNetwork ? 1 : 0); result = 31 * result + (_vpcUuid != null ? _vpcUuid.hashCode() : 0); result = 31 * result + (_domainTemplateName != null ? _domainTemplateName.hashCode() : 0); return result; }
Source:
<code>public void onScrollingEnded(CardWheelHorizontalView cardWheel, Object startValue, Object endValue) { switch (cardWheel.getId()) { case R.id.anglePicker: case R.id.altitudePicker: case R.id.overlapPicker: case R.id.sidelapPicker: final Drone drone = getDrone(); try { final List<T> surveyList = getMissionItems(); if (!surveyList.isEmpty()) { for (final T survey : surveyList) { SurveyDetail surveyDetail = survey.getSurveyDetail(); surveyDetail.setAltitude(mAltitudePicker.getCurrentValue().toBase().getValue()); surveyDetail.setAngle(mAnglePicker.getCurrentValue()); surveyDetail.setOverlap(mOverlapPicker.getCurrentValue()); surveyDetail.setSidelap(mSidelapPicker.getCurrentValue()); } final MissionItem.ComplexItem<T>[] surveys = surveyList .toArray(new MissionItem.ComplexItem[surveyList.size()]); drone.buildMissionItemsAsync(surveys, this); <START> System.out.println("nothing"); <END> } } catch (Exception e) { Log.e(TAG, "Error while building the survey.", e); } break; } }</code><technical_language>@squilter forgot behind. removed</technical_language>

Target:
public void onScrollingEnded(CardWheelHorizontalView cardWheel, Object startValue, Object endValue) { switch (cardWheel.getId()) { case R.id.anglePicker: case R.id.altitudePicker: case R.id.overlapPicker: case R.id.sidelapPicker: final Drone drone = getDrone(); try { final List<T> surveyList = getMissionItems(); if (!surveyList.isEmpty()) { for (final T survey : surveyList) { SurveyDetail surveyDetail = survey.getSurveyDetail(); surveyDetail.setAltitude(mAltitudePicker.getCurrentValue().toBase().getValue()); surveyDetail.setAngle(mAnglePicker.getCurrentValue()); surveyDetail.setOverlap(mOverlapPicker.getCurrentValue()); surveyDetail.setSidelap(mSidelapPicker.getCurrentValue()); } final MissionItem.ComplexItem<T>[] surveys = surveyList .toArray(new MissionItem.ComplexItem[surveyList.size()]); drone.buildMissionItemsAsync(surveys, this); } } catch (Exception e) { Log.e(TAG, "Error while building the survey.", e); } break; } }
Source:
<code>public SetClockConfigurationRequestData(final short timeZoneOffset, final CosemDateTime daylightSavingsBegin, final CosemDateTime daylightSavingsEnd, final byte daylightSavingsDeviation, final boolean daylightSavingsEnabled) { this.timeZoneOffset = timeZoneOffset; <START> this.daylightSavingsBegin = new CosemDateTime(daylightSavingsBegin); <END> this.daylightSavingsEnd = new CosemDateTime(daylightSavingsEnd); this.daylightSavingsDeviation = daylightSavingsDeviation; this.daylightSavingsEnabled = daylightSavingsEnabled; }</code><technical_language>CosemDateTime appears immutable, copy constructor is needed</technical_language>

Target:
public SetClockConfigurationRequestData(final short timeZoneOffset, final CosemDateTime daylightSavingsBegin, final CosemDateTime daylightSavingsEnd, final byte daylightSavingsDeviation, final boolean daylightSavingsEnabled) { this.timeZoneOffset = timeZoneOffset; this.daylightSavingsBegin = daylightSavingsBegin; this.daylightSavingsEnd = daylightSavingsEnd; this.daylightSavingsDeviation = daylightSavingsDeviation; this.daylightSavingsEnabled = daylightSavingsEnabled; }
Source:
<code>protected Map<String, String> getFileSystemProperties(BatchSourceContext context) { Map<String, String> properties = new HashMap<>(config.getFileSystemProperties()); if (config.shouldCopyHeader()) { properties.put(PathTrackingInputFormat.COPY_HEADER, "true"); } Pattern pattern = config.getFilePattern(); <START> properties.put(INPUT_REGEX_CONFIG, pattern == null ? ".*" : pattern.toString()); <END> properties.put("mapreduce.input.pathFilter.class", BatchFileFilter.class.getName()); return properties; }</code><technical_language>I remove this logic well, I hooks time table stuff</technical_language>

Target:
protected Map<String, String> getFileSystemProperties(BatchSourceContext context) { Map<String, String> properties = new HashMap<>(config.getFileSystemProperties()); if (config.shouldCopyHeader()) { properties.put(PathTrackingInputFormat.COPY_HEADER, "true"); } return properties; }
Source:
<code><START> public int getAverageTemp() { <END> return averageTemperature; }</code><technical_language>calculation assignment for averageTemperature calculated this line, is calculated else now</technical_language>

Target:
public int getAverageTemp() { averageTemperature = AstronomicalBodyHelper.getAverageTemperature(this.getStar(), this.getSolarOrbitalDistance(), this.getAtmosphereDensity()); return averageTemperature; }
Source:
<code><START> public Object methodException(Context context, Class claz, String method, Exception e, Info info) { <END> return null; }</code><technical_language>Is this change related updating apache velocity</technical_language>

Target:
public Object methodException(Context context, Class claz, String method, Exception e, Info info) { log.debug("Claz: " + claz.getName() + " method: " + method, e); if ("format".equals(method)) { return null; } return info; }
Source:
<code>private static Object getOuter(Object innerWM) { try { Field parentField = innerWM.getClass().getDeclaredField("mWindowManager"); parentField.setAccessible(true); Object outerWM = parentField.get(innerWM); parentField.setAccessible(false); return outerWM; } catch (NoSuchFieldException e) { <START> throw new RuntimeException("unfortunately, you cannot view the view tree of the dialog etc.", e); <END> } catch (IllegalAccessException e) { throw new RuntimeException("unfortunately, you cannot view the view tree of the dialog etc.", e); } }</code><technical_language>duplicate error messages again, in case I throwing context is fine. code explains wrong expect reasonable Android device</technical_language>

Target:
private static Object getOuter(Object innerWM) { try { Field parentField = innerWM.getClass().getDeclaredField("mWindowManager"); parentField.setAccessible(true); Object outerWM = parentField.get(innerWM); parentField.setAccessible(false); return outerWM; } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }