auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testNotEnoughForMultipleDiskAndDomainsFirstDomainFails() { <START> ArrayList<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, 4); <END> imagesDisks.addAll(mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID2, 4)); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(15, STORAGE_DOMAIN_ID); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID2); assertFalse("Validation should fail. First domain should not have enough free space for request.", cmd.isEnoughSpaceToMergeSnapshots()); }</code><technical_language>this defined a List<DiskImage></technical_language>

Target:
public void testNotEnoughForMultipleDiskAndDomainsFirstDomainFails() { List<DiskImage> imagesDisks = mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID, IMAGE_ACTUAL_SIZE_GB); imagesDisks.addAll(mockMultipleSourceImagesForDomain(4, STORAGE_DOMAIN_ID2, IMAGE_ACTUAL_SIZE_GB)); doReturn(imagesDisks).when(cmd).getSourceImages(); mockStorageDomainDAOGetForStoragePool(15, STORAGE_DOMAIN_ID); mockStorageDomainDAOGetForStoragePool(22, STORAGE_DOMAIN_ID2); assertFalse("Validation should fail. First domain should not have enough free space for request.", cmd.isEnoughSpaceToMergeSnapshots()); }
Source:
<code>private boolean executeOnce(final int thisTryNumber, final int totalTriesIntended) { final Connection sshConnection = new Connection(parent.host, parent.port); try { <START> sshConnection.connect(null, sshTimeoutMillis, 0, sshTimeoutMillis); <END> LOGGER.info("SSH port is open on {}:{}", parent.host, parent.port); return true; } catch (IOException e) { LOGGER.error("Failed to connect to {}:{} (try {}/{}) - {}", parent.host, parent.port, thisTryNumber, totalTriesIntended, e.getMessage()); return false; } finally { sshConnection.close(); } }</code><technical_language>While I agree passing a non-zero connectTimeout argument is a good idea, I passing 0 readTimeout argument is a good idea. I passing zero _either_ result in "no timeout" "a timeout of zero" outcomes bad (one results in non-robust code, other results in situation reported & fix)</technical_language>

Target:
private boolean executeOnce(final int thisTryNumber, final int totalTriesIntended) { final Connection sshConnection = new Connection(parent.host, parent.port); try { sshConnection.connect(null, sshTimeoutMillis, sshTimeoutMillis, sshTimeoutMillis); LOGGER.info("SSH port is open on {}:{}", parent.host, parent.port); return true; } catch (IOException e) { LOGGER.error("Failed to connect to {}:{} (try {}/{}) - {}", parent.host, parent.port, thisTryNumber, totalTriesIntended, e.getMessage()); return false; } finally { sshConnection.close(); } }
Source:
<code>private OnHeapValueHolder<V> invalidateInGetorComputeIfAbsent(MapWrapper<K, V> map, final K key, final ValueHolder<V> value, final Fault<V> fault, final long now) { final AtomicReference<OnHeapValueHolder<V>> toInvalidate = new AtomicReference<OnHeapValueHolder<V>>(); map.computeIfPresent(key, new BiFunction<K, OnHeapValueHolder<V>, OnHeapValueHolder<V>>() { @Override public OnHeapValueHolder<V> apply(K mappedKey, final OnHeapValueHolder<V> mappedValue) { if(mappedValue.equals(fault)) { try { toInvalidate.set(cloneValueHolder(key, value, now, Duration.ZERO, true)); } catch (LimitExceededException ex) { <START> throw new AssertionError("Should have already been thrown."); <END> } invalidationListener.onInvalidation(key, toInvalidate.get()); return null; } return mappedValue; } }); return toInvalidate.get(); }</code><technical_language>message is confusing. thrown sizing is happening</technical_language>

Target:
private OnHeapValueHolder<V> invalidateInGetorComputeIfAbsent(MapWrapper<K, V> map, final K key, final ValueHolder<V> value, final Fault<V> fault, final long now) { final AtomicReference<OnHeapValueHolder<V>> toInvalidate = new AtomicReference<OnHeapValueHolder<V>>(); map.computeIfPresent(key, new BiFunction<K, OnHeapValueHolder<V>, OnHeapValueHolder<V>>() { @Override public OnHeapValueHolder<V> apply(K mappedKey, final OnHeapValueHolder<V> mappedValue) { if(mappedValue.equals(fault)) { try { toInvalidate.set(cloneValueHolder(key, value, now, Duration.ZERO, false)); } catch (LimitExceededException ex) { throw new AssertionError("Sizing is not expected to happen."); } invalidationListener.onInvalidation(key, toInvalidate.get()); return null; } return mappedValue; } }); return toInvalidate.get(); }
Source:
<code>public String toResponse() { if (selectionSet instanceof String) { return String.format( "\"%s\":%s", getName(), getSelectionSet().toString().equals("") ? "{\"edges\":[]}" : getSelectionSet().toString() ); } else if (selectionSet instanceof Number) { <START> return String.format( <END> "\"%s\":%s", getName(), getSelectionSet().toString().equals("") ? "{\"edges\":[]}" : getSelectionSet().toString() ); } else { return String.format("\"%s\":%s", getName(), ((SelectionSet) getSelectionSet()).toResponse()); } }</code><technical_language>combine this case above? if (selectionSet instanceof String || selectionSet instanceOf Number)</technical_language>

Target:
public String toResponse() { if (selectionSet instanceof String || selectionSet instanceof Number) { return String.format( "\"%s\":%s", getName(), getSelectionSet().toString().equals("") ? "{\"edges\":[]}" : getSelectionSet().toString() ); } else { return String.format("\"%s\":%s", getName(), ((SelectionSet) getSelectionSet()).toResponse()); } }
Source:
<code>public <A extends Annotation> ConstraintValidator<A, ?> getInitializedValidator(Type validatedValueType, ConstraintDescriptorImpl<A> descriptor, ConstraintValidatorFactory constraintFactory) { Contracts.assertNotNull( validatedValueType ); Contracts.assertNotNull( descriptor ); Contracts.assertNotNull( constraintFactory ); final CacheKey key = new CacheKey( descriptor.getAnnotation(), validatedValueType, constraintFactory ); if ( constraintValidatorCache.containsKey( key ) ) { @SuppressWarnings("unchecked") ConstraintValidator<A, ?> constraintValidator = (ConstraintValidator<A, ?>) constraintValidatorCache.get( key ); if ( DUMMY_CONSTRAINT_VALIDATOR.equals( constraintValidator ) ) { return null; } else { log.tracef( "Constraint validator %s found in cache.", constraintValidator ); return constraintValidator; } } <START> ConstraintValidatorDescriptor<A> validatorTypeDescriptor = findMatchingValidatorClass( <END> descriptor, validatedValueType ); ConstraintValidator<A, ?> constraintValidator = createAndInitializeValidator( constraintFactory, validatorTypeDescriptor, descriptor ); if ( constraintValidator == null ) { putInitializedValidator( validatedValueType, descriptor.getAnnotation(), constraintFactory, DUMMY_CONSTRAINT_VALIDATOR ); return null; } else { putInitializedValidator( validatedValueType, descriptor.getAnnotation(), constraintFactory, constraintValidator ); return constraintValidator; } }</code><technical_language>validatorDescriptor nice consistent naming a lines below</technical_language>

Target:
public <A extends Annotation> ConstraintValidator<A, ?> getInitializedValidator(Type validatedValueType, ConstraintDescriptorImpl<A> descriptor, ConstraintValidatorFactory constraintFactory) { Contracts.assertNotNull( validatedValueType ); Contracts.assertNotNull( descriptor ); Contracts.assertNotNull( constraintFactory ); final CacheKey key = new CacheKey( descriptor.getAnnotation(), validatedValueType, constraintFactory ); if ( constraintValidatorCache.containsKey( key ) ) { @SuppressWarnings("unchecked") ConstraintValidator<A, ?> constraintValidator = (ConstraintValidator<A, ?>) constraintValidatorCache.get( key ); if ( DUMMY_CONSTRAINT_VALIDATOR.equals( constraintValidator ) ) { return null; } else { log.tracef( "Constraint validator %s found in cache.", constraintValidator ); return constraintValidator; } } ConstraintValidatorDescriptor<A> validatorDescriptor = findMatchingValidatorDescriptor( descriptor, validatedValueType ); ConstraintValidator<A, ?> constraintValidator = createAndInitializeValidator( constraintFactory, validatorDescriptor, descriptor ); if ( constraintValidator == null ) { putInitializedValidator( validatedValueType, descriptor.getAnnotation(), constraintFactory, DUMMY_CONSTRAINT_VALIDATOR ); return null; } else { putInitializedValidator( validatedValueType, descriptor.getAnnotation(), constraintFactory, constraintValidator ); return constraintValidator; } }
Source:
<code>private static JAXBContext initOnmsEventParameterContext() { try { return JAXBContext.newInstance(EventParms.class); } catch (JAXBException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>Lets re-throw this a RuntimeException instead</technical_language>

Target:
private static JAXBContext initOnmsEventParameterContext() { try { return JAXBContext.newInstance(EventParms.class); } catch (JAXBException e) { throw new RuntimeException(e); } }
Source:
<code>public RemoteCounterManagerTest() { <START> testImpl = new CounterManagerImplTest(this::allTestCounterManagers, this::log, this::cacheManager); <END> }</code><technical_language>fyi, @Factory method replace tested instance (its methods annotated @Test ofc)</technical_language>

Target:
public RemoteCounterManagerTest() { strategy = new CounterManagerImplTestStrategy(this::allTestCounterManagers, this::log, this::cacheManager); }
Source:
<code>private void tallyAlignmentRecords(final SAMRecord s1, final SAMRecord s2) { if (!s1.getReadName().equals(s2.getReadName())) { throw new PicardException("Read names do not match: " + s1.getReadName() + " : " + s2.getReadName()); } catalogDuplicateDifferences(s1, s2); final AlignmentComparison comp = compareAlignmentRecords(s1, s2); <START> switch (comp) { <END> case UNMAPPED_BOTH: ++comparisonMetric.unmappedBoth; break; case UNMAPPED_LEFT: ++comparisonMetric.unmappedLeft; break; case UNMAPPED_RIGHT: ++comparisonMetric.unmappedRight; break; case MAPPINGS_DIFFER: ++comparisonMetric.mappingsDiffer; break; case MAPPINGS_MATCH: ++comparisonMetric.mappingsMatch; break; default: throw new PicardException("Unhandled comparison type: " + comp); } }</code><technical_language>nice move this switch SamComparisonMetric. Or, move AlignmentComparison switch is longer necessary, e.g. AlignmentComparison.updateMetric(SamComparisonMetric), updateMetric() is overridden enum member increment correct field</technical_language>

Target:
private void tallyAlignmentRecords(final SAMRecord s1, final SAMRecord s2) { if (!s1.getReadName().equals(s2.getReadName())) { throw new PicardException("Read names do not match: " + s1.getReadName() + " : " + s2.getReadName()); } catalogDuplicateDifferences(s1, s2); final AlignmentComparison comp = compareAlignmentRecords(s1, s2); comparisonMetric.updateMetric(comp); }
Source:
<code>private Message.Builder getMessageBuilder(Class<?> clazz) { <START> try { <END> assert supports(clazz); Method method = methodCache.get(clazz); if (method == null) { method = clazz.getMethod("newBuilder"); methodCache.put(clazz, method); } return (Message.Builder) method.invoke(clazz); } catch (Exception ex) { throw new MessageConversionException( "Invalid Protobuf Message type: no invocable newBuilder() method on " + clazz, ex); } }</code><technical_language>Please check [our guidelines](<LINK_0> source code style</technical_language>

Target:
private Message.Builder getMessageBuilder(Class<?> clazz) { try { Method method = methodCache.get(clazz); if (method == null) { method = clazz.getMethod("newBuilder"); methodCache.put(clazz, method); } return (Message.Builder) method.invoke(clazz); } catch (Exception ex) { throw new MessageConversionException( "Invalid Protobuf Message type: no invocable newBuilder() method on " + clazz, ex); } }
Source:
<code>static String base64(byte[] data) { <START> byte[] encodedData = Base64.getEncoder().encode(data); <END> return new String(encodedData, StandardCharsets.UTF_8); }</code><technical_language>@doom369 wondering if call encodeToString directly. WDYT</technical_language>

Target:
static String base64(byte[] data) { return Base64.getEncoder().encodeToString(data); }
Source:
<code>public void onAdd(SolApplication solApplication) { IniReader reader = new IniReader(Const.SAVE_FILE_NAME, null); String saveMajorVersion = reader.getString("version", "").split("\\.")[0]; String gameMajorVersion = Const.VERSION.split("\\.")[0]; <START> continueControl.setEnabled(SaveManager.hasPrevShip("prevShip.ini") && saveMajorVersion.equals(gameMajorVersion)); <END> }</code><technical_language>"prevShip.ini" here, constant defined. In fact, I file passed save manager, more of a save manager concern. I consider moving of this logic hasPrevShip function</technical_language>

Target:
public void onAdd(SolApplication solApplication) { continueControl.setEnabled(SaveManager.hasPreviousCompatibleShip()); }
Source:
<code>public boolean execute(int retries, MapOperation mapOperation, ILogger logger) { RecordStore recordStore = mapOperation.recordStore; <START> if (recordStore == null) { <END> return false; } if (recordStore.getInMemoryFormat() != NATIVE || recordStore.getEvictionPolicy() == NONE) { return false; } MapContainer mapContainer = recordStore.getMapContainer(); Evictor evictor = mapContainer.getEvictor(); for (int i = 0; i < retries; i++) { if (logger.isFineEnabled()) { logger.fine(format( "Applying forced eviction on current RecordStore (map %s, partitionId: %d)!", mapOperation.getName(), mapOperation.getPartitionId() )); } try { evictor.forceEvict(recordStore); mapOperation.runInternal(); return true; } catch (NativeOutOfMemoryError e) { ignore(e); } } return false; }</code><technical_language>Minor: extract this null check in-memory format/eviction policy check a static method invoke other implementations of ForcedEviction</technical_language>

Target:
public boolean execute(int retries, MapOperation mapOperation, ILogger logger) { if (doesNotHaveRecordStore(mapOperation)) { return false; } RecordStore recordStore = mapOperation.recordStore; if (!nativeFormatWithEvictionPolicy(recordStore)) { return false; } MapContainer mapContainer = recordStore.getMapContainer(); Evictor evictor = mapContainer.getEvictor(); for (int i = 0; i < retries; i++) { if (logger.isFineEnabled()) { logger.fine(format( "Applying forced eviction on current RecordStore (map %s, partitionId: %d)!", mapOperation.getName(), mapOperation.getPartitionId() )); } try { evictor.forceEvict(recordStore); mapOperation.runInternal(); return true; } catch (NativeOutOfMemoryError e) { ignore(e); } } return false; }
Source:
<code>public void onFailure(Throwable caught) { if (hasResponse()) { <START> GWT.log("HTTP " + getResponse().getStatusCode() + ": " + getResponse().getStatusText()); <END> } Message message = new Message(translateCauses(caught), MessageStyle.ERROR); DisplayMessageEvent.fire(hasHandlers, message); }</code><technical_language>remove this log</technical_language>

Target:
public void onFailure(Throwable caught) { Message message = new Message(translateCauses(caught), MessageStyle.ERROR); DisplayMessageEvent.fire(hasHandlers, message); }
Source:
<code>public void stop() { coapServer.stop(); if (clientRegistry instanceof Stoppable) { ((Stoppable) clientRegistry).stop(); } if (securityRegistry instanceof Stoppable) { ((Stoppable) securityRegistry).stop(); } if (observationRegistry instanceof Stoppable) { ((Stoppable) observationRegistry).stop(); } <START> <END> LOG.info("LW-M2M server stopped"); }</code><technical_language>stop queueRequestSender</technical_language>

Target:
public void stop() { coapServer.stop(); if (clientRegistry instanceof Stoppable) { ((Stoppable) clientRegistry).stop(); } if (securityRegistry instanceof Stoppable) { ((Stoppable) securityRegistry).stop(); } if (observationRegistry instanceof Stoppable) { ((Stoppable) observationRegistry).stop(); } if (queueRequestSender instanceof Stoppable) { ((Stoppable) queueRequestSender).stop(); } LOG.info("LW-M2M server stopped"); }
Source:
<code>public void setLogFilePermission(String fileName) throws IOException { File file = new File(logRootDir, fileName).getCanonicalFile(); boolean runAsUser = ObjectReader.getBoolean(stormConf.get(SUPERVISOR_RUN_WORKER_AS_USER), false); File parent = new File(logRootDir, fileName).getParentFile(); Optional<File> mdFile = (parent == null) ? Optional.empty() : getMetadataFileForWorkerLogDir(parent); Optional<String> topoOwner = mdFile.isPresent() ? Optional.of(getTopologyOwnerFromMetadataFile(mdFile.get().getCanonicalPath())) : Optional.empty(); if (runAsUser && topoOwner.isPresent() && file.exists() && !Files.isReadable(file.toPath())) { LOG.debug("Setting permissions on file with topo-owner {}", fileName, topoOwner); try { ClientSupervisorUtils.processLauncherAndWait(stormConf, topoOwner.get(), Lists.newArrayList("blob", file.getCanonicalPath()), null, "setup group read permissions for file: " + fileName); } catch (IOException e) { <START> ExceptionMeters.NUM_PERMISSION_EXCEPTIONS.mark(); <END> throw e; } } }</code><technical_language>exception name is clear</technical_language>

Target:
public void setLogFilePermission(String fileName) throws IOException { File file = new File(logRootDir, fileName).getCanonicalFile(); boolean runAsUser = ObjectReader.getBoolean(stormConf.get(SUPERVISOR_RUN_WORKER_AS_USER), false); File parent = new File(logRootDir, fileName).getParentFile(); Optional<File> mdFile = (parent == null) ? Optional.empty() : getMetadataFileForWorkerLogDir(parent); Optional<String> topoOwner = mdFile.isPresent() ? Optional.of(getTopologyOwnerFromMetadataFile(mdFile.get().getCanonicalPath())) : Optional.empty(); if (runAsUser && topoOwner.isPresent() && file.exists() && !Files.isReadable(file.toPath())) { LOG.debug("Setting permissions on file with topo-owner {}", fileName, topoOwner); try { ClientSupervisorUtils.processLauncherAndWait(stormConf, topoOwner.get(), Lists.newArrayList("blob", file.getCanonicalPath()), null, "setup group read permissions for file: " + fileName); } catch (IOException e) { ExceptionMeters.NUM_SET_PERMISSION_EXCEPTIONS.mark(); throw e; } } }
Source:
<code>private void estimateCommandsMachineName( Devfile devfile, Tool tool, KubernetesList recipeObjects) { List<Command> toolsCommands = devfile .getCommands() .stream() .filter(c -> c.getActions().get(0).getTool().equals(tool.getName())) .collect(toList()); if (toolsCommands.isEmpty()) { return; } List<Pod> pods = recipeObjects .getItems() .stream() .filter(hasMetadata -> hasMetadata instanceof Pod) .map(hasMetadata -> (Pod) hasMetadata) .collect(toList()); if (pods.size() != 1) { <START> return; <END> } Pod pod = pods.get(0); List<Container> containers = pod.getSpec().getContainers(); if (containers.size() != 1) { return; } Container container = containers.get(0); String machineName = Names.machineName(pod, container); toolsCommands.forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }</code><technical_language>describe why, what</technical_language>

Target:
private void estimateCommandsMachineName( Devfile devfile, Tool tool, KubernetesList recipeObjects) { List<Command> toolsCommands = devfile .getCommands() .stream() .filter(c -> c.getActions().get(0).getTool().equals(tool.getName())) .collect(toList()); if (toolsCommands.isEmpty()) { return; } List<Pod> pods = recipeObjects .getItems() .stream() .filter(hasMetadata -> hasMetadata instanceof Pod) .map(hasMetadata -> (Pod) hasMetadata) .collect(toList()); Pod pod; if (pods.size() != 1 || (pod = pods.get(0)).getSpec().getContainers().isEmpty()) { return; } String machineName = Names.machineName(pod, pod.getSpec().getContainers().get(0)); toolsCommands.forEach(c -> c.getAttributes().put(MACHINE_NAME_ATTRIBUTE, machineName)); }
Source:
<code><START> private String encrypt(String value) { <END> try { return getStorageHelper().encrypt(mContext, value); } catch (GeneralSecurityException | IOException e) { Logger.e(TAG, "Encryption failure", "", ADALError.ENCRYPTION_FAILED, e); } return null; }</code><technical_language>nit: space</technical_language>

Target:
private String encrypt(String value) { try { return getStorageHelper().encrypt(value); } catch (GeneralSecurityException | IOException e) { Logger.e(TAG, "Encryption failure", "", ADALError.ENCRYPTION_FAILED, e); } return null; }
Source:
<code>public String getBackupIdentifier() { <START> return Const.SystemParams.ACCOUNT_ATTRIBUTES_BACKUP_LOG_MSG + this.googleId; <END> }</code><technical_language>Beside AccountAttributes.java, more *Atrributes.java need changed</technical_language>

Target:
public String getBackupIdentifier() { return ACCOUNT_ATTRIBUTES_BACKUP_LOG_MSG + this.googleId; }
Source:
<code><START> protected static WebDriver getCurrentBrowser() { <END> return b.getCurrentWebDriver(); }</code><technical_language>"protected static" is ok? sense override static methods</technical_language>

Target:
protected WebDriver getCurrentBrowser() { return b.getCurrentWebDriver(); }
Source:
<code>public void onlineUseCase() { <START> Assume.assumeTrue(mCameraId != null); <END> mCamera.open(); mCamera.addOnlineUseCase(Collections.<UseCase>singletonList(mFakeUseCase)); verify(mMockOnImageAvailableListener, never()).onImageAvailable(any(ImageReader.class)); mCamera.release(); }</code><technical_language>put this in test, put in setup() method</technical_language>

Target:
public void onlineUseCase() { mCamera.open(); mCamera.addOnlineUseCase(Collections.<UseCase>singletonList(mFakeUseCase)); verify(mMockOnImageAvailableListener, never()).onImageAvailable(any(ImageReader.class)); mCamera.release(); }
Source:
<code><START> public Boolean isWakeupEvent(ITmfEvent event) { <END> String eventName = event.getName(); ITmfTrace trace = event.getTrace(); LttngEventLayout eventLayout = getProvider().getEventLayout(); String wakeupEventName = NonNullUtils.nullToEmptyString(fWakeupEventMap.get(trace)); if (wakeupEventName.equals(eventLayout.eventSchedProcessWaking()) && (eventName.equals(eventLayout.eventSchedProcessWaking()) || eventName.equals(eventLayout.eventSchedProcessWakeupNew()))) { return NonNullUtils.checkNotNull(Boolean.TRUE); } else if (wakeupEventName.equals(eventLayout.eventSchedProcessTTWU()) && eventName.equals(eventLayout.eventSchedProcessTTWU())) { return NonNullUtils.checkNotNull(Boolean.TRUE); } return NonNullUtils.checkNotNull(Boolean.FALSE); }</code><technical_language>boolean? (lowercase?)</technical_language>

Target:
public boolean isWakeupEvent(ITmfEvent event) { String eventName = event.getName(); ITmfTrace trace = event.getTrace(); LttngEventLayout eventLayout = getProvider().getEventLayout(); String wakeupEventName = NonNullUtils.nullToEmptyString(fWakeupEventMap.get(trace)); if (wakeupEventName.equals(eventLayout.eventSchedProcessWaking())) { return (eventName.equals(eventLayout.eventSchedProcessWaking()) || eventName.equals(eventLayout.eventSchedProcessWakeupNew())); } if (wakeupEventName.equals(eventLayout.eventSchedProcessTTWU())) { return eventName.equals(eventLayout.eventSchedProcessTTWU()); } return false; }
Source:
<code>private void triggerDeveloperBan(final CertifiedProductSearchDetails updatedListing) { Scheduler scheduler; try { scheduler = getScheduler(); TriggerKey triggerId = triggerKey("triggerBanNow_" + new Date().getTime(), "triggerDeveloperBanTrigger"); JobKey jobId = jobKey("Trigger Developer Ban Notification", "chplJobs"); Trigger qzTrigger = newTrigger() .withIdentity(triggerId) .startNow() .forJob(jobId) .usingJobData("status", updatedListing.getCurrentStatus().getStatus().getName()) .usingJobData("dbId", updatedListing.getId()) .usingJobData("chplId", updatedListing.getChplProductNumber()) .usingJobData("developer", updatedListing.getDeveloper().getName()) .usingJobData("acb", updatedListing.getCertifyingBody().get("name").toString()) .usingJobData("changeDate", new Date().getTime()) .usingJobData("firstName", Util.getCurrentUser().getFullName()) <START> .usingJobData("lastName", Util.getCurrentUser().getFriendlyName()) <END> .usingJobData("effectiveDate", updatedListing.getCurrentStatus().getEventDate()) .usingJobData("openNcs", updatedListing.getCountOpenNonconformities()) .usingJobData("closedNcs", updatedListing.getCountClosedNonconformities()) .build(); scheduler.scheduleJob(qzTrigger); } catch (SchedulerException e) { LOGGER.error("Could not start Trigger Developer Ban", e); } }</code><technical_language>matter "firstName" "lastName" keys here? full friendly anyway</technical_language>

Target:
private void triggerDeveloperBan(final CertifiedProductSearchDetails updatedListing) { Scheduler scheduler; try { scheduler = getScheduler(); TriggerKey triggerId = triggerKey("triggerBanNow_" + new Date().getTime(), "triggerDeveloperBanTrigger"); JobKey jobId = jobKey("Trigger Developer Ban Notification", "chplJobs"); Trigger qzTrigger = newTrigger() .withIdentity(triggerId) .startNow() .forJob(jobId) .usingJobData("status", updatedListing.getCurrentStatus().getStatus().getName()) .usingJobData("dbId", updatedListing.getId()) .usingJobData("chplId", updatedListing.getChplProductNumber()) .usingJobData("developer", updatedListing.getDeveloper().getName()) .usingJobData("acb", updatedListing.getCertifyingBody().get("name").toString()) .usingJobData("changeDate", new Date().getTime()) .usingJobData("fullName", Util.getCurrentUser().getFullName()) .usingJobData("effectiveDate", updatedListing.getCurrentStatus().getEventDate()) .usingJobData("openNcs", updatedListing.getCountOpenNonconformities()) .usingJobData("closedNcs", updatedListing.getCountClosedNonconformities()) .build(); scheduler.scheduleJob(qzTrigger); } catch (SchedulerException e) { LOGGER.error("Could not start Trigger Developer Ban", e); } }
Source:
<code>public void destroyTelephonyConference() { for (Connection c : getConnections()) { <START> notifyConferenceMembershipChanged(c); <END> } destroy(); }</code><technical_language>doesn;t membership of connections changed yet.. removeTelephonyConnection called for of connections first</technical_language>

Target:
public void destroyTelephonyConference() { Iterator<Connection> connectionIterator = getConnections().iterator(); while (connectionIterator.hasNext()) { removeTelephonyConnection(connectionIterator.next()); } destroy(); }
Source:
<code>private long getWatermarkMs(String realtimeTableName, List<LLCRealtimeSegmentZKMetadata> completedSegmentsMetadata, long bucketMs) { RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata = _clusterInfoAccessor.getMinionRealtimeToOfflineSegmentsTaskMetadata(realtimeTableName); if (realtimeToOfflineSegmentsTaskMetadata == null) { long watermarkMs; long minStartTimeMs = Long.MAX_VALUE; for (LLCRealtimeSegmentZKMetadata realtimeSegmentZKMetadata : completedSegmentsMetadata) { minStartTimeMs = Math.min(minStartTimeMs, realtimeSegmentZKMetadata.getStartTimeMs()); <START> } <END> watermarkMs = (minStartTimeMs / bucketMs) * bucketMs; realtimeToOfflineSegmentsTaskMetadata = new RealtimeToOfflineSegmentsTaskMetadata(realtimeTableName, watermarkMs); _clusterInfoAccessor.setRealtimeToOfflineSegmentsTaskMetadata(realtimeToOfflineSegmentsTaskMetadata); } return realtimeToOfflineSegmentsTaskMetadata.getWatermarkMs(); }</code><technical_language>Do want add Preconditions.checkState(minStartTimeMs != Long.MAX_VALUE); throw exception condition</technical_language>

Target:
private long getWatermarkMs(String realtimeTableName, List<LLCRealtimeSegmentZKMetadata> completedSegmentsMetadata, long bucketMs) { RealtimeToOfflineSegmentsTaskMetadata realtimeToOfflineSegmentsTaskMetadata = _clusterInfoAccessor.getMinionRealtimeToOfflineSegmentsTaskMetadata(realtimeTableName); if (realtimeToOfflineSegmentsTaskMetadata == null) { long watermarkMs; long minStartTimeMs = Long.MAX_VALUE; for (LLCRealtimeSegmentZKMetadata realtimeSegmentZKMetadata : completedSegmentsMetadata) { minStartTimeMs = Math.min(minStartTimeMs, realtimeSegmentZKMetadata.getStartTimeMs()); } Preconditions.checkState(minStartTimeMs != Long.MAX_VALUE); watermarkMs = (minStartTimeMs / bucketMs) * bucketMs; realtimeToOfflineSegmentsTaskMetadata = new RealtimeToOfflineSegmentsTaskMetadata(realtimeTableName, watermarkMs); _clusterInfoAccessor.setRealtimeToOfflineSegmentsTaskMetadata(realtimeToOfflineSegmentsTaskMetadata); } return realtimeToOfflineSegmentsTaskMetadata.getWatermarkMs(); }
Source:
<code>private static void printTumorTypeSummary(Set<Evidence> evidences, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException { URL feedUrl = entry.getListFeedUrl(); if (evidences != null && service != null && entry != null) { for (Evidence evidence : evidences) { ListEntry row = new ListEntry(); setValue(row, "Gene", evidence.getGene().getHugoSymbol()); List<String> alterationNames = new ArrayList<>(); <START> for (Alteration alteration : evidence.getAlterations()) { <END> if (StringUtils.isNullOrEmpty(alteration.getName())) { alterationNames.add(alteration.getAlteration()); } else { alterationNames.add(alteration.getName()); } } setValue(row, "Variants", MainUtils.listToString(alterationNames, ", ")); setValue(row, "CancerType", getCancerType(evidence.getOncoTreeType())); setValue(row, "Summary", evidence.getDescription()); service.insert(feedUrl, row); } } }</code><technical_language>Put this snippet of alterationNames a function. code is in printEvidences()</technical_language>

Target:
private static void printTumorTypeSummary(Set<Evidence> evidences, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException { URL feedUrl = entry.getListFeedUrl(); if (evidences != null && service != null && entry != null) { for (Evidence evidence : evidences) { ListEntry row = new ListEntry(); setValue(row, "Gene", evidence.getGene().getHugoSymbol()); List<String> alterationNames = getAlterationNameByEvidence(evidence); setValue(row, "Variants", MainUtils.listToString(alterationNames, ", ")); setValue(row, "CancerType", getCancerType(evidence.getOncoTreeType())); setValue(row, "Summary", evidence.getDescription()); service.insert(feedUrl, row); } } }
Source:
<code>public static String md5(String str) { MessageDigest m = null; try { m = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); <START> } <END> m.update(str.getBytes(),0,str.length()); return new BigInteger(1,m.digest()).toString(16); }</code><technical_language>throw unchecked exception simply print error if error occurs variable 'm' null NullPointerException thrown (line 16). try { m = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); //use logger instead throw new RuntimeException("No Algorithm: MD5"); }</technical_language>

Target:
public static String md5(String str) { MessageDigest m = null; try { m = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException("No Such Algorithm: MD5"); } m.update(str.getBytes(),0,str.length()); return new BigInteger(1,m.digest()).toString(16); }
Source:
<code><START> public Map<K, V> removeAll(BiPredicate<? super K, ? super V> predicate) { <END> Objects.requireNonNull(predicate, "predicate is null"); return filter(predicate.negate()); }</code><technical_language>return type M</technical_language>

Target:
public M removeAll(BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate is null"); return filter(predicate.negate()); }
Source:
<code><START> static Path getCMPath(Configuration conf, String checkSum) throws IOException, MetaException { <END> String newFileName = checkSum; int maxLength = conf.getInt(DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_KEY, DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_DEFAULT); if (newFileName.length() > maxLength) { newFileName = newFileName.substring(0, maxLength-1); } return new Path(cmroot, newFileName); }</code><technical_language>getCMPath throw IOException MetaException. check remove it</technical_language>

Target:
static Path getCMPath(Configuration conf, String checkSum) { String newFileName = checkSum; int maxLength = conf.getInt(DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_KEY, DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_DEFAULT); if (newFileName.length() > maxLength) { newFileName = newFileName.substring(0, maxLength-1); } return new Path(cmroot, newFileName); }
Source:
<code><START> public void onApplicationEvent(ApplicationEvent event) { <END> if (event instanceof ApplicationEnvironmentPreparedEvent) { ApplicationEnvironmentPreparedEvent castEvent = (ApplicationEnvironmentPreparedEvent) event; String componentName = castEvent.getEnvironment().getProperty("info.component"); LOG.info("Setting service name to {}", componentName); CommonLogHolder.setServiceType(componentName); } if (event instanceof ApplicationFailedEvent) { LOG.info("Terminating default logging context"); ((LoggerContext) LoggerFactory.getILoggerFactory()).reset(); BasicConfigurator.configureDefaultContext(); } }</code><technical_language>this overloaded avoid casts</technical_language>

Target:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ApplicationEnvironmentPreparedEvent) { ApplicationEnvironmentPreparedEvent castEvent = (ApplicationEnvironmentPreparedEvent) event; String serviceName = castEvent.getSpringApplication().getMainApplicationClass().getPackage().getImplementationTitle(); LOG.info("Setting service name to {}", serviceName); CommonLogHolder.setServiceType(serviceName); } if (event instanceof ApplicationFailedEvent) { LOG.info("Terminating default logging context"); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); new BasicConfigurator().configure(loggerContext); } }
Source:
<code>private String getBundleVersion() { ClassLoader cl = getClass().getClassLoader(); if (cl instanceof URLClassLoader) { <START> URL url = ((URLClassLoader) cl).findResource(JarFile.MANIFEST_NAME); <END> try { Manifest manifest = new Manifest(url.openStream()); return manifest.getMainAttributes().getValue("Bundle-Version"); } catch (IOException e) { } } return null; }</code><technical_language>url checked for null</technical_language>

Target:
private String getBundleVersion() { ClassLoader cl = getClass().getClassLoader(); if (cl instanceof URLClassLoader) { URL url = ((URLClassLoader) cl).findResource(JarFile.MANIFEST_NAME); if (url != null) return getBundleVersion(url); } return null; }
Source:
<code>public Response ackAlert( <START> @ApiParam(required = true, value = "The alertId to Ack.", allowableValues = "An existing alertId.") @PathParam("alertId") final String alertId, <END> @ApiParam(required = false, value = "User acknowledging the alerts.") @QueryParam("ackBy") final String ackBy, @ApiParam(required = false, value = "Additional notes associated with the acknowledgement.") @QueryParam("ackNotes") final String ackNotes) { try { if (!isEmpty(alertId)) { alertsService.ackAlerts(tenantId, Arrays.asList(alertId), ackBy, ackNotes); if (log.isDebugEnabled()) { log.debug("AlertId: " + alertId); } return ResponseUtil.ok(); } else { return ResponseUtil.badRequest("AlertId required for ack"); } } catch (Exception e) { log.debug(e.getMessage(), e); if (e.getCause() != null && e.getCause() instanceof IllegalArgumentException) { return ResponseUtil.badRequest("Bad arguments: " + e.getMessage()); } return ResponseUtil.internalError(e); } }</code><technical_language>break/change format here. I annotation in a line for consistency readability. some automatic formatting IDE here</technical_language>

Target:
public Response ackAlert( @ApiParam(required = true, value = "The alertId to Ack.", allowableValues = "An existing alertId.") @PathParam("alertId") final String alertId, @ApiParam(required = false, value = "User acknowledging the alerts.") @QueryParam("ackBy") final String ackBy, @ApiParam(required = false, value = "Additional notes associated with the acknowledgement.") @QueryParam("ackNotes") final String ackNotes) { try { if (!isEmpty(alertId)) { alertsService.ackAlerts(tenantId, Arrays.asList(alertId), ackBy, ackNotes); log.debugf("AlertId: %s", alertId); return ResponseUtil.ok(); } return ResponseUtil.badRequest("AlertId required for ack"); } catch (Exception e) { return ResponseUtil.onException(e, log); } }
Source:
<code>public static String humanReadable(float bytes) { <START> if (bytes > GB) { <END> return String.format("%.03f GB", bytes / GB); } else if (bytes > MB) { return String.format("%.03f MB", bytes / MB); } else if (bytes > KB) { return String.format("%.03f kB", bytes / KB); } else { return String.format("%.02f B", bytes); } }</code><technical_language>TB too</technical_language>

Target:
public static String humanReadable(float bytes) { if (bytes > TB) { return String.format("%.03f TB", bytes / TB); } else if (bytes > GB) { return String.format("%.03f GB", bytes / GB); } else if (bytes > MB) { return String.format("%.03f MB", bytes / MB); } else if (bytes > KB) { return String.format("%.03f kB", bytes / KB); } else { return String.format("%.02f B", bytes); } }
Source:
<code>private void reset() { if (chunk != null) { chunkedInput = new HttpChunkedInput(new RepeatedBytesInput()); request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, path); HttpUtil.setContentLength(request, totalSize); request.headers().add(RestUtils.Headers.BLOB_SIZE, totalSize); request.headers().add(RestUtils.Headers.SERVICE_ID, serviceId); request.headers().add(RestUtils.Headers.AMBRY_CONTENT_TYPE, "application/octet-stream"); <START> if (targetAccountName != null) { <END> request.headers().add(RestUtils.Headers.TARGET_ACCOUNT_NAME, targetAccountName); } if (targetContainerName != null) { request.headers().add(RestUtils.Headers.TARGET_CONTAINER_NAME, targetContainerName); } } else { if (pathList == null) { request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); } else { request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, pathList.get(counter.getAndIncrement() % pathList.size())); } } for (Pair<String, String> headerNameValue : customHeaders) { request.headers().add(headerNameValue.getFirst(), headerNameValue.getSecond()); } chunksReceived = 0; sizeReceived = 0; lastChunkReceiveTime = 0; requestStartTime = System.currentTimeMillis(); response = null; }</code><technical_language>Do worthwhile check !targetAccountName.isEmpty() well? for container's check</technical_language>

Target:
private void reset() { if (chunk != null) { chunkedInput = new HttpChunkedInput(new RepeatedBytesInput()); request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, path); HttpUtil.setContentLength(request, totalSize); request.headers().add(RestUtils.Headers.BLOB_SIZE, totalSize); request.headers().add(RestUtils.Headers.SERVICE_ID, serviceId); request.headers().add(RestUtils.Headers.AMBRY_CONTENT_TYPE, "application/octet-stream"); if (targetAccountName != null && !targetAccountName.isEmpty()) { request.headers().add(RestUtils.Headers.TARGET_ACCOUNT_NAME, targetAccountName); } if (targetContainerName != null && !targetContainerName.isEmpty() ) { request.headers().add(RestUtils.Headers.TARGET_CONTAINER_NAME, targetContainerName); } } else { if (pathList == null) { request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); } else { request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, pathList.get(counter.getAndIncrement() % pathList.size())); } } for (Pair<String, String> headerNameValue : customHeaders) { request.headers().add(headerNameValue.getFirst(), headerNameValue.getSecond()); } chunksReceived = 0; sizeReceived = 0; lastChunkReceiveTime = 0; requestStartTime = System.currentTimeMillis(); response = null; }
Source:
<code>private void load() { List<OnmsNode> nodes = nodeDao.findAll(); this.sparseGraph = new DirectedSparseGraph(); <START> int counter = 0; <END> for (OnmsNode node : nodes) { CustomVertex vertexChild = new CustomVertex(NAMESPACE, node); if (node.getParent() == null) { this.sparseGraph.addVertex(vertexChild); } else { CustomVertex vertexParent = new CustomVertex(NAMESPACE, node.getParent()); vertexChild.setParent(vertexParent); this.sparseGraph.addVertex(vertexChild); this.sparseGraph.addVertex(vertexParent); this.sparseGraph.addEdge(new AbstractEdge(NAMESPACE, String.valueOf(counter), vertexParent, vertexChild), vertexParent, vertexChild, EdgeType.DIRECTED); counter++; } } List<CustomVertex> tempVertices = new ArrayList<>(); for (CustomVertex vertex : this.sparseGraph.getVertices()) { Collection<CustomVertex> predecessors = this.sparseGraph.getPredecessors(vertex); if (predecessors.isEmpty()) { vertex.setLevel(0); tempVertices.add(vertex); tempVertices.addAll(setLevel(this.sparseGraph, vertex, 1)); } } for (CustomVertex customVertex : tempVertices) { this.addVertices(customVertex); } for (AbstractEdge abstractEdge : this.sparseGraph.getEdges()) { this.addEdges(abstractEdge); } }</code><technical_language>Please rename edgeId</technical_language>

Target:
private void load() { List<OnmsNode> nodes = nodeDao.findAll(); this.sparseGraph = new DirectedSparseGraph(); int edgeID = 0; for (OnmsNode node : nodes) { PathOutageVertex vertexChild = new PathOutageVertex(node); if (node.getParent() == null) { this.sparseGraph.addVertex(vertexChild); } else { PathOutageVertex vertexParent = new PathOutageVertex(node.getParent()); vertexChild.setParent(vertexParent); this.sparseGraph.addVertex(vertexChild); this.sparseGraph.addVertex(vertexParent); this.sparseGraph.addEdge(new AbstractEdge(NAMESPACE, String.valueOf(edgeID), vertexParent, vertexChild), vertexParent, vertexChild, EdgeType.DIRECTED); edgeID++; } } List<PathOutageVertex> tempVertices = new ArrayList<>(); for (PathOutageVertex vertex : this.sparseGraph.getVertices()) { Collection<PathOutageVertex> predecessors = this.sparseGraph.getPredecessors(vertex); if (predecessors.isEmpty()) { vertex.setLevel(0); tempVertices.add(vertex); tempVertices.addAll(setLevel(this.sparseGraph, vertex, 1)); } } for (PathOutageVertex customVertex : tempVertices) { this.addVertices(customVertex); } for (AbstractEdge abstractEdge : this.sparseGraph.getEdges()) { this.addEdges(abstractEdge); } }
Source:
<code>public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) { BrowserProxySettings browserProxySettings = admin.getOptions().browserProxySettings(); KeyStoreSettings caKeyStore = browserProxySettings.caKeyStore(); try { X509KeyStore x509KeyStore = new X509KeyStore(caKeyStore.loadStore(), caKeyStore.password().toCharArray()); X509Certificate certificate = x509KeyStore.getCertificateAuthority().certificateChain()[0]; return new ResponseDefinitionBuilder() .withStatus(HTTP_OK) .withHeader("Content-Type", "application/x-pem-file") .withBody( "-----BEGIN CERTIFICATE-----\r\n" + BASE64_ENCODER.encodeToString(certificate.getEncoded()) + "\r\n" + "-----END CERTIFICATE-----" ) .build(); } catch (Exception e) { StringWriter stacktrace = new StringWriter(); e.printStackTrace(new PrintWriter(stacktrace)); return new ResponseDefinition( HTTP_INTERNAL_ERROR, "Failed to export certificate authority cert from " + caKeyStore.path() + "\r\n" + <START> stacktrace <END> ); } }</code><technical_language>log stacktrace, sending response</technical_language>

Target:
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) { BrowserProxySettings browserProxySettings = admin.getOptions().browserProxySettings(); KeyStoreSettings caKeyStore = browserProxySettings.caKeyStore(); try { X509KeyStore x509KeyStore = new X509KeyStore(caKeyStore.loadStore(), caKeyStore.password().toCharArray()); X509Certificate certificate = x509KeyStore.getCertificateAuthority().certificateChain()[0]; return new ResponseDefinitionBuilder() .withStatus(HTTP_OK) .withHeader("Content-Type", "application/x-pem-file") .withBody( "-----BEGIN CERTIFICATE-----\r\n" + BASE64_ENCODER.encodeToString(certificate.getEncoded()) + "\r\n" + "-----END CERTIFICATE-----" ) .build(); } catch (Exception e) { String message = "Failed to export certificate authority cert from " + caKeyStore.path(); admin.getOptions().notifier().error(message, e); return new ResponseDefinition(HTTP_INTERNAL_ERROR, message); } }
Source:
<code>public Function<Element, LeaseElement> parser() { return (element -> { NodeList childElements = element.getElementsByTagNameNS(NAMESPACE_STRING, LEASE_LENGTH_ELEMENT_NAME); if (childElements.getLength() != 1) { LOGGER.error("Found " + childElements.getLength() + " lease-length elements. The XSD should have prevented this."); throw new AssertionError("The schema for connection-leasing element requires one and only one lease-length element"); } Element leaseLengthElement = (Element)childElements.item(0); String leaseLengthString = leaseLengthElement.getTextContent(); LOGGER.info("Found lease length XML text: " + leaseLengthString); String timeUnitString = leaseLengthElement.getAttribute(TIME_UNIT_ATTRIBUTE_NAME); LOGGER.info("Found lease length time unit: " + timeUnitString); LeaseElement leaseElement = new LeaseElement(); <START> leaseElement.setLeaseValue(leaseLengthString); <END> leaseElement.setTimeUnit(timeUnitString); return leaseElement; }); }</code><technical_language>set values in constructor</technical_language>

Target:
private Function<Element, LeaseElement> parser() { return (element -> { NodeList childElements = element.getElementsByTagNameNS(NAMESPACE_STRING, LEASE_LENGTH_ELEMENT_NAME); if (childElements.getLength() != 1) { LOGGER.error("Found " + childElements.getLength() + " lease-length elements. The XSD should have prevented this."); throw new AssertionError("The schema for connection-leasing element requires one and only one lease-length element"); } Element leaseLengthElement = (Element)childElements.item(0); String leaseLengthString = leaseLengthElement.getTextContent(); LOGGER.info("Found lease length XML text: " + leaseLengthString); String timeUnitString = leaseLengthElement.getAttribute(TIME_UNIT_ATTRIBUTE_NAME); LOGGER.info("Found lease length time unit: " + timeUnitString); LeaseElement leaseElement = new LeaseElement(leaseLengthString, timeUnitString); return leaseElement; }); }
Source:
<code>XAResourceRegistryFile(Xid xid) throws SystemException { final String xidString = SimpleXid.of(xid).toHexString('_'); this.filePath = xaRecoveryPath.resolve(xidString); try { fileChannel = doPrivileged((PrivilegedExceptionAction<FileChannel>) () -> { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { <START> sm.checkPermission(new FilePermission(xaRecoveryPath.toString() + File.separatorChar + '*', "read,write")); <END> } xaRecoveryPath.toFile().mkdir(); return FileChannel.open(filePath, StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW); }); openFilePaths.add(xidString); fileChannel.lock(); Log.log.xaResourceRecoveryFileCreated(filePath); } catch (PrivilegedActionException e) { throw Log.log.createXAResourceRecoveryFileFailed(filePath, (IOException)e.getCause()); } catch (IOException e) { throw Log.log.createXAResourceRecoveryFileFailed(filePath, e); } }</code><technical_language>@tadamski If cache this FilePermission in FileSystemXAResourceRecoveryRegistry object save a per-transaction objection creation/gc</technical_language>

Target:
XAResourceRegistryFile(Xid xid) throws SystemException { final String xidString = SimpleXid.of(xid).toHexString('_'); this.filePath = xaRecoveryPath.resolve(xidString); try { fileChannel = doPrivileged((PrivilegedExceptionAction<FileChannel>) () -> { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(xaRecoveryDirPermission); } xaRecoveryPath.toFile().mkdir(); return FileChannel.open(filePath, StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW); }); openFilePaths.add(xidString); fileChannel.lock(); Log.log.xaResourceRecoveryFileCreated(filePath); } catch (PrivilegedActionException e) { throw Log.log.createXAResourceRecoveryFileFailed(filePath, (IOException)e.getCause()); } catch (IOException e) { throw Log.log.createXAResourceRecoveryFileFailed(filePath, e); } }
Source:
<code>public void fromRunnable() { Completable.fromRunnable(new Runnable() { @Override public void run() { <START> <END> } }) .test() .assertResult(); }</code><technical_language>increment a counter assert 1</technical_language>

Target:
public void fromRunnable() { final AtomicInteger atomicInteger = new AtomicInteger(); Completable.fromRunnable(new Runnable() { @Override public void run() { atomicInteger.incrementAndGet(); } }) .test() .assertResult(); assertEquals(1, atomicInteger.get()); }