auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); if ( Version.getJavaRelease() >= 8 ) { <START> this.defaultParameterNameProvider = new Java8DefaultParameterNameProvider(); <END> } else { this.defaultParameterNameProvider = new DefaultParameterNameProvider(); } this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }</code><technical_language>default? I agree this nice (and surely do of BV 1.2) for spec [describes](<LINK_0> "arg0", "arg1" etc. default names. I feel stick this for now</technical_language>

Target:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }
Source:
<code><START> @SuppressWarnings("unused") public void setQueryResults(List<QueryResult> queryResults) { <END> this.queryResults = queryResults; }</code><technical_language>I queryResults final remove method</technical_language>

Target:
public void setQueryResults(List<QueryResult> queryResults) { this.queryResults = queryResults; }
Source:
<code>public ProcessTxnResult processTxn(Request request) { TxnHeader hdr = request.getHdr(); processTxnForSessionEvents(request, hdr, request.getTxn()); final boolean writeRequest = (hdr != null); final boolean quorumRequest = request.isQuorum(); if (!writeRequest && !quorumRequest) { return new ProcessTxnResult(); } synchronized (outstandingChanges) { ProcessTxnResult rc = processTxnInDB(hdr, request.getTxn()); if (writeRequest) { long zxid = hdr.getZxid(); while (!outstandingChanges.isEmpty() && outstandingChanges.peek().zxid <= zxid) { ChangeRecord cr = outstandingChanges.remove(); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_REMOVED.add(1); if (cr.zxid < zxid) { <START> LOG.warn("Zxid outstanding is less than current {}", cr.zxid, zxid); <END> } if (outstandingChangesForPath.get(cr.path) == cr) { outstandingChangesForPath.remove(cr.path); } } } if (quorumRequest) { getZKDatabase().addCommittedProposal(request); } return rc; } }</code><technical_language>Add "0x"s? (and Long.tpHexString())</technical_language>

Target:
public ProcessTxnResult processTxn(Request request) { TxnHeader hdr = request.getHdr(); processTxnForSessionEvents(request, hdr, request.getTxn()); final boolean writeRequest = (hdr != null); final boolean quorumRequest = request.isQuorum(); if (!writeRequest && !quorumRequest) { return new ProcessTxnResult(); } synchronized (outstandingChanges) { ProcessTxnResult rc = processTxnInDB(hdr, request.getTxn()); if (writeRequest) { long zxid = hdr.getZxid(); while (!outstandingChanges.isEmpty() && outstandingChanges.peek().zxid <= zxid) { ChangeRecord cr = outstandingChanges.remove(); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_REMOVED.add(1); if (cr.zxid < zxid) { LOG.warn( "Zxid outstanding 0x{} is less than current 0x{}", Long.toHexString(cr.zxid), Long.toHexString(zxid)); } if (outstandingChangesForPath.get(cr.path) == cr) { outstandingChangesForPath.remove(cr.path); } } } if (quorumRequest) { getZKDatabase().addCommittedProposal(request); } return rc; } }
Source:
<code>private void sendBlockEntityToAllPlayers(TileEntity blockEntity) { if (blockEntity == null) { return; } <START> SPacketUpdateTileEntity packet = blockEntity.getUpdatePacket(); <END> if (packet == null) { return; } sendPacketToAllPlayers(packet); }</code><technical_language>change it</technical_language>

Target:
private void sendBlockEntityToAllPlayers(TileEntity blockEntity) { if (blockEntity == null) { return; } Packet packet = blockEntity.getUpdatePacket(); if (packet == null) { return; } sendPacketToAllPlayers(packet); }
Source:
<code>public static void writeHttpResponse(final ChannelHandlerContext ctx, final HttpResponse response, boolean keepAlive) { if (keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); ctx.write(response); } else { ctx.write(response); <START> ctx.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); <END> } }</code><technical_language>this collapsed a single writeAndFlush() call</technical_language>

Target:
public static void writeHttpResponse(final ChannelHandlerContext ctx, final HttpResponse response, boolean keepAlive) { if (keepAlive) { response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); ctx.write(response); } else { ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } }
Source:
<code><START> public Object invoke(final InvocationContext context) throws Exception { <END> Transaction current = TransactionSupport.current(); if (current == null) { return runInTransaction(context, TransactionScopeOption.Required); } else { Transactional transactional = context.getMethod().getAnnotation(Transactional.class); return runInTransaction(context, transactional.propogation()); } }</code><technical_language>is define TransactionalInterceptor inherited define AbstractJpaDao applied for JPA daos</technical_language>

Target:
public Object invoke(final InvocationContext context) throws Exception { Transaction current = TransactionSupport.current(); if (current == null) { return runInTransaction(context, TransactionScopeOption.Required); } else { Transactional transactional = context.getMethod().getAnnotation(Transactional.class); if (transactional != null) { return runInTransaction(context, transactional.propogation()); } else { return context.proceed(); } } }
Source:
<code>protected WorkloadProcessDescriptiveStatistics assembleDescriptiveScenarioStatistics(StatisticsCalculator calculator, TaskData taskData) { WorkloadProcessDescriptiveStatistics statistics = new WorkloadProcessDescriptiveStatistics(); statistics.setTaskData(taskData); List<WorkloadProcessLatencyPercentile> percentiles = Lists.newArrayList(); for (double percentileKey : getGlobalPercentilesKeys()) { double percentileValue = calculator.getPercentile(percentileKey); WorkloadProcessLatencyPercentile percentile = new WorkloadProcessLatencyPercentile(percentileKey, percentileValue); percentile.setWorkloadProcessDescriptiveStatistics(statistics); <START> if (Double.isNaN(percentileKey) || Double.isNaN(percentileValue)) { <END> log.error("Percentile has NaN values : key={}, value={}", percentileKey, percentileValue); continue; } percentiles.add(percentile); } if (!percentiles.isEmpty()) { statistics.setPercentiles(percentiles); } return statistics; }</code><technical_language>place conditional creating WorkloadProcessLatencyPercentile object</technical_language>

Target:
protected WorkloadProcessDescriptiveStatistics assembleDescriptiveScenarioStatistics(StatisticsCalculator calculator, TaskData taskData) { WorkloadProcessDescriptiveStatistics statistics = new WorkloadProcessDescriptiveStatistics(); statistics.setTaskData(taskData); List<WorkloadProcessLatencyPercentile> percentiles = Lists.newArrayList(); for (double percentileKey : getGlobalPercentilesKeys()) { double percentileValue = calculator.getPercentile(percentileKey); if (Double.isNaN(percentileKey) || Double.isNaN(percentileValue)) { log.error("Percentile has NaN values : key={}, value={}", percentileKey, percentileValue); continue; } WorkloadProcessLatencyPercentile percentile = new WorkloadProcessLatencyPercentile(percentileKey, percentileValue); percentile.setWorkloadProcessDescriptiveStatistics(statistics); percentiles.add(percentile); } if (!percentiles.isEmpty()) { statistics.setPercentiles(percentiles); } return statistics; }
Source:
<code><START> Builder parentFolder(File parentFolder) { <END> this.parentFolder = parentFolder; return this; }</code><technical_language>this public? Also, if need getter methods (and I do) put right setter methods</technical_language>

Target:
public Builder parentFolder(File parentFolder) { this.parentFolder = parentFolder; return this; }
Source:
<code>private boolean isOriginalError(Error newError, Optional<Error> originalError) { <START> if (!originalError.isPresent()) { <END> return false; } return originalError.get().equals(newError); }</code><technical_language>optional, luke</technical_language>

Target:
private boolean isOriginalError(Error newError, Optional<Error> originalError) { return originalError.map(error -> error.equals(newError)).orElse(false); }
Source:
<code>public void reloadBrooklynProperties() { log.info("Reloading brooklyn properties from " + builder); BrooklynProperties properties = builder.build(); configMap = properties; if (brooklynAdditionalProperties != null) { log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties); configMap.addFromMap(brooklynAdditionalProperties); } this.downloadsManager = BasicDownloadsManager.newDefault(configMap); this.locationRegistry = null; for (PropertiesReloadListener listener : reloadListeners) { <START> if (listener != null) <END> listener.reloaded(); } }</code><technical_language>prevent null in place; i.e. fail early in addPropertiesReloadListener with: import static com.google.common.base.Preconditions.checkNotNull; reloadListeners.add(checkNotNull(listener, "listener"));</technical_language>

Target:
public void reloadBrooklynProperties() { log.info("Reloading brooklyn properties from " + builder); BrooklynProperties properties = builder.build(); configMap = properties; if (brooklynAdditionalProperties != null) { log.info("Reloading additional brooklyn properties from " + brooklynAdditionalProperties); configMap.addFromMap(brooklynAdditionalProperties); } this.downloadsManager = BasicDownloadsManager.newDefault(configMap); this.locationRegistry = null; for (PropertiesReloadListener listener : reloadListeners) { listener.reloaded(); } }
Source:
<code>private void applyForcedChanges(){ ApiTokenPropertyConfiguration apiTokenPropertyConfiguration = ApiTokenPropertyConfiguration.get(); if(!apiTokenPropertyConfiguration.hasExistingConfigFile()){ <START> apiTokenPropertyConfiguration.setCreationOfLegacyTokenEnabled(false); <END> apiTokenPropertyConfiguration.setTokenGenerationOnCreationEnabled(false); } }</code><technical_language>Log statement catch missing/duplicate invocations of this</technical_language>

Target:
private void applyForcedChanges(){ ApiTokenPropertyConfiguration apiTokenPropertyConfiguration = ApiTokenPropertyConfiguration.get(); if(!apiTokenPropertyConfiguration.hasExistingConfigFile()){ LOGGER.log(Level.INFO, "New API token system configured with insecure options to keep legacy behavior"); apiTokenPropertyConfiguration.setCreationOfLegacyTokenEnabled(false); apiTokenPropertyConfiguration.setTokenGenerationOnCreationEnabled(false); } }
Source:
<code>public void run(final Object[] train, final ZContext chef, final Socket mic) { final int mandat = 5; Fortune star = (Fortune) train[1]; final Entourage entourage = (Entourage) train[3]; final ZContext producer = (ZContext) train[2]; final Set set = (Set) train[0]; final String gossip = (String) train[4]; final Object[] bags = new Object[train.length - mandat]; System.arraycopy(train, mandat, bags, 0, bags.length); if (entourage != null) { entourage.breakaleg(chef, star, mic, bags); } try { String name = star.premiere(mic, bags); set.lights(name, number); showMustGoOn(chef, set, mic, star, bags); } finally { try { boolean tell = star.interview(mic); if (tell && gossip != null) { try { mic.send(gossip); } catch (Exception e) { <START> } <END> } star.party(chef); star = null; if (entourage != null) { entourage.party(chef); } chef.close(); if (producer != null) { producer.close(); } } finally { exit.countDown(); } } }</code><technical_language>curious this one. Swallowing exceptions is bad news, especially unspecific exceptions. remove try/catch altogether exceptions happen, if this is a "this happen" scenario. wrap in some kind of ZMQ exception wrapper class</technical_language>

Target:
public void run(final Object[] train, final ZContext chef, final Socket mic) { final int mandat = 5; Fortune star = (Fortune) train[1]; final Entourage entourage = (Entourage) train[3]; final ZContext producer = (ZContext) train[2]; final Set set = (Set) train[0]; final String gossip = (String) train[4]; final Object[] bags = new Object[train.length - mandat]; System.arraycopy(train, mandat, bags, 0, bags.length); if (entourage != null) { entourage.breakaleg(chef, star, mic, bags); } try { String name = star.premiere(mic, bags); set.lights(name, number); showMustGoOn(chef, set, mic, star, bags); } finally { try { boolean tell = star.interview(mic); if (tell && gossip != null) { try { mic.send(gossip); } catch (ZMQException e) { assert (e.getErrorCode() == Error.ETERM.getCode()); } } star.party(chef); star = null; if (entourage != null) { entourage.party(chef); } chef.close(); if (producer != null) { producer.close(); } } finally { exit.countDown(); } } }
Source:
<code>protected boolean setupWorkingDirectoryAndExtractPackages() { String coreReleasePackageURI = LocalContext.corePackageUri(config); LOG.info("core release package uri: " + coreReleasePackageURI); String coreReleaseFileDestination = Paths.get( topologyWorkingDirectory, "heron-core.tar.gz").toString(); String topologyPackageURI = Runtime.topologyPackageUri(runtime).toString(); String topologyPackageDestination = Paths.get( topologyWorkingDirectory, "topology.tar.gz").toString(); <START> if (!SchedulerUtils.setupWorkingDirectory(topologyWorkingDirectory)) { <END> return false; } final boolean isVerbose = Context.verbose(config); if (config.getBooleanValue(LocalKey.USE_HERON_CORE_URI.value(), LocalKey.USE_HERON_CORE_URI.getDefaultBoolean())) { if (!SchedulerUtils.extractPackage(topologyWorkingDirectory, coreReleasePackageURI, coreReleaseFileDestination, true, isVerbose)) { return false; } } else { Path heronCore = Paths.get(config.getStringValue(Key.HERON_HOME), "heron-core"); Path heronCoreLink = Paths.get(topologyWorkingDirectory, "heron-core"); try { Files.createSymbolicLink(heronCoreLink, heronCore); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Unable to create heron core link from " + heronCoreLink + " to " + heronCore, ioe); return false; } } return SchedulerUtils.extractPackage(topologyWorkingDirectory, topologyPackageURI, topologyPackageDestination, true, isVerbose); }</code><technical_language>code line 123 line 148 is actual setup work. move SchedulerUtils. setupWorkingDirectory? If a reason put there, create a local method code clear</technical_language>

Target:
protected boolean setupWorkingDirectoryAndExtractPackages() { String coreReleasePackageURI = LocalContext.corePackageUri(config); LOG.info("core release package uri: " + coreReleasePackageURI); String coreReleaseFileDestination = Paths.get( topologyWorkingDirectory, "heron-core.tar.gz").toString(); String topologyPackageURI = Runtime.topologyPackageUri(runtime).toString(); String topologyPackageDestination = Paths.get( topologyWorkingDirectory, "topology.tar.gz").toString(); if (!SchedulerUtils.createOrCleanDirectory(topologyWorkingDirectory)) { return false; } final boolean isVerbose = Context.verbose(config); if (config.getBooleanValue(LocalKey.USE_HERON_CORE_URI.value(), LocalKey.USE_HERON_CORE_URI.getDefaultBoolean())) { if (!SchedulerUtils.extractPackage(topologyWorkingDirectory, coreReleasePackageURI, coreReleaseFileDestination, true, isVerbose)) { return false; } } else { Path heronCore = Paths.get(config.getStringValue(Key.HERON_HOME), "heron-core"); Path heronCoreLink = Paths.get(topologyWorkingDirectory, "heron-core"); try { Files.createSymbolicLink(heronCoreLink, heronCore); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Unable to create heron core link from " + heronCoreLink + " to " + heronCore, ioe); return false; } } return SchedulerUtils.extractPackage(topologyWorkingDirectory, topologyPackageURI, topologyPackageDestination, true, isVerbose); }
Source:
<code><START> protected AddressPair(String macAddress, String ipAddress) { <END> this.macAddress = macAddress; this.ipAddress = ipAddress; }</code><technical_language>Add @ConstructorProperties annotation in other domain objects, for consistency</technical_language>

Target:
protected AddressPair(String macAddress, String ipAddress) { checkNotNull(macAddress, "mac address should not be null"); checkNotNull(ipAddress, "ip should not be null"); this.macAddress = macAddress; this.ipAddress = ipAddress; }
Source:
<code>protected void recordCapabilitiesAndRequirements(OperationContext context, AttributeDefinition attributeDefinition, ModelNode newValue, ModelNode oldValue) { super.recordCapabilitiesAndRequirements(context, attributeDefinition, newValue, oldValue); if (oldValue.isDefined()) { context.deregisterCapability(DEFAULT_TRACER_CAPABILITY.getDynamicName(oldValue.asString())); <START> } <END> if (newValue.isDefined()) { context.registerCapability(RuntimeCapability.Builder.of(DEFAULT_TRACER_CAPABILITY.getDynamicName(newValue.asString()), false).build()); } }</code><technical_language>I want call super implementation, handling capability registration conditionally</technical_language>

Target:
protected void recordCapabilitiesAndRequirements(OperationContext context, AttributeDefinition attributeDefinition, ModelNode newValue, ModelNode oldValue) { if (oldValue.isDefined()) { context.deregisterCapability(DEFAULT_TRACER_CAPABILITY_NAME); } if (newValue.isDefined()) { context.registerCapability(DEFAULT_TRACER_CAPABILITY); } }
Source:
<code>public void verifySectionVisibility(){ waitForElementByElement(sectionVisibilityElement); <START> PageObjectLogging.log("verifySectionVisibility", "section is opened and visible", true, driver); <END> }</code><technical_language>I line, please remove "driver" parameter. This parameter is needed here, screenshot is needed in verification methods</technical_language>

Target:
public void verifySectionVisibility(){ waitForElementByElement(sectionVisibilityElement); PageObjectLogging.log("verifySectionVisibility", "section is opened and visible", true); }
Source:
<code><START> private Constraint processMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.PROCESS_MOVE_COST, HardSoftLongScore.ofSoft(1L), MrProcessAssignment::getProcessMoveCost); <END> }</code><technical_language>align columns</technical_language>

Target:
private Constraint processMoveCost(ConstraintFactory factory) { return factory.from(MrProcessAssignment.class) .filter(MrProcessAssignment::isMoved) .penalizeLong(MrConstraints.PROCESS_MOVE_COST, HardSoftLongScore.ONE_SOFT, MrProcessAssignment::getProcessMoveCost); }
Source:
<code>PendingAddOp(LedgerHandle lh, AddCallback cb, Object ctx) { this.lh = lh; this.cb = cb; this.ctx = ctx; this.entryId = LedgerHandle.INVALID_ENTRY_ID; writeSet = new int[lh.metadata.getWriteQuorumSize()]; <START> Arrays.fill(writeSet, -12345); <END> this.ackSet = lh.distributionSchedule.getAckSet(); this.addOpLogger = lh.bk.getAddOpLogger(); this.timeoutSec = lh.bk.getConf().getAddEntryQuorumTimeout(); }</code><technical_language>define a CONSTANT for -12345</technical_language>

Target:
PendingAddOp(LedgerHandle lh, AddCallback cb, Object ctx) { this.lh = lh; this.cb = cb; this.ctx = ctx; this.entryId = LedgerHandle.INVALID_ENTRY_ID; this.ackSet = lh.distributionSchedule.getAckSet(); this.addOpLogger = lh.bk.getAddOpLogger(); this.timeoutSec = lh.bk.getConf().getAddEntryQuorumTimeout(); }
Source:
<code>private String getDefaultAllowedOrigins() throws ServletException { <START> VdcQueryReturnValue value = backend.runPublicQuery(VdcQueryType.GetDefaultAllowedOrigins, <END> new VdcQueryParametersBase()); if (!value.getSucceeded()) { throw new ServletException("Can't get list of default origins"); } return value.getReturnValue(); }</code><technical_language>hit issues permissions here, GetDefaultAllowedOrigins loads hosts respecting permissions of user. But, if user permissions read hosts (which user typically have) this return empty list fail</technical_language>

Target:
private Set<String> getDefaultAllowedOrigins() throws ServletException { GetDefaultAllowedOriginsQueryParameters parameters = new GetDefaultAllowedOriginsQueryParameters(); parameters.addSuffix(":9090"); VdcQueryReturnValue value = backend.runPublicQuery(VdcQueryType.GetDefaultAllowedOrigins, parameters); if (!value.getSucceeded()) { throw new ServletException("Can't get list of default origins"); } log.debug("Origins allowed by default: {}", StringUtils.join((Set<String>)value.getReturnValue(), ',')); return value.getReturnValue(); }
Source:
<code>public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing graphite socket: ", e); } } <START> transport = null; <END> }</code><technical_language>I guess moved if statement</technical_language>

Target:
public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing Datadog client: ", e); } transport = null; } }
Source:
<code>public void fetchEncodings() throws Exception { <START> List<String> encodings = newArrayList("UTF-8", "UTF-16"); <END> driver.addExpectation(onRequestTo("/r/nai-realms/encodings").withMethod(GET), returnResponse(encodings)); List<String> got = client.fetchEncodings(); assertThat(got, deepEquals(encodings)); }</code><technical_language>rename want got/want</technical_language>

Target:
public void fetchEncodings() throws Exception { List<String> want = newArrayList("UTF-8", "UTF-16"); driver.addExpectation(onRequestTo("/r/nai-realms/encodings").withMethod(GET), returnResponse(want)); List<String> got = client.fetchEncodings(); assertThat(got, deepEquals(want)); }
Source:
<code>public Long getUuid() { <START> return new Long(self.getArtId()); <END> }</code><technical_language>Long.valueOf() instead of new Long() - for performance reasons</technical_language>

Target:
public Long getUuid() { return Long.valueOf(self.getArtId()); }
Source:
<code>public void run() { ViewPagerDownloadManager.instance.done(this, true); <START> } <END></code><technical_language>preloading here, get rid of ViewPagerDownloadManager setup</technical_language>

Target:
public void run() { }
Source:
<code>public void init() { createEditor(); <START> filterListEditor.hideLabel(); <END> initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); }</code><technical_language>This be: filterListEditor = createFilterListEditor(); filterListEditor.hideLabel();</technical_language>

Target:
public void init() { filterListEditor = createFilterListEditor(); filterListEditor.hideLabel(); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); addSelectedItemButton.addStyleName(Styles.PULL_RIGHT); }
Source:
<code>public List<UserDto> getAllOrgaMembers() { List<UserDto> result = new ArrayList(); <START> userService.findAllOrgaMembers().forEach(u -> result.add(userConverter.toDto(u))); <END> return result; }</code><technical_language>collect(Collectors.toList());</technical_language>

Target:
public List<UserDto> getAllOrgaMembers() { return userService .findAllOrgaMembers() .stream() .map(userConverter::toDto) .collect(Collectors.toList()); }
Source:
<code>private List<ModuleLaunchRequest> toModuleLaunchRequests(ModuleLauncherProperties moduleLauncherProperties) { List<ModuleLaunchRequest> requests = new ArrayList<>(); String[] modules = moduleLauncherProperties.getModules(); Map<Integer, Map<String, String>> arguments = moduleLauncherProperties.getArgs(); <START> for (int i = 0; i < moduleLauncherProperties.getModules().length; i++) { <END> ModuleLaunchRequest moduleLaunchRequest = new ModuleLaunchRequest(modules[i], arguments.get(i)); requests.add(moduleLaunchRequest); } return requests; }</code><technical_language>modules.length here</technical_language>

Target:
private List<ModuleLaunchRequest> toModuleLaunchRequests(ModuleLauncherProperties moduleLauncherProperties) { List<ModuleLaunchRequest> requests = new ArrayList<>(); String[] modules = moduleLauncherProperties.getModules(); Map<Integer, Map<String, String>> arguments = moduleLauncherProperties.getArgs(); for (int i = 0; i < modules.length; i++) { ModuleLaunchRequest moduleLaunchRequest = new ModuleLaunchRequest(modules[i], arguments.get(i)); requests.add(moduleLaunchRequest); } return requests; }
Source:
<code>public void enableSSL() { <START> if (!m_enableSSL || m_sslContextRef.get() != null) return; <END> synchronized (m_sslContextRef) { try { m_sslContextRef.set(SSLConfiguration.initializeSslContext(m_sslConfig)); } catch (IOException | NoSuchAlgorithmException | KeyStoreException | CertificateException | UnrecoverableKeyException | KeyManagementException ex) { throw new IllegalArgumentException("Failed to initialize SSL from config file: " + m_sslPropsFile, ex); } } }</code><technical_language>config object need do this setup aggressively. Set properties in this object do this work construct client. IllegalArgumentException setting a boolean is _unexpected_ least</technical_language>

Target:
public void enableSSL() { m_enableSSL = true; if (m_sslConfig == null) { m_sslConfig = new SSLConfiguration.SslConfig(); } }
Source:
<code>public void testPairedIntervalFilter(final String intervalFilename, final int expectNumber) throws Exception { final File inputSam = File.createTempFile("testSam", ".sam", TEST_DIR); inputSam.deleteOnExit(); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(builder.getHeader(), false, inputSam); for (final SAMRecord record : builder) { writer.addAlignment(record); } writer.close(); final File intervalFile = new File(intervalFilename); <START> final FilterSamReads program = new FilterSamReads(); <END> program.INPUT = inputSam; program.OUTPUT = File.createTempFile("FilterSamReads.output.", ".sam"); program.OUTPUT.deleteOnExit(); program.FILTER = FilterSamReads.Filter.includePairedIntervals; program.INTERVAL_LIST = intervalFile; Assert.assertEquals(program.doWork(),0); final SamReader samReader = SamReaderFactory.makeDefault().open(program.OUTPUT); final SAMRecordIterator iter = samReader.iterator(); int count = 0; while (iter.hasNext()) { iter.next(); ++ count; } iter.close(); samReader.close(); Assert.assertEquals(count, expectNumber); }</code><technical_language>refactor tests more DRY</technical_language>

Target:
public void testPairedIntervalFilter(final String intervalFilename, final int expectNumber) throws Exception { final File inputSam = File.createTempFile("testSam", ".sam", TEST_DIR); inputSam.deleteOnExit(); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(builder.getHeader(), false, inputSam); for (final SAMRecord record : builder) { writer.addAlignment(record); } writer.close(); final File intervalFile = new File(intervalFilename); FilterSamReads filterTest = setupProgram(intervalFile, inputSam, FilterSamReads.Filter.includePairedIntervals); Assert.assertEquals(filterTest.doWork(),0); long count = getReadCount(filterTest); Assert.assertEquals(count, expectNumber); }
Source:
<code>public void filterRegisteredTest() throws Exception { WebTarget base = client.target(generateURL("/") + "testIt"); Response response = base.request().get(); <START> Assert.assertEquals(404, response.getStatus()); <END> }</code><technical_language>@xstefank, This is a minor point, I suggest a status 456, arise otherwise. get a 404 URL wrong. -Ron</technical_language>

Target:
public void filterRegisteredTest() throws Exception { WebTarget base = client.target(generateURL("/") + "testIt"); Response response = base.request().get(); Assert.assertEquals(456, response.getStatus()); }
Source:
<code>private void putBlob(MessageInfo messageInfo, ByteBuffer messageBuf, long size) throws CloudStorageException, IOException, GeneralSecurityException { boolean performUpload = messageInfo.getExpirationTimeInMs() == Utils.Infinite_Time && !messageInfo.isDeleted(); if (performUpload) { BlobId blobId = (BlobId) messageInfo.getStoreKey(); boolean usesCloudEncryption = false; <START> if (cryptoService != null && (blobId.getVersion() < 4 || !BlobId.isEncrypted(blobId.getID()))) { <END> messageBuf = cryptoService.encrypt(messageBuf); usesCloudEncryption = true; } CloudBlobMetadata blobMetadata = new CloudBlobMetadata(blobId, messageInfo.getOperationTimeMs(), messageInfo.getExpirationTimeInMs(), messageInfo.getSize(), usesCloudEncryption); cloudDestination.uploadBlob(blobId, size, blobMetadata, new ByteBufferInputStream(messageBuf)); } }</code><technical_language>constant for "4". More importantly: if blob is encrypted, config flag "requireEncryption" is true, cryptoService is null, upload skipped. (You'll some of this logic merge master.)</technical_language>

Target:
private void putBlob(MessageInfo messageInfo, ByteBuffer messageBuf, long size) throws CloudStorageException, IOException, GeneralSecurityException { if (shouldUpload(messageInfo)) { BlobId blobId = (BlobId) messageInfo.getStoreKey(); String kmsContext = cryptoService.getEncryptionContext(); CloudBlobMetadata.EncryptionType encryptionType; if (cloudConfig.vcrRequireEncryption && cryptoService != null && (blobId.getVersion() < BlobId.BLOB_ID_V4 || !BlobId.isEncrypted(blobId.getID()))) { messageBuf = cryptoService.encrypt(messageBuf); encryptionType = CloudBlobMetadata.EncryptionType.VCR; } else { kmsContext = blobId.getAccountId()+":"+blobId.getContainerId(); encryptionType = CloudBlobMetadata.EncryptionType.ROUTER; } CloudBlobMetadata blobMetadata = new CloudBlobMetadata(blobId, messageInfo.getOperationTimeMs(), messageInfo.getExpirationTimeInMs(), messageInfo.getSize(), kmsContext, encryptionType, CloudBlobMetadata.VcrEncryptionFormat.DEFAULT); cloudDestination.uploadBlob(blobId, size, blobMetadata, new ByteBufferInputStream(messageBuf)); } }
Source:
<code>public Stream<? extends Arguments> provideArguments(ExtensionContext context) { CsvParserSettings settings = new CsvParserSettings(); settings.getFormat().setDelimiter(this.annotation.delimiter()); settings.getFormat().setLineSeparator(LINE_SEPARATOR); settings.getFormat().setQuote('\''); settings.getFormat().setQuoteEscape('\''); settings.setEmptyValue(this.annotation.emptyValue()); settings.setAutoConfigurationEnabled(false); CsvParser csvParser = new CsvParser(settings); AtomicLong index = new AtomicLong(0); <START> final DefaultConversionProcessor processor = getConversionProcessor(); <END> return Arrays.stream(this.annotation.value()) .map(line -> { String[] parsedLine = null; try { parsedLine = csvParser.parseLine(line + LINE_SEPARATOR); if (parsedLine != null) { parsedLine = Arrays.copyOf(processor.applyConversions(parsedLine, null), parsedLine.length, String[].class); } } catch (Throwable throwable) { handleCsvException(throwable, this.annotation); } Preconditions.notNull(parsedLine, () -> "Line at index " + index.get() + " contains invalid CSV: \"" + line + "\""); return parsedLine; }) .peek(values -> index.incrementAndGet()) .map(Arguments::of); }</code><technical_language>Remove final modifier. - a DefaultConversionProcessor type of variable instead of ConversionProcessor</technical_language>

Target:
public Stream<? extends Arguments> provideArguments(ExtensionContext context) { AtomicLong index = new AtomicLong(0); DefaultConversionProcessor processor = getConversionProcessor(); return Arrays.stream(this.annotation.value()) .map(line -> { String[] parsedLine = null; try { parsedLine = this.csvParser.parseLine(line + LINE_SEPARATOR); if (parsedLine != null) { parsedLine = Arrays.copyOf(processor.applyConversions(parsedLine, null), parsedLine.length, String[].class); } } catch (Throwable throwable) { handleCsvException(throwable, this.annotation); } Preconditions.notNull(parsedLine, () -> "Line at index " + index.get() + " contains invalid CSV: \"" + line + "\""); return parsedLine; }) .peek(values -> index.incrementAndGet()) .map(Arguments::of); }
Source:
<code>public boolean isOwner() { if (isOwner == null) { AccountGroup g = groupCache.get(group.getOwnerGroupUUID()); <START> AccountGroup.UUID ownerUUID = g != null ? g.getGroupUUID() : null; <END> isOwner = getCurrentUser().getEffectiveGroups().contains(ownerUUID) || getCurrentUser().getCapabilities().canAdministrateServer(); } return isOwner; }</code><technical_language>Simplify this to: AccountGroup.UUID ownerUUID = group.getOwnerGroupUUID() This drop GroupCache here</technical_language>

Target:
public boolean isOwner() { if (isOwner == null) { AccountGroup.UUID ownerUUID = group.getOwnerGroupUUID(); isOwner = getCurrentUser().getEffectiveGroups().contains(ownerUUID) || getCurrentUser().getCapabilities().canAdministrateServer(); } return isOwner; }
Source:
<code>private void buildQueue(File inputFile, ArrayBlockingQueue<Metacard> metacardQueue, long start) { try { if (includeContent) { try (FileInputStream fileInputStream = new FileInputStream(inputFile)) { String alias = System.getProperty("org.codice.ddf.system.hostname"); if (verifier.verifyDigitalSignature( <START> fileInputStream, new FileInputStream(signatureFile), alias)) { <END> processIncludeContent(metacardQueue); } else { throw new CatalogCommandRuntimeException( "The provided signature was invalid for the provided data"); } } catch (IOException | CatalogCommandRuntimeException e) { throw new CatalogCommandRuntimeException( "An error occurred while verifying digital signature", e); } } else { try (Stream<Path> ingestStream = Files.walk(inputFile.toPath(), FileVisitOption.FOLLOW_LINKS)) { ingestStream .map(Path::toFile) .filter(file -> !file.isDirectory()) .forEach(file -> addFileToQueue(metacardQueue, start, file)); } catch (IOException e) { throw new UncheckedIOException(e); } } } finally { phaser.arriveAndDeregister(); } }</code><technical_language>input stream needs closed</technical_language>

Target:
private void buildQueue(File inputFile, ArrayBlockingQueue<Metacard> metacardQueue, long start) { try { if (includeContent) { try (InputStream data = new FileInputStream(inputFile); InputStream signature = new FileInputStream(signatureFile)) { String alias = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("org.codice.ddf.system.hostname")); if (verifier.verifyDigitalSignature(data, signature, alias)) { processIncludeContent(metacardQueue); } else { console.println("The provided signature was invalid for the provided data"); } } catch (IOException | CatalogCommandRuntimeException e) { throw new CatalogCommandRuntimeException( "An error occurred while verifying digital signature", e); } } else { try (Stream<Path> ingestStream = Files.walk(inputFile.toPath(), FileVisitOption.FOLLOW_LINKS)) { ingestStream .map(Path::toFile) .filter(file -> !file.isDirectory()) .forEach(file -> addFileToQueue(metacardQueue, start, file)); } catch (IOException e) { throw new UncheckedIOException(e); } } } finally { phaser.arriveAndDeregister(); } }
Source:
<code>void run() throws Exception; } public static <T> boolean checkAndSleep(T expectedValue, Supplier expressionToCheck, int timeoutInMs) { <START> int checkIntervalInMs = 100; <END> long startTime = System.currentTimeMillis(); try { while (!Objects.equals(expectedValue, expressionToCheck.get())) { if (System.currentTimeMillis() - startTime >= timeoutInMs) { return false; } Thread.sleep(checkIntervalInMs); } } catch (InterruptedException e) { return false; } return true; }</code><technical_language>making this a constant beginning of TestUtils</technical_language>

Target:
void run() throws Exception; } public static <T> boolean checkAndSleep(T expectedValue, Supplier expressionToCheck, int timeoutInMs) { long startTime = System.currentTimeMillis(); try { while (!Objects.equals(expectedValue, expressionToCheck.get())) { if (System.currentTimeMillis() - startTime >= timeoutInMs) { return false; } Thread.sleep(CHECK_INTERVAL_IN_MS); } } catch (InterruptedException e) { return false; } return true; }
Source:
<code><START> public boolean isVmRunningOnSpm() { return this.spmId.equals(this.runningVdsId); } <END></code><technical_language>lose "this." notation. Also, this annotated serialized</technical_language>

Target:
public boolean isVmRunningOnSpm() { return spmId.equals(this.runningVdsId); }
Source:
<code>public String getAuthorPrincipalName(File file) { <START> return null; <END> }</code><technical_language>this StringUtils.empty</technical_language>

Target:
public String getAuthorPrincipalName(File file) { return StringUtils.EMPTY; }
Source:
<code>protected void fit(DataSet dataSet) { if (replicatedModel instanceof MultiLayerNetwork) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((MultiLayerNetwork) replicatedModel).setLastEtlTime(lastEtlTime.get()); modelLock.readLock().lock(); ((MultiLayerNetwork) replicatedModel).fit(dataSet); <START> modelLock.readLock().unlock(); <END> } else if (replicatedModel instanceof ComputationGraph) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((ComputationGraph) replicatedModel).setLastEtlTime(lastEtlTime.get()); modelLock.readLock().lock(); ((ComputationGraph) replicatedModel).fit(dataSet); modelLock.readLock().unlock(); } }</code><technical_language>unlock in finally block in case of exception. un-indent line above. for other lock in this class</technical_language>

Target:
protected void fit(DataSet dataSet) { if (replicatedModel instanceof MultiLayerNetwork) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((MultiLayerNetwork) replicatedModel).setLastEtlTime(lastEtlTime.get()); try { modelLock.readLock().lock(); ((MultiLayerNetwork) replicatedModel).fit(dataSet); } finally { modelLock.readLock().unlock(); } } else if (replicatedModel instanceof ComputationGraph) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((ComputationGraph) replicatedModel).setLastEtlTime(lastEtlTime.get()); try { modelLock.readLock().lock(); ((ComputationGraph) replicatedModel).fit(dataSet); } finally { modelLock.readLock().unlock(); } } }
Source:
<code>public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: <START> break; <END> case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); } break; case 409: exception = new IllegalStateException(message, exception); break; } command.setException(exception); }</code><technical_language>400 errors Bad Request errors populated IllegalArgumentException errors</technical_language>

Target:
public void handleError(HttpCommand command, HttpResponse response) { byte[] data = closeClientButKeepContentStream(response); String message = data != null ? new String(data) : null; Exception exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: exception = new IllegalArgumentException(message, exception); break; case 401: case 403: exception = new AuthorizationException(message, exception); break; case 404: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(message, exception); } break; case 409: exception = new IllegalStateException(message, exception); break; } command.setException(exception); }
Source:
<code>public DockerAccess createDockerAccess(DockerAccessContext dockerAccessContext) throws MojoExecutionException, MojoFailureException { try { DockerConnectionDetector dockerConnectionDetector = createDockerConnectionDetector(dockerAccessContext, dockerAccessContext.getLog()); DockerConnectionDetector.ConnectionParameter connectionParam = dockerConnectionDetector.detectConnectionParameter(dockerAccessContext.getDockerHost(), dockerAccessContext.getCertPath()); String version = dockerAccessContext.getMinimalApiVersion() != null ? dockerAccessContext.getMinimalApiVersion() : DockerAccessWithHcClient.fetchApiVersionFromServer(connectionParam.getUrl(), connectionParam.getCertPath(), dockerAccessContext.getMaxConnections(), dockerAccessContext.getLog()); <START> DockerAccess access = new DockerAccessWithHcClient("v" + version, connectionParam.getUrl(), <END> connectionParam.getCertPath(), dockerAccessContext.getMaxConnections(), dockerAccessContext.getLog()); access.start(); setDockerHostAddressProperty(dockerAccessContext, connectionParam.getUrl()); String serverVersion = access.getServerApiVersion(); if (!EnvUtil.greaterOrEqualsVersion(serverVersion, version)) { throw new MojoExecutionException( String.format("Server API version %s is smaller than required API version %s", serverVersion, version)); } return access; } catch (IOException e) { throw new MojoExecutionException("Cannot create docker access object ", e); } }</code><technical_language>put Api detection constructor ? verify reach Daemon avoid static method call (as createHttpClientAndUrlBuilder() method)</technical_language>

Target:
public DockerAccess createDockerAccess(DockerAccessContext dockerAccessContext) throws MojoExecutionException, MojoFailureException { try { DockerConnectionDetector dockerConnectionDetector = createDockerConnectionDetector(dockerAccessContext, dockerAccessContext.getLog()); DockerConnectionDetector.ConnectionParameter connectionParam = dockerConnectionDetector.detectConnectionParameter(dockerAccessContext.getDockerHost(), dockerAccessContext.getCertPath()); DockerAccess access = new DockerAccessWithHcClient(connectionParam.getUrl(), connectionParam.getCertPath(), dockerAccessContext.getMaxConnections(), dockerAccessContext.getLog()); access.start(); setDockerHostAddressProperty(dockerAccessContext, connectionParam.getUrl()); return access; } catch (IOException e) { throw new MojoExecutionException("Cannot create docker access object ", e); } }
Source:
<code>KinesisRecordWriter(AmazonKinesisClient kinesisClient, TaskAttemptContext context) { this.kinesisClient = kinesisClient; this.context = context; <START> distribute = "true".equals(context.getConfiguration().get(Properties.KinesisRealtimeSink.DISTRIBUTE)); <END> }</code><technical_language>I context.getconfiguration().getBoolean</technical_language>

Target:
KinesisRecordWriter(AmazonKinesisClient kinesisClient, TaskAttemptContext context) { this.kinesisClient = kinesisClient; this.context = context; this.distribute = context.getConfiguration().getBoolean(Properties.KinesisRealtimeSink.DISTRIBUTE, true); this.streamName = context.getConfiguration().get(Properties.KinesisRealtimeSink.NAME); }
Source:
<code>public void launch() { String command = format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper launchScript = newScript(LAUNCHING) <START> .failOnNonZeroResultCode() <END> .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); launchScript.environmentVariablesReset(newPathVariable); } launchScript.execute(); }</code><technical_language>INSTALLING, failOnNonZeroResultCode() removed</technical_language>

Target:
public void launch() { String command = format("%s start >/dev/null 2>&1 < /dev/null &", getRiakCmd()); command = isPackageInstall ? "sudo " + command : command; ScriptHelper launchScript = newScript(LAUNCHING) .body.append(command); if (!isRiakOnPath) { Map<String, String> newPathVariable = ImmutableMap.of("PATH", sbinPath); log.warn("riak command not found on PATH. Altering future commands' environment variables from to {}", getShellEnvironment(), newPathVariable); launchScript.environmentVariablesReset(newPathVariable); } launchScript.execute(); }
Source:
<code>private boolean isArgumentFileSupported() { return <START> (JavaCore.compareJavaVersions(javaVersion, <END> JavaCore.VERSION_9) >= 0); }</code><technical_language>Please remove redundant braces</technical_language>

Target:
private boolean isArgumentFileSupported() { return JavaCore.compareJavaVersions(javaVersion, JavaCore.VERSION_9) >= 0; }
Source:
<code>private User getDefaultUser() { <START> return dao.get(WORKFLOW_PROGRESS_ID_1).getUser(); <END> }</code><technical_language>This means get method tests test subject's get method generate reference data. pull user Hibernate (sessionFactory) instead</technical_language>

Target:
private User getDefaultUser() { return (User) sessionFactory.getCurrentSession().get(UserImpl.class, USER_ID); }
Source:
<code>public void validateCredentials(@NonNull final String strategy, @NonNull final String kuid, final JSONObject credentials, final Options options, @NonNull final ResponseListener<Boolean> listener) { if (listener == null) { throw new IllegalArgumentException("Security.getCredentials: listener is mandatory."); } try { JSONObject body = new JSONObject() .put("strategy", strategy) .put("credentials", credentials) <START> .put("kuid", kuid); <END> kuzzle.query(buildQueryArgs("security", "validateCredentials"), body, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(response.getBoolean("result")); } catch (JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } catch (JSONException e) { throw new RuntimeException(e); } }</code><technical_language>above. id nullified a validate query</technical_language>

Target:
public void validateCredentials(@NonNull final String strategy, @NonNull final String kuid, final JSONObject credentials, final Options options, @NonNull final ResponseListener<Boolean> listener) { if (listener == null) { throw new IllegalArgumentException("Security.getCredentials: listener is mandatory."); } try { JSONObject body = new JSONObject() .put("strategy", strategy) .put("credentials", credentials) .put("_id", kuid); kuzzle.query(buildQueryArgs("security", "validateCredentials"), body, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(response.getBoolean("result")); } catch (JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
<code>public void limit(TimeseriesQuery query) { <START> setDimension("limit", toString().valueOf(query.getLimit())); <END> }</code><technical_language>toString().valueOf(query.getLimit()) is a weird of writing String.valueOf(query.getLimit()), a strange Java feature lets call static methods (like valueOf) if methods of specific objects. please replace latter</technical_language>

Target:
public void limit(TimeseriesQuery query) { setDimension("limit", String.valueOf(query.getLimit())); }