auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SuccessfulResponse addResponse(Address sender, Response response) { if (response.isSuccessful()) { return (SuccessfulResponse) response; } if (response instanceof ExceptionResponse) { throw ResponseCollectors.wrapRemoteException(sender, ((ExceptionResponse) response).getException()); } if (response instanceof UnsureResponse) { <START> hasUnsureResponse = true; <END> return null; } else if (response instanceof CacheNotFoundResponse) { hasSuspectResponse = true; return null; } throw ResponseCollectors.unexpectedResponse(response); }</code><technical_language>this field is read</technical_language>

Target:
public SuccessfulResponse addResponse(Address sender, Response response) { if (response.isSuccessful()) { return (SuccessfulResponse) response; } if (response instanceof ExceptionResponse) { throw ResponseCollectors.wrapRemoteException(sender, ((ExceptionResponse) response).getException()); } if (response instanceof UnsureResponse) { return null; } else if (response instanceof CacheNotFoundResponse) { hasSuspectResponse = true; return null; } throw ResponseCollectors.unexpectedResponse(response); }
Source:
<code><START> public void onRTPSessionDestroy(RTPSession rtpSession) <END> { try{ String entryId = Utils.getEntryIdFromRTPSession(rtpSession); logger.info("Entry removed [" + entryId + "]"); KalturaEntryDataPersistence.entriesMapCleanUp(); } catch (Exception e){ logger.info("Error" + e.getMessage()); } }</code><technical_language>before. Spacing functions</technical_language>

Target:
public void onRTPSessionDestroy(RTPSession rtpSession) { try{ logger.debug("onRTPSessionDestroy - [" + rtpSession.getSessionId() + "]"); String entryId = Utils.getEntryIdFromRTPSession(rtpSession); logger.info("Entry removed [" + entryId + "]"); KalturaEntryDataPersistence.entriesMapCleanUp(); } catch (Exception e){ logger.info("Error" + e.getMessage()); } }
Source:
<code>public void testDiscardAfterSkipPast() throws Exception { try { m_pbd = PersistentBinaryDeque.builder(TEST_NONCE, TEST_DIR, logger).compression(true) .requiresId(true) .initialExtraHeader(m_metadata, SERIALIZER).build(); long seqNo = 1; int numSegments = 3; for (int i=0; i<numSegments; i++) { if (i>0) { m_pbd.updateExtraHeader(null); } for (int j=0; j<3; j++) { long startSeqNo = seqNo + i*3*10 + j*10; m_pbd.offer(DBBPool.wrapBB(getFilledSmallBuffer(0)), startSeqNo, startSeqNo + 9); } } long lastSeqNo = numSegments*3*10; assertEquals(numSegments, getSortedDirectoryListing().size()); BinaryDequeReader<ExtraHeaderMetadata> reader = m_pbd.openForRead("testreader"); BBContainer cont = reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); reader.skipPast(lastSeqNo); assertEquals(numSegments, getSortedDirectoryListing().size()); cont.discard(); assertEquals(1, getSortedDirectoryListing().size()); } catch(Throwable t) { <START> t.printStackTrace(); <END> } }</code><technical_language>remove try catch junit catch Throwable error out test</technical_language>

Target:
public void testDiscardAfterSkipPast() throws Exception { m_pbd = PersistentBinaryDeque.builder(TEST_NONCE, TEST_DIR, logger).compression(true) .requiresId(true) .initialExtraHeader(m_metadata, SERIALIZER).build(); long seqNo = 1; int numSegments = 3; for (int i=0; i<numSegments; i++) { if (i>0) { m_pbd.updateExtraHeader(null); } for (int j=0; j<3; j++) { long startSeqNo = seqNo + i*3*10 + j*10; m_pbd.offer(DBBPool.wrapBB(getFilledSmallBuffer(0)), startSeqNo, startSeqNo + 9); } } long lastSeqNo = numSegments*3*10; assertEquals(numSegments, getSortedDirectoryListing().size()); BinaryDequeReader<ExtraHeaderMetadata> reader = m_pbd.openForRead("testreader"); BBContainer cont = reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); reader.skipPast(lastSeqNo); assertEquals(numSegments, getSortedDirectoryListing().size()); cont.discard(); assertEquals(1, getSortedDirectoryListing().size()); }
Source:
<code>private void complete() { if (isRequestStarted()) { final boolean hasCommands = !commands.isEmpty(); if (hasCommands && roolback) { LOGGER.log(Level.FINEST, "Performing rollback for commands in current requrest."); final AbstractCanvasHandler canvasHandler = getCurrentSession().getCanvasHandler(); commands.forEach(c -> c.undo(canvasHandler)); } else if (hasCommands) { LOGGER.log(Level.FINEST, "Adding commands for current request into registry [size=" + commands.size() + "]"); getRegistry().register(new CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation>() .addCommands(commands.stream().collect(Collectors.toList())) .build()); <START> commandRegisteredEvent.fire(new CommandRegisteredEvent()); <END> } LOGGER.log(Level.FINEST, "Current client request completed."); } else { LOGGER.log(Level.WARNING, "Current client request has not been started."); } clear(); }</code><technical_language>IMO more sense firing CommandRegisteredEvent registry component (getRegistry().register), instead of this RequestCommandMananger class. other component is registry API benefit this, event fired internally</technical_language>

Target:
private void complete() { if (isRequestStarted()) { final boolean hasCommands = !commands.isEmpty(); if (hasCommands && roolback) { LOGGER.log(Level.FINEST, "Performing rollback for commands in current requrest."); final AbstractCanvasHandler canvasHandler = getCurrentSession().getCanvasHandler(); commands.forEach(c -> c.undo(canvasHandler)); } else if (hasCommands) { LOGGER.log(Level.FINEST, "Adding commands for current request into registry [size=" + commands.size() + "]"); getRegistry().register(new CompositeCommand.Builder<AbstractCanvasHandler, CanvasViolation>() .addCommands(new ArrayList<>(commands)) .build()); } LOGGER.log(Level.FINEST, "Current client request completed."); } else { LOGGER.log(Level.WARNING, "Current client request has not been started."); } clear(); }
Source:
<code>public void testGetMultipleNull() { InfinispanCommunicationDetailsCache cdc = createCache(); List<CommunicationDetails> id = cdc.getById(null, null); <START> Assert.assertTrue(id.isEmpty()); <END> }</code><technical_language>This fail, get this line</technical_language>

Target:
public void testGetMultipleNull() { cdc.getById(null, null); }
Source:
<code>public int hashCode() { <START> int hash = 5; <END> hash = 97 * hash + (this.event_initiator != null ? this.event_initiator.hashCode() : 0); hash = 97 * hash + (this.event_name != null ? this.event_name.hashCode() : 0); hash = 97 * hash + (int) (this.user_id ^ (this.user_id >>> 32)); hash = 97 * hash + (this.session_id != null ? this.session_id.hashCode() : 0); hash = 97 * hash + (this.ip != null ? this.ip.hashCode() : 0); hash = 97 * hash + (int) (this.timestamp ^ (this.timestamp >>> 32)); return hash; }</code><technical_language>Minor: delegate Objects.hashCode simplify these. Objects.equals for above. (The guava support java6)</technical_language>

Target:
public int hashCode() { return Objects.hashCode(getEvent_initiator(), getEvent_name(), getIp(), getSession_id(), getTimestamp(), getUser_id()); }
Source:
<code>public boolean isForkTask() { <START> if (taskType.equals(SCRIPT_TASK)) { <END> return false; } else if (taskType.equals(FORKED_SCRIPT_TASK)) { return true; } else { throw new IllegalStateException("Unexpected stored task type: " + taskType); } }</code><technical_language>if i totally String is null, i do: suggestion if (SCRIPT_TASK.equals(taskType)) {</technical_language>

Target:
public boolean isForkTask() { if (SCRIPT_TASK.equals(taskType)) { return false; } else if (FORKED_SCRIPT_TASK.equals(taskType)) { return true; } else { throw new IllegalStateException("Unexpected stored task type: " + taskType); } }
Source:
<code>public UpdateCanvasControlPointPositionCommand(final Edge edge, final ControlPoint[] controlPoints) { this.edge = edge; this.controlPoints = controlPoints; oldControlPoints = Stream.of(getControlPoints(edge)) .map(ControlPoint::copy) .toArray(ControlPoint[]::new); <START> ; <END> }</code><technical_language>unnecessary **;**</technical_language>

Target:
public UpdateCanvasControlPointPositionCommand(final Edge edge, final ControlPoint[] controlPoints) { this.edge = edge; this.controlPoints = controlPoints; oldControlPoints = Stream.of(getControlPoints(edge)) .map(ControlPoint::copy) .toArray(ControlPoint[]::new); }
Source:
<code>int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { boolean fixWrap = resize && labelHandle != 0 && (style & SWT.WRAP) != 0; if (fixWrap) OS.gtk_widget_set_size_request (labelHandle, -1, -1); int result = super.setBounds (x, y, width, height, move, resize); if (fixWrap) { GtkAllocation allocation = new GtkAllocation(); OS.gtk_widget_get_allocation (handle, allocation); int labelWidth = allocation.width; int labelHeight = allocation.height; OS.gtk_widget_set_size_request (labelHandle, labelWidth, labelHeight); GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_get_allocation(labelHandle, allocation); allocation.width = labelWidth; allocation.height = labelHeight; <START> gtk_widget_get_preferred_size <END> (labelHandle, requisition); OS.gtk_widget_size_allocate (labelHandle, allocation); } return result; }</code><technical_language>moved puropse</technical_language>

Target:
int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { boolean fixWrap = resize && labelHandle != 0 && (style & SWT.WRAP) != 0; if (fixWrap) OS.gtk_widget_set_size_request (labelHandle, -1, -1); int result = super.setBounds (x, y, width, height, move, resize); if (fixWrap) { GtkAllocation allocation = new GtkAllocation(); OS.gtk_widget_get_allocation (handle, allocation); int labelWidth = allocation.width; int labelHeight = allocation.height; OS.gtk_widget_set_size_request (labelHandle, labelWidth, labelHeight); GtkRequisition requisition = new GtkRequisition (); gtk_widget_get_preferred_size (labelHandle, requisition); OS.gtk_widget_get_allocation(labelHandle, allocation); allocation.width = labelWidth; allocation.height = labelHeight; OS.gtk_widget_size_allocate (labelHandle, allocation); } return result; }
Source:
<code><START> public ArrayInterface setLong(int index, long value) { <END> return setObject(index, value); }</code><technical_language>I return Array here</technical_language>

Target:
public Array setLong(int index, long value) { return setObject(index, value); }
Source:
<code>private String encrypt(byte[] plainTextBytes, String keyStorePath, String keyStorePassword, String alias, String keyStoreType, String algorithm) throws FunctionCallException { if (plainTextBytes == null) { throw new FunctionCallException("Plaintext can't be null."); } try { Cipher cipher = Cipher.getInstance(algorithm); KeyStore keyStore = KeyStoreManager.getKeyStore(keyStorePath, keyStorePassword, keyStoreType); Certificate certificate = KeyStoreManager.getCertificateFromStore(keyStore, alias); if (log.isDebugEnabled()) { log.debug("Certificate used for encrypting : " + certificate); } cipher.init(Cipher.ENCRYPT_MODE, certificate.getPublicKey()); byte[] cipherText = cipher.doFinal(plainTextBytes); if (log.isDebugEnabled()) { log.debug(String.format("Successfully encrypted data using the algorithm '%s'", algorithm)); } return Base64.getEncoder().encodeToString(cipherText); <START> <END> } catch (NoSuchAlgorithmException | NoSuchPaddingException | KeyStoreException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) { throw new FunctionCallException("An error occurred while encrypting data.", e); } }</code><technical_language>remove this empty line</technical_language>

Target:
private String encrypt(byte[] plainTextBytes, String keyStorePath, String keyStorePassword, String alias, String keyStoreType, String algorithm) throws FunctionCallException { if (plainTextBytes == null) { throw new FunctionCallException("Plaintext can't be null."); } try { Cipher cipher = getCipherInstance(algorithm); KeyStore keyStore = KeyStoreManager.getKeyStore(keyStorePath, keyStorePassword, keyStoreType); Certificate certificate = KeyStoreManager.getCertificateFromStore(keyStore, alias); if (log.isDebugEnabled()) { log.debug("Certificate used for encrypting : " + certificate); } cipher.init(Cipher.ENCRYPT_MODE, certificate.getPublicKey()); byte[] cipherText = cipher.doFinal(plainTextBytes); if (log.isDebugEnabled()) { log.debug(String.format("Successfully encrypted data using the algorithm '%s'", algorithm)); } return Base64.getEncoder().encodeToString(cipherText); } catch (NoSuchAlgorithmException | NoSuchPaddingException | KeyStoreException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException e) { throw new FunctionCallException("An error occurred while encrypting data.", e); } }
Source:
<code>private void testOldCourseTable(CourseDetailsBundle oldCourse, CourseTable courseTable) { assertEquals(oldCourse.feedbackSessions.size(), courseTable.getRows().size()); List<HomeFeedbackSessionRow> sessions = courseTable.getRows(); HomeFeedbackSessionRow publishedRow = sessions.get(0); HomeFeedbackSessionRow closedRow = sessions.get(1); HomeFeedbackSessionRow submittedClosedRow = sessions.get(2); int accumlativeOffset = courses.get(0).feedbackSessions.size(); int index = 0 + accumlativeOffset; testFeedbackSession(index++, publishedRow, publishedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PENDING + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PUBLISHED, "Closed", "Yes"); testFeedbackSession(index++, closedRow, closedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PENDING + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED, "Closed", "No"); testFeedbackSession(index++, submittedClosedRow, submittedClosedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_SUBMITTED + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED, <START> "Closed", "No"); <END> }</code><technical_language>"Yes" "No"s a carryover previous implementation</technical_language>

Target:
private void testOldCourseTable(CourseDetailsBundle oldCourse, CourseTable courseTable) { assertEquals(oldCourse.feedbackSessions.size(), courseTable.getRows().size()); List<HomeFeedbackSessionRow> sessions = courseTable.getRows(); HomeFeedbackSessionRow publishedRow = sessions.get(0); HomeFeedbackSessionRow closedRow = sessions.get(1); HomeFeedbackSessionRow submittedClosedRow = sessions.get(2); int accumlativeOffset = courses.get(0).feedbackSessions.size(); int index = 0 + accumlativeOffset; testFeedbackSession(index++, publishedRow, publishedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PENDING + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PUBLISHED, "Closed", "Published"); testFeedbackSession(index++, closedRow, closedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_PENDING + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED, "Closed", "Not Published"); testFeedbackSession(index++, submittedClosedRow, submittedClosedSession, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_SUBMITTED + Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_CLOSED, Const.Tooltips.STUDENT_FEEDBACK_SESSION_STATUS_NOT_PUBLISHED, "Closed", "Not Published"); }
Source:
<code>private String mkKey(Class clazz, String propertyName) { <START> return clazz.getCanonicalName() + "__" + propertyName; <END> }</code><technical_language>also, getCanonicalName return null for anonymous classes: java package foo; public class Foo { interface Bar { void baz(); } public static void main(String[] args) { System.out.println("class name:"+Foo.class.getName()); Bar b = new Bar() { @Override public void baz() { } }; System.out.println("anon class name: "+ b.getClass().getName()); System.out.println("anon class canonicalName: "+b.getClass().getCanonicalName()); } }</technical_language>

Target:
private String mkKey(Class clazz, String propertyName) { return clazz.getName() + "__" + propertyName; }
Source:
<code>private void reportMetrics(DatastreamRecordMetadata metadata, DatastreamTask task, DatastreamProducerRecord record) { synchronized (_sourceToDestinationLatencyMs) { _sourceToDestinationLatencyMs = System.currentTimeMillis() - record.getEventsTimestamp(); if (_sourceToDestinationLatencyMs <= _availabilityThresholdSlaMs) { EVENTS_PRODUCED_WITHIN_SLA.inc(); } else { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), metadata.getTopic(), EVENTS_PRODUCED_OUTSIDE_SLA, 1); _logger.warn( String.format("Event latency of %d for source %s, topic %s, partition %d exceeded SLA of %d millseconds", _sourceToDestinationLatencyMs, task.getDatastreamSource().getConnectionString(), metadata.getTopic(), metadata.getPartition(), _availabilityThresholdSlaMs)); } TOTAL_EVENTS_PRODUCED.inc(); } EVENT_PRODUCE_RATE.mark(record.getEvents().size()); <START> record.getEvents().forEach(e -> EVENT_BYTES_PRODUCE_RATE.mark(e.getKey().length + e.getValue().length)); <END> }</code><technical_language>Is a difference calculating total bytes call mark vs. calling mark event</technical_language>

Target:
private void reportMetrics(DatastreamRecordMetadata metadata, DatastreamTask task, DatastreamProducerRecord record) { _sourceToDestinationLatencyMs = System.currentTimeMillis() - record.getEventsTimestamp(); if (_sourceToDestinationLatencyMs <= _availabilityThresholdSlaMs) { EVENTS_PRODUCED_WITHIN_SLA.inc(); } else { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), metadata.getTopic(), EVENTS_PRODUCED_OUTSIDE_SLA, 1); _logger.warn( String.format("Event latency of %d for source %s, topic %s, partition %d exceeded SLA of %d millseconds", _sourceToDestinationLatencyMs, task.getDatastreamSource().getConnectionString(), metadata.getTopic(), metadata.getPartition(), _availabilityThresholdSlaMs)); } TOTAL_EVENTS_PRODUCED.inc(); EVENT_PRODUCE_RATE.mark(record.getEvents().size()); record.getEvents().forEach(e -> EVENT_BYTES_PRODUCE_RATE.mark(e.getKey().length + e.getValue().length)); }
Source:
<code>public DBUpdatesWrapper getUpdatesSince(long sequenceNumber) throws DataNotFoundException { DBUpdatesWrapper dbUpdatesWrapper = new DBUpdatesWrapper(); try { TransactionLogIterator transactionLogIterator = db.getUpdatesSince(sequenceNumber); boolean flag = true; <START> while (transactionLogIterator.isValid()) { <END> TransactionLogIterator.BatchResult result = transactionLogIterator.getBatch(); long currSequenceNumber = result.sequenceNumber(); if (flag && currSequenceNumber > 1 + sequenceNumber) { throw new DataNotFoundException("Unable to read data from " + "RocksDB wal to get delta updates. It may have already been" + "flushed to SSTs."); } flag = false; if (currSequenceNumber == sequenceNumber) { transactionLogIterator.next(); continue; } WriteBatch writeBatch = result.writeBatch(); byte[] writeBatchData = writeBatch.data(); dbUpdatesWrapper.addWriteBatch(writeBatchData, result.sequenceNumber()); transactionLogIterator.next(); } } catch (RocksDBException e) { LOG.error("Unable to get delta updates since sequenceNumber ", sequenceNumber, e); } return dbUpdatesWrapper; }</code><technical_language>this imply flush sst happen while iterating log</technical_language>

Target:
public DBUpdatesWrapper getUpdatesSince(long sequenceNumber) throws SequenceNumberNotFoundException { DBUpdatesWrapper dbUpdatesWrapper = new DBUpdatesWrapper(); try { TransactionLogIterator transactionLogIterator = db.getUpdatesSince(sequenceNumber); boolean checkValidStartingSeqNumber = true; while (transactionLogIterator.isValid()) { TransactionLogIterator.BatchResult result = transactionLogIterator.getBatch(); long currSequenceNumber = result.sequenceNumber(); if (checkValidStartingSeqNumber && currSequenceNumber > 1 + sequenceNumber) { throw new SequenceNumberNotFoundException("Unable to read data from" + " RocksDB wal to get delta updates. It may have already been" + "flushed to SSTs."); } checkValidStartingSeqNumber = false; if (currSequenceNumber <= sequenceNumber) { transactionLogIterator.next(); continue; } dbUpdatesWrapper.addWriteBatch(result.writeBatch().data(), result.sequenceNumber()); transactionLogIterator.next(); } } catch (RocksDBException e) { LOG.error("Unable to get delta updates since sequenceNumber ", sequenceNumber, e); } return dbUpdatesWrapper; }
Source:
<code><START> private TuningParameterUtils() { <END> }</code><technical_language>space constructor</technical_language>

Target:
public TuningParameterUtils() { httpClient = HttpClients.createDefault(); }
Source:
<code>default Duration getTotalDuration() { <START> return StreamSupport.stream(getDataSources().spliterator(), false) <END> .map(spec -> BaseQuery.initDuration(spec.getQuerySegmentSpec())) .reduce(new Duration(0), Duration::plus); }</code><technical_language>IMO old-style for-each loop is clearer</technical_language>

Target:
default Duration getTotalDuration() { Duration totalDuration = new Duration(0); for (DataSourceWithSegmentSpec spec : getDataSources()) { totalDuration = totalDuration.plus(Queries.getTotalDuration(spec.getQuerySegmentSpec())); } return totalDuration; }
Source:
<code>public void testUnmapDoesntCrashJVM() throws Exception { final File file = temporaryFolder.newFile("some_mmap_file"); try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { final byte[] data = new byte[4096]; Arrays.fill(data, (byte) 0x5A); os.write(data); } <START> final MappedByteBuffer mappedByteBuffer; <END> try (final FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ)) { mappedByteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, 4096); } Assert.assertEquals((byte) 0x5A, mappedByteBuffer.get(0)); ByteBufferUtils.unmap(mappedByteBuffer); ByteBufferUtils.unmap(mappedByteBuffer); }</code><technical_language>mappedByteBuffer = Files.map(file)</technical_language>

Target:
public void testUnmapDoesntCrashJVM() throws Exception { final File file = temporaryFolder.newFile("some_mmap_file"); try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { final byte[] data = new byte[4096]; Arrays.fill(data, (byte) 0x5A); os.write(data); } final MappedByteBuffer mappedByteBuffer = Files.map(file); Assert.assertEquals((byte) 0x5A, mappedByteBuffer.get(0)); ByteBufferUtils.unmap(mappedByteBuffer); ByteBufferUtils.unmap(mappedByteBuffer); }
Source:
<code>private static void updateEnsembleInfo( AsyncCallback.VoidCallback ensembleUpdatedCb, long fragmentStartId, LedgerHandle lh, Map<BookieSocketAddress, BookieSocketAddress> oldBookie2NewBookie) { List<BookieSocketAddress> ensemble = lh.getLedgerMetadata().getEnsembles().get(fragmentStartId); List<BookieSocketAddress> newEnsemble = new ArrayList<>(ensemble); for (Map.Entry<BookieSocketAddress, BookieSocketAddress> entry : oldBookie2NewBookie.entrySet()) { int deadBookieIndex = newEnsemble.indexOf(entry.getKey()); if (deadBookieIndex >= 0) { newEnsemble.set(deadBookieIndex, entry.getValue()); } else { LOG.info("Bookie doesn't exist in ensemble anymore.", entry.getKey(), ensemble); } } List<BookieSocketAddress> immutable = ImmutableList.copyOf(newEnsemble); <START> lh.getLedgerMetadata().updateEnsemble(fragmentStartId, immutable); <END> lh.writeLedgerConfig(new UpdateEnsembleCb(ensembleUpdatedCb, fragmentStartId, lh, oldBookie2NewBookie)); }</code><technical_language>updating internals of LedgerMetadata here? I expected this like: newMetadata = lh.getLedgerMetadata().updateEnsemble(....)</technical_language>

Target:
private static void updateEnsembleInfo( AsyncCallback.VoidCallback ensembleUpdatedCb, long fragmentStartId, LedgerHandle lh, Map<BookieSocketAddress, BookieSocketAddress> oldBookie2NewBookie) { List<BookieSocketAddress> ensemble = lh.getLedgerMetadata().getEnsembles().get(fragmentStartId); List<BookieSocketAddress> newEnsemble = new ArrayList<>(ensemble); for (Map.Entry<BookieSocketAddress, BookieSocketAddress> entry : oldBookie2NewBookie.entrySet()) { int deadBookieIndex = newEnsemble.indexOf(entry.getKey()); if (deadBookieIndex >= 0) { newEnsemble.set(deadBookieIndex, entry.getValue()); } else { LOG.info("Bookie doesn't exist in ensemble anymore.", entry.getKey(), ensemble); } } lh.getLedgerMetadata().updateEnsemble(fragmentStartId, newEnsemble); lh.writeLedgerConfig(new UpdateEnsembleCb(ensembleUpdatedCb, fragmentStartId, lh, oldBookie2NewBookie)); }
Source:
<code>public Iterable<Issue> issues( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtPagination<Issue>( RtSearch.searchRequest( this.entry, "/search/issues", keywords, sort, order ), new RtPagination.Mapping<Issue>() { @Override public Issue map(final JsonObject object) { try { final String[] parts = RtSearch.SLASH.split( new URI(object.getString("url")).getPath() ); return new RtIssue( RtSearch.this.entry, new RtRepo( RtSearch.this.ghub, RtSearch.this.entry, <START> new Coordinates.Simple(parts[2], parts[3]) <END> ), object.getInt("number") ); } catch (final URISyntaxException ex) { throw new IllegalStateException(ex); } } } ); }</code><technical_language>This is necessary, Coordinates.Simple(String) constructor, this work for</technical_language>

Target:
public Iterable<Issue> issues( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtSearchPagination<Issue>( this.request, "issues", keywords, sort, order, new RtPagination.Mapping<Issue, JsonObject>() { @Override public Issue map(final JsonObject object) { try { final String[] parts = RtSearch.SLASH.split( new URI(object.getString("url")).getPath() ); return RtSearch.this.ghub.repos().get( new Coordinates.Simple(parts[2], parts[3]) ).issues().get(object.getInt("number")); } catch (final URISyntaxException ex) { throw new IllegalStateException(ex); } } } ); }
Source:
<code>public Object getParent(Object object, IMergeViewerItemProviderConfiguration configuration) { <START> return ResourceAttachmentChangeMergeViewerItem.class.cast(object).getParent(); <END> }</code><technical_language>Please syntax for casts, is done else in project: return ((ResourceAttachmentChangeMergeViewerItem)object).getParent();</technical_language>

Target:
public Object getParent(Object object, IMergeViewerItemProviderConfiguration configuration) { return ((ResourceAttachmentChangeMergeViewerItem)object).getParent(); }
Source:
<code>public PlanWithProperties visitStatisticsWriterNode(StatisticsWriterNode node, PreferredProperties context) { PlanWithProperties child = planChild(node, PreferredProperties.any()); if ((child.getNode() instanceof ExchangeNode) && ((ExchangeNode) child.getNode()).getType().equals(GATHER)) { return rebaseAndDeriveProperties(node, child); } if (!child.getProperties().isSingleNode() || !child.getProperties().isCoordinatorOnly()) { <START> child = withDerivedProperties( <END> gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }</code><technical_language>!child.getProperties().isCoordinatorOnly() check enough implies single node distribution</technical_language>

Target:
public PlanWithProperties visitStatisticsWriterNode(StatisticsWriterNode node, PreferredProperties context) { PlanWithProperties child = planChild(node, PreferredProperties.any()); if ((child.getNode() instanceof ExchangeNode) && ((ExchangeNode) child.getNode()).getType().equals(GATHER)) { return rebaseAndDeriveProperties(node, child); } if (!child.getProperties().isCoordinatorOnly()) { child = withDerivedProperties( gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }
Source:
<code>public boolean retryRequest(IOException e, int retryCount, HttpContext httpContext) { if (e instanceof InterruptedIOException) { LOGGER.debug("Connection timeout."); } if (e instanceof UnknownHostException) { LOGGER.warn("Solr Client: Unknown host."); } if (e instanceof SSLException) { LOGGER.warn("Solr Client: SSL handshake exception."); } LOGGER.debug("Connection failed", e); try { long waitTime = (long) Math.pow(2, Math.min(retryCount, MAX_RETRY_COUNT)) * 50; if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Solr Client: Connection failed, waiting before retrying.", DurationFormatUtils.formatDurationWords(waitTime, true, true)); } synchronized (this) { wait(waitTime); } } catch (InterruptedException ie) { LOGGER.debug("Exception while waiting.", ie); <START> Thread.currentThread().interrupt(); <END> } return true; }</code><technical_language>Dangerous checking this method is called if is called a loop, continuously get interrupted. figure out properly handle interruptions turn out simply propagating is ok</technical_language>

Target:
public boolean retryRequest(IOException e, int retryCount, HttpContext httpContext) { if (e instanceof InterruptedIOException) { LOGGER.debug("Connection timeout."); } if (e instanceof UnknownHostException) { LOGGER.warn("Solr Client: Unknown host."); } if (e instanceof SSLException) { LOGGER.warn("Solr Client: SSL handshake exception."); } LOGGER.debug("Connection failed", e); try { long waitTime = (long) Math.pow(2, Math.min(retryCount, MAX_RETRY_COUNT)) * 50; if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Solr Client: Connection failed, waiting before retrying.", DurationFormatUtils.formatDurationWords(waitTime, true, true)); } synchronized (this) { wait(waitTime); } } catch (InterruptedException ie) { LOGGER.debug("Exception while waiting.", ie); } return true; }
Source:
<code>public void stateChanged(CuratorFramework client, ConnectionState newState) { <START> if (newState.equals(ConnectionState.RECONNECTED)) { <END> LOG.info("Reconnected to zookeeper, checking if configs are still in sync"); Optional<String> maybeLastRequestForGroup = loadBalancerDatastore.getLastRequestForGroup(configuration.getLoadBalancerConfiguration().getName()); if (!maybeLastRequestForGroup.isPresent() || !maybeLastRequestForGroup.get().equals(mostRecentRequestId.get())) { agentState.set(BaragonAgentState.BOOTSTRAPING); reapplyConfigsWithRetry(); agentState.set(BaragonAgentState.ACCEPTING); } } else if (newState.equals(ConnectionState.SUSPENDED) || newState.equals(ConnectionState.LOST)) { agentState.set(BaragonAgentState.DISCONNECTED); } }</code><technical_language>a huge deal, enums pass-by-value == is (and some people prefer susceptible NPEs)</technical_language>

Target:
public void stateChanged(CuratorFramework client, ConnectionState newState) { switch (newState) { case RECONNECTED: LOG.info("Reconnected to zookeeper, checking if configs are still in sync"); Optional<String> maybeLastRequestForGroup = loadBalancerDatastore.getLastRequestForGroup(configuration.getLoadBalancerConfiguration().getName()); if (!maybeLastRequestForGroup.isPresent() || !maybeLastRequestForGroup.get().equals(mostRecentRequestId.get())) { agentState.set(BaragonAgentState.BOOTSTRAPING); reapplyConfigsWithRetry(); } agentState.set(BaragonAgentState.ACCEPTING); break; case SUSPENDED: case LOST: agentState.set(BaragonAgentState.DISCONNECTED); break; case CONNECTED: agentState.set(BaragonAgentState.ACCEPTING); break; default: break; } }
Source:
<code>public double getProgressionFactor() { <START> final double extent = this.max - (double) this.min; <END> if (extent == 0.) { return 0.; } return (this.current - this.min) / extent; }</code><technical_language>here, extent integer</technical_language>

Target:
public double getProgressionFactor() { final int extent = this.max - this.min; if (extent == 0.) { return 0.; } return (this.current - this.min) / extent; }
Source:
<code>public Iterable<InstanceType> listHardwareProfiles() { final ImmutableSet.Builder<String> instanceTypeIds = ImmutableSet.builder(); final List<String> availableLocationNames = newArrayList( transform(listLocations(), new Function<Region, String>() { @Override public String apply(Region location) { return location.id(); } })); for (String regionId : availableLocationNames) { instanceTypeIds.addAll(getInstanceTypeId(regionId)); } List<InstanceType> instanceTypes = FluentIterable.from(api.instanceApi().listTypes()) .filter(new Predicate<InstanceType>() { @Override public boolean apply(@Nullable InstanceType input) { <START> return contains(instanceTypeIds.build(), input.instanceTypeId()); <END> } }).toList(); return instanceTypes; }</code><technical_language>call build in iteration. Build list outside</technical_language>

Target:
public Iterable<InstanceType> listHardwareProfiles() { final ImmutableSet.Builder<String> instanceTypeIdsBuilder = ImmutableSet.builder(); for (String regionId : getAvailableLocationNames()) { instanceTypeIdsBuilder.addAll(getInstanceTypeIds(regionId)); } final Set<String> ids = instanceTypeIdsBuilder.build(); List<InstanceType> instanceTypes = FluentIterable.from(api.instanceApi().listTypes()) .filter(new Predicate<InstanceType>() { @Override public boolean apply(@Nullable InstanceType input) { return contains(ids, input.id()); } }).toList(); return instanceTypes; }
Source:
<code>public String serializeRaw(Object object) { <START> final ClientLogger logger = new ClientLogger(JacksonAdapter.class); <END> if (object == null) { return null; } try { return serialize(object, SerializerEncoding.JSON).replaceAll("^\"*", "").replaceAll("\"*$", ""); } catch (IOException ex) { logger.warning("Failed to serialize to JSON.", object.getClass()); return null; } }</code><technical_language>creating a new instead of a private final in class</technical_language>

Target:
public String serializeRaw(Object object) { if (object == null) { return null; } try { return serialize(object, SerializerEncoding.JSON).replaceAll("^\"*", "").replaceAll("\"*$", ""); } catch (IOException ex) { logger.warning("Failed to serialize to JSON.", object.getClass(), ex); return null; } }
Source:
<code>public SolenoidSet(String name, SolenoidSubsystem system, SolenoidState state, BooleanSupplier... booleanSuppliers) { this.system = system; this.state = state; this.booleanSuppliers = booleanSuppliers; <START> requirements = Set.of((Subsystem) system); <END> }</code><technical_language>replace addRequirements(system)</technical_language>

Target:
public SolenoidSet(String name, SolenoidSubsystem system, SolenoidState state, BooleanSupplier... booleanSuppliers) { super(); setName(name); this.system = system; this.state = state; this.booleanSuppliers = booleanSuppliers; addRequirements(system); }
Source:
<code><START> String getAzureContainerName(String partitionPath) { <END> String rawContainerName = clusterName + SEPARATOR + partitionPath; return rawContainerName.toLowerCase(); }</code><technical_language>minor: a private method</technical_language>

Target:
private String getAzureContainerName(String partitionPath) { String rawContainerName = clusterName + SEPARATOR + partitionPath; return rawContainerName.toLowerCase(); }
Source:
<code>public void generateConstantFieldDeclaration(VariableElement fieldElement) { if (isConstant(fieldElement)) { String constantValue = determineFinalConstantValue(fieldElement); if (constantValue != null) { Set<Modifier> modifiers = fieldElement.getModifiers(); println(" {0}{1} {2} = {3};", <START> generateModifierList(modifiers.toArray(new Modifier[modifiers.size()])), <END> fieldElement.asType().toString(), fieldElement.getSimpleName(), constantValue ); } else { Set<Modifier> modifiers = fieldElement.getModifiers(); println(" {0}{1} {2};", generateModifierList(modifiers.toArray(new Modifier[modifiers.size()])), fieldElement.asType().toString(), fieldElement.getSimpleName() ); } } }</code><technical_language>execute this line if</technical_language>

Target:
public void generateConstantFieldDeclaration(VariableElement fieldElement) { if (isConstant(fieldElement)) { String constantValue = determineFinalConstantValue(fieldElement); Set<Modifier> modifiers = fieldElement.getModifiers(); String modifierList = generateModifierList(modifiers.toArray(new Modifier[modifiers.size()])); if (constantValue != null) { println(" {0}{1} {2} = {3};", modifierList, fieldElement.asType().toString(), fieldElement.getSimpleName(), constantValue ); } else { println(" {0}{1} {2};", modifierList, fieldElement.asType().toString(), fieldElement.getSimpleName() ); } } }
Source:
<code><START> public static void validatePassword(String password, JsonMapper jsonMapper) { <END> String authValidateUrl = AUTH_VALIDATE_URL.get(); if (!StringUtils.isBlank(authValidateUrl)) { try { Map<String, String> data = new HashMap<String, String>(); data.put("secret", password); String jsonString = jsonMapper.writeValueAsString(data); HttpResponse response = Request.Post(authValidateUrl).bodyString(jsonString, ContentType.APPLICATION_JSON).execute().returnResponse(); if (response.getStatusLine().getStatusCode() >=400 && response.getStatusLine().getStatusCode() <= 499) { Map<String, Object> jsonData; jsonData = jsonMapper.readValue(response.getEntity().getContent()); if (!jsonData.containsKey("type") || !jsonData.containsKey("message")) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "Incomplete JSON response"); } if (jsonData.get("type") != null) { throw new ClientVisibleException(ResponseCodes.UNPROCESSABLE_ENTITY, (String) jsonData.get("message")); } } else { if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "Error talking to validator"); } } } catch (IOException e) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "No response from validator"); } } }</code><technical_language>inject jsonmapper in this class instead of passing a parameter callers</technical_language>

Target:
public static void validatePassword(String password, JsonMapper jsonMapper) { String authValidateUrl = AUTH_VALIDATE_URL.get(); if (StringUtils.isBlank(authValidateUrl)) { return; } Map<String, String> data = new HashMap<String, String>(); data.put("secret", password); String jsonString = ""; Integer code; HttpResponse response = null; try { jsonString = jsonMapper.writeValueAsString(data); } catch (IOException e) { log.error("Error in creating json for POST request", e); } try { response = Request.Post(authValidateUrl).bodyString(jsonString, ContentType.APPLICATION_JSON).execute().returnResponse(); } catch (IOException e) { log.error("Error sending POST request", e); throw new ClientVisibleException(ResponseCodes.BAD_REQUEST, "Error sending POST request"); } code = response.getStatusLine().getStatusCode(); if (code >=400 && code <= 499) { Map<String, Object> jsonData = new HashMap<String, Object>(); try { jsonData = jsonMapper.readValue(response.getEntity().getContent()); } catch (IOException e) { log.error("No JSON response from validator", e); } if (!jsonData.containsKey("type") || !jsonData.containsKey("message")) { throw new ClientVisibleException(code, "Incomplete JSON response"); } if (jsonData.get("type") != null) { throw new ClientVisibleException(code, (String) jsonData.get("message")); } } else if (code < 200 || code > 299) { throw new ClientVisibleException(ResponseCodes.INTERNAL_SERVER_ERROR, "Error talking to validator"); } }
Source:
<code>private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String sessionId = (String) request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (sessionId == null) { throw new ServletException("Engine session missing"); } Current current = new Current(); current.setSessionId(sessionId); current.setApplicationMode(findApplicationMode(sessionId)); current.setUser(findPrincipal(sessionId)); current.setRoot(getRoot(request)); current.setPrefix(getPrefix(request)); current.setPath(getPath(request)); current.setBackend(backend); <START> CorrelationIdTracker.fromRequest(request, response); <END> CurrentManager.put(current); try { chain.doFilter(request, response); } finally { CurrentManager.remove(); } }</code><technical_language>CorrelationIdTracker class is a backend internal implementation dependency, API depend in details, possible. get correlation id header, a query parameter, put "Current.parameters" map. String correlationId = getCorrelationId(request); if (correlationId != null) { current.getParameters().put(CORRELATION_ID, correlationId); }</technical_language>

Target:
private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String sessionId = (String) request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (sessionId == null) { throw new ServletException("Engine session missing"); } Current current = new Current(); current.setSessionId(sessionId); current.setApplicationMode(findApplicationMode(sessionId)); current.setUser(findPrincipal(sessionId)); current.setRoot(getRoot(request)); current.setPrefix(getPrefix(request)); current.setPath(getPath(request)); current.setBackend(backend); fromRequest(request, response, current); CurrentManager.put(current); try { chain.doFilter(request, response); } finally { CurrentManager.remove(); } }
Source:
<code><START> public MetricValueForCommit[] get(GetMetricsForCommitCommand command, Long projectId) { <END> if (getProjectPort.existsById(projectId)) { return getMetricValuesOfCommitPort.get(command, projectId); } else { throw new ProjectNotFoundException(projectId); } }</code><technical_language>UseCase</technical_language>

Target:
public List<MetricValueForCommit> get(GetMetricsForCommitCommand command, Long projectId) { if (getProjectPort.existsById(projectId)) { return getMetricValuesOfCommitPort.get(command, projectId); } else { throw new ProjectNotFoundException(projectId); } }
Source:
<code>public void processElement(ProcessContext context) throws IOException { if (context.element() != null) { if (converter == null) { AvroRegistry registry = new AvroRegistry(); converter = registry.createIndexedRecordConverter(context.element().getClass()); } IndexedRecord input = (IndexedRecord) converter.convertToAvro(context.element()); if (schema == null) { schema = input.getSchema(); } if (reader == null) { <START> reader = new GenericDatumReader<>(schema); <END> } if (MapType.MAP.equals(properties.mapType.getValue())) { map(input, context); } else { flatMap(input, context); } } python.cleanup(); }</code><technical_language>This variable "reader" is longer used. Do "schema"</technical_language>

Target:
public void processElement(ProcessContext context) throws IOException { if (context.element() != null) { if (converter == null) { AvroRegistry registry = new AvroRegistry(); converter = registry.createIndexedRecordConverter(context.element().getClass()); } IndexedRecord input = (IndexedRecord) converter.convertToAvro(context.element()); if (MapType.MAP.equals(properties.mapType.getValue())) { map(input, context); } else { flatMap(input, context); } } python.cleanup(); }
Source:
<code>public FluentIterable<TYPE> filter(Predicate<? super TYPE> predicate) { return new LazyFluentIterable<TYPE>() { @Override public Iterator<TYPE> iterator() { return new DecoratingIterator<TYPE>(iterable.iterator()) { @Override public TYPE computeNext() { <START> while(true) { <END> if(fromIterator.hasNext()) { TYPE candidate = fromIterator.next(); if(!predicate.test(candidate)) { continue; } return candidate; } return null; } } }; } }; }</code><technical_language>while(fromIterator.hasNext())</technical_language>

Target:
public FluentIterable<TYPE> filter(Predicate<? super TYPE> predicate) { return new LazyFluentIterable<TYPE>() { @Override public Iterator<TYPE> iterator() { return new DecoratingIterator<TYPE>(iterable.iterator()) { @Override public TYPE computeNext() { while (fromIterator.hasNext()) { TYPE candidate = fromIterator.next(); if (!predicate.test(candidate)) { continue; } return candidate; } return null; } }; } }; }
Source:
<code><START> @Test void createAsyncIdentityClientUsingConnectionString() { <END> asyncClient = getCommunicationIdentityClientUsingConnectionString().buildAsyncClient(); assertNotNull(asyncClient); Mono<CommunicationUser> response = asyncClient.createUser(); String id = response.block().getId(); assertNotNull(id); assertFalse(id.isEmpty()); }</code><technical_language>Move annotation new line test case</technical_language>

Target:
public void createAsyncIdentityClientUsingConnectionString() { asyncClient = getCommunicationIdentityClientUsingConnectionString().buildAsyncClient(); assertNotNull(asyncClient); Mono<CommunicationUser> response = asyncClient.createUser(); String id = response.block().getId(); assertNotNull(id); assertFalse(id.isEmpty()); }
Source:
<code>public void postCommit() { switch (state()) { case RUNNING: case RESTORING: <START> commitNeeded = false; <END> commitRequested = false; if (eosDisabled) { stateMgr.checkpoint(checkpointableOffsets()); } log.info("Committed"); break; default: throw new IllegalStateException("Illegal state " + state() + " while post committing active task " + id); } }</code><technical_language>This is introduced in this PR, but: while thinking it, I realized for RESTORING state do need rely eosDisabled checkpoint, in fact checkpoint RESTORING here</technical_language>

Target:
public void postCommit() { switch (state()) { case RUNNING: commitNeeded = false; commitRequested = false; if (eosDisabled) { stateMgr.checkpoint(checkpointableOffsets()); } log.info("Committed"); break; case RESTORING: commitNeeded = false; commitRequested = false; stateMgr.checkpoint(checkpointableOffsets()); log.info("Committed"); break; default: throw new IllegalStateException("Illegal state " + state() + " while post committing active task " + id); } }
Source:
<code>private boolean canPrefixApply(String fieldName, String prefix) { final int prefixLength = prefix.length(); return prefixLength == 0 || fieldName.startsWith(prefix) && fieldName.length() > prefixLength && <START> (!Character.isLetter(prefix.charAt(prefix.length() - 1)) || Character.isUpperCase(fieldName.charAt(prefixLength)) || Character.isDigit(fieldName.charAt(prefixLength))); <END> }</code><technical_language>Good catch! this beautiful code here: <LINK_0> asking myself, instead change Character.isUpperCase(fieldName.charAt(prefixLength) !Character.isLowerCase(fieldName.charAt(prefixLength) ? do think</technical_language>

Target:
private boolean canPrefixApply(String fieldName, String prefix) { final int prefixLength = prefix.length(); return prefixLength == 0 || fieldName.startsWith(prefix) && fieldName.length() > prefixLength && (!Character.isLetter(prefix.charAt(prefix.length() - 1)) || !Character.isLowerCase(fieldName.charAt(prefixLength))); }
Source:
<code>private static void checkGeometryToBingTilesLimits(OGCGeometry geometry, boolean pointOrRectangle, int tileCount) { if (pointOrRectangle) { checkCondition(tileCount <= 1_000_000, "The number of input tiles is too large (more than 1M) to compute a set of covering bing tiles."); } else { <START> long complexity = (long) tileCount * getPointCount(geometry.getEsriGeometry()); <END> checkCondition(complexity <= 25_000_000, "The zoom level is too high or the geometry is too complex to compute a set of covering bing tiles. " + "Please use a lower zoom level or convert the geometry to its bounding box using the ST_Envelope function."); } }</code><technical_language>Change commit title "Fix potential overflow in Bing tile functions". Also, for readability, add parenthesis (long) tileCount</technical_language>

Target:
private static void checkGeometryToBingTilesLimits(OGCGeometry geometry, boolean pointOrRectangle, int tileCount) { if (pointOrRectangle) { checkCondition(tileCount <= 1_000_000, "The number of input tiles is too large (more than 1M) to compute a set of covering bing tiles."); } else { long complexity = ((long) tileCount) * getPointCount(geometry.getEsriGeometry()); checkCondition(complexity <= 25_000_000, "The zoom level is too high or the geometry is too complex to compute a set of covering bing tiles. " + "Please use a lower zoom level or convert the geometry to its bounding box using the ST_Envelope function."); } }