auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void testTrimLeft() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String val = "ABCD"; byte[] b = val.getBytes(); byte[] vb = val.getBytes(); String tableName = initTable(conn, b, 4, vb); <START> ResultSet rs = conn.createStatement().executeQuery("SELECT TRIMB(b,cast('AB' as VARBINARY)),TRIMB(vb,cast('A' as VARBINARY)) FROM " <END> + tableName + " WHERE TRIMB(b,cast('AB' as VARBINARY))='CD' and TRIMB(vb,cast('A' as VARBINARY))='BCD'"); assertTrue(rs.next()); assertEquals("CD", new String(rs.getBytes(1))); assertEquals("BCD", new String(rs.getBytes(2))); assertFalse(rs.next()); }</code><technical_language>line more 100 chars, plz follow code conventions FYI: <LINK_0></technical_language>

Target:
@Test public void testTrimLeft() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String val = "ABCD"; byte[] b = val.getBytes(); byte[] vb = val.getBytes(); String tableName = initTable(conn, b, 4, vb); ResultSet rs = conn.createStatement().executeQuery( "SELECT TRIMB(b,cast('AB' as VARBINARY)),TRIMB(vb,cast('A' as VARBINARY))" + " FROM " + tableName + " WHERE TRIMB(b,cast('AB' as VARBINARY))='CD' and TRIMB(vb,cast" + "('A' as VARBINARY))='BCD'"); assertTrue(rs.next()); assertEquals("CD", new String(rs.getBytes(1))); assertEquals("BCD", new String(rs.getBytes(2))); assertFalse(rs.next()); }
Source:
<code>public void testInvalidRefreshToken(String opHost, String redirectUrl) throws Exception { final DevelopersApi client = Tester.api(); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String authorizationStr = Tester.getAuthorization(site); final String invalidCode = CoreUtils.secureRandomString(); final GetAccessTokenByRefreshTokenParams params = new GetAccessTokenByRefreshTokenParams(); params.setOxdId(site.getOxdId()); params.setRefreshToken(invalidCode); try { client.getAccessTokenByRefreshToken(authorizationStr, params); } catch (ApiException ex) { <START> assertEquals(401, ex.getCode()); <END> } }</code><technical_language>400, 401</technical_language>

Target:
public void testInvalidRefreshToken(String opHost, String redirectUrl) throws Exception { final DevelopersApi client = Tester.api(); final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final String authorizationStr = Tester.getAuthorization(site); final String invalidCode = CoreUtils.secureRandomString(); final GetAccessTokenByRefreshTokenParams params = new GetAccessTokenByRefreshTokenParams(); params.setOxdId(site.getOxdId()); params.setRefreshToken(invalidCode); try { client.getAccessTokenByRefreshToken(authorizationStr, params); fail("Test should throw an exception"); } catch (ApiException ex) { assertEquals(401, ex.getCode()); } }
Source:
<code>public void checkSpecificAccessControl() { if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("Instructor privilege is required to access this resource."); } <START> String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); <END> gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(idOfCourseToDelete, userInfo.id), logic.getCourse(idOfCourseToDelete), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); }</code><technical_language>idOfCourseToDelete -> idOfCourseToBin</technical_language>

Target:
public void checkSpecificAccessControl() { if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("Instructor privilege is required to access this resource."); } String idOfCourseToBin = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(idOfCourseToBin, userInfo.id), logic.getCourse(idOfCourseToBin), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); }
Source:
<code>public ImmutableSet<EventClass> externalEventClasses() { <START> return ImmutableSet.of(); <END> }</code><technical_language>introducing EventClass.emptySet() easier find places return empty sets</technical_language>

Target:
public ImmutableSet<EventClass> externalEventClasses() { return EventClass.emptySet(); }
Source:
<code>public int callJavaUserDefinedAggregateCombine() { m_udfBuffer.clear(); m_udfBuffer.getInt(); int functionId = m_udfBuffer.getInt(); UserDefinedAggregateFunctionRunner udafRunner = m_functionManager.getAggregateFunctionRunnerById(functionId); Throwable throwable = null; Object worker_object = null; try { assert(udafRunner != null); byte[] worker_byte_array = UserDefinedAggregateFunctionRunner.readVarbinary(m_udfBuffer); ByteArrayInputStream bis = new ByteArrayInputStream(worker_byte_array); ObjectInput in = null; try { in = new udfObjectInputStream(bis); worker_object = in.readObject(); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { } } udafRunner.combine(worker_object); m_udfBuffer.clear(); return 0; } catch (InvocationTargetException ex1) { throwable = ex1.getCause(); } catch (Throwable ex2) { throwable = ex2; <START> ex2.printStackTrace(); <END> } try { assert(throwable != null); byte[] errorMsg = throwable.toString().getBytes(Constants.UTF8ENCODING); if (errorMsg.length + 4 > m_udfBuffer.capacity()) { resizeUDFBuffer(errorMsg.length + 4); } m_udfBuffer.clear(); SerializationHelper.writeVarbinary(errorMsg, m_udfBuffer); } catch (IOException e) { throw new RuntimeException(e); } return -1; }</code><technical_language>Do call printStackTrace in production code. stderr a log file</technical_language>

Target:
public int callJavaUserDefinedAggregateCombine() { UserDefinedAggregateFunctionRunner udafRunner = getUdafRunner(); int udafIndex = m_udfBuffer.getInt(); Object workerObject = null; try { assert(udafRunner != null); byte[] workerByteArray = UserDefinedAggregateFunctionRunner.readVarbinary(m_udfBuffer); ByteArrayInputStream bis = new ByteArrayInputStream(workerByteArray); ObjectInput in = new UDAFObjectInputStream(bis); try { workerObject = in.readObject(); } finally { try { in.close(); } catch (IOException ex) { } } udafRunner.combine(workerObject, udafIndex); m_udfBuffer.clear(); return 0; } catch (InvocationTargetException ex1) { handleUDAFError(ex1.getCause()); } catch (Throwable ex2) { handleUDAFError(ex2); } return -1; }
Source:
<code>public static File toFile(final Archive<?> archive, final boolean exploded) { try { File root = File.createTempFile("arquillian", archive.getName()); root.delete(); root.mkdirs(); File deployment = new File(root, archive.getName()); deployment.deleteOnExit(); <START> archive.as(ZipExporter.class).exportTo(deployment, true); <END> return exploded ? Unzipper.unzip(deployment, new File(new File(root, "exploded"), archive.getName())) : deployment; } catch (Exception e) { throw new RuntimeException("Could not export deployment to temp", e); } }</code><technical_language>this export a Compressed file if requested export exploded</technical_language>

Target:
public static File toFile(final Archive<?> archive, final boolean exploded) { try { File root = File.createTempFile("arquillian", archive.getName()); root.delete(); root.mkdirs(); File deployment = new File(root, archive.getName()); deployment.deleteOnExit(); if (exploded) { return archive.as(ExplodedExporter.class).exportExploded(root, archive.getName()); } else { archive.as(ZipExporter.class).exportTo(deployment, true); return deployment; } } catch (Exception e) { throw new RuntimeException("Could not export deployment to temp", e); } }
Source:
<code>public void run() { final long startTime = System.nanoTime(); final long currentTime = System.currentTimeMillis(); long timeSpent = (startTime - lastPoll) / 1000; if (timeSpent == 0) { timeSpent = 1; } if (history.size() > 10) { history.remove(); } double tps = tickInterval * 1000000.0 / timeSpent; if (tps <= 21) { history.add(tps); } lastPoll = startTime; int count = 0; for (Player player : ess.getOnlinePlayers()) { count++; if (skip1 > 0) { skip1--; continue; } if (count % 10 == 0) { if (System.nanoTime() - startTime > maxTime / 2) { skip1 = count - 1; break; } } try { final User user = ess.getUser(player); onlineUsers.add(user.getBase().getUniqueId()); user.setLastOnlineActivity(currentTime); user.checkActivity(); } catch (Exception e) { ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e); } } count = 0; final Iterator<UUID> iterator = onlineUsers.iterator(); while (iterator.hasNext()) { count++; if (skip2 > 0) { skip2--; continue; } if (count % 10 == 0) { if (System.nanoTime() - startTime > maxTime) { skip2 = count - 1; break; } } final User user = ess.getUser(iterator.next()); if (user == null) { iterator.remove(); continue; } if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) { if (!user.isHidden()) { user.setLastLogout(user.getLastOnlineActivity()); } iterator.remove(); continue; } user.checkMuteTimeout(currentTime); <START> user.checkIgnoreTimeouts(currentTime); <END> user.checkJailTimeout(currentTime); user.resetInvulnerabilityAfterTeleport(); } }</code><technical_language>@md678685 said, if share timings this change determine if this is safe sync</technical_language>

Target:
public void run() { final long startTime = System.nanoTime(); final long currentTime = System.currentTimeMillis(); long timeSpent = (startTime - lastPoll) / 1000; if (timeSpent == 0) { timeSpent = 1; } if (history.size() > 10) { history.remove(); } double tps = tickInterval * 1000000.0 / timeSpent; if (tps <= 21) { history.add(tps); } lastPoll = startTime; int count = 0; for (Player player : ess.getOnlinePlayers()) { count++; if (skip1 > 0) { skip1--; continue; } if (count % 10 == 0) { if (System.nanoTime() - startTime > maxTime / 2) { skip1 = count - 1; break; } } try { final User user = ess.getUser(player); onlineUsers.add(user.getBase().getUniqueId()); user.setLastOnlineActivity(currentTime); user.checkActivity(); } catch (Exception e) { ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e); } } count = 0; final Iterator<UUID> iterator = onlineUsers.iterator(); while (iterator.hasNext()) { count++; if (skip2 > 0) { skip2--; continue; } if (count % 10 == 0) { if (System.nanoTime() - startTime > maxTime) { skip2 = count - 1; break; } } final User user = ess.getUser(iterator.next()); if (user == null) { iterator.remove(); continue; } if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) { if (!user.isHidden()) { user.setLastLogout(user.getLastOnlineActivity()); } iterator.remove(); continue; } user.checkMuteTimeout(currentTime); user.checkJailTimeout(currentTime); user.resetInvulnerabilityAfterTeleport(); } }
Source:
<code>public void setId() { EntityDictionary dictionary = this.requestScope.getDictionary(); <START> String idFieldName = dictionary.getIdFieldName(this.entityClass); <END> if(!getId().isPresent()) { String uuid = UUID.randomUUID().toString() .replaceAll("[^0-9]", "") .substring(0, 3); this.data.put(idFieldName, uuid); this.attributes.add(new Attribute(idFieldName, uuid)); } }</code><technical_language>statements moved if statement</technical_language>

Target:
public void setId() { if(!getId().isPresent()) { EntityDictionary dictionary = this.requestScope.getDictionary(); String idFieldName = dictionary.getIdFieldName(this.entityClass); String uuid = UUID.randomUUID().toString() .replaceAll("[^0-9]", "") .substring(0, 3); this.attributes.add(new Attribute(idFieldName, uuid)); } }
Source:
<code>public UiAction.Description getDescription(RevisionResource resource) { return new UiAction.Description() .setLabel("Cherry Pick") .setTitle("Cherry pick change to a different branch") .setVisible(resource.getControl().getProjectControl().canUpload() && <START> resource.getPatchSet().getId().equals( resource.getChange().currentPatchSetId())); <END> }</code><technical_language>move this logic RevisionResource a method named isCurrent</technical_language>

Target:
public UiAction.Description getDescription(RevisionResource resource) { return new UiAction.Description() .setLabel("Cherry Pick") .setTitle("Cherry pick change to a different branch") .setVisible(resource.getControl().getProjectControl().canUpload() && resource.isCurrent()); }
Source:
<code>public AsyncDolphinConfiguration build() { if (trainerClass == null) { throw new RuntimeException("Trainer class is required."); } if (updaterClass == null) { <START> throw new RuntimeException("Updater class is required."); <END> } return new AsyncDolphinConfiguration(trainerClass, memoryStoreInitializer, updaterClass, keyCodecClass, preValueCodecClass, valueCodecClass, parameterClassList, workerSerializerClass, serverSerializerClass, workerConfiguration, serverConfiguration); }</code><technical_language>MemoryStoreInitializer is required one..</technical_language>

Target:
public AsyncDolphinConfiguration build() { BuilderUtils.notNull(trainerClass); BuilderUtils.notNull(memoryStoreInitializer); BuilderUtils.notNull(updaterClass); return new AsyncDolphinConfiguration(trainerClass, memoryStoreInitializer, updaterClass, keyCodecClass, preValueCodecClass, valueCodecClass, parameterClassList, workerSerializerClass, serverSerializerClass, workerConfiguration, serverConfiguration); }
Source:
<code>public List<Suggestion> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { Map<String, Serializable> suggestProps = new HashMap<>(); suggestProps.put(SUGGESTION_QUERY_KEY, queryString); suggestProps.put(SUGGESTION_CONTEXT_KEY, GAZETTEER_METACARD_TAG); suggestProps.put(SUGGESTION_DICT_KEY, SUGGEST_PLACE_KEY); SortBy[] sortbys = { <START> new SortByImpl(GeoCodingConstants.GAZETTEER_SORT_VALUE, SortOrder.ASCENDING) <END> }; suggestProps.put(ADDITIONAL_SORT_BYS, sortbys); Query suggestionQuery = new QueryImpl(filterBuilder.attribute(Core.TITLE).text(queryString)); QueryRequest suggestionRequest = new QueryRequestImpl(suggestionQuery, suggestProps); try { QueryResponse suggestionResponse = catalogFramework.query(suggestionRequest); if (suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY) instanceof List) { List<Map.Entry<String, String>> suggestions = (List<Map.Entry<String, String>>) suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY); return suggestions .stream() .map(suggestion -> new SuggestionImpl(suggestion.getKey(), suggestion.getValue())) .limit(maxResults) .collect(Collectors.toList()); } } catch (SourceUnavailableException | FederationException | UnsupportedQueryException e) { throw new GeoEntryQueryException("Failed to execute suggestion query", e); } return Collections.emptyList(); }</code><technical_language>GeoCodingConstants.COUNTRY_GAZETTEER_SORT_VALUE added a secondary sort this list</technical_language>

Target:
public List<Suggestion> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { Map<String, Serializable> suggestProps = new HashMap<>(); suggestProps.put(SUGGESTION_QUERY_KEY, queryString); suggestProps.put(SUGGESTION_CONTEXT_KEY, GAZETTEER_METACARD_TAG); suggestProps.put(SUGGESTION_DICT_KEY, SUGGEST_PLACE_KEY); Query suggestionQuery = new QueryImpl(filterBuilder.attribute(Core.TITLE).text(queryString)); QueryRequest suggestionRequest = new QueryRequestImpl(suggestionQuery, suggestProps); try { QueryResponse suggestionResponse = catalogFramework.query(suggestionRequest); if (suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY) instanceof List) { List<Map.Entry<String, String>> suggestions = (List<Map.Entry<String, String>>) suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY); return suggestions .stream() .map(suggestion -> new SuggestionImpl(suggestion.getKey(), suggestion.getValue())) .limit(maxResults) .collect(Collectors.toList()); } } catch (SourceUnavailableException | FederationException | UnsupportedQueryException e) { throw new GeoEntryQueryException("Failed to execute suggestion query", e); } return Collections.emptyList(); }
Source:
<code>public void insert(final Task task, final TaskStatus status) { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(status, "status"); Preconditions.checkArgument( task.getId().equals(status.getId()), "Task/Status ID mismatch[%s/%s]", task.getId(), status.getId() ); log.info("Inserting task %s with status: %s", task.getId(), status); try { dbi.withHandle( new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { handle.createStatement( String.format( "INSERT INTO %s (id, created_date, datasource, payload, active, status_payload) VALUES (:id, :created_date, :datasource, :payload, :active, :status_payload)", dbConnectorConfig.getTaskTable() ) ) .bind("id", task.getId()) .bind("created_date", new DateTime().toString()) .bind("datasource", task.getDataSource()) .bind("payload", jsonMapper.writeValueAsString(task)) <START> .bind("active", status.isRunnable() ? 1 : 0) <END> .bind("status_payload", jsonMapper.writeValueAsString(status)) .execute(); return null; } } ); } catch (StatementException e) { if(getTask(task.getId()).isPresent()) { throw new TaskExistsException(task.getId(), e); } else { throw e; } } }</code><technical_language>"runnable" "active" (runnable means run necessarily running. active means is actively running). Is more explanation of semantics/a (and better) set of namings convey state is</technical_language>

Target:
public void insert(final Task task, final TaskStatus status) { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(status, "status"); Preconditions.checkArgument( task.getId().equals(status.getId()), "Task/Status ID mismatch[%s/%s]", task.getId(), status.getId() ); log.info("Inserting task %s with status: %s", task.getId(), status); try { dbi.withHandle( new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { handle.createStatement( String.format( "INSERT INTO %s (id, created_date, datasource, payload, active, status_payload) VALUES (:id, :created_date, :datasource, :payload, :active, :status_payload)", dbConnectorConfig.getTaskTable() ) ) .bind("id", task.getId()) .bind("created_date", new DateTime().toString()) .bind("datasource", task.getDataSource()) .bind("payload", jsonMapper.writeValueAsBytes(task)) .bind("active", status.isRunnable() ? 1 : 0) .bind("status_payload", jsonMapper.writeValueAsBytes(status)) .execute(); return null; } } ); } catch (StatementException e) { if(getTask(task.getId()).isPresent()) { throw new TaskExistsException(task.getId(), e); } else { throw e; } } }
Source:
<code>public static void redefineProperty(String name, String value, ModelControllerClient client) { ModelNode modelNode = createOpNode("system-property=" + name, WRITE_ATTRIBUTE_OPERATION); modelNode.get(NAME).set(VALUE); modelNode.get(VALUE).set(value); <START> modelNode.get(OPERATION_HEADERS).get(ALLOW_RESOURCE_SERVICE_RESTART).set(true); <END> ModelNode result = executeOp(modelNode, client); log.debugf("Redefine property %s to value %s. Result: %s.", name, value, result); }</code><technical_language>This cruft. SystemPropertyValueWriteAttributeHandler respect this header, in case updating props in test trigger reload-required. If do a bug</technical_language>

Target:
public static void redefineProperty(String name, String value, ModelControllerClient client) { ModelNode modelNode = createOpNode("system-property=" + name, WRITE_ATTRIBUTE_OPERATION); modelNode.get(NAME).set(VALUE); modelNode.get(VALUE).set(value); ModelNode result = executeOp(modelNode, client); log.debugf("Redefine property %s to value %s. Result: %s.", name, value, result); }
Source:
<code>public void testTableSink() { final DataType consumedDataType = SINK_SCHEMA.toPhysicalRowDataType(); SinkFormat<SerializationSchema<RowData>> sinkFormat = new TestFormatFactory.SinkFormatMock(","); ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "sinkTable"); final CatalogTable sinkTable = createKafkaSinkCatalogTable(); final DynamicTableSink actualSink = FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); assertThat(actualSink, instanceOf(getExpectedSinkClass())); <START> assertThat(actualSink, instanceOf(KafkaSinkBase.class)); final KafkaSinkBase kafkaSink = (KafkaSinkBase) actualSink; assertEquals(consumedDataType, kafkaSink.consumedDataType); assertEquals(TOPIC, kafkaSink.topic); assertEquals(KAFKA_PROPERTIES, kafkaSink.properties); assertThat(kafkaSink.partitioner.isPresent(), is(true)); assertThat(kafkaSink.partitioner.get(), instanceOf(FlinkFixedPartitioner.class)); final KafkaSinkBase actualKafkaSink = (KafkaSinkBase) actualSink; assertEquals(sinkFormat, actualKafkaSink.sinkFormat); <END> DynamicTableSink.SinkRuntimeProvider provider = actualKafkaSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false)); assertThat(provider, instanceOf(SinkFunctionProvider.class)); final SinkFunctionProvider sinkFunctionProvider = (SinkFunctionProvider) provider; final SinkFunction<RowData> sinkFunction = sinkFunctionProvider.createSinkFunction(); assertThat(sinkFunction, instanceOf(getExpectedProducerClass())); }</code><technical_language>assert KafakSink object ? KafkaTableSourceSinkFactoryTestBase do</technical_language>

Target:
public void testTableSink() { final DataType consumedDataType = SINK_SCHEMA.toPhysicalRowDataType(); SinkFormat<SerializationSchema<RowData>> sinkFormat = new TestFormatFactory.SinkFormatMock(","); ObjectIdentifier objectIdentifier = ObjectIdentifier.of( "default", "default", "sinkTable"); final CatalogTable sinkTable = createKafkaSinkCatalogTable(); final DynamicTableSink actualSink = FactoryUtil.createTableSink( null, objectIdentifier, sinkTable, new Configuration(), Thread.currentThread().getContextClassLoader()); final DynamicTableSink expectedSink = getExpectedSink( consumedDataType, TOPIC, KAFKA_PROPERTIES, Optional.of(new FlinkFixedPartitioner<>()), sinkFormat); assertEquals(expectedSink, actualSink); final KafkaSinkBase actualKafkaSink = (KafkaSinkBase) actualSink; assertEquals(sinkFormat, actualKafkaSink.sinkFormat); DynamicTableSink.SinkRuntimeProvider provider = actualKafkaSink.getSinkRuntimeProvider(new SinkRuntimeProviderContext(false)); assertThat(provider, instanceOf(SinkFunctionProvider.class)); final SinkFunctionProvider sinkFunctionProvider = (SinkFunctionProvider) provider; final SinkFunction<RowData> sinkFunction = sinkFunctionProvider.createSinkFunction(); assertThat(sinkFunction, instanceOf(getExpectedProducerClass())); }
Source:
<code>private static ImmutableSet<Flavor> getValidFlavors(Flavored flavored, BuildTarget target) { return target.getFlavors().stream() .filter(flavor -> flavored.hasFlavors(ImmutableSet.of(flavor))) <START> .collect(collectingAndThen(toList(), ImmutableSet::copyOf)); <END> }</code><technical_language>pleas MoreCollectors.toImmutableSet()</technical_language>

Target:
private static ImmutableSet<Flavor> getValidFlavors(Flavored flavored, BuildTarget target) { return target .getFlavors() .stream() .filter(flavor -> flavored.hasFlavors(ImmutableSet.of(flavor))) .collect(ImmutableSet.toImmutableSet()); }
Source:
<code>private void flushEventFile(File eventFile) { try { EventPayload payload = new EventPayload(config.getApiKey(), eventFile); DeliveryParams deliveryParams = config.getErrorApiDeliveryParams(); DeliveryStatus deliveryStatus = config.getDelivery().deliver(payload, deliveryParams); switch (deliveryStatus) { case DELIVERED: deleteStoredFiles(Collections.singleton(eventFile)); logger.i("Deleting sent error file " + eventFile.getName()); break; case UNDELIVERED: cancelQueuedFiles(Collections.singleton(eventFile)); logger.w("Could not send previously saved error(s)" + " to Bugsnag, will try again later"); break; case FAILURE: <START> Exception exc = new RuntimeException("Failed to deliver eventPayload"); <END> handleEventFlushFailure(exc, eventFile); break; default: break; } } catch (Exception exception) { handleEventFlushFailure(exception, eventFile); } }</code><technical_language>suggestion Exception exc = new RuntimeException("Failed deliver event payload");</technical_language>

Target:
private void flushEventFile(File eventFile) { try { EventPayload payload = new EventPayload(config.getApiKey(), eventFile); DeliveryParams deliveryParams = config.getErrorApiDeliveryParams(); DeliveryStatus deliveryStatus = config.getDelivery().deliver(payload, deliveryParams); switch (deliveryStatus) { case DELIVERED: deleteStoredFiles(Collections.singleton(eventFile)); logger.i("Deleting sent error file " + eventFile.getName()); break; case UNDELIVERED: cancelQueuedFiles(Collections.singleton(eventFile)); logger.w("Could not send previously saved error(s)" + " to Bugsnag, will try again later"); break; case FAILURE: Exception exc = new RuntimeException("Failed to deliver event payload"); handleEventFlushFailure(exc, eventFile); break; default: break; } } catch (Exception exception) { handleEventFlushFailure(exception, eventFile); } }
Source:
<code>public int hashCode() { return Objects.hashCode( account, invoice, subscription, uuid, taxInCents, currency, description, <START> productCode, <END> recurring, createdAt, updatedAt, details ); }</code><technical_language>Missing some elements</technical_language>

Target:
public int hashCode() { return Objects.hashCode( account, invoice, subscription, uuid, taxInCents, currency, description, productCode, recurring, createdAt, updatedAt, details, message, gatewayType, gatewayErrorCodes, origin, approvalCode, failureType ); }
Source:
<code>private void handleExecutionException(Exception e) { boolean didCleanup = false; AsyncCheckpointState currentState = asyncCheckpointState.get(); while (AsyncCheckpointState.DISCARDED != currentState) { if (asyncCheckpointState.compareAndSet(currentState, AsyncCheckpointState.DISCARDED)) { didCleanup = true; try { cleanup(); } catch (Exception cleanupException) { e.addSuppressed(cleanupException); } Exception checkpointException = new Exception( "Could not materialize checkpoint " + checkpointMetaData.getCheckpointId() + " for operator " + taskName + '.', e); try { taskEnvironment.declineCheckpoint(checkpointMetaData.getCheckpointId(), <START> new CheckpointException(CheckpointFailureReason.EXCEPTION, checkpointException)); <END> } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); asyncExceptionHandler.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } currentState = AsyncCheckpointState.DISCARDED; } else { currentState = asyncCheckpointState.get(); } } if (!didCleanup) { LOG.trace("Caught followup exception from a failed checkpoint thread. This can be ignored.", e); } }</code><technical_language>I is necessary type of thrown exception is changed in this PR. is optional do change logics there. if want supplement some previously missing unit tests for CheckpointCoordinator component, I fine it. :)</technical_language>

Target:
private void handleExecutionException(Exception e) { boolean didCleanup = false; AsyncCheckpointState currentState = asyncCheckpointState.get(); while (AsyncCheckpointState.DISCARDED != currentState) { if (asyncCheckpointState.compareAndSet(currentState, AsyncCheckpointState.DISCARDED)) { didCleanup = true; try { cleanup(); } catch (Exception cleanupException) { e.addSuppressed(cleanupException); } Exception checkpointException = new Exception( "Could not materialize checkpoint " + checkpointMetaData.getCheckpointId() + " for operator " + taskName + '.', e); try { taskEnvironment.declineCheckpoint( checkpointMetaData.getCheckpointId(), new CheckpointException(CheckpointFailureReason.CHECKPOINT_ASYNC_EXCEPTION, checkpointException)); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); asyncExceptionHandler.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } currentState = AsyncCheckpointState.DISCARDED; } else { currentState = asyncCheckpointState.get(); } } if (!didCleanup) { LOG.trace("Caught followup exception from a failed checkpoint thread. This can be ignored.", e); } }
Source:
<code>public Integer getReferenceIndex() { if (null == mReferenceIndex) { mReferenceIndex = resolveIndexFromName(mReferenceName, mHeader, false); if (null == mReferenceIndex) { <START> return NO_ALIGNMENT_REFERENCE_INDEX; <END> } } return mReferenceIndex; }</code><technical_language>This new code leaves mReferenceIndex set null in case lookup failed, previous version leave set NO_ALIGNMENT_REFERENCE_INDEX. Is this want</technical_language>

Target:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { mReferenceIndex = resolveIndexFromName(mReferenceName, mHeader, false); if (null == mReferenceIndex) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } } return mReferenceIndex; }
Source:
<code>private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); <START> if (accessorFactory != null && accessorFactory instanceof IModelUpdateStrategyProvider) { <END> ret = (IModelUpdateStrategyProvider)accessorFactory; } else { ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }</code><technical_language>useless check for null null instanceof returns false</technical_language>

Target:
private IModelUpdateStrategyProvider createModelUpdateStrategyProvider() { final IModelUpdateStrategyProvider ret; IAccessorFactory accessorFactory = getAccessorFactoryForTarget(); if (accessorFactory instanceof IModelUpdateStrategyProvider) { ret = (IModelUpdateStrategyProvider)accessorFactory; } else { ret = new IModelUpdateStrategyProvider() { public IModelUpdateStrategy getModelUpdateStrategy() { return new SingleValuedAttributeModelUpdateStrategy(); } }; } return ret; }
Source:
<code><START> public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception { <END> Bundle bundle = new BundleImpl(osgi, lookupBundle(name), null); RuntimeContext ctx = new OSGiRuntimeContext(runtime, bundle); listBundleComponents(bundle).map(URLStreamRef::new).forEach(component -> { try { deployPartialComponent(ctx, targetExtensions, component); } catch (IOException e) { log.error("PartialBundle: " + name + " failed to load: " + component, e); } }); return ctx; }</code><technical_language>if/else instead of if/return</technical_language>

Target:
public RuntimeContext deployPartial(String name, Set<TargetExtensions> targetExtensions) throws Exception { Bundle bundle = new BundleImpl(osgi, lookupBundle(name), getClass().getClassLoader()); RuntimeContext ctx = new OSGiRuntimeContext(runtime, bundle); listBundleComponents(bundle).map(URLStreamRef::new).forEach(component -> { try { deployPartialComponent(ctx, targetExtensions, component); } catch (IOException e) { log.error("PartialBundle: " + name + " failed to load: " + component, e); } }); return ctx; }
Source:
<code>void createHandle(int index) { state |= HANDLE | THEME_BACKGROUND; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = OS.gtk_frame_new (null); if (handle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); OS.g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (clientHandle, true); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); if ((style & SWT.SHADOW_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_IN); } if ((style & SWT.SHADOW_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_OUT); } if ((style & SWT.SHADOW_ETCHED_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_IN); } if ((style & SWT.SHADOW_ETCHED_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_OUT); } <START> if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { <END> setFontDescription(defaultFont().handle); } }</code><technical_language>Generally check for GTK dev versions. GTK3.21 is a development version, this call GTK3.22</technical_language>

Target:
void createHandle(int index) { state |= HANDLE | THEME_BACKGROUND; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); handle = OS.gtk_frame_new (null); if (handle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); OS.g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (clientHandle, true); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); if ((style & SWT.SHADOW_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_IN); } if ((style & SWT.SHADOW_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_OUT); } if ((style & SWT.SHADOW_ETCHED_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_IN); } if ((style & SWT.SHADOW_ETCHED_OUT) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_ETCHED_OUT); } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
<code>protected AbstractProcessor(final String[] sourceExtensions, final String[] headerExtensions) { this.sourceExtensions = sourceExtensions.clone(); <START> if(headerExtensions != null) <END> { this.headerExtensions = (String[]) headerExtensions.clone(); } else { this.headerExtensions = null; } }</code><technical_language>changing contract other compilers match, follow existing pattern pass new String[] {}</technical_language>

Target:
protected AbstractProcessor(final String[] sourceExtensions, final String[] headerExtensions) { this.sourceExtensions = sourceExtensions.clone(); this.headerExtensions = headerExtensions.clone(); }
Source:
<code>protected void initializeModelHandlers(BookmarkListModel model) { super.initializeModelHandlers(model); model.getItemSavedEvent().addListener((ev, sender, args) -> clearSelection()); getModel().getSelectionModel().addSelectionChangeHandler(event -> { if (!getModel().getSelectedObjects().isEmpty()) { BookmarkModelProvider.this.getModel().setSelectedItem(getModel().getSelectedObjects().get(0)); } else { BookmarkModelProvider.this.getModel().setSelectedItem(null); } <START> }); <END> }</code><technical_language>ignore if like: Bookmark bookmark = getModel().getSelectedObjects().isEmpty() ? null : getModel().getSelectedObjects().get(0); BookmarkModelProvider.this.getModel().setSelectedItem(bookmark);</technical_language>

Target:
protected void initializeModelHandlers(BookmarkListModel model) { super.initializeModelHandlers(model); model.getItemSavedEvent().addListener((ev, sender, args) -> clearSelection()); getModel().getSelectionModel().addSelectionChangeHandler(event -> { Bookmark bookmark = getModel().getSelectedObjects().isEmpty() ? null : (Bookmark) getModel().getSelectedObjects().get(0); BookmarkModelProvider.this.getModel().setSelectedItem(bookmark); }); }
Source:
<code><START> public void refresh() { <END> }</code><technical_language>need a @since tag</technical_language>

Target:
public void refresh() { super.refresh(); for (AbstractAttributeEditor editor : editors) { if (editor.hasIncomingChanges()) { getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); } } }
Source:
<code><START> public void testDynamicChanges() throws Exception { <END> deployContrib("org.nuxeo.ecm.core.schema.tests", "OSGI-INF/CoreTestExtensions.xml"); applyInlineDeployments(); postSetUp(); DocumentType t = schemaManager.getDocumentType("myDoc3"); Set<String> ts = new HashSet<String>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<String>(Arrays.asList("schema1", "schema2")), ts); assertEquals(Collections.singleton("myfacet"), t.getFacets()); deployContrib("org.nuxeo.ecm.core.schema.tests", "OSGI-INF/test-change-doctype.xml"); applyInlineDeployments(); postSetUp(); t = schemaManager.getDocumentType("myDoc3"); ts = new HashSet<String>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<String>(Arrays.asList("schema1", "common")), ts); assertEquals(0, t.getFacets().size()); }</code><technical_language>postSetUp called applyInlineDeployments + pushInlineDeployments</technical_language>

Target:
public void testDynamicChanges() throws Exception { pushInlineDeployments("org.nuxeo.ecm.core.schema.tests:OSGI-INF/CoreTestExtensions.xml"); DocumentType t = schemaManager.getDocumentType("myDoc3"); Set<String> ts = new HashSet<>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<>(Arrays.asList("schema1", "schema2")), ts); assertEquals(Collections.singleton("myfacet"), t.getFacets()); pushInlineDeployments("org.nuxeo.ecm.core.schema.tests:OSGI-INF/test-change-doctype.xml"); t = schemaManager.getDocumentType("myDoc3"); ts = new HashSet<>(Arrays.asList(t.getSchemaNames())); assertEquals(new HashSet<>(Arrays.asList("schema1", "common")), ts); assertEquals(0, t.getFacets().size()); }
Source:
<code>private String extractNextLink(HttpResponse canvasResponse, HttpSession session) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getHeaders("Link"); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); String[] splitPairs = headerPair.split(";"); splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = "/canvasCourseManager/manager" + links.get(searchPhrase).substring(links.get(searchPhrase).indexOf("/api"), links.get(searchPhrase).length()); if(linkValueNext.contains("as_user_id") && session.getAttribute(SectionUtilityToolFilter.LAUNCH_TYPE) == "lti"){ <START> linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); <END> } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }</code><technical_language>"lti" string constant is referenced more place in code</technical_language>

Target:
private String extractNextLink(HttpResponse canvasResponse, HttpSession session) { String linkValueString = null; String linkValueNext = null; String searchPhrase = "rel=\"next\""; M_log.debug("SEARCH PHRASE: " + searchPhrase); HashMap<String, String> links = new HashMap<String, String>(); Header[] headers = canvasResponse.getHeaders("Link"); for (Header header : headers) { M_log.debug("Key : " + header.getName() + " ,Value : " + header.getValue()); if(header.getName().equals("Link")){ linkValueString = header.getValue(); String[] headerPairs = linkValueString.split(","); for(String headerPair : headerPairs){ M_log.debug("String: " + headerPair); String[] splitPairs = headerPair.split(";"); splitPairs[0] = splitPairs[0].replace("<",""); splitPairs[0] = splitPairs[0].replace(">",""); links.put(splitPairs[1].trim(), splitPairs[0]); } break; } } if(links.containsKey(searchPhrase)){ M_log.debug("LINKS CONTAINS NEXT: " + links.get(searchPhrase)); linkValueNext = "/canvasCourseManager/manager" + links.get(searchPhrase).substring(links.get(searchPhrase).indexOf("/api"), links.get(searchPhrase).length()); if(linkValueNext.contains("as_user_id") && session.getAttribute(SectionUtilityToolFilter.LAUNCH_TYPE) == LTI){ linkValueNext = linkValueNext.replaceAll("as_user_id=sis_login_id.*?&", "user=self&"); } } M_log.debug("LINKS; " + links); M_log.debug("NEXT LINK VALUE: " + linkValueNext); return linkValueNext; }
Source:
<code>public String toString() { <START> final ToStringBuilder builder = new ToStringBuilder(this); <END> builder .attr("name", m_name) .attr("type", m_type) .attr("resolveMethod", m_resolveMethod) .attr("properties", m_properties); return builder.toString(); }</code><technical_language>Change to: return new ToStringBuilder(this) .attr("name", m_name) .attr("type", m_type) .attr("resolveMethod", m_resolveMethod) .attr("properties", m_properties) .toString();</technical_language>

Target:
public String toString() { return new ToStringBuilder(this) .attr("name", m_name) .attr("type", m_type) .attr("resolveMethod", m_resolveMethod) .attr("properties", m_properties) .toString(); }
Source:
<code>public SWTBotMenu contextMenu(int row, int col, String text) throws WidgetNotFoundException { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); rightClick(row, col); Rectangle location = widget.getBoundsByPosition(col, row); <START> return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2), text); <END> }</code><technical_language>OK, assuming getBoundsByPosition is cell's bound relative NatTable control</technical_language>

Target:
public SWTBotMenu contextMenu(int row, int col, String text) throws WidgetNotFoundException { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); Rectangle location = widget.getBoundsByPosition(col, row); return NatTableContextMenuFinder.contextMenu(widget, location.x + (location.width / 2), location.y + (location.height / 2), text); }
Source:
<code>private static String normalizeIccid(String data) throws CorrelationAttributeNormalizationException { <START> final String validIccidRegex = "^([8][9][f0-9]{17,22})$"; <END> final String iccidWithoutSeperators = data.toLowerCase().replaceAll(SEPERATORS_REGEX, ""); if (iccidWithoutSeperators.matches(validIccidRegex)) { return iccidWithoutSeperators; } else { throw new CorrelationAttributeNormalizationException("Data provided was not a valid ICCID. : " + data); } }</code><technical_language>I this "^89[f0-9]{17,22}$"</technical_language>

Target:
private static String normalizeIccid(String data) throws CorrelationAttributeNormalizationException { final String validIccidRegex = "^89[f0-9]{17,22}$"; final String iccidWithoutSeperators = data.toLowerCase().replaceAll(SEPERATORS_REGEX, ""); if (iccidWithoutSeperators.matches(validIccidRegex)) { return iccidWithoutSeperators; } else { throw new CorrelationAttributeNormalizationException("Data provided was not a valid ICCID. : " + data); } }
Source:
<code>public void testGetMilisToNextSunset() { System.out.println("getMilisToNextSunset"); Calendar calendar = Calendar.getInstance(); long nextSunset = DateTimeUtils.getMilisToNextSunset(calendar, 40.4131699, -3.6830699); <START> assertTrue(nextSunset < 86400000); <END> }</code><technical_language>suggest this magic number a constant, for clarity. (In general, magic numbers in code, opaque ;))</technical_language>

Target:
public void testGetMilisToNextSunset() { System.out.println("getMilisToNextSunset"); Calendar calendar = Calendar.getInstance(); long nextSunset = DateTimeUtils.getMilisToNextSunset(calendar, LATITUDE, LONGITUDE); assertTrue(nextSunset < DAYTOMILIS); }
Source:
<code>void downloadArchiveForValidExperimentAccessions() throws Exception { String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) <START> .param("accession", EXPERIMENT_ACCESSION_LIST.toString().replace("[", "").replace("]", ""))) <END> .andExpect(status().isOk()) .andExpect( header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }</code><technical_language>I understand that, testing a feature offering. Remember want stick a standard URL scheme. test build URL chaining .param("accession", ...) multiple times</technical_language>

Target:
void downloadArchiveForValidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1))); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); ImmutableList<String> sourceFileNames = getSourceValidFileNames(); ArrayList<String> contentFileNames = new ArrayList<>(); ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { contentFileNames.add(Paths.get(entry.getName()).getFileName().toString()); } assertThat(sourceFileNames.containsAll(contentFileNames)).isTrue(); result.andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)); }
Source:
<code>protected List<Resource<?>> doListResources() { <START> return Collections.emptyList(); <END> }</code><technical_language>This return list of resources it, FileResource impl for more details</technical_language>

Target:
protected List<Resource<?>> doListResources() { if (isDirectory()) { if (isStale()) { listCache = null; } if (listCache == null) { refresh(); listCache = new LinkedList<>(); Path[] files = getPathOperations().listResources(getUnderlyingResourceObject()); if (files != null) { for (Path f : files) { listCache.add(getResourceFactory().create(f)); } } } return listCache; } else { return Collections.emptyList(); } }
Source:
<code>private Runnable createPollTaskForStartOrder(long startOrder) { return () -> { ReentrantReadWriteLock.ReadLock lock = startStopLock.readLock(); lock.lock(); try { <START> if (startOrder == currentStartOrder) { <END> poll(); } } catch (Exception e) { log.makeAlert(e, "uncaught exception in segment manager polling thread").emit(); } finally { lock.unlock(); } }; }</code><technical_language>a log message skip due a concurrency issue</technical_language>

Target:
private Runnable createPollTaskForStartOrder(long startOrder) { return () -> { ReentrantReadWriteLock.ReadLock lock = startStopLock.readLock(); lock.lock(); try { if (startOrder == currentStartOrder) { poll(); } else { log.debug("startOrder = currentStartOrder = %d, skipping poll()", startOrder); } } catch (Exception e) { log.makeAlert(e, "uncaught exception in segment manager polling thread").emit(); } finally { lock.unlock(); } }; }