auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testFinalFieldReference() throws Exception { <START> Builder b = new Builder(); <END> b.setProperty(Constants.DSANNOTATIONS, "test.component.*FinalClassNonFinalField*"); b.setProperty("Private-Package", "test.component"); b.addClasspath(new File("bin_test")); b.build(); assertOk(b); }</code><technical_language>clean properly, please place Builder in a try-with-resource block java try (Builder b = new Builder()) { // test }</technical_language>

Target:
public void testFinalFieldReference() throws Exception { try (Builder b = new Builder()) { b.setProperty(Constants.DSANNOTATIONS, "test.component.*FinalClassNonFinalField*"); b.setProperty("Private-Package", "test.component"); b.addClasspath(new File("bin_test")); b.build(); assertOk(b); } }
Source:
<code>public void cleanup() { <START> final double[] b = new double[vecXArray.length]; <END> for (int index = 0; index < b.length; index++) { b[index] = worker.pull(index); if (b[index] != 0) { LOG.log(Level.INFO, "Index {0}: value {1}", new Object[]{index, b[index]}); } } }</code><technical_language>do pick b variable name? model m. I curious</technical_language>

Target:
public void cleanup() { final double[] vecModel = new double[vecXArray.length]; for (int index = 0; index < vecModel.length; index++) { vecModel[index] = worker.pull(index); if (vecModel[index] != 0) { LOG.log(Level.INFO, "Index {0}: value {1}", new Object[]{index, vecModel[index]}); } } }
Source:
<code>private boolean containsCodeQName(AttributeMap unknownAttributes) { for(QName qName : unknownAttributes.keySet()) { <START> if(qName.getLocalPart().equals(NhincConstants.CE_CODE_ID)) { <END> return true; } } return false; }</code><technical_language>need check for codeSystem together? Optional: Consider compare constant.equalsIgnoreCase(variable) approach prevent NPE</technical_language>

Target:
private static boolean containsCodeQName(AttributeMap unknownAttributes) { for(QName qName : unknownAttributes.keySet()) { if(NhincConstants.CE_CODE.equals(qName.getLocalPart())) { return true; } } return false; }
Source:
<code>public String getGoogleId() { return googleId; <START> } <END></code><technical_language>Is storing in class required? account.googleId work fine well. (or ${data.account.googleId})</technical_language>

Target:
public String getGoogleId() { return account.googleId; }
Source:
<code>protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { <START> configurationBuilderHolder.setGlobalConfigurationBuilder(gcb); <END> } if (builder != null) { configurationBuilderHolder.setDefaultConfigurationBuilder(builder); } return new DefaultCacheManager(configurationBuilderHolder, true); } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return createCacheManager(gcb, builder); } }</code><technical_language>Instead of setters, try this instead? configurationBuilderHolder.getGlobalConfigurationBuilder.read(gcb.build()) ^ is base configuration objects read XML override gcb contains. Is achieve</technical_language>

Target:
protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { configurationBuilderHolder.getGlobalConfigurationBuilder().read(gcb.build()); } if (builder != null) { configurationBuilderHolder.getDefaultConfigurationBuilder().read(builder.build()); } return new DefaultCacheManager(configurationBuilderHolder, true); } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return createCacheManager(gcb, builder); } }
Source:
<code>public void testInsertAllNulls_ENG_19237() throws Exception { Client client = getClient(m_cluster); streamNames.remove("t_2"); streamNames.add("nullable"); ClientResponse response = client.callProcedure("@AdHoc", String.format(DROP_STREAM_FORMAT, "t_2")); assertEquals(ClientResponse.SUCCESS, response.getStatus()); response = client.callProcedure("@AdHoc", NULLABLE_SCHEMA); assertEquals(ClientResponse.SUCCESS, response.getStatus()); response = client.callProcedure("@AdHoc", "insert into nullable values(null, null, null)" ); assertEquals(ClientResponse.SUCCESS, response.getStatus()); TestExportBaseSocketExport.waitForExportAllRowsDelivered(client, streamNames); assertEquals(3, m_cluster.getLiveNodeCount()); <START> client.callProcedure("@AdHoc", String.format(DROP_STREAM_FORMAT, "nullable")); client.callProcedure("@AdHoc", T2_SCHEMA); streamNames.remove("nullable"); streamNames.add("t_2"); <END> }</code><technical_language>This is necessary. setup teardown run test entire environment is recreated</technical_language>

Target:
public void testInsertAllNulls_ENG_19237() throws Exception { Client client = getClient(m_cluster); streamNames.add("nullable"); ClientResponse response = client.callProcedure("@AdHoc", NULLABLE_SCHEMA); assertEquals(ClientResponse.SUCCESS, response.getStatus()); response = client.callProcedure("@AdHoc", "insert into nullable values(null, null, null)" ); assertEquals(ClientResponse.SUCCESS, response.getStatus()); TestExportBaseSocketExport.waitForExportAllRowsDelivered(client, streamNames); assertEquals(3, m_cluster.getLiveNodeCount()); }
Source:
<code>static File createBundle(File outputDir, String bundleName, Map<String, String> headers, Map<String, String>... entries) throws IOException { Manifest m = new Manifest(); Attributes attributes = m.getMainAttributes(); attributes.putValue("Manifest-Version", "1.0"); for (Map.Entry<String, String> entry : headers.entrySet()) { attributes.putValue(entry.getKey(), entry.getValue()); } File file = new File(outputDir, "bundle" + bundleName + ".jar"); <START> JarOutputStream jos = <END> new JarOutputStream(new FileOutputStream(file), m); if (entries != null) { for (Map<String, String> entryMap : entries) { for (Map.Entry<String, String> entry : entryMap.entrySet()) { jos.putNextEntry(new JarEntry(entry.getKey())); if (entry.getValue() != null) { jos.write(entry.getValue().getBytes()); } jos.closeEntry(); } } } jos.flush(); jos.close(); file.deleteOnExit(); return file; }</code><technical_language>please try()</technical_language>

Target:
static File createBundle(File outputDir, String bundleName, Map<String, String> headers, Map<String, String>... entries) throws IOException { Manifest m = new Manifest(); Attributes attributes = m.getMainAttributes(); attributes.putValue("Manifest-Version", "1.0"); for (Map.Entry<String, String> entry : headers.entrySet()) { attributes.putValue(entry.getKey(), entry.getValue()); } File file = new File(outputDir, "bundle" + bundleName + ".jar"); try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(file), m)) { if (entries != null) { for (Map<String, String> entryMap : entries) { for (Map.Entry<String, String> entry : entryMap.entrySet()) { jos.putNextEntry(new JarEntry(entry.getKey())); if (entry.getValue() != null) { jos.write(entry.getValue().getBytes()); } jos.closeEntry(); } } } jos.flush(); } file.deleteOnExit(); return file; }
Source:
<code>public Parser<String, Object> makeParser() { <START> if (firstRowIsHeader) { <END> return new DelimitedParser( Optional.fromNullable(delimiter), Optional.fromNullable(listDelimiter), firstRowIsHeader ); } else { return new DelimitedParser( Optional.fromNullable(delimiter), Optional.fromNullable(listDelimiter) ); } }</code><technical_language>if needed</technical_language>

Target:
public Parser<String, Object> makeParser() { return new DelimitedParser( Optional.fromNullable(delimiter), Optional.fromNullable(listDelimiter), columns, hasHeaderRow ); }
Source:
<code>private synchronized void updateReview(TaskTask task) { String summary = task.getSummary(); boolean ourQuery = task.getParentContainers().contains(fCurrentQuery); <START> if (ourQuery && summary != null && !summary.equals("")) { END> try { TaskData taskData = fConnector.getTaskData(getTaskRepository(), task.getTaskId(), new NullProgressMonitor()); GerritTask gtask = new GerritTask(taskData); if (gtask.getAttribute(GerritTask.DATE_COMPLETION) == null) { fReviewTable.updateReviewItem(gtask); } } catch (CoreException e) { StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e)); } } }</code><technical_language>!Strings.isNullOrEmpty(summary)</technical_language>

Target:
private synchronized void updateReview(TaskTask task) { boolean ourQuery = task.getParentContainers().contains(fCurrentQuery); if (ourQuery && !Strings.isNullOrEmpty(task.getSummary())) { try { TaskData taskData = fConnector.getTaskData(getTaskRepository(), task.getTaskId(), new NullProgressMonitor()); GerritTask gtask = new GerritTask(taskData); if (gtask.getAttribute(GerritTask.DATE_COMPLETION) == null) { fReviewTable.updateReviewItem(gtask); } } catch (CoreException e) { StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e)); } } }
Source:
<code>public void onFullScreen(boolean isFullScreen) { if (isPrepared) { isManualFullscreen = isFullScreen; if (isFullScreen) { enterFullScreen(); environment.getAnalyticsRegistry().trackVideoOrientation(videoEntry.videoId, player.getCurrentPosition() / AppConstants.MILLISECONDS_PER_SECOND, true, videoEntry.eid, videoEntry.lmsUrl); } else { exitFullScreen(); environment.getAnalyticsRegistry().trackVideoOrientation(videoEntry.videoId, player.getCurrentPosition() / AppConstants.MILLISECONDS_PER_SECOND, <START> false, videoEntry.eid, videoEntry.lmsUrl); <END> } } else { logger.debug("Player not prepared ?? full screen will NOT work!"); } }</code><technical_language>replace 3rd argument in this function call isFullscreen move this call bottom of parent if i.e. if (isPrepared). This get rid of extra function call well</technical_language>

Target:
public void onFullScreen(boolean isFullScreen) { if (isPrepared) { isManualFullscreen = isFullScreen; if (isFullScreen) { enterFullScreen(); } else { exitFullScreen(); } environment.getAnalyticsRegistry().trackVideoOrientation(videoEntry.videoId, player.getCurrentPosition() / AppConstants.MILLISECONDS_PER_SECOND, isFullScreen, videoEntry.eid, videoEntry.lmsUrl); } else { logger.debug("Player not prepared ?? full screen will NOT work!"); } }
Source:
<code>public KafkaSimpleConsumer(String topic, int partitionId, String clientId, List<String> brokers, boolean earliest) { List<KafkaBroker> brokerList = new ArrayList<KafkaBroker>(); for (String broker : brokers) { <START> String[] tokens = broker.split(":"); <END> if (tokens.length != 2) { log.warn("wrong broker name [%s], its format should be host:port", broker); continue; } try { brokerList.add(new KafkaBroker(tokens[0], Integer.parseInt(tokens[1]))); } catch (NumberFormatException e) { log.warn("wrong broker name [%s], its format should be host:port", broker); continue; } } this.allBrokers = Collections.unmodifiableList(brokerList); this.topic = topic; this.partitionId = partitionId; this.clientId = String.format("%s_%d_%s", topic, partitionId, clientId); this.leaderLookupClientId = clientId + "leaderLookup"; this.replicaBrokers = new ArrayList<>(); this.replicaBrokers.addAll(this.allBrokers); this.earliest = earliest; log.info( "KafkaSimpleConsumer initialized with clientId [%s] for message consumption and clientId [%s] for leader lookup", this.clientId, this.leaderLookupClientId ); }</code><technical_language>ipv6 addresses supported here</technical_language>

Target:
public KafkaSimpleConsumer(String topic, int partitionId, String clientId, List<String> brokers, boolean earliest) { List<HostAndPort> brokerList = new ArrayList<>(); for (String broker : brokers) { HostAndPort brokerHostAndPort = HostAndPort.fromString(broker); Preconditions.checkArgument( brokerHostAndPort.getHostText() != null && !brokerHostAndPort.getHostText().isEmpty() && brokerHostAndPort.hasPort(), "kafka broker [%s] is not valid, must be <host>:<port>", broker ); brokerList.add(brokerHostAndPort); } this.allBrokers = Collections.unmodifiableList(brokerList); this.topic = topic; this.partitionId = partitionId; this.clientId = String.format("%s_%d_%s", topic, partitionId, clientId); this.leaderLookupClientId = clientId + "leaderLookup"; this.replicaBrokers = new ArrayList<>(); this.replicaBrokers.addAll(this.allBrokers); this.earliest = earliest; log.info( "KafkaSimpleConsumer initialized with clientId [%s] for message consumption and clientId [%s] for leader lookup", this.clientId, this.leaderLookupClientId ); }
Source:
<code>public void removeGroup(GroupInfo group) { Object[] listenersArray = listeners.getListeners(); <START> for (Object element : listenersArray) { <END> ((IJobProgressManagerListener)element).removeGroup(group); } }</code><technical_language>inline listeners.getListeners()</technical_language>

Target:
public void removeGroup(GroupInfo group) { for (Object element : listeners.getListeners()) { ((IJobProgressManagerListener)element).removeGroup(group); } }
Source:
<code>public void handleCommand(Command command) { Thing thing = thingProvider.apply(link.getLinkedUID().getThingUID()); if (thing != null) { final ThingHandler handler = thing.getHandler(); if (handler != null) { if (ThingHandlerHelper.isHandlerInitialized(thing)) { logger.debug("Delegating command '{}' for item '{}' to handler for channel '{}'", command, link.getItemName(), link.getLinkedUID()); safeCaller.create(handler).withTimeout(CommunicationManager.THINGHANDLER_EVENT_TIMEOUT) .onTimeout(() -> { logger.warn("Handler for thing '{}' takes more than {}ms for handling a command", <START> handler.getThing().getUID(), SafeCaller.DEFAULT_TIMEOUT); <END> }).build().handleCommand(link.getLinkedUID(), command); } else { logger.debug("Not delegating command '{}' for item '{}' to handler for channel '{}', " + "because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE but was {}).", command, link.getItemName(), link.getLinkedUID(), thing.getStatus()); } } else { logger.warn("Cannot delegate command '{}' for item '{}' to handler for channel '{}', " + "because no handler is assigned. Maybe the binding is not installed or not " + "propertly initialized.", command, link.getItemName(), link.getLinkedUID()); } } else { logger.warn( "Cannot delegate command '{}' for item '{}' to handler for channel '{}', " + "because no thing with the UID '{}' could be found.", command, link.getItemName(), link.getLinkedUID(), link.getLinkedUID().getThingUID()); } }</code><technical_language>SafeCaller.DEFAULT_TIMEOUT -> CommunicationManager.THINGHANDLER_EVENT_TIMEOUT logging lie</technical_language>

Target:
public void handleCommand(Command command) { Thing thing = thingProvider.apply(link.getLinkedUID().getThingUID()); if (thing != null) { final ThingHandler handler = thing.getHandler(); if (handler != null) { if (ThingHandlerHelper.isHandlerInitialized(thing)) { logger.debug("Delegating command '{}' for item '{}' to handler for channel '{}'", command, link.getItemName(), link.getLinkedUID()); safeCaller.create(handler).withTimeout(CommunicationManager.THINGHANDLER_EVENT_TIMEOUT) .onTimeout(() -> { logger.warn("Handler for thing '{}' takes more than {}ms for handling a command", handler.getThing().getUID(), CommunicationManager.THINGHANDLER_EVENT_TIMEOUT); }).build().handleCommand(link.getLinkedUID(), command); } else { logger.debug("Not delegating command '{}' for item '{}' to handler for channel '{}', " + "because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE but was {}).", command, link.getItemName(), link.getLinkedUID(), thing.getStatus()); } } else { logger.warn("Cannot delegate command '{}' for item '{}' to handler for channel '{}', " + "because no handler is assigned. Maybe the binding is not installed or not " + "propertly initialized.", command, link.getItemName(), link.getLinkedUID()); } } else { logger.warn( "Cannot delegate command '{}' for item '{}' to handler for channel '{}', " + "because no thing with the UID '{}' could be found.", command, link.getItemName(), link.getLinkedUID(), link.getLinkedUID().getThingUID()); } }
Source:
<code>public static void sendErrorResponse(ChannelHandlerContext ctx, FullHttpRequest request, List<ErrorResponse.ErrorData> validationErrors, HttpResponseStatus status) { try { String responseBody = new ObjectMapper().writeValueAsString(new ErrorResponse(validationErrors)); sendResponse(ctx, request, responseBody, status); } catch (IOException e) { <START> log.warn("Error preparing response", e); <END> sendErrorResponse(ctx, request, "Error preparing response", HttpResponseStatus.INTERNAL_SERVER_ERROR); } }</code><technical_language>this error warn? sending a 500 user</technical_language>

Target:
public static void sendErrorResponse(ChannelHandlerContext ctx, FullHttpRequest request, List<ErrorResponse.ErrorData> validationErrors, HttpResponseStatus status) { try { String responseBody = new ObjectMapper().writeValueAsString(new ErrorResponse(validationErrors)); sendResponse(ctx, request, responseBody, status); } catch (IOException e) { log.error("Error preparing response", e); sendErrorResponse(ctx, request, "Error preparing response", HttpResponseStatus.INTERNAL_SERVER_ERROR); } }
Source:
<code>public void testMajorVersionNot3() throws Exception { SslContext nettyContext = makeSslContext(provider, false); try { DomainNameMapping<SslContext> mapping = new DomainNameMappingBuilder<SslContext>(nettyContext).build(); SniHandler handler = new SniHandler(mapping); EmbeddedChannel ch = new EmbeddedChannel(handler); byte[] message = {22, 2, 0, 0, 0}; try { ch.writeInbound(Unpooled.wrappedBuffer(message)); <START> } catch (Exception e) { <END> } ch.close(); ByteBuf buf = ch.readOutbound(); if (buf != null) { assertFalse(buf.isReadable()); buf.release(); } assertThat(ch.finish(), is(false)); assertThat(handler.hostname(), nullValue()); assertThat(handler.sslContext(), is(nettyContext)); } finally { releaseAll(nettyContext); } }</code><technical_language>@njhill some more digging this depends if jdkCompatibilityMode is true of not. do a follow fix investigate on</technical_language>

Target:
public void testMajorVersionNot3() throws Exception { SslContext nettyContext = makeSslContext(provider, false); try { DomainNameMapping<SslContext> mapping = new DomainNameMappingBuilder<SslContext>(nettyContext).build(); SniHandler handler = new SniHandler(mapping); EmbeddedChannel ch = new EmbeddedChannel(handler); byte[] message = {22, 2, 0, 0, 0}; try { ch.writeInbound(Unpooled.wrappedBuffer(message)); fail(); } catch (Exception e) { } ch.close(); ByteBuf buf = ch.readOutbound(); if (buf != null) { assertFalse(buf.isReadable()); buf.release(); } assertThat(ch.finish(), is(false)); assertThat(handler.hostname(), nullValue()); assertThat(handler.sslContext(), is(nettyContext)); } finally { releaseAll(nettyContext); } }
Source:
<code>private void addToBlacklist(InetSocketAddress badHost) { blacklistedHosts.put(badHost, System.currentTimeMillis()); <START> log.info("Blacklisted host '{}'", SafeArg.of("badHost", badHost)); <END> }</code><technical_language>change this warn</technical_language>

Target:
private void addToBlacklist(InetSocketAddress badHost) { blacklistedHosts.put(badHost, System.currentTimeMillis()); log.warn("Blacklisted host '{}'", SafeArg.of("badHost", badHost)); }
Source:
<code><START> public String description() { <END> return "number of problems in Problems view is " + problems.size() + ".\n" + "Expected number of problems is: " + problems.size(); }</code><technical_language>problems.size() is 0 of line 66</technical_language>

Target:
public String description() { return "number of problems in Problems view is " + problems.size() + ".\n" + "Expected number of problems is: " + expectedProblemsCount; }
Source:
<code>public void run() { try { List<BatchOperation<K, V>> batches = createMonomorphicBatches(operations()); for (BatchOperation<K, V> batch : batches) { try { batch.performBatchOperation(cacheLoaderWriter); } catch (Exception e) { LOGGER.warn("Exception while bulk processing in write behind queue", e); } } } finally { try { for (SingleOperation<K, V> op : operations()) { latest.remove(op.getKey(), op); } } finally { <START> LOGGER.debug("Batch processing completed"); <END> expireTask.cancel(false); } } }</code><technical_language>statement is inform cancelling scheduled batch expiry task, while needed a level change clarification, change longer reflects this</technical_language>

Target:
public void run() { try { List<BatchOperation<K, V>> batches = createMonomorphicBatches(operations()); for (BatchOperation<K, V> batch : batches) { try { batch.performBatchOperation(cacheLoaderWriter); } catch (Exception e) { LOGGER.warn("Exception while bulk processing in write behind queue", e); } } } finally { try { for (SingleOperation<K, V> op : operations()) { latest.remove(op.getKey(), op); } } finally { LOGGER.debug("Cancelling batch expiry task"); expireTask.cancel(false); } } }
Source:
<code>private void updateNetworkDisplay() { String networkName = null; VmInitNetwork obj = null; if (getNetworkList().getSelectedItem() != null) { networkName = getNetworkList().getSelectedItem(); obj = networkMap.get(networkName); } final NetworkBootProtocol bootProtocol = ((obj == null || obj.getBootProtocol() == null) ? NetworkBootProtocol.NONE : obj.getBootProtocol()); <START> getNetworkBootProtocolList().setSelectedItem(Linq.firstOrDefault(getNetworkBootProtocolList().getItems(), <END> new IPredicate<Map.Entry<String, NetworkBootProtocol>>() { @Override public boolean match(Map.Entry<String, NetworkBootProtocol> item) { return item.getValue() == bootProtocol; } })); getNetworkIpAddress().setEntity(obj == null ? null : obj.getIp()); getNetworkNetmask().setEntity(obj == null ? null : obj.getNetmask()); getNetworkGateway().setEntity(obj == null ? null : obj.getGateway()); getNetworkStartOnBoot().setEntity(networkName == null ? null : networkStartOnBoot.contains(networkName)); }</code><technical_language>This simplified above</technical_language>

Target:
private void updateNetworkDisplay() { String networkName = null; VmInitNetwork obj = null; if (getNetworkList().getSelectedItem() != null) { networkName = getNetworkList().getSelectedItem(); obj = networkMap.get(networkName); } if (obj == null || obj.getBootProtocol() == null) { getNetworkBootProtocolList().setSelectedItem(NetworkBootProtocol.NONE); } else { getNetworkBootProtocolList().setSelectedItem(obj.getBootProtocol()); } getNetworkIpAddress().setEntity(obj == null ? null : obj.getIp()); getNetworkNetmask().setEntity(obj == null ? null : obj.getNetmask()); getNetworkGateway().setEntity(obj == null ? null : obj.getGateway()); getNetworkStartOnBoot().setEntity(networkName == null ? null : networkStartOnBoot.contains(networkName)); }
Source:
<code>public String decrypt(String encryptedValue) throws CrypterException { <START> if (encryptedValue == null || encryptedValue.isEmpty()) { <END> throw new CrypterException("Value to decrypt cannot be null or empty."); } if (associatedData == null) { throw new CrypterException("Associated data cannot be null."); } try { byte[] encryptedBytes = Base64.getDecoder().decode(encryptedValue); return new String(aead.decrypt(encryptedBytes, associatedData)); } catch (GeneralSecurityException | NullPointerException e) { LOGGER.debug("Problem decrypting.", e); throw new CrypterException("Problem decrypting.", e); } }</code><technical_language>Is a reason Apache commons included in this module (<LINK_0></technical_language>

Target:
public String decrypt(String encryptedValue) throws CrypterException { if (isBlank(encryptedValue)) { throw new CrypterException("Value to decrypt cannot be null or blank."); } if (associatedData == null) { throw new CrypterException("Associated data cannot be null."); } try { byte[] encryptedBytes = Base64.getDecoder().decode(encryptedValue); return new String(aead.decrypt(encryptedBytes, associatedData)); } catch (GeneralSecurityException | NullPointerException e) { LOGGER.debug("Problem decrypting.", e); throw new CrypterException("Problem decrypting.", e); } }
Source:
<code>public static <Key, Value> Cache<Key, Value> createOneSlotCache() { return new CacheGuava<>(1) ; <START> } <END></code><technical_language>CacheGuava is a bit heavy for a one-slot cache. While Cahce1 currently, if were, keeping simple, small implementation is better. Proposal: Cache1 is</technical_language>

Target:
public static <Key, Value> Cache<Key, Value> createOneSlotCache() { return new Cache1<>() ; }
Source:
<code>protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { buffer = new TupleBatchBuffer(getSchema()); Character delim = ','; Character esc = '\\'; Integer skip = 0; <START> if (delimiter != null) { <END> delim = delimiter; } if (escape != null) { esc = escape; } if (numberOfSkippedLines != null) { skip = numberOfSkippedLines; } try { scanner = new CSVReader(new BufferedReader(new InputStreamReader(source.getInputStream())), delim, '"', esc, skip); } catch (IOException e) { throw new DbException(e); } lineNumber = 0; }</code><technical_language>firstNonNull for this type of logic</technical_language>

Target:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { buffer = new TupleBatchBuffer(getSchema()); try { scanner = new CSVReader(new BufferedReader(new InputStreamReader(source.getInputStream())), delimiter, quote, escape, numberOfSkippedLines); } catch (IOException e) { throw new DbException(e); } lineNumber = 0; }
Source:
<code>public boolean shouldVendorBeSentToPaymentWorks(PaymentWorksVendor paymentWorksVendor) { Integer vendorNumber = paymentWorksVendor.getVendorHeaderGeneratedIdentifier(); Integer vendorParentChildNumber = paymentWorksVendor.getVendorDetailAssignedIdentifier(); VendorDetail vendorDetail = getVendorService().getVendorDetail(vendorNumber, vendorParentChildNumber); if (ObjectUtils.isNotNull(vendorDetail)) { return shouldVendorBeSentToPaymentWorks(vendorDetail); <START> } else { <END> LOG.error("shouldVendorBeSentToPaymentWorks2, unable to find a vendor by " + vendorNumber + " and " + vendorParentChildNumber); } return false; }</code><technical_language>else is needed code called if if condition is true method returns</technical_language>

Target:
public boolean shouldVendorBeSentToPaymentWorks(PaymentWorksVendor paymentWorksVendor) { Integer headerId = paymentWorksVendor.getVendorHeaderGeneratedIdentifier(); Integer detailId = paymentWorksVendor.getVendorDetailAssignedIdentifier(); VendorDetail vendorDetail = getVendorService().getVendorDetail(headerId, detailId); if (ObjectUtils.isNotNull(vendorDetail)) { return shouldVendorBeSentToPaymentWorks(vendorDetail); } LOG.error("shouldVendorBeSentToPaymentWorks2, unable to find a vendor by headerId: " + headerId + " and detailId: " + detailId); return false; }
Source:
<code>private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } if (lastCommit instanceof Map) { Map<Object, Object> lastCommitMap = (Map) lastCommit; for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); } else { <START> log.error("Unable to cast lastCommit to Map"); <END> } return offsetMap; }</code><technical_language>this alert</technical_language>

Target:
private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } if (lastCommit instanceof Map) { Map<Object, Object> lastCommitMap = (Map) lastCommit; for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); } else { log.makeAlert("Unable to cast lastCommit to Map for feed [%s]", feed); } return offsetMap; }
Source:
<code><START> public BlockLocator(){ <END> blockLocator = new ArrayList<>(); }</code><technical_language>Code style: empty line methods</technical_language>

Target:
public BlockLocator() { hashes = ImmutableList.of(); }
Source:
<code>private static String dialogSanitize(String text) { StringBuilder sanitized = new StringBuilder(); boolean firstSegment = true; for (String segment : text.split("<", -1)) { if (firstSegment) { firstSegment = false; sanitized.append(SafeHtmlUtils.htmlEscapeAllowEntities(segment)); continue; } int tagStart = 0; int tagEnd = segment.indexOf('>'); String tag = null; boolean isValidTag = false; if (tagEnd > 0) { if (segment.charAt(0) == '/') { tagStart = 1; } <START> tag = segment.substring(tagStart, tagEnd); <END> if (TAG_WHITELIST.contains(tag)) { isValidTag = true; } } if (isValidTag) { if (tagStart == 0) { sanitized.append('<'); } else { sanitized.append("</"); } sanitized.append(tag).append('>'); sanitized.append(SafeHtmlUtils.htmlEscapeAllowEntities( segment.substring(tagEnd + 1))); } else { sanitized.append("&lt;").append( SafeHtmlUtils.htmlEscapeAllowEntities(segment)); } } return sanitized.toString(); }</code><technical_language>this get tolower'ed <P>, etc. used? written this reject tags attributes -- this is safest stance (as want e.g. <p onmouseover="pwn();">) consider a whitelist of attributes in future</technical_language>

Target:
private static String dialogSanitize(String text) { StringBuilder sanitized = new StringBuilder(); boolean firstSegment = true; for (String segment : text.split("<", -1)) { if (firstSegment) { firstSegment = false; sanitized.append(SafeHtmlUtils.htmlEscapeAllowEntities(segment)); continue; } int tagStart = 0; int tagEnd = segment.indexOf('>'); String tag = null; boolean isValidTag = false; if (tagEnd > 0) { if (segment.charAt(0) == '/') { tagStart = 1; } tag = segment.substring(tagStart, tagEnd).toLowerCase(); if (TAG_WHITELIST.contains(tag)) { isValidTag = true; } } if (isValidTag) { if (tagStart == 0) { sanitized.append('<'); } else { sanitized.append("</"); } sanitized.append(tag).append('>'); sanitized.append(SafeHtmlUtils.htmlEscapeAllowEntities( segment.substring(tagEnd + 1))); } else { sanitized.append("&lt;").append( SafeHtmlUtils.htmlEscapeAllowEntities(segment)); } } return sanitized.toString(); }
Source:
<code>public void emitTuples() { if (currentWindowId <= windowDataManager.getLargestCompletedWindow()) { return; } int count = consumer.getQueueSize(); if(maxTuplesPerWindow > 0) count = Math.min(count, maxTuplesPerWindow - emitCount); for (int i = 0; i < count; i++) { Pair<String, Record> data = consumer.pollRecord(); String shardId = data.getFirst(); String recordId = data.getSecond().getSequenceNumber(); T tuple = getTuple(data.getSecond()); outputPort.emit(tuple); if(!currentWindowRecoveryState.containsKey(shardId)) { <START> currentWindowRecoveryState.put(shardId, new MutablePair<String, Integer>(recordId, 1)); <END> } else { MutablePair<String, Integer> second = currentWindowRecoveryState.get(shardId); Integer noOfRecords = second.getRight(); currentWindowRecoveryState.put(data.getFirst(), new MutablePair<String, Integer>(second.getLeft(), noOfRecords+1)); } shardPosition.put(shardId, recordId); } if(isReplayState) { isReplayState = false; Map<String, String> statsData = new HashMap<String, String>(getConsumer().getShardPosition()); statsData.putAll(shardPosition); getConsumer().resetShardPositions(statsData); consumer.start(); } emitCount += count; }</code><technical_language>I suggest optimize this if block below: java MutablePair<String, Integer> shardOffsetAndCount = currentWindowRecoveryState.get(shardId); if (shardOffsetAndCount == null) { currentWindowRecoveryState.put(shardId, new MutablePair<String, Integer>(recordId, 1)); } else { shardOffsetAndCount.setRight(shardOffsetAndCount.right+1); }</technical_language>

Target:
public void emitTuples() { if (currentWindowId <= windowDataManager.getLargestCompletedWindow()) { return; } int count = consumer.getQueueSize(); if(maxTuplesPerWindow > 0) count = Math.min(count, maxTuplesPerWindow - emitCount); for (int i = 0; i < count; i++) { Pair<String, Record> data = consumer.pollRecord(); String shardId = data.getFirst(); String recordId = data.getSecond().getSequenceNumber(); emitTuple(data); MutablePair<String, Integer> shardOffsetAndCount = currentWindowRecoveryState.get(shardId); if (shardOffsetAndCount == null) { currentWindowRecoveryState.put(shardId, new MutablePair<String, Integer>(recordId, 1)); } else { shardOffsetAndCount.setRight(shardOffsetAndCount.right+1); } shardPosition.put(shardId, recordId); } emitCount += count; }
Source:
<code><START> private static Optional<FastpassData> extractFastpassData(Project project) { <END> try { String path = project.getBasePath(); if (path != null) { Path bloopSettingsPath = Paths.get(path, ".bloop", "bloop.settings.json"); VirtualFile bloopSettings = LocalFileSystem.getInstance().findFileByIoFile(bloopSettingsPath.toFile()); if (bloopSettings != null && bloopSettings.exists()) { String content = new String(bloopSettings.contentsToByteArray()); Gson gson = new Gson(); BloopSettings settings = gson.fromJson(content, BloopSettings.class); Pattern pattern = Pattern.compile("org\\.scalameta:metals_2\\.12:(.*)"); Optional<String> version = settings.refreshProjectsCommand.stream().map(pattern::matcher).filter(Matcher::find).map(m -> m.group(1)).findFirst(); return version.map(fastpassVersion -> { String projectName = settings.refreshProjectsCommand.get(settings.refreshProjectsCommand.size() - 1); return new FastpassData(fastpassVersion, projectName); }); } } } catch (Exception e) { LOG.warn("Failed to extract fastpass data from " + project, e); } return Optional.empty(); }</code><technical_language>I noticed this method relies implementation details of bloop.settings.json change in future. add a check read fastpassVersion field in .bsp/bloop.json? This field is currently generated fastpass now, add separately Metals this logic fragile</technical_language>

Target:
private static Optional<FastpassData> extractFastpassData(Project project) { try { String path = project.getBasePath(); if (path != null) { Optional<FastpassData> fromBsp = readJsonFile(Paths.get(path, ".bsp", "bloop.json"), BspSettings.class) .flatMap(settings -> { if (settings.fastpassVersion != null && settings.fastpassProjectName != null) { return Optional.of(new FastpassData(settings.fastpassVersion, settings.fastpassProjectName)); } else { return Optional.empty(); } }); Supplier<Optional<FastpassData>> fromBloopSettings = () -> readJsonFile(Paths.get(path, ".bloop", "bloop.settings.json"), BloopSettings.class).flatMap(settings -> { Pattern pattern = Pattern.compile("org\\.scalameta:metals_2\\.12:(.*)"); Optional<String> version = settings.refreshProjectsCommand.stream().map(pattern::matcher).filter(Matcher::find).map(m -> m.group(1)).findFirst(); return version.map(fastpassVersion -> { String projectName = settings.refreshProjectsCommand.get(settings.refreshProjectsCommand.size() - 1); return new FastpassData(fastpassVersion, projectName); }); }); return fromBsp.map(Optional::of).orElseGet(fromBloopSettings); } } catch (Exception e) { LOG.warn("Failed to extract fastpass data from " + project, e); } return Optional.empty(); }
Source:
<code>public TextView addTextField(String message) { LinearLayout field = (LinearLayout) mInflater.inflate(R.layout.openmrs_text_view_field, null); TextView textView = (TextView) field.findViewById(R.id.openmrsTextView); textView.setText(message); textView.setSingleLine(false); <START> FontsUtil.setFont(textView, FontsUtil.OpenFonts.OPEN_SANS_REGULAR); <END> if(null != mCustomDialogBundle.getLocationList()){ textView.setTextSize(18); } mFieldsLayout.addView(field, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); return textView; }</code><technical_language>default font for dialogs, is [Roboto](<LINK_0> I know</technical_language>

Target:
public TextView addTextField(String message) { LinearLayout field = (LinearLayout) mInflater.inflate(R.layout.openmrs_text_view_field, null); TextView textView = (TextView) field.findViewById(R.id.openmrsTextView); textView.setText(message); textView.setSingleLine(false); if(null != mCustomDialogBundle.getLocationList()){ textView.setTextSize(18); } mFieldsLayout.addView(field, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); return textView; }
Source:
<code>AttributesNode load() throws IOException { AttributesNode r; if (entry != null) { r = super.load(); if (r == null) r = new AttributesNode(); } else { r = new AttributesNode(); } FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) <START> .getExcludesFile(); <END> if (path != null) { File excludesfile; if (path.startsWith("~/")) excludesfile = fs.resolve(fs.userHome(), path.substring(2)); else excludesfile = fs.resolve(null, path); loadRulesFromFile(r, excludesfile); } File attributes = fs.resolve(repository.getDirectory(), "info/attributes"); loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }</code><technical_language>this is incorrect. want parse excludes file. want core.attributesfile here</technical_language>

Target:
AttributesNode load() throws IOException { AttributesNode r; if (entry != null) { r = super.load(); if (r == null) r = new AttributesNode(); } else { r = new AttributesNode(); } FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) attributesFile = fs.resolve(fs.userHome(), path.substring(2)); else attributesFile = fs.resolve(null, path); loadRulesFromFile(r, attributesFile); } File attributes = fs.resolve(repository.getDirectory(), "info/attributes"); loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }
Source:
<code>public EventBookingDTO createBookingOrAddToWaitingList(final IsaacEventPageDTO event, final RegisteredUserDTO user, final Map<String, String> additionalEventInformation) throws SegueDatabaseException, DuplicateBookingException { <START> if (this.isUserReserved(event.getId(), user.getId())) { <END> this.deleteBooking(event, user); } if (this.isUserBooked(event.getId(), user.getId())) { throw new DuplicateBookingException(String.format("Unable to book onto event (%s) as user (%s) is already" + " booked on to it.", event.getId(), user.getEmail())); } EventBookingDTO booking; if (EventStatus.WAITING_LIST_ONLY.equals(event.getEventStatus())) { try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.WAITING_LIST); } catch (EventIsFullException e1) { throw new RuntimeException("Creating a waiting list booking should never throw an event is full exception " + "- something went terribly wrong for this to have happened", e1); } return booking; } try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.CONFIRMED); } catch (EventIsFullException e) { try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.WAITING_LIST); } catch (EventIsFullException e1) { throw new RuntimeException("Creating a waiting list booking should never throw an event is full exception " + "- something went terribly wrong for this to have happened", e1); } } return booking; }</code><technical_language>locking this? Also, this functionality wanted in Facade layer</technical_language>

Target:
public EventBookingDTO createBookingOrAddToWaitingList(final IsaacEventPageDTO event, final RegisteredUserDTO user, final Map<String, String> additionalEventInformation) throws SegueDatabaseException, DuplicateBookingException { if (this.isUserBooked(event.getId(), user.getId())) { throw new DuplicateBookingException(String.format("Unable to book onto event (%s) as user (%s) is already" + " booked on to it.", event.getId(), user.getEmail())); } EventBookingDTO booking; if (EventStatus.WAITING_LIST_ONLY.equals(event.getEventStatus())) { try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.WAITING_LIST); } catch (EventIsFullException e1) { throw new RuntimeException("Creating a waiting list booking should never throw an event is full exception " + "- something went terribly wrong for this to have happened", e1); } return booking; } try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.CONFIRMED); } catch (EventIsFullException e) { try { booking = this.createBooking(event, user, additionalEventInformation, BookingStatus.WAITING_LIST); } catch (EventIsFullException e1) { throw new RuntimeException("Creating a waiting list booking should never throw an event is full exception " + "- something went terribly wrong for this to have happened", e1); } } return booking; }
Source:
<code>protected List<MoveDiskParameters> getMoveDisksParametersList() { for (MoveDiskParameters moveDiskParameters : moveParametersList) { <START> moveDiskParameters.setSessionId(getParameters().getSessionId()); <END> } return moveParametersList; }</code><technical_language>separate rename method a true 'getter'. do set session move disk live migrate</technical_language>

Target:
protected ArrayList<VdcActionParametersBase> getMoveDisksParametersList() { for (MoveDiskParameters moveDiskParameters : moveParametersList) { moveDiskParameters.setSessionId(getParameters().getSessionId()); } return new ArrayList<VdcActionParametersBase>(moveParametersList); }
Source:
<code>default <A> BiConstraintStream<A, A> fromUniquePair(Class<A> fromClass, BiJoiner<A, A> joiner) { MemberAccessor planningIdMemberAccessor = ConfigUtils.findPlanningIdMemberAccessor(fromClass); if (planningIdMemberAccessor == null) { throw new IllegalArgumentException("The fromClass (" + fromClass + ") has no member with a @" + PlanningId.class.getSimpleName() + " annotation," + " so the pairs can not be made unique ([A,B] vs [B,A])."); } Function<A, Comparable> planningIdGetter = (fact) -> (Comparable<?>) planningIdMemberAccessor.executeGetter(fact); <START> return from(fromClass).join(fromClass, lessThan(planningIdGetter), joiner); <END> }</code><technical_language>I 3 proposals: A) Leave is (bad idea, fromUniquePair(..., Joiners.filtering(...)) work for CS-D CS-B) B) Put lessThan() filtering() - Is a regression for Bavet? this break of existing Bavet working examples? C) B), add Bavet syntactic sugar support filtering() avoid regressions of B</technical_language>

Target:
default <A> BiConstraintStream<A, A> fromUniquePair(Class<A> fromClass, BiJoiner<A, A> joiner) { MemberAccessor planningIdMemberAccessor = ConfigUtils.findPlanningIdMemberAccessor(fromClass); if (planningIdMemberAccessor == null) { throw new IllegalArgumentException("The fromClass (" + fromClass + ") has no member with a @" + PlanningId.class.getSimpleName() + " annotation," + " so the pairs can not be made unique ([A,B] vs [B,A])."); } Function<A, Comparable> planningIdGetter = fact -> (Comparable<?>) planningIdMemberAccessor.executeGetter(fact); if (joiner instanceof FilteringBiJoiner) { BiPredicate<A, A> filter = ((FilteringBiJoiner<A, A>)joiner).getFilter(); return from(fromClass) .join(fromClass, lessThan(planningIdGetter)) .filter(filter); } else { return from(fromClass) .join(fromClass, joiner, lessThan(planningIdGetter)); } }
Source:
<code>Notification<Void> executeServerCalls() { Observable<Void> resultObservable = registerMovies().materialize().flatMap( new Func1<Notification<ByteBuf>, Observable<Void>>() { @Override public Observable<Void> call(Notification<ByteBuf> notif) { if (!verifyStatus(notif)) { return Observable.error(notif.getThrowable()); } System.out.print("Updating user recommendations..."); return updateRecommendations().materialize().flatMap( new Func1<Notification<ByteBuf>, Observable<Void>>() { @Override public Observable<Void> call(Notification<ByteBuf> notif) { if (!verifyStatus(notif)) { return Observable.error(notif.getThrowable()); } System.out.println("Searching through the movie catalog..."); return searchCatalog(); } }); } } ); <START> return resultObservable.materialize().toBlockingObservable().last(); <END> }</code><technical_language>revert this change? toBlockingObservable() is deprecated in 0.19</technical_language>

Target:
Notification<Void> executeServerCalls() { Observable<Void> resultObservable = registerMovies().materialize().flatMap( new Func1<Notification<ByteBuf>, Observable<Void>>() { @Override public Observable<Void> call(Notification<ByteBuf> notif) { if (!verifyStatus(notif)) { return Observable.error(notif.getThrowable()); } System.out.print("Updating user recommendations..."); return updateRecommendations().materialize().flatMap( new Func1<Notification<ByteBuf>, Observable<Void>>() { @Override public Observable<Void> call(Notification<ByteBuf> notif) { if (!verifyStatus(notif)) { return Observable.error(notif.getThrowable()); } System.out.println("Searching through the movie catalog..."); return searchCatalog(); } }); } } ); return resultObservable.materialize().toBlocking().last(); }
Source:
<code><START> private RefCountingFSDataInputStream(SupplierWithException<FSDataInputStream, IOException> streamSupplier, ChannelStateDeserializer serializer) { <END> this.streamSupplier = streamSupplier; this.serializer = serializer; }</code><technical_language>long line for splitting arguments</technical_language>

Target:
private RefCountingFSDataInputStream( SupplierWithException<FSDataInputStream, IOException> streamSupplier, ChannelStateDeserializer serializer) { this.streamSupplier = checkNotNull(streamSupplier); this.serializer = checkNotNull(serializer); }
Source:
<code>private void scheduleStatsCollection() { <START> if (scheduler != null) { <END> cancelScheduledCollection(); } if (isEnabled()) { scheduler = threadPool.scheduleWithFixedDelay(statsCollector, getInterval(), threadPoolName()); } }</code><technical_language>Do need synchronize here? races a setting update stopping this component do non-atomic scheduler</technical_language>

Target:
private void scheduleStatsCollection() { cancelScheduledCollection(); if (isEnabled()) { scheduledTask = threadPool.scheduleWithFixedDelay(statsCollector, interval, ThreadPool.Names.GENERIC); } }