auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private <START> void setSiriusSheetLabelProvider(SWTBotView <END> propertiesView) { IPage currentPage = ((org.eclipse.ui.views.properties.PropertySheet) propertiesView.getReference().getView(false)).getCurrentPage(); Option<Object> valueOption = ReflectionHelper.getFieldValueWithoutException(currentPage, "registry"); assertTrue(valueOption.get() instanceof TabbedPropertyRegistry); TabbedPropertyRegistry tabbedPropertyRegistry = (TabbedPropertyRegistry) valueOption.get(); String contributorId = (String) ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "contributorId").get(); oldPropertyViewLabelProvider = ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider").get(); Object newLabelProvider = null; if (DiagramUIPlugin.ID.equals(contributorId)) { newLabelProvider = new SiriusSheetLabelProvider(); } else if ("org.eclipse.sirius.table.ui.EditorID".equals(contributorId) || DTreeEditor.ID.equals(contributorId)) { newLabelProvider = new DTableLabelProvider(); } if (newLabelProvider != null) { ReflectionHelper.setFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider", newLabelProvider); } }</code><technical_language>return</technical_language>

Target:
private Object setSiriusSheetLabelProvider(SWTBotView propertiesView) { Object oldLabelProvider; IPage currentPage = ((org.eclipse.ui.views.properties.PropertySheet) propertiesView.getReference().getView(false)).getCurrentPage(); Option<Object> valueOption = ReflectionHelper.getFieldValueWithoutException(currentPage, "registry"); assertTrue(valueOption.get() instanceof TabbedPropertyRegistry); TabbedPropertyRegistry tabbedPropertyRegistry = (TabbedPropertyRegistry) valueOption.get(); String contributorId = (String) ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "contributorId").get(); oldLabelProvider = ReflectionHelper.getFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider").get(); Object newLabelProvider = null; if (DiagramUIPlugin.ID.equals(contributorId)) { newLabelProvider = new SiriusSheetLabelProvider(); } else if ("org.eclipse.sirius.table.ui.EditorID".equals(contributorId) || DTreeEditor.ID.equals(contributorId)) { newLabelProvider = new DTableLabelProvider(); } if (newLabelProvider != null) { ReflectionHelper.setFieldValueWithoutException(tabbedPropertyRegistry, "labelProvider", newLabelProvider); } return oldLabelProvider; }
Source:
<code>public boolean getIsNamespaceEnabled() throws AzureBlobFileSystemException { if (!isNamespaceEnabledSet) { <START> if (this.abfsConfiguration.getAbfsAuthorizer() != null) <END> { LOG.debug("Authorizer is set. Account MUST be Namespace enabled."); isNamespaceEnabled = true; isNamespaceEnabledSet = true; return isNamespaceEnabled; } LOG.debug("Get root ACL status"); try (AbfsPerfInfo perfInfo = startTracking("getIsNamespaceEnabled", "getAclStatus")) { AbfsRestOperation op = client.getAclStatus(AbfsHttpConstants.FORWARD_SLASH + AbfsHttpConstants.ROOT_PATH); perfInfo.registerResult(op.getResult()); isNamespaceEnabled = true; perfInfo.registerSuccess(true); } catch (AbfsRestOperationException ex) { if (HttpURLConnection.HTTP_BAD_REQUEST != ex.getStatusCode()) { throw ex; } isNamespaceEnabled = false; } isNamespaceEnabledSet = true; } return isNamespaceEnabled; }</code><technical_language>style nit, put { if clause</technical_language>

Target:
public boolean getIsNamespaceEnabled() throws AzureBlobFileSystemException { if (!isNamespaceEnabledSet) { LOG.debug("Get root ACL status"); try (AbfsPerfInfo perfInfo = startTracking("getIsNamespaceEnabled", "getAclStatus")) { AbfsRestOperation op = client.getAclStatus(AbfsHttpConstants.FORWARD_SLASH + AbfsHttpConstants.ROOT_PATH); perfInfo.registerResult(op.getResult()); isNamespaceEnabled = true; perfInfo.registerSuccess(true); } catch (AbfsRestOperationException ex) { if (HttpURLConnection.HTTP_BAD_REQUEST != ex.getStatusCode()) { throw ex; } isNamespaceEnabled = false; } isNamespaceEnabledSet = true; } return isNamespaceEnabled; }
Source:
<code>public ListBoxModel doFillPriorityIdItems(@AncestorInPath Item item) { Project project = null; ListBoxModel items = new ListBoxModel().add(""); if(item instanceof Project) { project = (Project) item; final JiraProjectProperty jiraProjectProperty = (JiraProjectProperty) project.getProperty(JiraProjectProperty.class); JiraSite site = jiraProjectProperty.getSite(); <START> if(null != site) { <END> JiraSession session = site.getSession(); if (session != null) { for (Priority priority : session.getPriorities()) { items.add("[" + site.getName() + "] " + priority.getName(), String.valueOf(priority.getId())); } } } } return items; }</code><technical_language>try coding style everywhere, for conditionals (site != null)</technical_language>

Target:
public ListBoxModel doFillPriorityIdItems(@AncestorInPath Item item) { Project project = null; ListBoxModel items = new ListBoxModel().add(""); if(item instanceof Project) { project = (Project) item; final JiraProjectProperty jiraProjectProperty = (JiraProjectProperty) project.getProperty(JiraProjectProperty.class); JiraSite site = jiraProjectProperty.getSite(); if(site != null) { JiraSession session = site.getSession(); if (session != null) { for (Priority priority : session.getPriorities()) { items.add("[" + site.getName() + "] " + priority.getName(), String.valueOf(priority.getId())); } } } } return items; }
Source:
<code>protected Vector<URL> searchResourcesInBundles(String name) { Vector<URL> urlList = new Vector<URL>(); for (Bundle b : m_bundles) { try { Enumeration<URL> en = b.getResources(name); <START> if (en != null && en.hasMoreElements()) { <END> while (en.hasMoreElements()) { URL url = en.nextElement(); urlList.add(url); } } } catch (Exception e) { } } return urlList; }</code><technical_language>condition is unnecessary (checked in while loop below)</technical_language>

Target:
protected Vector<URL> searchResourcesInBundles(String name) { Vector<URL> urlList = new Vector<URL>(); for (Bundle b : m_bundles) { try { Enumeration resources = b.getResources(name); while (resources != null && resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); urlList.add(url); } } catch (Exception e) { } } return urlList; }
Source:
<code>public Delta() { <START> super(); <END> }</code><technical_language>need call super() currently extend anything</technical_language>

Target:
public Delta() { }
Source:
<code>public void update(final Iterable<Directive> dirs) throws IOException { <START> final XMLDocument xml = new XMLDocument( <END> new Xembler(dirs).applyQuietly(this.read().node()) ); this.item.put( new AttributeUpdates().with(DyRepo.ATTR_MEMO, xml.toString()) ); }</code><technical_language>inline xml</technical_language>

Target:
public void update(final Iterable<Directive> dirs) throws IOException { this.item.put( new AttributeUpdates().with( DyRepo.ATTR_MEMO, new XMLDocument( new Xembler(dirs).applyQuietly(this.read().node()) ).toString() ) ); }
Source:
<code><START> private static Condition fromRssi(final Integer rssi) { <END> if (rssi == RSSI_NONE) { return Condition.NONE; } else if (rssi <= RSSI_LOW_CEILING) { return Condition.BAD; } else if (rssi <= RSSI_MEDIUM_CEILING) { return Condition.FAIR; } return Condition.GOOD; }</code><technical_language>public</technical_language>

Target:
public static Condition fromRssi(final Integer rssi) { if (rssi == RSSI_NONE) { return Condition.NONE; } else if (rssi <= RSSI_LOW_CEILING) { return Condition.BAD; } else if (rssi <= RSSI_MEDIUM_CEILING) { return Condition.FAIR; } return Condition.GOOD; }
Source:
<code>private void discardContent(Queue<HttpObject> contents, int expectedDiscardCount) throws InterruptedException { <START> if (expectedDiscardCount != -1) { <END> assertEquals("Objects that will be discarded are more than expected", expectedDiscardCount, contents.size()); } boolean endMarkerFound = false; for (HttpObject object : contents) { assertFalse("There should have been only a single end marker", endMarkerFound); endMarkerFound = object instanceof LastHttpContent; ReferenceCountUtil.release(object); } assertTrue("There should have been an end marker", endMarkerFound); }</code><technical_language>this check for -1. test code pass negative values right</technical_language>

Target:
private void discardContent(Queue<HttpObject> contents, int expectedDiscardCount) throws InterruptedException { assertEquals("Objects that will be discarded are more than expected", expectedDiscardCount, contents.size()); boolean endMarkerFound = false; for (HttpObject object : contents) { assertFalse("There should have been only a single end marker", endMarkerFound); endMarkerFound = object instanceof LastHttpContent; ReferenceCountUtil.release(object); } assertTrue("There should have been an end marker", endMarkerFound); }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { Tree parent = mit.parent(); while(parent != null && !parent.is(Tree.Kind.METHOD)) { parent = parent.parent(); } if(parent != null) { MethodTree methodTree = (MethodTree) parent; Symbol.MethodSymbol symbol = methodTree.symbol(); <START> if("run".equals(symbol.name()) && symbol.parameterTypes().isEmpty() && symbol.owner().type().isSubtypeOf("java.lang.Runnable")) { <END> return; } } reportIssue(MethodsHelper.methodName(mit), "Call the method Thread.start() to execute the content of the run() method in a dedicated thread."); }</code><technical_language>Reuse methodMatcher entry point check parent is a run method, simpler. if (parent != null && RUNNABLE_RUN_METHOD_MATCHER.matches((MethodTree) parent)) { return; }</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { Tree parent = mit.parent(); while (parent != null && !parent.is(Tree.Kind.METHOD)) { parent = parent.parent(); } if (parent != null && RUNNABLE_RUN_METHOD_MATCHER.matches((MethodTree) parent)) { return; } reportIssue(MethodsHelper.methodName(mit), "Call the method Thread.start() to execute the content of the run() method in a dedicated thread."); }
Source:
<code>public Object toAvro(Schema schema, BlobProperty input) { switch (schema.getType()) { case NULL: if (input == null) { return null; } throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType()); case UNION: for (Schema s : schema.getTypes()) { try { return service.toAvro(s, input); } catch (RuntimeServiceException e) { } } throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType()); case RECORD: GenericRecord record = new GenericData.Record(schema); for (Field f : schema.getFields()) { if ("data".equals(f.name())) { Blob blob = (Blob) input.getValue(); try { record.put(f.name(), ByteBuffer.wrap(blob.getByteArray())); } catch (IOException e) { <START> e.printStackTrace(); <END> } } else { record.put(f.name(), service.toAvro(f.schema(), input.get(service.decodeName(f.name())))); } input.getValueForWrite(); } return record; default: throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType()); } }</code><technical_language>sense rethrow exception UncheckedIOException NuxeoException ? If not, log exception</technical_language>

Target:
public Object toAvro(Schema schema, BlobProperty input) { switch (schema.getType()) { case NULL: if (input == null) { return null; } throw new NonNullValueException(); case UNION: for (Schema s : schema.getTypes()) { try { return service.toAvro(s, input); } catch (NonNullValueException e) { } } throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType()); case RECORD: GenericRecord record = new GenericData.Record(schema); for (Field f : schema.getFields()) { if ("data".equals(f.name())) { Blob blob = (Blob) input.getValue(); try { record.put(f.name(), ByteBuffer.wrap(blob.getByteArray())); } catch (IOException e) { throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType(), e); } } else { record.put(f.name(), service.toAvro(f.schema(), input.get(service.decodeName(f.name())))); } } return record; default: throw new RuntimeServiceException(CANNOT_MAP_TO + schema.getType()); } }
Source:
<code>public static void main(String... a) throws Exception { TestBase test = TestBase.createCaller().init(); <START> FilePathEncrypt.register(); for (int i = 0; i < 100; i++) { ((TestFileSystem)test).testConcurrent("encrypt:0007:" + test.getBaseDir() + "/fs"); test.println("Done pass #" + i); } <END> }</code><technical_language>This temporary change here</technical_language>

Target:
public static void main(String... a) throws Exception { TestBase test = TestBase.createCaller().init(); test.testFromMain(); }
Source:
<code><START> public DuoAuthenticationHandler duoAuthenticationHandler() { <END> final List<DuoSecurityMultifactorProperties> duos = casProperties.getAuthn().getMfa().getDuo(); if (duos.isEmpty()) { throw new BeanCreationException("No configuration/settings could be found for Duo Security. Review settings and ensure the correct syntax is used"); } final String name = duos.get(0).getName(); if (duos.size() > 1) { LOGGER.debug("Multiple Duo Security providers are available; Duo authentication handler is named after [{}]", name); } final DuoAuthenticationHandler h = new DuoAuthenticationHandler(name, servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProvider()); return h; }</code><technical_language>I understand do this, this needs re-worked. try stick generic type possible, introduce polymorphically recognized</technical_language>

Target:
public Collection<AuthenticationHandler> duoAuthenticationHandler() { final List<DuoSecurityMultifactorProperties> duos = casProperties.getAuthn().getMfa().getDuo(); if (duos.isEmpty()) { throw new BeanCreationException("No configuration/settings could be found for Duo Security. Review settings and ensure the correct syntax is used"); } return duos.stream() .map(d -> new DuoAuthenticationHandler(d.getId(), servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProviders(d)) ).collect(Collectors.toList()); }
Source:
<code>protected boolean validate() { if (!super.validate()) { return false; } oldPool = vmPoolDao.get(getVmPool().getVmPoolId()); if (oldPool == null) { return failValidation(EngineMessage.VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND); } if (getParameters().getVmsCount() < 0) { return failValidation(EngineMessage.VM_POOL_CANNOT_DECREASE_VMS_FROM_POOL); } if (oldPool.getVmPoolType() != getParameters().getVmPool().getVmPoolType()) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_TYPE); } if (oldPool.isStateful() != getParameters().getVmPool().isStateful()) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_STATEFUL_OPTION); } if (!oldPool.getName().equals(getParameters().getVmPool().getName())) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_NAME); } if (oldPool.isAutoStorageSelect() != <START> (getParameters().getVmPool().isAutoStorageSelect())) <END> { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_AUTO_STORAGE_SELECT); } return true; }</code><technical_language>please remove redundant parentheses</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } oldPool = vmPoolDao.get(getVmPool().getVmPoolId()); if (oldPool == null) { return failValidation(EngineMessage.VM_POOL_CANNOT_UPDATE_POOL_NOT_FOUND); } if (getParameters().getVmsCount() < 0) { return failValidation(EngineMessage.VM_POOL_CANNOT_DECREASE_VMS_FROM_POOL); } if (oldPool.getVmPoolType() != getParameters().getVmPool().getVmPoolType()) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_TYPE); } if (oldPool.isStateful() != getParameters().getVmPool().isStateful()) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_STATEFUL_OPTION); } if (!oldPool.getName().equals(getParameters().getVmPool().getName())) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_POOL_NAME); } if (oldPool.isAutoStorageSelect() != getParameters().getVmPool().isAutoStorageSelect()) { return failValidation(EngineMessage.VM_POOL_CANNOT_CHANGE_AUTO_STORAGE_SELECT); } return true; }
Source:
<code>protected Query doBuild(LuceneSearchPredicateContext context) { Builder builder = new BooleanQuery.Builder(); <START> values.forEach( value -> builder.add( termQuery( value ), Occur.SHOULD ) ); <END> BooleanQuery query = builder.build(); return query; }</code><technical_language>here, I avoid lambda</technical_language>

Target:
protected Query doBuild(LuceneSearchPredicateContext context) { Builder builder = new BooleanQuery.Builder(); for ( String value : values ) { builder.add( termQuery( value ), Occur.SHOULD ); } return builder.build(); }
Source:
<code><START> public void getJobStatuses(Collection<Job> jobs) throws IOException, InterruptedException { <END> if (jobs == null || jobs.isEmpty()) { return; } final Map<String, Job> qualifiedJobToInfo = new HashMap<>(); for(Job job : jobs) { qualifiedJobToInfo.put(getQualifiedJobName(new JobInstance(job.getJobName(), job.getJobId())), job); } try { byte[] response = httpGet(_apiEndpoint); ApplicationInfoWrapper appInfoWrapper = _objectMapper.readValue(response, ApplicationInfoWrapper.class); for (ApplicationInfo appInfo: appInfoWrapper.getApps()) { String qualifiedName = appInfo.getName(); JobStatus samzaStatus = yarnStateToSamzaStatus(YarnApplicationState.valueOf(appInfo.getState().toUpperCase())); Job job = qualifiedJobToInfo.get(qualifiedName); if (job != null && (job.getStatusDetail() == null || samzaStatus != JobStatus.STOPPED)) { job.setStatusDetail(appInfo.getState()); job.setStatus(samzaStatus); } } } catch (IOException e) { throw new RuntimeException("Failed to retrieve node info.", e); } }</code><technical_language>bad practice mutate passed in data. return a Map<JobName, Status> instead? Also, if do that, need a Collection<Job>, a Collection<String> of qualifiedJobName</technical_language>

Target:
public void getJobStatuses(Collection<Job> jobs) throws IOException, InterruptedException { if (jobs == null || jobs.isEmpty()) { return; } try { byte[] response = httpGet(apiEndpoint); YarnApplicationInfo yarnApplicationInfo = OBJECT_MAPPER.readValue(response, YarnApplicationInfo.class); Map<String, YarnApplicationInfo.YarnApplication> yarnApplications = yarnApplicationInfo.getApplications(); for (Job job: jobs) { String qualifiedJobName = YarnApplicationInfo.getQualifiedJobName(new JobInstance(job.getJobName(), job.getJobId())); YarnApplicationInfo.YarnApplication yarnApp = yarnApplications.get(qualifiedJobName); if (yarnApp == null) { job.setStatusDetail(JobStatus.UNKNOWN.toString()); job.setStatus(JobStatus.UNKNOWN); continue; } JobStatus samzaStatus = yarnStateToSamzaStatus(YarnApplicationState.valueOf(yarnApp.getState().toUpperCase())); if (job.getStatusDetail() == null || samzaStatus != JobStatus.STOPPED) { job.setStatusDetail(yarnApp.getState()); job.setStatus(samzaStatus); } } } catch (IOException e) { throw new RuntimeException("Failed to retrieve node info.", e); } }
Source:
<code><START> private static void checkNokia(Options options, Context context) { <END> List<Appstore> availableStores = options.availableStores; boolean hasNokia = false; if (availableStores != null && availableStores.size() > 0) { for (Appstore appstore : availableStores) { if (appstore.getAppstoreName().equals(NAME_NOKIA)) { hasNokia = true; break; } } } if (hasNokia) { if (!hasRequestedPermission(context, "com.nokia.payment.BILLING")) { throw new IllegalStateException("Nokia permission \"com.nokia.payment.BILLING\" NOT REQUESTED"); } } }</code><technical_language>method static? OpenIab helper contains Options in field. method non-static remove Option parametres</technical_language>

Target:
private static void checkNokia(Options options, Context context) { List<Appstore> availableStores = options.availableStores; boolean hasNokia = false; if (availableStores != null && !availableStores.isEmpty()) { for (Appstore appstore : availableStores) { if (appstore.getAppstoreName().equals(NAME_NOKIA)) { hasNokia = true; break; } } } if (hasNokia) { if (!hasRequestedPermission(context, "com.nokia.payment.BILLING")) { throw new IllegalStateException("Nokia permission \"com.nokia.payment.BILLING\" NOT REQUESTED"); } } }
Source:
<code>public ColumnRef resolveColumn(String schemaName, String tableName, String colName) throws SQLException { if (tableName == null) { int theColumnPosition = -1; TableRef theTableRef = null; Iterator<TableRef> iterator = tables.iterator(); while (iterator.hasNext()) { TableRef tableRef = iterator.next(); try { <START> PColumn column = tableRef.getTable().getPColumnForColumnName(colName); <END> if (theTableRef != null) { throw new AmbiguousColumnException(colName); } theTableRef = tableRef; theColumnPosition = column.getPosition(); } catch (ColumnNotFoundException e) { } } if (theTableRef != null) { return new ColumnRef(theTableRef, theColumnPosition); } throw new ColumnNotFoundException(colName); } else { try { TableRef tableRef = resolveTable(schemaName, tableName); PColumn column = tableRef.getTable().getPColumnForColumnName(colName); return new ColumnRef(tableRef, column.getPosition()); } catch (TableNotFoundException e) { ColumnFamilyRef cfRef = resolveColumnFamily(schemaName, tableName); PColumn column = cfRef.getFamily().getPColumnForColumnName(colName); return new ColumnRef(cfRef.getTableRef(), column.getPosition()); } } }</code><technical_language>reason for method rename? usages of this API of Phoenix jar (for example Platform teams), resist making this change absolutely necessary</technical_language>

Target:
public ColumnRef resolveColumn(String schemaName, String tableName, String colName) throws SQLException { if (tableName == null) { int theColumnPosition = -1; TableRef theTableRef = null; Iterator<TableRef> iterator = tables.iterator(); while (iterator.hasNext()) { TableRef tableRef = iterator.next(); try { PColumn column = tableRef.getTable().getColumnForColumnName(colName); if (theTableRef != null) { throw new AmbiguousColumnException(colName); } theTableRef = tableRef; theColumnPosition = column.getPosition(); } catch (ColumnNotFoundException e) { } } if (theTableRef != null) { return new ColumnRef(theTableRef, theColumnPosition); } throw new ColumnNotFoundException(colName); } else { try { TableRef tableRef = resolveTable(schemaName, tableName); PColumn column = tableRef.getTable().getColumnForColumnName(colName); return new ColumnRef(tableRef, column.getPosition()); } catch (TableNotFoundException e) { ColumnFamilyRef cfRef = resolveColumnFamily(schemaName, tableName); PColumn column = cfRef.getFamily().getPColumnForColumnName(colName); return new ColumnRef(cfRef.getTableRef(), column.getPosition()); } } }
Source:
<code>private void normalizeIntensities() { normalizedXIntensities = new float[numberOfSnps]; normalizedYIntensities = new float[numberOfSnps]; for (int i = 0; i < rawXIntensities.length; i++) { final int rawX = rawXIntensities[i]; final int rawY = rawYIntensities[i]; final int normId; int normIndex = -1; <START> if ((allNormalizationIds != null) && (allNormalizationIds.length > i)) { <END> normId = allNormalizationIds[i]; normIndex = getAllNormIndex(normId); } if (normIndex != -1) { final InfiniumTransformation xform = normalizationTransformations[normIndex]; final float tempX = rawX - xform.getOffsetX(); final float tempY = rawY - xform.getOffsetY(); final float theta = xform.getTheta(); double tempX2 = Math.cos(theta) * tempX + Math.sin(theta) * tempY; double tempY2 = -Math.sin(theta) * tempX + Math.cos(theta) * tempY; double tempX3 = tempX2 - xform.getShear() * tempY2; if (tempX3 < 0) { tempX3 = 0; } if (tempY2 < 0) { tempY2 = 0; } normalizedXIntensities[i] = (float) (tempX3 / xform.getScaleX()); normalizedYIntensities[i] = (float) (tempY2 / xform.getScaleY()); } else { normalizedXIntensities[i] = rawXIntensities[i]; normalizedYIntensities[i] = rawYIntensities[i]; } } }</code><technical_language>simplify suggestion if (allNormalizationIds.length > i) {</technical_language>

Target:
private void normalizeIntensities() { normalizedXIntensities = new float[numberOfSnps]; normalizedYIntensities = new float[numberOfSnps]; for (int i = 0; i < rawXIntensities.length; i++) { final int rawX = rawXIntensities[i]; final int rawY = rawYIntensities[i]; final int normId; int normIndex = -1; if (allNormalizationIds.length > i) { normId = allNormalizationIds[i]; normIndex = getAllNormIndex(normId); } if (normIndex != -1) { final InfiniumTransformation xform = normalizationTransformations[normIndex]; final float tempX = rawX - xform.getOffsetX(); final float tempY = rawY - xform.getOffsetY(); final float theta = xform.getTheta(); double tempX2 = Math.cos(theta) * tempX + Math.sin(theta) * tempY; double tempY2 = -Math.sin(theta) * tempX + Math.cos(theta) * tempY; double tempX3 = tempX2 - xform.getShear() * tempY2; if (tempX3 < 0) { tempX3 = 0; } if (tempY2 < 0) { tempY2 = 0; } normalizedXIntensities[i] = (float) (tempX3 / xform.getScaleX()); normalizedYIntensities[i] = (float) (tempY2 / xform.getScaleY()); } else { normalizedXIntensities[i] = rawXIntensities[i]; normalizedYIntensities[i] = rawYIntensities[i]; } } }
Source:
<code>public void showNPCReset(final Player player, final NPC npc) { <START> npc.despawn(); <END> Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { npc.spawn(npc.getStoredLocation()); } }, 1); }</code><technical_language>need packet sequence: Packet19 destroy entity ADD_PLAYER player info PacketxxNamedEntitySpawn REMOVE_PLAYER player info</technical_language>

Target:
public void showNPCReset(final Player player, final NPC npc) { ((CraftPlayer)player).getHandle().playerConnection.sendPacket (new PacketPlayOutEntityDestroy(npc.getEntity().getEntityId())); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { if (player.isOnline() && player.isValid() && npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { NMS.sendPlayerlistPacket(true, player, npc); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn (((CraftPlayer) npc.getEntity()).getHandle())); } } }, 1); Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { if (player.isOnline() && player.isValid() && npc.isSpawned() && npc.getEntity().getType() == EntityType.PLAYER) { NMS.sendPlayerlistPacket(false, player, npc); } } }, 61); }
Source:
<code>protected <T> PrioritizedListenableFutureTask<T> newTaskFor(Runnable runnable, T value) { Preconditions.checkArgument( allowRegularTasks || runnable instanceof PrioritizedRunnable, "task does not implement PrioritizedRunnable" ); return PrioritizedListenableFutureTask.create( ListenableFutureTask.create(runnable, value), <START> getPriority(runnable), <END> config.isFifo() ); }</code><technical_language>if extracting this method out of a difference, if I find confusing getPriority Object</technical_language>

Target:
protected <T> PrioritizedListenableFutureTask<T> newTaskFor(Runnable runnable, T value) { Preconditions.checkArgument( allowRegularTasks || runnable instanceof PrioritizedRunnable, "task does not implement PrioritizedRunnable" ); return PrioritizedListenableFutureTask.create( ListenableFutureTask.create(runnable, value), runnable instanceof PrioritizedRunnable ? ((PrioritizedRunnable) runnable).getPriority() : defaultPriority, config.isFifo() ? queuePosition.decrementAndGet() : 0 ); }
Source:
<code>public static void bootstrap(Level level) { LoggingUtil.hijackJDKLogging(); bootstrappingLock.lock(); try { <START> if (!bootstrapped) { <END> final Logger root = LoggingUtil.getLoggerContext().getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); root.detachAndStopAllAppenders(); final DropwizardLayout formatter = new DropwizardLayout(root.getLoggerContext(), TimeZone.getDefault()); formatter.start(); final ThresholdFilter filter = new ThresholdFilter(); filter.setLevel(level.toString()); filter.start(); final ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<>(); appender.addFilter(filter); appender.setContext(root.getLoggerContext()); LayoutWrappingEncoder<ILoggingEvent> layoutEncoder = new LayoutWrappingEncoder<>(); layoutEncoder.setLayout(formatter); appender.setEncoder(layoutEncoder); appender.start(); root.addAppender(appender); bootstrapped = true; } } finally { bootstrappingLock.unlock(); } }</code><technical_language>revert condition? If logging is bootstrapped, return early. Advantage is a reduction of a big _if_ block identation</technical_language>

Target:
public static void bootstrap(Level level) { LoggingUtil.hijackJDKLogging(); bootstrappingLock.lock(); try { if (bootstrapped) { return; } final Logger root = LoggingUtil.getLoggerContext().getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); root.detachAndStopAllAppenders(); final DropwizardLayout formatter = new DropwizardLayout(root.getLoggerContext(), TimeZone.getDefault()); formatter.start(); final ThresholdFilter filter = new ThresholdFilter(); filter.setLevel(level.toString()); filter.start(); final ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<>(); appender.addFilter(filter); appender.setContext(root.getLoggerContext()); LayoutWrappingEncoder<ILoggingEvent> layoutEncoder = new LayoutWrappingEncoder<>(); layoutEncoder.setLayout(formatter); appender.setEncoder(layoutEncoder); appender.start(); root.addAppender(appender); bootstrapped = true; } finally { bootstrappingLock.unlock(); } }
Source:
<code>public List<Runnable> clearTasks() { synchronized (scheduledQueue.getModificationLock()) { synchronized (executeQueueRemoveLock) { List<Runnable> result = new ArrayList<Runnable>(executeQueue.size() + scheduledQueue.size()); Iterator<? extends TaskContainer> it = executeQueue.iterator(); while (it.hasNext()) { TaskContainer tc = it.next(); if (! tc.running) { result.add(tc.runnable); } } executeQueue.clear(); it = scheduledQueue.iterator(); while (it.hasNext()) { TaskContainer tc = it.next(); if (! tc.running) { result.add(tc.runnable); } } scheduledQueue.clear(); <START> return result; <END> } } }</code><technical_language>if matters this list out of order</technical_language>

Target:
public List<Runnable> clearTasks() { synchronized (scheduledQueue.getModificationLock()) { synchronized (executeQueueRemoveLock) { List<TaskContainer> containers = new ArrayList<TaskContainer>(executeQueue.size() + scheduledQueue.size()); Iterator<? extends TaskContainer> it = executeQueue.iterator(); while (it.hasNext()) { TaskContainer tc = it.next(); if (! tc.running) { int index = ListUtils.getInsertionEndIndex(containers, tc, true); containers.add(index, tc); } } executeQueue.clear(); it = scheduledQueue.iterator(); while (it.hasNext()) { TaskContainer tc = it.next(); if (! tc.running) { int index = ListUtils.getInsertionEndIndex(containers, tc, true); containers.add(index, tc); } } scheduledQueue.clear(); List<Runnable> result = new ArrayList<Runnable>(containers.size()); it = containers.iterator(); while (it.hasNext()) { result.add(it.next().runnable); } return result; } } }
Source:
<code>public synchronized void sendMessageSync(String destAddress, String message) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException { if (getSession() != null && getSession().isBound()) { byte[] textBytes = CharsetUtil.encode(message, charsetName); SubmitSm submit = new SubmitSm(); submit.setSourceAddress(new Address(sourceTon, sourceNpi, sourceAddress)); submit.setDestAddress(new Address(destTon, destNpi, destAddress)); <START> submit.setRegisteredDelivery(SmppConstants.REGISTERED_DELIVERY_SMSC_RECEIPT_REQUESTED); <END> submit.setDataCoding((byte) dataCoding); submit.setShortMessage(textBytes); SubmitSmResp submitResponce = getSession().submit(submit, submitTimeout); Log.debug("SMS submited, msg_id: " + submitResponce.getMessageId()); } else { throw new SmppChannelException("Smpp session is not connected"); } }</code><technical_language>Do want request it? handle it, right</technical_language>

Target:
public synchronized void sendMessageSync(String destAddress, String message) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException { if (getSession() != null && getSession().isBound()) { byte[] textBytes = CharsetUtil.encode(message, charsetName); SubmitSm submit = new SubmitSm(); submit.setSourceAddress(new Address(sourceTon, sourceNpi, sourceAddress)); submit.setDestAddress(new Address(destTon, destNpi, destAddress)); submit.setDataCoding(dataCoding); submit.setShortMessage(textBytes); SubmitSmResp submitResponce = getSession().submit(submit, submitTimeout); Log.debug("SMS submited, msg_id: " + submitResponce.getMessageId()); } else { throw new SmppChannelException("Smpp session is not connected"); } }
Source:
<code>public void release(Jedis j, byte[] lockKey, byte[] lockValue) { if (lockValue != null) { j.watch(lockKey); byte[] prevousLockValue = j.get(lockKey); <START> if (Arrays.equals(prevousLockValue, lockValue)) { <END> Transaction transaction = j.multi(); transaction.del(lockKey); boolean succeed = transaction.exec() != null; if (!succeed) { LOG.warn( "Failed to release lock for key {}/{}, meaning the key probably expired because of acquiring the lock for too long {}ms (expiration at {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), System.currentTimeMillis() - extractTime(lockValue), expiration); } } else { LOG.warn( "Nothing to release for key {}/{}, meaning the key probably expired because of acquiring the lock for too long {}ms (expiration at {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), System.currentTimeMillis() - extractTime(lockValue), expiration); j.unwatch(); } } else { LOG.warn("Trying to release a lock for with a null value", new String(lockKey)); } }</code><technical_language>typo</technical_language>

Target:
public void release(Jedis j, byte[] lockKey, byte[] lockValue) { if (lockValue != null) { j.watch(lockKey); byte[] previousLockValue = j.get(lockKey); if (Arrays.equals(previousLockValue, lockValue)) { Transaction transaction = j.multi(); transaction.del(lockKey); boolean succeed = transaction.exec() != null; if (!succeed) { LOG.warn( "Failed to release lock for key {}/{}, meaning the key probably expired because of acquiring the lock for too long {}ms (expiration at {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), System.currentTimeMillis() - extractTime(lockValue), expiration); } } else { LOG.warn( "Nothing to release for key {}/{}, meaning the key probably expired because of acquiring the lock for too long {}ms (expiration at {}ms)", new String(lockKey), Hex.encodeHexString(lockValue), System.currentTimeMillis() - extractTime(lockValue), expiration); j.unwatch(); } } else { LOG.warn("Trying to release a lock for with a null value", new String(lockKey)); } }
Source:
<code>protected Optional<Boolean> getVal(EntityAgeable container) { <START> return Optional.of(!container.isChild()); <END> }</code><technical_language>OptBool here</technical_language>

Target:
protected Optional<Boolean> getVal(EntityAgeable container) { return OptBool.of(!container.isChild()); }
Source:
<code>public static boolean isImpactingNotification(final Collection<Notification> notifications) { boolean isImpactingNotification = false; Set<EObject> alreadyDoneNotifiers = new HashSet<>(); for (Notification notification : notifications) { Object notifier = notification.getNotifier(); if (notifier instanceof EObject) { EObject eObjectNotifier = (EObject) notifier; if (!alreadyDoneNotifiers.contains(eObjectNotifier)) { Resource notifierResource = <START> eObjectNotifier.eResource(); <END> if (notifierResource != null) { if (impactingNotificationPredicates.isEmpty()) { alreadyDoneNotifiers.add(eObjectNotifier); } if (!new ResourceQuery(notifierResource).isAirdOrSrmResource() || isSpecificImpactingNotification(notification)) { isImpactingNotification = true; break; } } } } } return isImpactingNotification; }</code><technical_language>optimized a cache Map NotifierTo"new ResourceQuery(notifierResource).isAirdOrSrmResource()"</technical_language>

Target:
public static boolean isImpactingNotification(final Collection<Notification> notifications) { Map<EObject, Boolean> notifierIsInAirdOrSrmResource = new HashMap<>(); Map<EObject, Resource> notifierWithResource = new HashMap<>(); Set<EObject> alreadyDoneNotifiers = new HashSet<>(); for (Notification notification : notifications) { Object notifier = notification.getNotifier(); if (notifier instanceof EObject) { EObject eObjectNotifier = (EObject) notifier; if (!alreadyDoneNotifiers.contains(eObjectNotifier) && isImpactingNotification(notification, eObjectNotifier, alreadyDoneNotifiers, notifierWithResource, notifierIsInAirdOrSrmResource)) { return true; } } } return false; }
Source:
<code>public static ActivityObject buildActivityObject(Interaction interaction) { ActivityObject actObj = new ActivityObject(); actObj.setObjectType(interaction.getContenttype()); actObj.setUrl(interaction.getLink()); <START> actObj.setId(interaction.getId()); <END> actObj.setContent(interaction.getContent()); return actObj; }</code><technical_language>I other converters set id "id:<provider>:post:<postid>" if a tweet data sift, "id:twitter:post:<tweetid>"</technical_language>

Target:
public static ActivityObject buildActivityObject(Interaction interaction) { ActivityObject actObj = new ActivityObject(); actObj.setObjectType(interaction.getContenttype()); actObj.setUrl(interaction.getLink()); actObj.setId(formatId("post",interaction.getId())); actObj.setContent(interaction.getContent()); return actObj; }
Source:
<code>public Optional<FlyingData> createFrom(DataHolder dataHolder) { if (supports(dataHolder)) { boolean isFlying = ((net.minecraft.entity.Entity) dataHolder).isAirBorne; if (dataHolder instanceof EntityPlayer) { <START> isFlying = ((EntityPlayer) dataHolder).capabilities.allowFlying; <END> } return Optional.<FlyingData>of(new SpongeFlyingData(isFlying)); } return Optional.absent(); }</code><technical_language>allowing flight is player flying, I meant capabilities.isFlying instead</technical_language>

Target:
public Optional<FlyingData> createFrom(DataHolder dataHolder) { final boolean isFlying; if (supports(dataHolder)) { if (dataHolder instanceof EntityPlayer) { isFlying = ((EntityPlayer) dataHolder).capabilities.isFlying; } else { isFlying = ((net.minecraft.entity.Entity) dataHolder).isAirBorne; } return Optional.<FlyingData>of(new SpongeFlyingData(isFlying)); } else { return Optional.absent(); } }
Source:
<code>private RepositoryDirectoryValue.Builder fetchRepository( SkyKey skyKey, Path repoRoot, Environment env, Map<String, String> markerData, RepositoryFunction handler, Rule rule) throws InterruptedException, RepositoryFunctionException { setupRepositoryRoot(repoRoot); String repositoryName = ((RepositoryName) skyKey.argument()).getName(); env.getListener().post(new RepositoryFetching(repositoryName, false)); RepositoryDirectoryValue.Builder repoBuilder; try { repoBuilder = handler.fetch(rule, repoRoot, directories, env, markerData, skyKey); } catch (RepositoryFunctionException e) { env.getListener().post(new RepositoryFetching(repositoryName, true)); env.getListener().post(new RepositoryFailedEvent(repositoryName, e.getMessage())); env.getListener().handle(Event.error("Error fetching repository: " + e.getMessage())); <START> throw e; <END> } if (env.valuesMissing()) { env.getListener().post(new RepositoryFetching(repositoryName, false, "Restarting.")); return null; } env.getListener().post(new RepositoryFetching(repositoryName, true)); return Preconditions.checkNotNull(repoBuilder); }</code><technical_language>change situation worse, problems this SkyFunction is throwing random exceptions RepositoryFunctionException (which is unwrapped anyway). more sense if underlying exception wrapped in a RepositoryException similar. callers try handle show errors coming here. stands, some callers try do IOException</technical_language>

Target:
private RepositoryDirectoryValue.Builder fetchRepository( SkyKey skyKey, Path repoRoot, Environment env, Map<String, String> markerData, RepositoryFunction handler, Rule rule) throws InterruptedException, RepositoryFunctionException { setupRepositoryRoot(repoRoot); String repositoryName = ((RepositoryName) skyKey.argument()).getName(); env.getListener().post(new RepositoryFetching(repositoryName, false)); RepositoryDirectoryValue.Builder repoBuilder; try { repoBuilder = handler.fetch(rule, repoRoot, directories, env, markerData, skyKey); } catch (RepositoryFunctionException e) { env.getListener().post(new RepositoryFetching(repositoryName, true)); env.getListener().post(new RepositoryFailedEvent(repositoryName, e.getMessage())); env.getListener().handle(Event.error("Error fetching repository: " + e.getMessage())); throw new RepositoryFunctionException( new AlreadyReportedRepositoryAccessException( e.getCause()), e.isTransient() ? Transience.TRANSIENT : Transience.PERSISTENT); } if (env.valuesMissing()) { env.getListener().post(new RepositoryFetching(repositoryName, false, "Restarting.")); return null; } env.getListener().post(new RepositoryFetching(repositoryName, true)); return Preconditions.checkNotNull(repoBuilder); }
Source:
<code>public boolean removeSecurityGroup(String id) { final NetworkConfiguration networkConfiguration = api.getVirtualNetworkApi().get(); if (networkConfiguration != null) { for (VirtualNetworkSite virtualNetworkSite : networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites()) { for (NetworkConfiguration.Subnet subnet : virtualNetworkSite.subnets()) { final String virtualNetworkName = virtualNetworkSite.name(); final String subnetName = subnet.name(); if (virtualNetworkName != null && subnetName != null) { NetworkSecurityGroup networkSecurityGroupAppliedToSubnet = api.getNetworkSecurityGroupApi() .getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, subnetName); if (networkSecurityGroupAppliedToSubnet != null) { if (!networkSecurityGroupAppliedToSubnet.name().equals(id)) { logger.debug("Removing a networkSecurityGroup %s is already applied to subnet '%s' ...", id, subnetName); String removeFromSubnetRequestId = api.getNetworkSecurityGroupApi().removeFromSubnet (virtualNetworkName, subnetName, networkSecurityGroupAppliedToSubnet.name()); String operationDescription = format("Remove existing networkSecurityGroup(%s) from subnet(%s)", id, subnetName); waitForOperationCompletion(removeFromSubnetRequestId, operationDescription); } } } } } } String deleteRequestId = api.getNetworkSecurityGroupApi().delete(id); if (!operationSucceeded.apply(deleteRequestId)) { return false; } <START> return true; <END> }</code><technical_language>return operationSucceeded.apply(deleteRequestId);</technical_language>

Target:
public boolean removeSecurityGroup(String id) { final NetworkConfiguration networkConfiguration = api.getVirtualNetworkApi().getNetworkConfiguration(); if (networkConfiguration != null) { for (VirtualNetworkSite virtualNetworkSite : networkConfiguration.virtualNetworkConfiguration().virtualNetworkSites()) { for (NetworkConfiguration.Subnet subnet : virtualNetworkSite.subnets()) { final String virtualNetworkName = virtualNetworkSite.name(); final String subnetName = subnet.name(); if (virtualNetworkName != null && subnetName != null) { NetworkSecurityGroup networkSecurityGroupAppliedToSubnet = api.getNetworkSecurityGroupApi() .getNetworkSecurityGroupAppliedToSubnet(virtualNetworkName, subnetName); if (networkSecurityGroupAppliedToSubnet != null) { if (!networkSecurityGroupAppliedToSubnet.name().equals(id)) { logger.debug("Removing a networkSecurityGroup %s is already applied to subnet '%s' ...", id, subnetName); String removeFromSubnetRequestId = api.getNetworkSecurityGroupApi().removeFromSubnet (virtualNetworkName, subnetName, networkSecurityGroupAppliedToSubnet.name()); if (operationSucceededPredicate.apply(removeFromSubnetRequestId)) { final String message = generateIllegalStateExceptionMessage(removeFromSubnetRequestId, azureComputeConstants.operationTimeout()); logger.warn(message); throw new IllegalStateException(message); } } } } } } } String deleteRequestId = api.getNetworkSecurityGroupApi().delete(id); return operationSucceededPredicate.apply(deleteRequestId); }
Source:
<code><START> public String notifyLayerListeners(ILayerListener.EventType type, HttpServletRequest request, IModule module) throws IOException { <END> StringBuffer sb = new StringBuffer(); Object[] refs; if(PlatformAggregatorProvider.getPlatformAggregator() != null){ refs = PlatformAggregatorProvider.getPlatformAggregator().getServiceReferences(ILayerListener.class.getName(), "(name="+aggr.getName()+")"); if (refs != null) { for (Object ref : refs) { ILayerListener listener = (ILayerListener)PlatformAggregatorProvider.getPlatformAggregator().getService(ref); try { Set<String> dependentFeatures = new HashSet<String>(); String str = listener.layerBeginEndNotifier(type, request, type == ILayerListener.EventType.BEGIN_MODULE ? Arrays.asList(new IModule[]{module}) : layerListenerModuleList, dependentFeatures); if (dependentFeatures.size() != 0) { moduleList.getDependentFeatures().addAll(dependentFeatures); } if (str != null) { sb.append(str); } } finally { PlatformAggregatorProvider.getPlatformAggregator().ungetService(ref); } } } } return sb.length() != 0 ? sb.toString() : null; }</code><technical_language>Restore original visibility of this other methods in this class unit tests moved jaggr-core</technical_language>

Target:
protected String notifyLayerListeners(ILayerListener.EventType type, HttpServletRequest request, IModule module) throws IOException { StringBuffer sb = new StringBuffer(); Object[] refs = null; if(aggr.getPlatformServices() != null){ try { refs = aggr.getPlatformServices().getServiceReferences(ILayerListener.class.getName(), "(name="+aggr.getName()+")"); } catch (PlatformServicesException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); } } if (refs != null) { for (Object ref : refs) { ILayerListener listener = (ILayerListener)aggr.getPlatformServices().getService(ref); try { Set<String> dependentFeatures = new HashSet<String>(); String str = listener.layerBeginEndNotifier(type, request, type == ILayerListener.EventType.BEGIN_MODULE ? Arrays.asList(new IModule[]{module}) : layerListenerModuleList, dependentFeatures); if (dependentFeatures.size() != 0) { moduleList.getDependentFeatures().addAll(dependentFeatures); } if (str != null) { sb.append(str); } } finally { aggr.getPlatformServices().ungetService(ref); } } } } return sb.length() != 0 ? sb.toString() : null; }
Source:
<code>public Optional<Long> lastSequenceNumberFor(String aggregateIdentifier) { String sql = "SELECT max(" + schema.sequenceNumberColumn() + ") FROM " + schema.domainEventTable() + " WHERE " + schema.aggregateIdentifierColumn() + " = ?"; return Optional.ofNullable(transactionManager.fetchInTransaction( () -> executeQuery(getConnection(), connection -> { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, aggregateIdentifier); return stmt; }, resultSet -> { if (resultSet.next()) { final Long value = resultSet.getObject(1, Long.class); if (false == resultSet.wasNull()) { return value; } } return null; <START> }, <END> e -> new EventStoreException( format("Failed to read events for aggregate [%s]", aggregateIdentifier), e )))); }</code><technical_language>I agree this approach. However, readable if this lambda is extracted a method. method reused later. I I benefit in #425</technical_language>

Target:
public Optional<Long> lastSequenceNumberFor(String aggregateIdentifier) { String sql = "SELECT max(" + schema.sequenceNumberColumn() + ") FROM " + schema.domainEventTable() + " WHERE " + schema.aggregateIdentifierColumn() + " = ?"; return Optional.ofNullable(transactionManager.fetchInTransaction( () -> executeQuery(getConnection(), connection -> { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, aggregateIdentifier); return stmt; }, resultSet -> JdbcUtils.nextAndExtract(resultSet, 1, Long.class), e -> new EventStoreException(format("Failed to read events for aggregate [%s]", aggregateIdentifier), e) ))); }