auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void buildGetBlobOptionsTest() throws RestServiceException { doBuildGetBlobOptionsTest(null, null, true, true); doBuildGetBlobOptionsTest("bytes=0-7", ByteRange.fromOffsetRange(0, 7), true, false); doBuildGetBlobOptionsTest("bytes=234-56679090", ByteRange.fromOffsetRange(234, 56679090), true, false); doBuildGetBlobOptionsTest("bytes=1-", ByteRange.fromStartOffset(1), true, false); doBuildGetBlobOptionsTest("bytes=12345678-", ByteRange.fromStartOffset(12345678), true, false); doBuildGetBlobOptionsTest("bytes=-8", ByteRange.fromLastNBytes(8), true, false); doBuildGetBlobOptionsTest("bytes=-123456789", ByteRange.fromLastNBytes(123456789), true, false); doBuildGetBlobOptionsTest("bytes=0-abcd", null, false, false); doBuildGetBlobOptionsTest("bytes=0as23-44444444", null, false, false); doBuildGetBlobOptionsTest("bytes=22-7777777777777777777777777777777777777777777", null, false, false); doBuildGetBlobOptionsTest("bytes=22--53", null, false, false); doBuildGetBlobOptionsTest("bytes=223-34", null, false, false); doBuildGetBlobOptionsTest("bytes=-34ab", null, false, false); doBuildGetBlobOptionsTest("bytes=--12", null, false, false); doBuildGetBlobOptionsTest("bytes=-12-", null, false, false); doBuildGetBlobOptionsTest("bytes=12ab-", null, false, false); doBuildGetBlobOptionsTest("bytes=---", null, false, false); <START> doBuildGetBlobOptionsTest("btes=3-5", null, false, false); <END> }</code><technical_language>a test case for "bytes=345" // hyphen</technical_language>

Target:
public void buildGetBlobOptionsTest() throws RestServiceException { doBuildGetBlobOptionsTest(null, null, true, true); doBuildGetBlobOptionsTest("bytes=0-7", ByteRange.fromOffsetRange(0, 7), true, false); doBuildGetBlobOptionsTest("bytes=234-56679090", ByteRange.fromOffsetRange(234, 56679090), true, false); doBuildGetBlobOptionsTest("bytes=1-", ByteRange.fromStartOffset(1), true, false); doBuildGetBlobOptionsTest("bytes=12345678-", ByteRange.fromStartOffset(12345678), true, false); doBuildGetBlobOptionsTest("bytes=-8", ByteRange.fromLastNBytes(8), true, false); doBuildGetBlobOptionsTest("bytes=-123456789", ByteRange.fromLastNBytes(123456789), true, false); String[] badRanges = {"bytes=0-abcd", "bytes=0as23-44444444", "bytes=22-7777777777777777777777777777777777777777777", "bytes=22--53", "bytes=223-34", "bytes=-34ab", "bytes=--12", "bytes=-12-", "bytes=12ab-", "bytes=---", "btes=3-5", "bytes=345", "bytes=3.14-22", "bytes=3-6.2", "bytes=", "bytes=-", "bytes= -"}; for (String badRange : badRanges) { doBuildGetBlobOptionsTest(badRange, null, false, false); } }
Source:
<code>private Injector newRootInjector(final PluginGuiceEnvironment env) { List<Module> modules = Lists.newArrayListWithCapacity(4); if (getApiType() == ApiType.PLUGIN) { modules.add(env.getSysModule()); } modules.add(new AbstractModule() { @Override protected void configure() { bind(PluginUser.class).toInstance(getPluginUser()); bind(String.class) .annotatedWith(PluginName.class) .toInstance(getName()); bind(String.class) .annotatedWith(PluginCanonicalWebUrl.class) .toInstance(pluginCanonicalWebUrl); bind(File.class) .annotatedWith(PluginData.class) .toProvider(new Provider<File>() { private volatile boolean ready; @Override public File get() { <START> synchronized (dataDir) { <END> if (!ready) { if (!dataDir.exists() && !dataDir.mkdirs()) { throw new ProvisionException(String.format( "Cannot create %s for plugin %s", dataDir.getAbsolutePath(), getName())); } ready = true; } } return dataDir; } }); } }); return Guice.createInjector(modules); }</code><technical_language>I want double-checked locking here: if (!ready) { synchronized (dataDir) { if (!ready) { ... } ready = true; } } <LINK_0></technical_language>

Target:
private Injector newRootInjector(final PluginGuiceEnvironment env) { List<Module> modules = Lists.newArrayListWithCapacity(4); if (getApiType() == ApiType.PLUGIN) { modules.add(env.getSysModule()); } modules.add(new AbstractModule() { @Override protected void configure() { bind(PluginUser.class).toInstance(getPluginUser()); bind(String.class) .annotatedWith(PluginName.class) .toInstance(getName()); bind(String.class) .annotatedWith(PluginCanonicalWebUrl.class) .toInstance(pluginCanonicalWebUrl); bind(File.class) .annotatedWith(PluginData.class) .toProvider(new Provider<File>() { private volatile boolean ready; @Override public File get() { if (!ready) { synchronized (dataDir) { if (!ready) { if (!dataDir.exists() && !dataDir.mkdirs()) { throw new ProvisionException(String.format( "Cannot create %s for plugin %s", dataDir.getAbsolutePath(), getName())); } ready = true; } } } return dataDir; } }); } }); return Guice.createInjector(modules); }
Source:
<code>public static List<NodeAndData> getChildDataAndWatchForNewChildren( ZKWatcher zkw, String baseNode) throws KeeperException { List<String> nodes = ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); if (nodes != null) { List<NodeAndData> newNodes = new ArrayList<>(); for (String node : nodes) { if (Thread.interrupted()) { <START> return new ArrayList<>(); <END> } String nodePath = ZNodePaths.joinZNode(baseNode, node); byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath); newNodes.add(new NodeAndData(nodePath, data)); } return newNodes; } return null; }</code><technical_language>returning Collections.emptyList()</technical_language>

Target:
public static List<NodeAndData> getChildDataAndWatchForNewChildren( ZKWatcher zkw, String baseNode) throws KeeperException { List<String> nodes = ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); if (nodes != null) { List<NodeAndData> newNodes = new ArrayList<>(); for (String node : nodes) { if (Thread.interrupted()) { return Collections.emptyList(); } String nodePath = ZNodePaths.joinZNode(baseNode, node); byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath); newNodes.add(new NodeAndData(nodePath, data)); } return newNodes; } return null; }
Source:
<code>public boolean isDisambiguationPage() { if (hasProperties()) { return properties.isDisambiguationPage(); } else { throw new NullPointerException("No PageProperties object exists for this PageTitle!"); } <START> } <END></code><technical_language>I unsurprising behavior for client returning false / null appropriate</technical_language>

Target:
public boolean isDisambiguationPage() { if (hasProperties()) { return properties.isDisambiguationPage(); } else { return false; } }
Source:
<code>private <T extends IResource> T execute(HttpMethod method, String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); <START> namespace = ResourceKind.PROJECT.equals(kind) ? null : namespace; <END> final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); try { Request.Builder builder = newRequestBuilderTo(endpoint.toString()); if(HttpMethod.GET != method) { builder.method(method.toString(), RequestBody.create(MediaType.parse(MEDIATYPE_APPLICATION_JSON), payload == null ? "" : payload.toJson(true))); } Request request = builder.build(); LOGGER.debug("About to make request {}", request); try(Response result = client.newCall(request).execute()){ String response = result.body().string(); LOGGER.debug(response); return (T) factory.create(response); } } catch (IOException e){ throw new OpenShiftException(e, "Unable to execute request to %s", endpoint); } }</code><technical_language>Shouldnt this in URLBuilder</technical_language>

Target:
private <T extends IResource> T execute(HttpMethod method, String kind, String namespace, String name, String subresource, IResource payload) { return execute(method.toString(), kind, namespace, name, subresource, payload); }
Source:
<code>public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { <START> return BigtableAsyncUtilities.performAsyncRpc(retryOptions, request, sampleRowKeysAsync, <END> executorService); }</code><technical_language>some troubles understanding do resuse sampleRowKeysAsync RetryableRpc, create new for mutations. this match, say, checkAndMutateRow? Oh, I see, createStreamingAsync. reuse? for others</technical_language>

Target:
public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { return BigtableAsyncUtilities.performRetryingAsyncRpc(retryOptions, request, sampleRowKeysAsync, executorService); }
Source:
<code><START> String generateValue() { <END> return RandomStringUtils.random(valueSize, true, true); }</code><technical_language>![Codacy](<LINK_0> Issue found: [Use explicit scoping instead of default package private level](<LINK_1></technical_language>

Target:
protected String generateValue() { return RandomStringUtils.random(valueSize, true, true); }
Source:
<code>private GrantedAccess grantLocks(LockRequests requests, GrantedAccess rights) { Map<URI, AbstractLock> locks = createStreamOfLockRequests(requests) .map(requestedLock -> Pair.of(requestedLock.getKey(), getInitializedGrantedPermissions(requestedLock.getKey()).addAGrantedLock(requests.getUser(), requestedLock.getValue(), streamManagement, immutableReadFileManagement, rights))) <START> .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue())); <END> return new GrantedAccess(requests.getUser(), locks, this); }</code><technical_language>Lambda replaced method reference</technical_language>

Target:
private GrantedAccess grantLocks(LockRequests requests, GrantedAccess rights) { Map<URI, AbstractLock> locks = createStreamOfLockRequests(requests) .map(requestedLock -> Pair.of(requestedLock.getKey(), getInitializedGrantedPermissions(requestedLock.getKey()).addAGrantedLock(requests.getUser(), requestedLock.getValue(), streamManagement, immutableReadFileManagement, rights))) .collect(Collectors.toMap(Pair::getKey, Pair::getValue)); return new GrantedAccess(requests.getUser(), locks, this); }
Source:
<code><START> public static JMXServer getInstance() { <END> return jmxServer; }</code><technical_language>Return Optional instead</technical_language>

Target:
public static Optional<JMXServer> getInstance() { return Optional.ofNullable(jmxServer); }
Source:
<code>public void preProcessModule(Module module) { Properties props = new Properties(); <START> props.put(XD_MODULE_NAME_KEY, module.getName()); <END> props.put(XD_MODULE_INDEX_KEY, module.getDeploymentMetadata().getIndex()); props.put(XD_MODULE_TYPE_KEY, module.getType().name()); module.addProperties(props); }</code><technical_language>technically setProperty method working Properties underlying map methods</technical_language>

Target:
public void preProcessModule(Module module) { Properties props = new Properties(); props.setProperty(XD_MODULE_NAME_KEY, module.getName()); props.setProperty(XD_MODULE_INDEX_KEY, String.valueOf(module.getDeploymentMetadata().getIndex())); props.setProperty(XD_MODULE_TYPE_KEY, module.getType().name()); module.addProperties(props); }
Source:
<code>public boolean isActive() { long inactiveAge = System.currentTimeMillis() - lastAccessTime; <START> long sessionTimeout = 1000 * getHiveConf().getLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, <END> GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS_DEFAULT); return inactiveAge < sessionTimeout; }</code><technical_language>calculate session timeout in constructor? Calculating in isActive() is costly</technical_language>

Target:
public boolean isActive() { long inactiveAge = System.currentTimeMillis() - lastAccessTime; return inactiveAge < sessionTimeout; }
Source:
<code>private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (!StringUtils.isBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, <START> SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" <END> + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (!StringUtils.isBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (!StringUtils.isBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } } }</code><technical_language>a space open/close quotes? Otherwise, unnecessary string concatenations this statement</technical_language>

Target:
private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (StringUtils.isNotBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } } }
Source:
<code>public final void doAperiodicRun() { try { if(thread!=null && thread.isAlive()) { <START> logger.log(getSlowLoggingLevel(), name+" thread is still running. Execution aborted."); <END> return; } thread = new Thread(new Runnable() { public void run() { logger.log(getNormalLoggingLevel(), "Started "+name); long startTime = System.currentTimeMillis(); StreamTaskListener l = createListener(); try { l.getLogger().printf("Started at %tc%n", new Date(startTime)); ACL.impersonate(ACL.SYSTEM); try { execute(l); } finally { long stopTime = System.currentTimeMillis(); l.getLogger().printf("Finished at %tc. %dms%n", new Date(stopTime), stopTime - startTime); } } catch (IOException e) { e.printStackTrace(l.fatalError(e.getMessage())); } catch (InterruptedException e) { e.printStackTrace(l.fatalError("aborted")); } finally { l.closeQuietly(); } logger.log(getNormalLoggingLevel(), "Finished {0}. {1,number} ms", new Object[]{name, System.currentTimeMillis() - startTime}); } },name+" thread"); thread.start(); } catch (Throwable t) { logger.log(Level.SEVERE, name+" thread failed with error", t); } }</code><technical_language>changing this line is paramaterized logging avoid string concat if unneeded</technical_language>

Target:
public final void doAperiodicRun() { try { if(thread!=null && thread.isAlive()) { logger.log(getSlowLoggingLevel(), "{0} thread is still running. Execution aborted.", name); return; } thread = new Thread(new Runnable() { public void run() { logger.log(getNormalLoggingLevel(), "Started {0}", name); long startTime = System.currentTimeMillis(); long stopTime; StreamTaskListener l = createListener(); try { l.getLogger().printf("Started at %tc%n", new Date(startTime)); ACL.impersonate(ACL.SYSTEM); execute(l); } catch (IOException e) { e.printStackTrace(l.fatalError(e.getMessage())); } catch (InterruptedException e) { e.printStackTrace(l.fatalError("aborted")); } finally { stopTime = System.currentTimeMillis(); try { l.getLogger().printf("Finished at %tc. %dms%n", new Date(stopTime), stopTime - startTime); } finally { l.closeQuietly(); } } logger.log(getNormalLoggingLevel(), "Finished {0}. {1,number} ms", new Object[]{name, stopTime - startTime}); } },name+" thread"); thread.start(); } catch (Throwable t) { logger.log(Level.SEVERE, name+" thread failed with error", t); } }
Source:
<code>public String processForm(HttpServletRequest request, @ModelAttribute("queuedReports") QueuedReport editedReport, BindingResult errors, @RequestParam(value = "repeatIntervalUnits", required = false) String repeatIntervalUnits ) throws Exception { HttpSession httpSession = request.getSession(); QueuedReportService queuedReportService = Context.getService(QueuedReportService.class); repeatIntervalUnits = repeatIntervalUnits.toLowerCase().trim(); if (editedReport.getRepeatInterval() == null || editedReport.getRepeatInterval() < 0) { editedReport.setRepeatInterval(0); } else if (editedReport.getRepeatInterval() > 0) { if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "minutes")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60); } else if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "hours")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60); } else { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60 * 24); } } if (request.getParameter("purge") != null) { try { queuedReportService.purgeQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "The report was successfully removed"); return SUCCESS_VIEW; } catch (DataIntegrityViolationException e) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "error.object.inuse.cannot.purge"); return FORM_VIEW; } catch (APIException e) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "error.general: " + e.getLocalizedMessage()); return FORM_VIEW; } } <START> <END> queuedReportService.saveQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "Report queued for processing."); return SUCCESS_VIEW; }</code><technical_language>this block reached anymore? If not, revert this code too</technical_language>

Target:
public String processForm(HttpServletRequest request, @ModelAttribute("queuedReports") QueuedReport editedReport, BindingResult errors, @RequestParam(value = "repeatIntervalUnits", required = false) String repeatIntervalUnits ) throws Exception { HttpSession httpSession = request.getSession(); QueuedReportService queuedReportService = Context.getService(QueuedReportService.class); repeatIntervalUnits = repeatIntervalUnits.toLowerCase().trim(); if (editedReport.getRepeatInterval() == null || editedReport.getRepeatInterval() < 0) { editedReport.setRepeatInterval(0); } else if (editedReport.getRepeatInterval() > 0) { if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "minutes")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60); } else if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "hours")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60); } else { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60 * 24); } } queuedReportService.saveQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "Report queued for processing."); return SUCCESS_VIEW; }
Source:
<code>private void updateActionAvailability() { ArrayList<LibvirtSecretModel> secrets = getSelectedItems() != null ? Linq.<LibvirtSecretModel> cast(getSelectedItems()) : new ArrayList<LibvirtSecretModel>(); <START> getEditCommand().setIsExecutionAllowed(secrets.size() > 0); <END> getRemoveCommand().setIsExecutionAllowed(secrets.size() > 0); }</code><technical_language>equals 1? editing of multiple secrets is allowed</technical_language>

Target:
private void updateActionAvailability() { ArrayList<LibvirtSecretModel> secrets = getSelectedItems() != null ? Linq.<LibvirtSecretModel> cast(getSelectedItems()) : new ArrayList<LibvirtSecretModel>(); getEditCommand().setIsExecutionAllowed(secrets.size() == 1); getRemoveCommand().setIsExecutionAllowed(secrets.size() > 0); }
Source:
<code>public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { <START> if ("http".equals(context.getHttpRequest().getUrl().getProtocol())) { <END> return Mono.error(new RuntimeException("Token credentials require a URL using the HTTPS protocol scheme")); } return next.clone().process() .doOnNext(httpResponse -> { try { httpResponse.getBody().subscribe().dispose(); } catch (RuntimeException ignored) { logger.logExceptionAsWarning(ignored); } }) .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { cache.setTokenRequest(new TokenRequestContext().addScopes(map.get("resource") + "/.default")); return cache.getToken(); }) .flatMap(token -> { context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); }</code><technical_language>Nit: safer check equal "https"? other protocol would/should work, matter in grand scope of fits error message better</technical_language>

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (!context.getHttpRequest().getUrl().getProtocol().startsWith("https")) { return Mono.error(new RuntimeException("Token credentials require a URL using the HTTPS protocol scheme")); } return next.clone().process() .doOnNext(httpResponse -> { try { httpResponse.getBody().subscribe().dispose(); } catch (RuntimeException ignored) { logger.logExceptionAsWarning(ignored); } }) .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { cache.setTokenRequest(new TokenRequestContext().addScopes(map.get("resource") + "/.default")); return cache.getToken(); }) .flatMap(token -> { context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); }
Source:
<code>private static List<ResourceLocator> orderedResources0(String classpathResourceName) throws IOException { ClassLoader classLoader = ResourceLocator.classLoader(); List<String> names = new ArrayList<>(); List<ResourceLocator> result = new ArrayList<>(); for (String dir : RESOURCE_DIRS) { String name = CONFIG_PACKAGE + dir + "/" + classpathResourceName; names.add(name); List<URL> urls = Collections.list(classLoader.getResources(name)); switch (urls.size()) { case 0: continue; case 1: result.add(ResourceLocator.ofClasspathUrl(urls.get(0))); break; default: ResourceLocator baseResource = ResourceLocator.ofClasspathUrl(urls.get(0)); for (int i = 1; i < urls.size(); i++) { <START> ResourceLocator otherResource = ResourceLocator.ofClasspathUrl(urls.get(1)); <END> if (!baseResource.getByteSource().contentEquals(otherResource.getByteSource())) { log.severe("More than one file found on the classpath: " + name + ": " + urls); throw new IllegalStateException("More than one file found on the classpath: " + name + ": " + urls); } } result.add(baseResource); break; } } if (result.isEmpty()) { log.severe("No resource files found on the classpath: " + names); throw new IllegalStateException("No files found on the classpath: " + names); } log.config(() -> "Resources found: " + result); return result; }</code><technical_language>I this urls.get(i)</technical_language>

Target:
private static List<ResourceLocator> orderedResources0(String classpathResourceName) throws IOException { ClassLoader classLoader = ResourceLocator.classLoader(); List<String> names = new ArrayList<>(); List<ResourceLocator> result = new ArrayList<>(); for (String dir : RESOURCE_DIRS) { String name = CONFIG_PACKAGE + dir + "/" + classpathResourceName; names.add(name); List<URL> urls = Collections.list(classLoader.getResources(name)); switch (urls.size()) { case 0: continue; case 1: result.add(ResourceLocator.ofClasspathUrl(urls.get(0))); break; default: ResourceLocator baseResource = ResourceLocator.ofClasspathUrl(urls.get(0)); for (int i = 1; i < urls.size(); i++) { ResourceLocator otherResource = ResourceLocator.ofClasspathUrl(urls.get(i)); if (!baseResource.getByteSource().contentEquals(otherResource.getByteSource())) { log.severe("More than one file found on the classpath: " + name + ": " + urls); throw new IllegalStateException("More than one file found on the classpath: " + name + ": " + urls); } } result.add(baseResource); break; } } if (result.isEmpty()) { log.severe("No resource files found on the classpath: " + names); throw new IllegalStateException("No files found on the classpath: " + names); } log.config(() -> "Resources found: " + result); return result; }
Source:
<code><START> public ClaimedTaskRest fromModel(ClaimedTask obj) { <END> ClaimedTaskRest taskRest = new ClaimedTaskRest(); XmlWorkflowItem witem = obj.getWorkflowItem(); taskRest.setId(obj.getID()); taskRest.setWorkflowitem(workflowItemConverter.convert(witem)); taskRest.setAction(obj.getActionID()); taskRest.setStep(obj.getStepID()); return taskRest; }</code><technical_language>owner of claimed task part of ClaimedTaskRest</technical_language>

Target:
public ClaimedTaskRest fromModel(ClaimedTask obj) { ClaimedTaskRest taskRest = new ClaimedTaskRest(); XmlWorkflowItem witem = obj.getWorkflowItem(); taskRest.setId(obj.getID()); taskRest.setWorkflowitem(workflowItemConverter.convert(witem)); taskRest.setAction(obj.getActionID()); taskRest.setStep(obj.getStepID()); taskRest.setOwner(epersonConverter.convert(obj.getOwner())); return taskRest; }
Source:
<code>public VdcParameter deserializeKey(String key, DeserializationContext ctxt) throws IOException { String[] tokens = key.split(";"); <START> return VdcParameter.getExisting(tokens[2]); <END> }</code><technical_language>is token[2], please explain</technical_language>

Target:
public VdcParameter deserializeKey(String key, DeserializationContext ctxt) throws IOException { return VdcParameter.deserialize(key); }
Source:
<code>public void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .build()); <START> when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(any(), any())).thenReturn(Optional.of(charge)); <END> final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); notificationService.handleNotificationFor(payload); verify(mockChargeNotificationProcessor, times(1)).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }</code><technical_language>a fan of any()s here: provide more specific values</technical_language>

Target:
public void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .withGatewayTransactionId(payId) .build()); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger("epdq", payId)) .thenReturn(Optional.of(charge)); final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); notificationService.handleNotificationFor(payload); verify(mockChargeNotificationProcessor, times(1)).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }
Source:
<code>protected IPageStore newPersistentStore() { StoreSettings storeSettings = application.getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); <START> if (storeSettings.isEncrypted()) { <END> return new SerializingPageStore(new CryptingPageStore(new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession)), getSerializer()); } else { return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession, getSerializer()); } }</code><technical_language>nice chain configurable a field in general more spring like. (Like in case of spring Filters) implemented a List in add filter places delegate other. add new filters in filters.add(0,new MyFilter(...)); WDYT</technical_language>

Target:
protected IPageStore newPersistentStore() { StoreSettings storeSettings = application.getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession); }
Source:
<code>public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkState(); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } <START> setState(false); <END> return walk; }</code><technical_language>errors? Is ok retry execution of a partially failed command</technical_language>

Target:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkCallable(); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } setCallable(false); return walk; }
Source:
<code>FutureDerivative addResult(URI path) { <START> FutureDerivative furureDerivative = new FutureDerivative(uriToPath(path)); <END> results.add(furureDerivative); return furureDerivative; }</code><technical_language>is a typo in furureDerivative</technical_language>

Target:
FutureDerivative addResult(URI path) { FutureDerivative futureDerivative = new FutureDerivative(uriToPath(path)); results.add(futureDerivative); return futureDerivative; }
Source:
<code>public TrackListLocalCardAdapter getRecyclerViewAdapter() { return new TrackListLocalCardAdapter(mTrackList, new OnTrackInteractionCallback() { @Override public void onTrackDetailsClicked(Track track, View transitionView) { LOG.info(String.format("onTrackDetailsClicked(%s)", track.getTrackID() .toString())); int trackID = (int) track.getTrackID().getId(); TrackDetailsActivity.navigate(getActivity(), transitionView, trackID); } @Override public void onDeleteTrackClicked(Track track) { LOG.info(String.format("onDeleteTrackClicked(%s)", track.getTrackID())); createDeleteTrackDialog(track); } @Override public void onUploadTrackClicked(Track track) { LOG.info(String.format("onUploadTrackClicked(%s)", track.getTrackID())); if (track.hasProperty(Measurement.PropertyKey.SPEED)) { onUploadSingleTrack(track); } else { showSnackbar(R.string.trackviews_cannot_upload_gps_tracks); } } @Override public void onExportTrackClicked(Track track) { LOG.info(String.format("onExportTrackClicked(%s)", track.getTrackID())); if (mUserManager.getUser()!=null) { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), mUserManager.getUser().getTermsOfUseVersion())); exportTrack(track); } else { <START> showSnackbar(R.string.trackview_cannot_export_track); <END> } } @Override public void onDownloadTrackClicked(Track track, AbstractTrackListCardAdapter .TrackCardViewHolder holder) { } }); }</code><technical_language>I guess simply set terms of version null if user exists. is logged in users export a track</technical_language>

Target:
public TrackListLocalCardAdapter getRecyclerViewAdapter() { return new TrackListLocalCardAdapter(mTrackList, new OnTrackInteractionCallback() { @Override public void onTrackDetailsClicked(Track track, View transitionView) { LOG.info(String.format("onTrackDetailsClicked(%s)", track.getTrackID() .toString())); int trackID = (int) track.getTrackID().getId(); TrackDetailsActivity.navigate(getActivity(), transitionView, trackID); } @Override public void onDeleteTrackClicked(Track track) { LOG.info(String.format("onDeleteTrackClicked(%s)", track.getTrackID())); createDeleteTrackDialog(track); } @Override public void onUploadTrackClicked(Track track) { LOG.info(String.format("onUploadTrackClicked(%s)", track.getTrackID())); if (track.hasProperty(Measurement.PropertyKey.SPEED)) { onUploadSingleTrack(track); } else { showSnackbar(R.string.trackviews_cannot_upload_gps_tracks); } } @Override public void onExportTrackClicked(Track track) { LOG.info(String.format("onExportTrackClicked(%s)", track.getTrackID())); if (mUserManager.getUser()!=null) { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), mUserManager.getUser().getTermsOfUseVersion())); } else { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), null)); } exportTrack(track); } @Override public void onDownloadTrackClicked(Track track, AbstractTrackListCardAdapter .TrackCardViewHolder holder) { } }); }
Source:
<code>public static Matrix4 createRotationMatrix(double yaw, double pitch, double roll) { Matrix4 ret = new Matrix4(); <START> return ret.setToRotation(yaw, pitch, roll); <END> }</code><technical_language>return new Matrix4().setToRotation(yaw, pitch, roll);</technical_language>

Target:
public static Matrix4 createRotationMatrix(double yaw, double pitch, double roll) { return new Matrix4().setToRotation(yaw, pitch, roll); }
Source:
<code>public User getUserByActivationKey(String activationKey) { <START> return (User) sessionFactory.getCurrentSession().createCriteria(User.class).add(Restrictions.ilike("activation_key", activationKey, MatchMode.START)).uniqueResult(); <END> }</code><technical_language>I for this more correct need compare keys stripped ttl</technical_language>

Target:
public User getUserByActivationKey(String activationKey) { User user = (User) sessionFactory.getCurrentSession().createCriteria(User.class).add(Restrictions.like("activationKey", activationKey, MatchMode.START)).uniqueResult(); if(user != null) { String[] tokens = user.getActivationKey().split(":"); if(tokens[0].equals(activationKey)) { return user; } } return null; }
Source:
<code>private void mockConcat(Path target, Path[] srcArray) throws IOException { Path tmp = new Path(target.getParent(), target.getName() + ".bak"); lfs.rename(target, tmp); OutputStream out = lfs.create(target); try { InputStream in = lfs.open(tmp); try { IOUtils.copyBytes(in, out, 1024); } finally { if (in != null) { <START> in.close(); <END> } lfs.delete(tmp, true); } for (int i = 0; i < srcArray.length; i++) { in = lfs.open(srcArray[i]); try { IOUtils.copyBytes(in, out, 1024); } finally { if (in != null) { in.close(); } lfs.delete(srcArray[i], true); } } } finally { if (out != null) { out.close(); } } }</code><technical_language>try/finally restore error stream</technical_language>

Target:
private void mockConcat(Path target, Path[] srcArray) throws IOException { Path tmp = new Path(target.getParent(), target.getName() + ".bak"); lfs.rename(target, tmp); try (OutputStream out = lfs.create(target)) { try (InputStream in = lfs.open(tmp)) { IOUtils.copyBytes(in, out, 1024); } lfs.delete(tmp, true); for (int i = 0; i < srcArray.length; i++) { try (InputStream iin = lfs.open(srcArray[i])) { IOUtils.copyBytes(iin, out, 1024); } lfs.delete(srcArray[i], true); } } }
Source:
<code>private static HttpRequestRetryHandler createRetryHandler() { switch ( RETRY_HANDLER_CLASS ) { case "default": if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) { return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) { }; <START> case "standard": <END> return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); case "auto": return DefaultHttpRequestRetryHandler.INSTANCE; default: try { final ClassLoader classLoader = AbstractHttpClientWagon.class.getClassLoader(); return HttpRequestRetryHandler.class.cast( classLoader.loadClass( RETRY_HANDLER_CLASS ) .getConstructor().newInstance() ); } catch ( final Exception e ) { throw new IllegalArgumentException( e ); } } }</code><technical_language>I accept this for reasons above</technical_language>

Target:
private static HttpRequestRetryHandler createRetryHandler() { switch ( RETRY_HANDLER_CLASS ) { case "default": if ( StringUtils.isEmpty( RETRY_HANDLER_EXCEPTIONS ) ) { if ( RETRY_HANDLER_COUNT == 3 && !RETRY_HANDLER_REQUEST_SENT_ENABLED ) { return DefaultHttpRequestRetryHandler.INSTANCE; } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) { }; case "standard": return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); default: try { final ClassLoader classLoader = AbstractHttpClientWagon.class.getClassLoader(); return HttpRequestRetryHandler.class.cast( classLoader.loadClass( RETRY_HANDLER_CLASS ) .getConstructor().newInstance() ); } catch ( final Exception e ) { throw new IllegalArgumentException( e ); } } }
Source:
<code><START> ImmutableIntArray getIds() <END> { return new ImmutableIntArray(ids, idsOffset, positionCount); }</code><technical_language>DictionaryBlock need offset length, hence, this method return int[]. DictionaryBlockEncoding offset length, is clear work huge arrays this change. error occur in SliceOutput</technical_language>

Target:
Slice getIds() { return Slices.wrappedIntArray(ids, idsOffset, positionCount); }
Source:
<code>public void addChildElement(PropertyWriter p) { this.childElements.put(p.getElement().getId(), p); <START> if (p instanceof BoundaryEventPropertyWriter) { <END> process.getFlowElements().add(p.getFlowElement()); } else { process.getFlowElements().add(0, p.getFlowElement()); } ElementParameters simulationParameters = p.getSimulationParameters(); if (simulationParameters != null) { this.simulationParameters.add(simulationParameters); } addChildShape(p.getShape()); addChildEdge(p.getEdge()); this.itemDefinitions.addAll(p.getItemDefinitions()); this.rootElements.addAll(p.rootElements); if (p instanceof SubProcessPropertyWriter) { Collection<BasePropertyWriter> childElements = ((SubProcessPropertyWriter) p).getChildElements(); childElements.forEach(el -> { addChildShape(el.getShape()); addChildEdge(el.getEdge()); }); } }</code><technical_language>this code cam shared process/subprocess property writers, it? In some helper method abstraction works for me..</technical_language>

Target:
public void addChildElement(PropertyWriter p) { Processes.addChildElement( p, childElements, process, simulationParameters, itemDefinitions, rootElements); addChildShape(p.getShape()); addChildEdge(p.getEdge()); if (p instanceof SubProcessPropertyWriter) { Collection<BasePropertyWriter> childElements = ((SubProcessPropertyWriter) p).getChildElements(); childElements.forEach(el -> { addChildShape(el.getShape()); addChildEdge(el.getEdge()); }); } }
Source:
<code>boolean isRefreshTokenInvalid() { return httpStatusCode == 401 || httpStatusCode == 403 || (httpStatusCode == 400 && response.error .equals(INVALID_GRANT) || (httpStatusCode == 400 && response.error .equals(WRONG_VERSION))); <START> } <END></code><technical_language>isRefreshTokenInvalid() return true for 400 of response.error is</technical_language>

Target:
boolean isRefreshTokenInvalid() { return httpStatusCode == HttpStatus.SC_UNAUTHORIZED || httpStatusCode == HttpStatus.SC_FORBIDDEN || httpStatusCode == HttpStatus.SC_BAD_REQUEST; }
Source:
<code>public void cacheUpdateTriggeredOnNodeChange() throws InterruptedException { final int parralelism = 10; final List<Cache> caches = new ArrayList<>(); for (int i = 0; i < parralelism; ++i) { caches.add(Mockito.mock(Cache.class)); } final List<ZookeeperNodeInvalidator> invalidators = caches .stream() .map(v -> new ZookeeperNodeInvalidator(v, CURATOR, "/xxx/yyy", TimeUnit.MINUTES.toMillis(10))) .collect(Collectors.toList()); invalidators.forEach(ZookeeperNodeInvalidator::start); try { <START> ThreadUtils.sleep(200); <END> for (int idx = 0; idx < 5; ++idx) { invalidators.get(idx % invalidators.size()).notifyUpdate(); ThreadUtils.sleep(200); for (final Cache c : caches) { Mockito.verify(c, Mockito.times(idx + 2)).refresh(); } } } finally { invalidators.forEach(ZookeeperNodeInvalidator::stop); } }</code><technical_language>wait a condition instead of waiting time? This produce brittle tests</technical_language>

Target:
public void cacheUpdateTriggeredOnNodeChange() throws InterruptedException { final int parralelism = 10; final List<Cache> caches = new ArrayList<>(); for (int i = 0; i < parralelism; ++i) { caches.add(Mockito.mock(Cache.class)); } final List<ZookeeperNodeInvalidator> invalidators = caches .stream() .map(v -> new ZookeeperNodeInvalidator(v, CURATOR, "/xxx/yyy", TimeUnit.MINUTES.toMillis(10))) .collect(Collectors.toList()); invalidators.forEach(ZookeeperNodeInvalidator::start); try { waitForNCachesRefreshes(1, true, caches); for (int idx = 0; idx < 5; ++idx) { invalidators.get(idx % invalidators.size()).notifyUpdate(); waitForNCachesRefreshes(idx + 2, true, caches); } } finally { invalidators.forEach(ZookeeperNodeInvalidator::stop); } }
Source:
<code>public long getSegmentSize(long startAddress) { long size = 0; <START> try { <END> size = getSegmentHandleForAddress(startAddress).getWriteChannel().size(); } catch (IOException e) { log.error("Could not get file size for address ", startAddress, e); } return size; }</code><technical_language>exception bubble up, confusing debug IOException ' s</technical_language>

Target:
public long getSegmentSize(long startAddress) { long size = 0; try { size = getSegmentHandleForAddress(startAddress).getWriteChannel().size(); } catch (IOException e) { log.error("Could not get file size for startAddress ", startAddress, e); } return size; }
Source:
<code>public ScriptMetadata readObject(ObjectInput input) throws IOException, ClassNotFoundException { Builder builder = new ScriptMetadata.Builder(); builder.name(input.readUTF()).extension(input.readUTF()).mode(ExecutionMode.valueOf(input.readUTF())); builder.parameters(readSet(input)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.language(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.role(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.reducer(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.collator(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.combiner(s)); <START> return builder.build(); <END> }</code><technical_language>constructor directly</technical_language>

Target:
public ScriptMetadata readObject(ObjectInput input) throws IOException, ClassNotFoundException { String name = input.readUTF(); String extension = input.readUTF(); ExecutionMode mode = ExecutionMode.valueOf(input.readUTF()); Set<String> parameters = (Set<String>) input.readObject(); Optional<String> language = (Optional<String>) input.readObject(); Optional<String> role = (Optional<String>) input.readObject(); Optional<String> reducer = (Optional<String>) input.readObject(); Optional<String> collator = (Optional<String>) input.readObject(); Optional<String> combiner = (Optional<String>) input.readObject(); return new ScriptMetadata(name, language, extension, mode, parameters, role, reducer, collator, combiner); }
Source:
<code><START> public VirtualReplicatorCluster getVirtualReplicatorCluster() { <END> if (virtualReplicatorCluster == null) { virtualReplicatorCluster = new StaticVcrCluster(cloudConfig, clusterMapConfig, clusterMap); } return virtualReplicatorCluster; }</code><technical_language>Singleton threadsafe. worried multiple threads calling this method</technical_language>

Target:
synchronized public VirtualReplicatorCluster getVirtualReplicatorCluster() { if (virtualReplicatorCluster == null) { virtualReplicatorCluster = new StaticVcrCluster(cloudConfig, clusterMapConfig, clusterMap); } return virtualReplicatorCluster; }
Source:
<code>public void checkDisplay() { String[] resourceNames = new String[]{FhirResourceService.BINARY_RESOURCE_NAME, FhirResourceService.DOCREF_RESOURCE_NAME, FhirResourceService.PATIENT_RESOURCE_NAME }; for(String resourceName : resourceNames) { boolean hasResource; try { hasResource = checkForResource(resourceName); } catch(ConnectionManagerException e) { <START> LOG.warn(e, e); <END> hasResource = false; } if(hasResource == true) { DisplayHolder.getInstance().setFhirEnabled(hasResource); return; } } DisplayHolder.getInstance().setFhirEnabled(false); }</code><technical_language>this "LOG.warn(e.getLocalizedMessage(), e)"</technical_language>

Target:
public void checkDisplay() { String[] resourceNames = new String[]{FhirResourceService.BINARY_RESOURCE_NAME, FhirResourceService.DOCREF_RESOURCE_NAME, FhirResourceService.PATIENT_RESOURCE_NAME}; for (String resourceName : resourceNames) { boolean hasResource; try { hasResource = checkForResource(resourceName); } catch (ConnectionManagerException e) { LOG.warn(e.getLocalizedMessage(), e); hasResource = false; } if (hasResource) { DisplayHolder.getInstance().setFhirEnabled(hasResource); return; } } DisplayHolder.getInstance().setFhirEnabled(false); }
Source:
<code>public void setID(Serializable iD) { <START> this.iD = iD; <END> }</code><technical_language>I need call wrappedBuilder.setId(id)</technical_language>

Target:
public void setID(Serializable iD) { wrappedBuilder.setID(iD); }
Source:
<code>public void addDomainSpecifColumns(ExtendedPagedTable<T> extendedPagedTable, Set<String> columns) { extendedPagedTable.storeColumnToPreferences(); List<ColumnMeta<T>> columnMetas = extendedPagedTable.getColumnMetaList().stream() .filter(cm -> cm.isExtraColumn()) .collect(Collectors.toList()); columnMetas.forEach(colMet -> { if (!columns.contains(colMet.getCaption())) { extendedPagedTable.removeColumnMeta(colMet); } else { columns.remove(colMet.getCaption()); } }); List<ColumnMeta<T>> columnMetaList = (List<ColumnMeta<T>>)extendedPagedTable.getColumnMetaList().stream() .filter(cm -> !cm.isExtraColumn() && columns.contains(cm.getCaption())) .map(colMet -> { Column genericColumn = initGenericColumn(colMet.getCaption()); genericColumn.setSortable(false); return new ColumnMeta<T>(genericColumn, "Var_" + colMet.getCaption(), true, true); }).collect(Collectors.toList()); <START> columns.stream().filter(column -> (columnMetaList.stream().filter(columnMeta -> column.contains(columnMeta.getColumn().getDataStoreName())).collect(Collectors.toList())).size() == 0) <END> .collect(Collectors.toList()) .forEach(column -> { Column genericColumn = initGenericColumn(column); genericColumn.setSortable(false); columnMetaList.add(new ColumnMeta<T>(genericColumn, column, true, true)); }); extendedPagedTable.addColumns(columnMetaList); }</code><technical_language>This code is unnecessarily complex: Couple of general tips: Stream.of(1,2,3).collect(toList()).size() -> Stream.of(1,2,3).count()</technical_language>

Target:
public void addDomainSpecifColumns(ExtendedPagedTable<T> extendedPagedTable, Set<String> columns) { extendedPagedTable.storeColumnToPreferences(); List<GridColumnPreference> gridColumnPreferenceList = removeRedundantColumns(extendedPagedTable, columns); List<ColumnMeta<T>> columnMetaList = renameDomainSpecifColumns(extendedPagedTable, columns); addDomainColumns(columnMetaList, columns); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().addAll(gridColumnPreferenceList); columnMetaList.forEach(columnMeta -> { List<GridColumnPreference> list = gridColumnPreferenceList.stream().filter(gridColumnPreference -> gridColumnPreference.getName().equals(columnMeta.getColumn().getDataStoreName())).collect(Collectors.toList()); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().addAll(list); extendedPagedTable.addColumns(Arrays.asList(columnMeta)); }); }