auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testSqlLedgerStorage() { try { try { PrototypeFactory mPrototypeFactory = new PrototypeFactory(); mPrototypeFactory.addClass(Ledger.class); String storageKey = "Ledger"; String username = "wspride"; SqlTestUtils.deleteDatabase(username); ledgerStorage = new SqlIndexedStorageUtility<Ledger>(Ledger.class, username, storageKey); ledgerStorage.write(l); ledgerStorage.write(l2); ledgerStorage.write(l3); Vector<Object> ids = ledgerStorage.getIDsForValue("entity_id", "ledger_entity_id"); assertEquals(2, ids.size()); assertTrue(ids.contains(1)); assertTrue(ids.contains(2)); <START> Ledger readLedger2 = ledgerStorage.getRecordForValue("entity_id", "ledger_entity_id_3"); <END> int count = ledgerStorage.getNumRecords(); assertEquals(count, 3); assertTrue(ledgerStorage.exists(1)); assertFalse(ledgerStorage.exists(-123)); SqlStorageIterator<Ledger> mIterator = ledgerStorage.iterate(); assertEquals(3, mIterator.numRecords()); assertEquals(1, mIterator.nextID()); assertEquals(2, mIterator.nextID()); assertEquals(3, mIterator.nextID()); assertEquals(-1, mIterator.nextID()); } catch ( Exception e ) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); e.printStackTrace(); System.exit(0); } } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } }</code><technical_language>query result is tested</technical_language>

Target:
public void testSqlLedgerStorage() { try { PrototypeFactory mPrototypeFactory = new PrototypeFactory(); mPrototypeFactory.addClass(Ledger.class); String storageKey = "Ledger"; String username = "wspride"; ledgerStorage = new SqliteIndexedStorageUtility<Ledger>(Ledger.class, username, storageKey); ledgerStorage.write(l); ledgerStorage.write(l2); ledgerStorage.write(l3); Vector ids = ledgerStorage.getIDsForValue("entity_id", "ledger_entity_id"); assertEquals(2, ids.size()); assertTrue(ids.contains(1)); assertTrue(ids.contains(2)); Ledger readLedger2 = ledgerStorage.getRecordForValue("entity_id", "ledger_entity_id_3"); assertEquals(readLedger2.getID(), 3); int count = ledgerStorage.getNumRecords(); assertEquals(count, 3); assertTrue(ledgerStorage.exists(1)); assertFalse(ledgerStorage.exists(-123)); JdbcSqlStorageIterator<Ledger> mIterator = ledgerStorage.iterate(); assertEquals(3, mIterator.numRecords()); assertEquals(1, mIterator.nextID()); assertEquals(2, mIterator.nextID()); assertEquals(3, mIterator.nextID()); assertEquals(-1, mIterator.nextID()); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception " + e.getMessage()); } }
Source:
<code>public ConvertOperationBuilder<T> excludeAttribute(String attributePath) { <START> if ( (key.getSourceType() != null) && !key.getSourceType().getRecursiveAttributes().containsKey(attributePath) && !key.getSourceType().getRecursiveSubviewAttributes().containsKey(attributePath) ) { throw new IllegalArgumentException("Attribute '" + attributePath + "' could not be found on type: " + key.getSourceType().getJavaType().getName()); <END> } subMappers.put(attributePath, ViewMapper.Key.EXCLUDE_MARKER); return this; }</code><technical_language>I more target type here. suggestion if (!key.getTargetType().getRecursiveAttributes().containsKey(attributePath) && !key.getTargetType().getRecursiveSubviewAttributes().containsKey(attributePath)) { throw new IllegalArgumentException("Attribute '" + attributePath + "' type: " + key.getTargetType().getJavaType().getName()); in excludeAttributes(String...) below. Previously difference views compatible i.e. same/similar attributes, more correct base this target attributes</technical_language>

Target:
public ConvertOperationBuilder<T> excludeAttribute(String attributePath) { if (!key.getTargetType().getRecursiveAttributes().containsKey(attributePath) && !key.getTargetType().getRecursiveSubviewAttributes().containsKey(attributePath)) { throw new IllegalArgumentException("Attribute '" + attributePath + "' could not be found on type: " + key.getTargetType().getJavaType().getName()); } subMappers.put(attributePath, ViewMapper.Key.EXCLUDE_MARKER); return this; }
Source:
<code>public Duration nextWait() { if (nextBackoffTime == 0) { nextBackoffTime = System.currentTimeMillis() + backoffDuration.toMillis(); } long sleepTime = (long) Math.pow(base, retryCounter.incrementAndGet()); sleepTime += extraWait; float randomPart = new Random().nextFloat() * randomPortion; sleepTime -= sleepTime * randomPart; if (maxRetryThreshold.toMillis() > 0) { sleepTime = Math.min(sleepTime, maxRetryThreshold.toMillis()); } if (System.currentTimeMillis() + sleepTime > nextBackoffTime) { nextBackoffTime = 0; <START> retryCounter.set(1); <END> sleepTime = base + extraWait; sleepTime -= sleepTime * randomPart; } return Duration.ofMillis(sleepTime); }</code><technical_language>I set startBasePower</technical_language>

Target:
public Duration nextWait() { if (nextBackoffTime == 0) { nextBackoffTime = System.currentTimeMillis() + backoffDuration.toMillis(); } long sleepTime = (long) Math.pow(base, retryCounter.incrementAndGet()); sleepTime += extraWait; float randomPart = new Random().nextFloat() * randomPortion; sleepTime -= sleepTime * randomPart; if (maxRetryThreshold.toMillis() > 0) { sleepTime = Math.min(sleepTime, maxRetryThreshold.toMillis()); } if (System.currentTimeMillis() + sleepTime > nextBackoffTime) { nextBackoffTime = 0; retryCounter.set(this.startPower); sleepTime = base + extraWait; sleepTime -= sleepTime * randomPart; } return Duration.ofMillis(sleepTime); }
Source:
<code>public Object getValue(Session session) { if (opType != OpTypes.STARTS_WITH) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); if (startsWithObject.isVariable) { <START> synchronized (startsWithObject) { <END> startsWithObject.setPattern(session, rightValue); return startsWithObject.compare(session, leftValue); } } return startsWithObject.compare(session, leftValue); }</code><technical_language>Is this necessary? multiple threads ExpressionStartsWith object instance be</technical_language>

Target:
public Object getValue(Session session) { if (opType != OpTypes.STARTS_WITH) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); if (startsWithObject.isVariable) { startsWithObject.setPattern(session, rightValue); } return startsWithObject.compare(session, leftValue); }
Source:
<code><START> public UmaMetadata getUmaDiscovery(String opConfigurationEndpoint, String opHost, String opDiscoveryPath) { <END> return Strings.isNullOrEmpty(opConfigurationEndpoint) ? getUmaDiscovery(opHost, opDiscoveryPath) : getUmaDiscovery(opConfigurationEndpoint); }</code><technical_language>story for UMA, please refactor existing method re-use</technical_language>

Target:
public UmaMetadata getUmaDiscovery(String opConfigurationEndpoint, String opHost, String opDiscoveryPath) { return Strings.isNullOrEmpty(opConfigurationEndpoint) ? getUmaDiscovery(getConnectDiscoveryUrl(opHost, opDiscoveryPath)) : getUmaDiscovery(opConfigurationEndpoint); }
Source:
<code>public <R> Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry, final ServiceCallback<S, R> callback) { Collection<Future<R>> futures = Lists.newArrayList(); for (final ServiceEndPoint endPoint : _pool.getAllEndPoints()) { if (!predicate.apply(endPoint)) { continue; } Future<R> future = _executor.submit(new Callable<R>() { @Override public R call() throws Exception { TimerContext timer = _executionTime.time(); Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; try { Exception lastException; do { try { R result = _pool.executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteFailures.mark(); if (!_pool.isRetriableException(e)) { throw e; } lastException = e; } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); <START> throw new MaxRetriesException( "Exception from the last retry attempt", lastException ); <END> } finally { timer.stop(); } } }); futures.add(future); } _executeBatchSize.update(futures.size()); return futures; }</code><technical_language>message a more descriptive Throwable constructor functionality consistent previous version</technical_language>

Target:
public <R> Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry, final ServiceCallback<S, R> callback) { Collection<Future<R>> futures = Lists.newArrayList(); for (final ServiceEndPoint endPoint : _pool.getAllEndPoints()) { if (!predicate.apply(endPoint)) { continue; } Future<R> future = _executor.submit(new Callable<R>() { @Override public R call() throws Exception { TimerContext timer = _executionTime.time(); Stopwatch sw = new Stopwatch(_ticker).start(); int numAttempts = 0; try { Exception lastException; do { try { R result = _pool.executeOnEndPoint(endPoint, callback); _numExecuteSuccesses.mark(); return result; } catch (Exception e) { _numExecuteFailures.mark(); if (!_pool.isRetriableException(e)) { throw e; } lastException = e; LOG.info("Retriable exception from end point id: " + endPoint.getId(), e); } } while (retry.allowRetry(++numAttempts, sw.elapsedMillis())); throw new MaxRetriesException(lastException); } finally { timer.stop(); } } }); futures.add(future); } _executeBatchSize.update(futures.size()); return futures; }
Source:
<code>private static Object findFragmentForViewInActivity(Activity activity, View view) { FragmentCompat supportLib = FragmentCompat.getSupportLibInstance(); if (supportLib != null && <START> supportLib.getFragmentActivityClass() == activity.getClass()) { <END> Object fragment = findFragmentForViewInActivity(supportLib, activity, view); if (fragment != null) { return fragment; } } FragmentCompat framework = FragmentCompat.getFrameworkInstance(); if (framework != null) { Object fragment = findFragmentForViewInActivity(framework, activity, view); if (fragment != null) { return fragment; } } return null; }</code><technical_language>This isAssignableFrom() call, a == comparison Class<?>'s, right</technical_language>

Target:
private static Object findFragmentForViewInActivity(Activity activity, View view) { FragmentCompat supportLib = FragmentCompat.getSupportLibInstance(); if (supportLib != null && supportLib.getFragmentActivityClass().isInstance(activity)) { Object fragment = findFragmentForViewInActivity(supportLib, activity, view); if (fragment != null) { return fragment; } } FragmentCompat framework = FragmentCompat.getFrameworkInstance(); if (framework != null) { Object fragment = findFragmentForViewInActivity(framework, activity, view); if (fragment != null) { return fragment; } } return null; }
Source:
<code>public ConnectionFactory jmsConnectionFactory(AzureServiceBusJMSProperties serviceBusJMSProperties) { final String connectionString = serviceBusJMSProperties.getConnectionString(); final long idleTimeout = serviceBusJMSProperties.getIdleTimeout(); <START> final ServiceBusJmsConnectionFactorySettings settings = <END> new ServiceBusJmsConnectionFactorySettings(idleTimeout, false); final ServiceBusJmsConnectionFactory serviceBusJmsConnectionFactory = new ServiceBusJmsConnectionFactory(connectionString, settings); return new CachingConnectionFactory(serviceBusJmsConnectionFactory); }</code><technical_language>need for topic client id anymore? BTW, do need set UA header for BI here</technical_language>

Target:
public ConnectionFactory jmsConnectionFactory(AzureServiceBusJMSProperties serviceBusJMSProperties) { final String connectionString = serviceBusJMSProperties.getConnectionString(); final String clientId = serviceBusJMSProperties.getTopicClientId(); final long idleTimeout = serviceBusJMSProperties.getIdleTimeout(); final ServiceBusJmsConnectionFactorySettings settings = new ServiceBusJmsConnectionFactorySettings(idleTimeout, false); final SpringServiceBusJmsConnectionFactory springServiceBusJmsConnectionFactory = new SpringServiceBusJmsConnectionFactory(connectionString, settings); springServiceBusJmsConnectionFactory.setClientId(clientId); springServiceBusJmsConnectionFactory.setCustomUserAgent(AZURE_SPRING_SERVICE_BUS); return new CachingConnectionFactory(springServiceBusJmsConnectionFactory); }
Source:
<code>public void respectIndexOrder() throws Exception { IndexEntryUpdate<IndexDescriptor>[] someUpdates = layoutUtil.someUpdates(); processAll( someUpdates ); Value[] expectedValues = layoutUtil.extractValuesFromUpdates( someUpdates ); IndexReader reader = accessor.newReader(); IndexQuery.NumberRangePredicate supportedQuery = IndexQuery.range( 0, Double.NEGATIVE_INFINITY, true, Double.POSITIVE_INFINITY, true ); for ( IndexOrder supportedOrder : NumberSchemaIndexProvider.CAPABILITY.orderCapability( ValueGroup.NUMBER ) ) { if ( supportedOrder == IndexOrder.ASCENDING ) { Arrays.sort( expectedValues, Values.COMPARATOR ); } if ( supportedOrder == IndexOrder.DESCENDING ) { Arrays.sort( expectedValues, Values.COMPARATOR.reversed() ); } SimpleNodeValueClient client = new SimpleNodeValueClient(); reader.query( client, supportedOrder, supportedQuery ); int i = 0; while ( client.next() ) { assertEquals( "values in order", expectedValues[i++], client.values[0] ); } <START> assertTrue( "found all values", i == expectedValues.length ); <END> } }</code><technical_language>assertEquals</technical_language>

Target:
public void respectIndexOrder() throws Exception { IndexEntryUpdate<IndexDescriptor>[] someUpdates = layoutUtil.someUpdates(); processAll( someUpdates ); Value[] expectedValues = layoutUtil.extractValuesFromUpdates( someUpdates ); IndexReader reader = accessor.newReader(); IndexQuery.NumberRangePredicate supportedQuery = IndexQuery.range( 0, Double.NEGATIVE_INFINITY, true, Double.POSITIVE_INFINITY, true ); for ( IndexOrder supportedOrder : NumberSchemaIndexProvider.CAPABILITY.orderCapability( ValueGroup.NUMBER ) ) { if ( supportedOrder == IndexOrder.ASCENDING ) { Arrays.sort( expectedValues, Values.COMPARATOR ); } if ( supportedOrder == IndexOrder.DESCENDING ) { Arrays.sort( expectedValues, Values.COMPARATOR.reversed() ); } SimpleNodeValueClient client = new SimpleNodeValueClient(); reader.query( client, supportedOrder, supportedQuery ); int i = 0; while ( client.next() ) { assertEquals( "values in order", expectedValues[i++], client.values[0] ); } assertEquals( "found all values", i, expectedValues.length ); } }
Source:
<code>public void testReaderIsNotBrokenWhileWritingFeatureDirectly() throws IOException { int expectedFeatureCount = roadFeatures.length; int currentFeatureCount = 0; FeatureReader<SimpleFeatureType, SimpleFeature> featureReader = memoryDataStore .getFeatureReader( new Query(roadType.getTypeName(), Filter.INCLUDE), transaction); if (featureReader.hasNext()) { featureReader.next(); currentFeatureCount++; } SimpleFeature newFeature = SimpleFeatureBuilder.template(roadType, null); memoryDataStore.addFeature(newFeature); <START> while (featureReader.hasNext()) { <END> featureReader.next(); currentFeatureCount++; } assertEquals("a write in MemoryDataStore should not 'destroy' readers", expectedFeatureCount, currentFeatureCount); }</code><technical_language>this fail changes</technical_language>

Target:
public void testReaderIsNotBrokenWhileWritingFeatureDirectly() throws IOException { int expectedFeatureCount = roadFeatures.length; int currentFeatureCount = 0; FeatureReader<SimpleFeatureType, SimpleFeature> featureReader = memoryDataStore .getFeatureReader( new Query(roadType.getTypeName(), Filter.INCLUDE), transaction); if (featureReader.hasNext()) { featureReader.next(); currentFeatureCount++; } SimpleFeature newFeature = SimpleFeatureBuilder.template(roadType, null); memoryDataStore.addFeature(newFeature); assertReaderHasFeatureCount(expectedFeatureCount, currentFeatureCount, featureReader); }
Source:
<code>private static String getProcname(ITmfEvent event) { ITmfEventField field = event.getContent().getField(UstMemoryStrings.CONTEXT_PROCNAME); if (field == null) { <START> return new String(); <END> } return (String) field.getValue(); }</code><technical_language>return "";</technical_language>

Target:
private static String getProcname(ITmfEvent event) { ITmfEventField field = event.getContent().getField(UstMemoryStrings.CONTEXT_PROCNAME); if (field == null) { return EMPTY_STRING; } return (String) field.getValue(); }
Source:
<code>public void testNullDatasource() throws IOException { <START> Map<DataSegment, SegmentMetadataHolder> segmentsMetadata = schema.getSegmentMetadata(); <END> Set<DataSegment> segments = segmentsMetadata.keySet(); Assert.assertEquals(segments.size(), 3); final DataSegment segmentToRemove = segments.stream().findFirst().orElse(null); Assert.assertFalse(segmentToRemove == null); schema.removeSegment(segmentToRemove); schema.refreshSegments(segments); segmentsMetadata = schema.getSegmentMetadata(); segments = segmentsMetadata.keySet(); Assert.assertEquals(segments.size(), 2); }</code><technical_language>segmentMetadatas more clear multiple objects</technical_language>

Target:
public void testNullDatasource() throws IOException { Map<DataSegment, SegmentMetadataHolder> segmentMetadatas = schema.getSegmentMetadata(); Set<DataSegment> segments = segmentMetadatas.keySet(); Assert.assertEquals(segments.size(), 3); final DataSegment segmentToRemove = segments.stream().filter(segment -> segment.getDataSource().equals("foo2")).findFirst().orElse(null); Assert.assertFalse(segmentToRemove == null); schema.removeSegment(segmentToRemove); schema.refreshSegments(segments); segmentMetadatas = schema.getSegmentMetadata(); segments = segmentMetadatas.keySet(); Assert.assertEquals(segments.size(), 2); }
Source:
<code>private static boolean isUnsuitableOperand(Expression expr) { InferredType tpe = expr.type(); if (isUnsuitableType(tpe)) { if (expr.is(Tree.Kind.NAME)) { Symbol symb = ((Name) expr).symbol(); return symb != null && !isVariableThatCanEscape(symb); } else { return true; } } if (expr.is(Tree.Kind.STRING_LITERAL)) { return true; } else if (expr.is(Tree.Kind.CALL_EXPR)) { Symbol calleeSymbol = ((CallExpression) expr).calleeSymbol(); if (calleeSymbol != null) { String calleeFqn = calleeSymbol.fullyQualifiedName(); return VULNERABLE_CONSTRUCTOR_FQNS.contains(calleeFqn); } else { <START> return false; <END> } } else { return false; } }</code><technical_language>Minor: I remove else returning in if body</technical_language>

Target:
private static boolean isUnsuitableOperand(Expression expr) { InferredType tpe = expr.type(); if (isUnsuitableType(tpe)) { if (expr.is(Tree.Kind.NAME)) { Symbol symb = ((Name) expr).symbol(); return symb != null && !isVariableThatCanEscape(symb); } else { return true; } } if (expr.is(Tree.Kind.STRING_LITERAL)) { return true; } else if (expr.is(Tree.Kind.CALL_EXPR)) { Symbol calleeSymbol = ((CallExpression) expr).calleeSymbol(); if (calleeSymbol != null) { String calleeFqn = calleeSymbol.fullyQualifiedName(); return FQNS_CONSTRUCTORS_RETURNING_UNIQUE_REF.contains(calleeFqn); } } return false; }
Source:
<code>public void testSaveNullData() throws Exception { Document expectedDocument = new Document(); expectedDocument.setId(UUID.randomUUID().toString()); expectedDocument.setTimestamp(System.currentTimeMillis()); expectedDocument.setData(null); <START> queryStore.save(TestUtils.TEST_TABLE_NAME, expectedDocument); <END> }</code><technical_language>Check for equality of error code</technical_language>

Target:
public void testSaveNullData() throws Exception { Document expectedDocument = new Document(); expectedDocument.setId(UUID.randomUUID().toString()); expectedDocument.setTimestamp(System.currentTimeMillis()); expectedDocument.setData(null); try { queryStore.save(TestUtils.TEST_TABLE_NAME, expectedDocument); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.INVALID_REQUEST, e.getErrorCode()); throw e; } }
Source:
<code>public String getInlineComments(int lines) { StringBuilder cmts = new StringBuilder(); final Repository repo = getRepository(); try { final PatchList patchList = repo != null ? getPatchList() : null; Patch.Key currentFileKey = null; PatchFile currentFileData = null; for (final PatchLineComment c : inlineComments) { final Patch.Key pk = c.getKey().getParentKey(); final int lineNbr = c.getLine(); final short side = c.getSide(); if (!pk.equals(currentFileKey)) { cmts.append("....................................................\n"); if (Patch.COMMIT_MSG.equals(pk.get())) { cmts.append("Commit Message\n"); } else { cmts.append("File "); cmts.append(pk.get()); cmts.append("\n"); } currentFileKey = pk; if (patchList != null) { try { currentFileData = new PatchFile(repo, patchList, pk.getFileName()); } catch (IOException e) { } } else { currentFileData = null; } } for (int line = lineNbr - lines + 1; line <= lineNbr; ++line) { appendFileLine(cmts, currentFileData, side, line); } cmts.append(c.getMessage().trim()); cmts.append("\n"); <START> for (int line = lineNbr + 1; line < lineNbr + lines ; ++line) { <END> appendFileLine(cmts, currentFileData, side, line); } cmts.append("\n\n"); } } finally { if (repo != null) { repo.close(); } } return cmts.toString(); }</code><technical_language>need cap this upper limit number of lines in file</technical_language>

Target:
public String getInlineComments(int lines) { StringBuilder cmts = new StringBuilder(); final Repository repo = getRepository(); try { final PatchList patchList = repo != null ? getPatchList() : null; Patch.Key currentFileKey = null; PatchFile currentFileData = null; for (final PatchLineComment c : inlineComments) { final Patch.Key pk = c.getKey().getParentKey(); final int lineNbr = c.getLine(); final short side = c.getSide(); if (!pk.equals(currentFileKey)) { cmts.append("....................................................\n"); if (Patch.COMMIT_MSG.equals(pk.get())) { cmts.append("Commit Message\n"); } else { cmts.append("File "); cmts.append(pk.get()); cmts.append("\n"); } currentFileKey = pk; if (patchList != null) { try { currentFileData = new PatchFile(repo, patchList, pk.getFileName()); } catch (IOException e) { } } else { currentFileData = null; } } if (currentFileData != null) { int maxLines; try { maxLines = currentFileData.getLineCount(side); } catch (Throwable e) { maxLines = Integer.MAX_VALUE; } final int startLine = Math.max(1, lineNbr - lines + 1); final int stopLine = Math.min(maxLines, lineNbr + lines); for (int line = startLine; line <= lineNbr; ++line) { appendFileLine(cmts, currentFileData, side, line); } cmts.append(c.getMessage().trim()); cmts.append("\n"); for (int line = lineNbr + 1; line < stopLine; ++line) { appendFileLine(cmts, currentFileData, side, line); } } cmts.append("\n\n"); } } finally { if (repo != null) { repo.close(); } } return cmts.toString(); }
Source:
<code>public void testHetVsArbitrary(final File metricsFile, final double tolerance, final int sampleSize) throws Exception { final MetricsFile Metrics = new MetricsFile(); Metrics.read(new FileReader(metricsFile)); final List<Histogram> histograms = Metrics.getAllHistograms(); final Histogram depthHistogram = histograms.get(0); final Histogram qualityHistogram = histograms.get(1); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double resultFromTS = TheoreticalSensitivity.theoreticalSensitivity(depthDistribution, qualityDistribution, sampleSize, 3, 0.5); final double resultFromTHS = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, 3); Assert.assertEquals(resultFromTHS, resultFromTS, tolerance); <START> } <END></code><technical_language>I unit test a back-of-the-envelope result</technical_language>

Target:
public void testHetVsArbitrary(final File metricsFile, final double tolerance, final int sampleSize) throws Exception { final MetricsFile Metrics = new MetricsFile(); Metrics.read(new FileReader(metricsFile)); final List<Histogram> histograms = Metrics.getAllHistograms(); final Histogram depthHistogram = histograms.get(0); final Histogram qualityHistogram = histograms.get(1); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double resultFromTS = TheoreticalSensitivity.theoreticalSensitivity(depthDistribution, qualityDistribution, sampleSize, 3, 0.5); final double resultFromTHS = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, 3); Assert.assertEquals(resultFromTS, resultFromTHS, tolerance); }
Source:
<code>public IsWidget getFormWidget() { inlineFrame.setWidth("100%"); inlineFrame.setHeight("100%"); inlineFrame.getElement().setPropertyBoolean("webkitallowfullscreen", true); inlineFrame.getElement().setPropertyBoolean("mozallowfullscreen", true); inlineFrame.getElement().setPropertyBoolean("allowfullscreen", true); inlineFrame.getElement().getStyle().setBorderWidth(0, Style.Unit.PX); inlineFrame.getElement().getStyle().setPosition(Position.ABSOLUTE); inlineFrame.getElement().getStyle().setTop(0, Unit.PX); inlineFrame.getElement().getStyle().setLeft(0, Unit.PX); inlineFrame.setUrl(renderingSettings.getUrl()); <START> FlowPanel div = new FlowPanel(); <END> div.getElement().getStyle().setPosition(Position.RELATIVE); div.getElement().getStyle().setOverflow(Overflow.HIDDEN); div.getElement().getStyle().setPaddingTop(40, Unit.PCT); div.add(inlineFrame); return div; }</code><technical_language>suggestion FlowPanel div = GWT.create(FlowPanel.class);</technical_language>

Target:
public IsWidget getFormWidget() { inlineFrame.setWidth("100%"); inlineFrame.setHeight("100%"); inlineFrame.getElement().setPropertyBoolean("webkitallowfullscreen", true); inlineFrame.getElement().setPropertyBoolean("mozallowfullscreen", true); inlineFrame.getElement().setPropertyBoolean("allowfullscreen", true); inlineFrame.getElement().getStyle().setBorderWidth(0, Style.Unit.PX); inlineFrame.getElement().getStyle().setPosition(Position.ABSOLUTE); inlineFrame.getElement().getStyle().setTop(0, Unit.PX); inlineFrame.getElement().getStyle().setLeft(0, Unit.PX); inlineFrame.setUrl(renderingSettings.getUrl()); FlowPanel div = GWT.create(FlowPanel.class); div.getElement().getStyle().setPosition(Position.RELATIVE); div.getElement().getStyle().setOverflow(Overflow.HIDDEN); div.getElement().getStyle().setPaddingTop(40, Unit.PCT); div.add(inlineFrame); return div; }
Source:
<code>public static StudentCurricularPlan getStudentCurricularPlan(Registration registration, CycleType cycleType) { Optional<StudentCurricularPlan> studentCurricularPlan = registration.getStudentCurricularPlansSet().stream() .filter(scp -> scp.getRoot().getCycleCurriculumGroup(cycleType) != null) .max(StudentCurricularPlan.STUDENT_CURRICULAR_PLAN_COMPARATOR_BY_START_DATE); if (!studentCurricularPlan.isPresent()) { return registration.getLastStudentCurricularPlan(); } else { return studentCurricularPlan.get(); <START> } <END> }</code><technical_language>orElse this more clean</technical_language>

Target:
public static StudentCurricularPlan getStudentCurricularPlan(Registration registration, CycleType cycleType) { Optional<StudentCurricularPlan> studentCurricularPlan = registration.getStudentCurricularPlansSet().stream() .filter(scp -> scp.getRoot().getCycleCurriculumGroup(cycleType) != null) .max(StudentCurricularPlan.STUDENT_CURRICULAR_PLAN_COMPARATOR_BY_START_DATE); return studentCurricularPlan.orElse(registration.getLastStudentCurricularPlan()); }
Source:
<code><START> void mavenResourcesCanBeLoaded() { <END> MavenBuild build = new MavenBuild(); List<String> includes = Arrays.asList("** *.properties"); build.resource("src/main/resources", (resource) -> { resource.include(includes); resource.targetPath("targetPath"); resource.filtering(false); resource.excludes(excludes); }); Resource resource = build.getResources().get(0); assertThat(resource.getIncludes().get(0)).isEqualTo("** *.properties"); assertThat(resource.isFiltering()).isFalse(); assertThat(resource.getTargetPath()).isEqualTo("targetPath"); assertThat(resource.getDirectory()).isEqualTo("src/main/resources"); }</code><technical_language>test is enough I afraid, other tests in this class for inspiration</technical_language>

Target:
void mavenResourcesCanBeLoaded() { MavenBuild build = new MavenBuild(); build.resource("src/main/resources", (resource) -> { resource.include("** *.properties"); }); Resource resource = build.getResources().get(0); assertThat(resource.getIncludes().get(0)).isEqualTo("** *.properties"); assertThat(resource.isFiltering()).isTrue(); assertThat(resource.getTargetPath()).isEqualTo("targetPath"); assertThat(resource.getDirectory()).isEqualTo("src/main/resources"); }
Source:
<code>public Map<TargetEnvironment, P2ResolutionResult> resolveTargetDependencies(TargetPlatform targetPlatform, ReactorProject project) { setContext(targetPlatform, project); if (project != null && PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(project.getPackaging())) { addDependenciesForTests(); } Map<TargetEnvironment, P2ResolutionResult> results = new LinkedHashMap<>(); usedTargetPlatformUnits = new LinkedHashSet<>(); Set<?> metadata = project != null ? project.getDependencyMetadata(true) : Collections.emptySet(); <START> targetLoop: for (TargetEnvironment environment : environments) { <END> for (Object meta : metadata) { if (meta instanceof IInstallableUnit) { IMatchExpression<IInstallableUnit> filter = ((IInstallableUnit) meta).getFilter(); if (filter != null && !filter.isMatch(InstallableUnit.contextIU(environment.toFilterProperties()))) { logger.debug(MessageFormat.format("{0}: {1}", filter, Arrays.toString(filter.getParameters()))); logger.info(MessageFormat.format( "Project {0}:{1}:{2} does not match environment {3} skipp dependecy resolution", project.getGroupId(), project.getArtifactId(), project.getVersion(), environment.toFilterExpression())); continue targetLoop; } } } results.put(environment, resolveDependencies(project, new ProjectorResolutionStrategy(logger), environment)); } context.reportUsedLocalIUs(usedTargetPlatformUnits); usedTargetPlatformUnits = null; return results; }</code><technical_language>prefer avoiding gotos in Eclipse projects code in general. Please rework this extract a method</technical_language>

Target:
public Map<TargetEnvironment, P2ResolutionResult> resolveTargetDependencies(TargetPlatform targetPlatform, ReactorProject project) { setContext(targetPlatform, project); if (project != null && PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(project.getPackaging())) { addDependenciesForTests(); } Map<TargetEnvironment, P2ResolutionResult> results = new LinkedHashMap<>(); usedTargetPlatformUnits = new LinkedHashSet<>(); Set<?> metadata = project != null ? project.getDependencyMetadata(true) : Collections.emptySet(); for (TargetEnvironment environment : environments) { if (isMatchingEnv(metadata, environment)) { results.put(environment, resolveDependencies(project, new ProjectorResolutionStrategy(logger), environment)); } else { logger.info(MessageFormat.format( "Project {0}:{1}:{2} does not match environment {3} skipp dependecy resolution", project.getGroupId(), project.getArtifactId(), project.getVersion(), environment.toFilterExpression())); } } context.reportUsedLocalIUs(usedTargetPlatformUnits); usedTargetPlatformUnits = null; return results; }
Source:
<code>private static String getUrl(final String urlBase, final String filter, final int page, final int perPage, final String orderBy, final OrderDirection direction, final Map<String, Object> extraParams){ final Map<String, String> params = new HashMap<>(); if (UtilMethods.isSet(filter)){ params.put(FILTER, String.valueOf(filter)); } params.put(PER_PAGE, String.valueOf(perPage)); if (page != -1){ params.put(PAGE, String.valueOf(page)); <START> }else{ <END> params.put(PAGE, "pageValue"); } if (UtilMethods.isSet(direction)) { params.put(DIRECTION, direction.toString()); } if (UtilMethods.isSet(orderBy)) { params.put(ORDER_BY, orderBy); } if (extraParams != null) { for (final Map.Entry<String, Object> extraParamsEntry : extraParams.entrySet()) { final Object value = extraParamsEntry.getValue(); if (value != null) { params.put(extraParamsEntry.getKey(), value.toString()); } } } final StringBuilder buffer = new StringBuilder(urlBase); boolean firstParam = true; for (final Map.Entry<String, String> paramsEntry : params.entrySet()) { if (firstParam){ buffer.append('?'); firstParam = false; }else{ buffer.append('&'); } try { final String encode = URLEncoder.encode(paramsEntry.getValue(), "UTF-8"); buffer.append(paramsEntry.getKey()) .append('=') .append(encode); } catch (UnsupportedEncodingException e) { continue; } } return buffer.toString(); }</code><technical_language>params.put (PAGE, (-1 != page)?String.valueOf(page):"pageValue"); In addition pageValue a constant</technical_language>

Target:
private static String getUrl(final String urlBase, final String filter, final int page, final int perPage, final String orderBy, final OrderDirection direction, final Map<String, Object> extraParams){ final Map<String, String> params = new HashMap<>(); if (UtilMethods.isSet(filter)){ params.put(FILTER, String.valueOf(filter)); } params.put(PER_PAGE, String.valueOf(perPage)); params.put (PAGE, (-1 != page) ? String.valueOf(page) : PAGE_VALUE_TEMPLATE); if (UtilMethods.isSet(direction)) { params.put(DIRECTION, direction.toString()); } if (UtilMethods.isSet(orderBy)) { params.put(ORDER_BY, orderBy); } if (extraParams != null) { for (final Map.Entry<String, Object> extraParamsEntry : extraParams.entrySet()) { final Object value = extraParamsEntry.getValue(); if (value != null) { params.put(extraParamsEntry.getKey(), value.toString()); } } } final StringBuilder buffer = new StringBuilder(urlBase); boolean firstParam = true; for (final Map.Entry<String, String> paramsEntry : params.entrySet()) { if (firstParam){ buffer.append('?'); firstParam = false; }else{ buffer.append('&'); } try { final String encode = URLEncoder.encode(paramsEntry.getValue(), "UTF-8"); buffer.append(paramsEntry.getKey()) .append('=') .append(encode); } catch (UnsupportedEncodingException e) { continue; } } return buffer.toString(); }
Source:
<code>public static Collection<Object[]> data() throws Exception { final Collection<DatabaseConfiguration> configurations = DatabaseTestUtil.loadConfigurations(); final Collection<String> schemaPolicies = Arrays.asList( "drop-create", "create-drop", "create", "none" ); final ArrayList<Object[]> data = new ArrayList<>(); <START> for (DatabaseConfiguration configuration : configurations) { <END> for (String schemaPolicy : schemaPolicies) { data.add(new Object[]{configuration, schemaPolicy}); } } return data; }</code><technical_language>Missing finals lines</technical_language>

Target:
public static Collection<Object[]> data() throws Exception { final Collection<DatabaseConfiguration> configurations = DatabaseTestUtil.loadConfigurations(); final Collection<String> schemaPolicies = Arrays.asList( "drop-create", "create-drop", "create", "none" ); final ArrayList<Object[]> data = new ArrayList<>(); for (final DatabaseConfiguration configuration : configurations) { for (final String schemaPolicy : schemaPolicies) { data.add(new Object[]{configuration, schemaPolicy}); } } return data; }
Source:
<code>private Path useBundledMaven() { Path mavenHome = getConfigDirectory(); if (Files.exists(mavenHome)) { log.info("Maven already extracted"); return mavenHome.resolve("apache-maven-3.3.9"); } log.info("Maven bundle not previously extracted, extracting..."); try { InputStream data = getClass().getResourceAsStream("apache-maven-3.3.9.zip"); Preconditions.checkNotNull(data, "Couldn't load bundled maven from tmc-langs-java.jar."); <START> Path tmpFile = File.createTempFile("tmc-maven", "zip").toPath(); <END> Files.copy(data, tmpFile, StandardCopyOption.REPLACE_EXISTING); Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP); archiver.extract(tmpFile.toFile(), mavenHome.toFile()); return mavenHome.resolve("apache-maven-3.3.9"); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>reason Files.createTempFile(...) instead: returns Path permissions</technical_language>

Target:
private Path useBundledMaven() { Path mavenHome = getConfigDirectory(); if (Files.exists(mavenHome)) { log.info("Maven already extracted"); return mavenHome.resolve("apache-maven-3.3.9"); } log.info("Maven bundle not previously extracted, extracting..."); try { InputStream data = getClass().getResourceAsStream("apache-maven-3.3.9.zip"); Preconditions.checkNotNull( data, "Couldn't load bundled maven from tmc-langs-java.jar."); Path tmpFile = Files.createTempFile("tmc-maven", "zip"); Files.copy(data, tmpFile, StandardCopyOption.REPLACE_EXISTING); Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP); archiver.extract(tmpFile.toFile(), mavenHome.toFile()); try { Files.deleteIfExists(tmpFile); } catch (IOException e) { log.warn("Deleting tmp apache-maven.zip failed", e); } return mavenHome.resolve("apache-maven-3.3.9"); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public void download(@Observes MethodExecuted event) { <START> if (isDownloadType(event.getControllerMethod().getMethod().getReturnType())) { <END> logger.debug("Sending a file to the client"); Object result = event.getMethodInfo().getResult(); if (result == null && this.result.used()) return; checkNotNull(result, "You've just returned a Null Download. Consider redirecting to another page/logic"); try (OutputStream output = response.getOutputStream()) { Download download = resolveDownload(result); download.write(response); output.flush(); } catch (IOException e) { throw new RuntimeException(e); } } }</code><technical_language>like: java Download download = resolveDownload(result); if (download != null) { //.... } isDownloadType is needed</technical_language>

Target:
public void download(@Observes MethodExecuted event) throws IOException { Object methodResult = event.getMethodInfo().getResult(); Download download = resolveDownload(methodResult); if (download != null) { logger.debug("Sending a file to the client"); if (this.result.used()) return; this.result.use(DownloadView.class).of(download); } }
Source:
<code>private FeedbackResponseCommentRow buildFeedbackResponseCommentAddForm(FeedbackQuestionAttributes question, FeedbackResponseAttributes response, Map<FeedbackParticipantType, Boolean> responseVisibilityMap, String giverName, String recipientName) { FeedbackResponseCommentAttributes frca = new FeedbackResponseCommentAttributes(question.courseId, question.feedbackSessionName, question.getFeedbackQuestionId(), response.getId()); FeedbackParticipantType[] relevantTypes = { FeedbackParticipantType.GIVER, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.RECEIVER_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.INSTRUCTORS }; frca.showCommentTo = new ArrayList<>(); frca.showGiverNameTo = new ArrayList<>(); for (FeedbackParticipantType type : relevantTypes) { if (isResponseCommentVisibleTo(question, type)) { frca.showCommentTo.add(type); } if (isResponseCommentGiverNameVisibleTo(question, type)) { frca.showGiverNameTo.add(type); } } return new FeedbackResponseCommentRow(frca, giverName, recipientName, getResponseCommentVisibilityString(question), getResponseCommentGiverNameVisibilityString(question), responseVisibilityMap, <START> bundle.feedbackSession.getTimeZone()); <END> }</code><technical_language>bundle.getTimezone()</technical_language>

Target:
private FeedbackResponseCommentRow buildFeedbackResponseCommentAddForm(FeedbackQuestionAttributes question, FeedbackResponseAttributes response, Map<FeedbackParticipantType, Boolean> responseVisibilityMap, String giverName, String recipientName) { FeedbackResponseCommentAttributes frca = new FeedbackResponseCommentAttributes(question.courseId, question.feedbackSessionName, question.getFeedbackQuestionId(), response.getId()); FeedbackParticipantType[] relevantTypes = { FeedbackParticipantType.GIVER, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.RECEIVER_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.INSTRUCTORS }; frca.showCommentTo = new ArrayList<>(); frca.showGiverNameTo = new ArrayList<>(); for (FeedbackParticipantType type : relevantTypes) { if (isResponseCommentVisibleTo(question, type)) { frca.showCommentTo.add(type); } if (isResponseCommentGiverNameVisibleTo(question, type)) { frca.showGiverNameTo.add(type); } } return new FeedbackResponseCommentRow(frca, giverName, recipientName, getResponseCommentVisibilityString(question), getResponseCommentGiverNameVisibilityString(question), responseVisibilityMap, bundle.getTimeZone()); }
Source:
<code>public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); if (client.exists(Paths.statusDeploymentGroupHosts(name)) != null) { client.delete(Paths.statusDeploymentGroupHosts(name)); } if (client.exists(Paths.statusDeploymentGroup(name)) != null) { client.delete(Paths.statusDeploymentGroup(name)); } <START> client.delete(Paths.configDeploymentGroup(name)); <END> } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }</code><technical_language>if issue this path exist (not clear if case), wrap in if (client.exists(path)) block other deletes</technical_language>

Target:
public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); client.transaction( delete(Paths.configDeploymentGroup(name)), delete(Paths.statusDeploymentGroupHosts(name)), delete(Paths.statusDeploymentGroup(name)) ); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }
Source:
<code>public void onEvict( long filePageId, Page page ) { MuninnPage removed = file.evictPage( filePageId ); assert removed == page : "Removed unexpected page when cleaning up translation table for filePageId " + filePageId + ". " + "Evicted " + page + " but removed " + removed + " from the translation table."; <START> file.setHighestEvictedTransactionId( removed.resetLastModifiedTxId() ); <END> }</code><technical_language>I do this evictPage, is gap "highest evicted" is be</technical_language>

Target:
public void onEvict( long filePageId, Page page ) { MuninnPage removed = file.evictPage( filePageId ); assert removed == page : "Removed unexpected page when cleaning up translation table for filePageId " + filePageId + ". " + "Evicted " + page + " but removed " + removed + " from the translation table."; }
Source:
<code>protected void executeVDSCommand() { if (_vdsManager != null) { try { <START> _vdsManager.getLockObj().lock(); <END> executeVdsIdCommand(); } finally { _vdsManager.getLockObj().unlock(); } } else { executeVdsIdCommand(); } }</code><technical_language>change this</technical_language>

Target:
protected void executeVDSCommand() { if (_vdsManager != null) { synchronized (_vdsManager.getLockObj()) { executeVdsIdCommand(); } } else { executeVdsIdCommand(); } }
Source:
<code>protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength) { <START> this(uri, version, subprotocol, customHeaders, maxFramePayloadLength,-1); <END> }</code><technical_language>nit: add a whitespace ,</technical_language>

Target:
protected WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol, HttpHeaders customHeaders, int maxFramePayloadLength) { this(uri, version, subprotocol, customHeaders, maxFramePayloadLength, DEFAULT_FORCE_CLOSE_TIMEOUT_MILLIS); }
Source:
<code>public void requestPasswordReset_shouldCreateUserActivationKeyGivenUsername() throws Exception { <START> User u = new User(); <END> u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); assertNull(dao.getLoginCredential(createdUser).getActivationKey()); assertEquals(createdUser, userService.setUserActivationKey(createdUser)); handle(newPostRequest(RESET_PASSWORD_URI, "{\"usernameOrEmail\":\"" + "bwolfe" + "\"}")); assertNotNull(dao.getLoginCredential(createdUser).getActivationKey()); }</code><technical_language>existing user</technical_language>

Target:
public void requestPasswordReset_shouldCreateUserActivationKeyGivenUsername() throws Exception { User user = userService.getUserByUuid("c98a1558-e131-11de-babe-001e378eb67e"); assertNull(dao.getLoginCredential(user).getActivationKey()); handle(newPostRequest(RESET_PASSWORD_URI, "{\"usernameOrEmail\":\"" + user.getUsername() + "\"}")); assertNotNull(dao.getLoginCredential(user).getActivationKey()); }
Source:
<code><START> protected IWorkbenchPage getPartPage(ExecutionEvent event) { <END> IWorkbenchPart part = (IWorkbenchPart) ((IEvaluationContext) event .getApplicationContext()).getRoot().getVariable("activePart"); return part.getSite().getPage(); }</code><technical_language>Matthias, HandlerUtil.getActivePart(event); instead. Note null returned swap getActivePartChecked(ExecutionEvent) instead</technical_language>

Target:
protected IWorkbenchPage getPartPage(ExecutionEvent event) throws ExecutionException { return HandlerUtil.getActivePartChecked(event).getSite().getPage(); }
Source:
<code><START> void flush() throws IOException { <END> out.flush(); }</code><technical_language>Call super.flush() trigger validation check for Writing state</technical_language>

Target:
void flush() throws IOException { super.flush(); out.flush(); }
Source:
<code>public LocalRecipeDaoImpl(LocalStorageFactory storageFactory) throws IOException { Map<Class<?>, Object> adapters = new HashMap<>(); adapters.put(Permissions.class, new PermissionsDeserializer()); adapters.put(Group.class, new GroupDeserializer()); <START> this.recipeStorage = storageFactory.create("recipes.json", adapters); <END> this.recipes = new HashMap<>(); lock = new ReentrantReadWriteLock(); }</code><technical_language><LINK_0>,%20V)</technical_language>

Target:
public LocalRecipeDaoImpl(LocalStorageFactory storageFactory) throws IOException { Map<Class<?>, Object> adapters = ImmutableMap.of(Permissions.class, new PermissionsSerializer(), Group.class, new GroupSerializer()); this.recipeStorage = storageFactory.create("recipes.json", adapters); this.recipes = new HashMap<>(); lock = new ReentrantReadWriteLock(); }
Source:
<code>private static URI stripDefaultPort(URI uri) { if ((uri.getPort() == 80 && "http".equalsIgnoreCase(uri.getScheme())) || (uri.getPort() == 443 && "https".equalsIgnoreCase(uri.getScheme()))) { try { <START> uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), -1, uri.getPath(), uri.getQuery(), uri.getFragment()); <END> } catch (URISyntaxException e) { throw new WebApplicationException(e); } } return uri; }</code><technical_language>If passed in UriInfo object here, create new URI uriInfo.getBaseUriBuilder().port(-1).build() save copying around</technical_language>

Target:
private static URI stripDefaultPort(URI uri) { if ((uri.getPort() == HTTP_PORT && HTTP_SCHEME.equalsIgnoreCase(uri.getScheme())) || (uri.getPort() == HTTPS_PORT && HTTPS_SCHEME.equalsIgnoreCase(uri.getScheme()))) { try { uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), -1, uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { throw new WebApplicationException(e); } } return uri; }
Source:
<code>public CompletableFuture<Long> readLastAddConfirmedAsync() { <START> return CompletableFuture.completedFuture((long) (entries.size() - 1)); <END> }</code><technical_language>return CompletableFuture.completedFuture(getLastAddConfirmed())</technical_language>

Target:
public CompletableFuture<Long> readLastAddConfirmedAsync() { return CompletableFuture.completedFuture(getLastAddConfirmed()); }