auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Jenkins j = Jenkins.getInstance(); j.checkPermission(Jenkins.ADMINISTER); HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm)j.getSecurityRealm(); User admin = securityRealm.getUser(SetupWizard.initialSetupAdminUserName); try { if(admin != null) { admin.delete(); } <START> User u = securityRealm.createAccountByAdmin(req, rsp, "/jenkins/install/SetupWizard/setupWizardFirstUser.jelly", j.getRootUrl()); <END> if (u != null) { if(admin != null) { admin = null; } j.setInstallState(InstallState.CREATE_ADMIN_USER.getNextState()); Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1")); a = securityRealm.getSecurityComponents().manager.authenticate(a); SecurityContextHolder.getContext().setAuthentication(a); } } finally { if(admin != null) { admin.save(); } } }</code><technical_language>sendRedirect2 pass /. Do getRootUrl internally. [Guide](<LINK_0></technical_language>

Target:
public void doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Jenkins j = Jenkins.getInstance(); j.checkPermission(Jenkins.ADMINISTER); HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm)j.getSecurityRealm(); User admin = securityRealm.getUser(SetupWizard.initialSetupAdminUserName); try { if(admin != null) { admin.delete(); } User u = securityRealm.createAccountByAdmin(req, rsp, "/jenkins/install/SetupWizard/setupWizardFirstUser.jelly", req.getContextPath() + "/"); if (u != null) { if(admin != null) { admin = null; } j.setInstallState(InstallState.CREATE_ADMIN_USER.getNextState()); Authentication a = new UsernamePasswordAuthenticationToken(u.getId(),req.getParameter("password1")); a = securityRealm.getSecurityComponents().manager.authenticate(a); SecurityContextHolder.getContext().setAuthentication(a); } } finally { if(admin != null) { admin.save(); } } }
Source:
<code>public synchronized String toString(LocalTime localTime) { sbuf.setLength(0); if (localTime.isAfter(MAX_TIME)) { return "24:00:00"; } int nano = localTime.getNano(); <START> if (nano % 1000 >= 500) { <END> localTime = localTime.plus(ONE_MICROSECOND); } appendTime(sbuf, localTime); return sbuf.toString(); }</code><technical_language>This expression (nano % 1000 >= 500) is in more place, extract a function</technical_language>

Target:
public synchronized String toString(LocalTime localTime) { sbuf.setLength(0); if (localTime.isAfter(MAX_TIME)) { return "24:00:00"; } int nano = localTime.getNano(); if (nanosExceed499(nano)) { localTime = localTime.plus(ONE_MICROSECOND); } appendTime(sbuf, localTime); return sbuf.toString(); }
Source:
<code>public void uncaughtException(Thread thread, Throwable exception) { try { <START> handleException(thread, exception); <END> } catch (Throwable t) { LOG.log(Level.SEVERE, "Failed to handle exception. Process halting", t); Runtime.getRuntime().halt(1); } }</code><technical_language>I need complicated. do recovering here, simply: Log(...); // ReleaseResourcesExplicitlyIfNeeded() a bit tricky. // If want release resources explicitly, set a timeout void unexpected hanging // Also, is other unexpected behaviors // If resources eventually released death of a process, // ok clean explicitly ReleaseResourcesExplicitlyIfNeeded(); Runtime.getRuntime().halt(1);</technical_language>

Target:
public void uncaughtException(Thread thread, Throwable exception) { try { LOG.log(Level.SEVERE, "Exception caught in thread: " + thread.getName() + " with thread id: " + thread.getId(), exception); } finally { Runtime.getRuntime().halt(1); } }
Source:
<code>public void test_ipv4_cidr_operator() throws Throwable { test(COLUMN_NAME, new String[]{"192.168.0.1", "192.168.1.1", "192.168.1.7", "192.168.1.255", "192.168.2.0", "10.0.0.1"}, <START> String.format("%s << '192.168.1.1/24'", COLUMN_NAME), <END> "192.168.1.1", "192.168.1.7", "192.168.1.255"); }</code><technical_language>Please String.format explicit LOCALE. randomize locales in tests, this flaky. I guess column name inlined anyway, is static/always same</technical_language>

Target:
public void test_ipv4_cidr_operator() throws Throwable { test("ip_addr", new String[]{"192.168.0.1", "192.168.1.1", "192.168.1.7", "192.168.1.255", "192.168.2.0", "10.0.0.1"}, "ip_addr << '192.168.1.1/24'", "192.168.1.1", "192.168.1.7", "192.168.1.255"); }
Source:
<code>public void onFailure(@NonNull final Call<T> call, @NonNull final Throwable error) { if (progressCallback != null) { progressCallback.finishProcess(); } if (errorNotification != null) { if (refreshListener != null) { <START> errorNotification.showError(R.string.reset_no_network_message, <END> FontAwesomeIcons.fa_wifi, R.string.lbl_reload, new View.OnClickListener() { @Override public void onClick(View v) { if (NetworkUtil.isConnected(context)) { refreshListener.onRefresh(); } } }); } else { errorNotification.showError(context, error); } } onFailure(error); }</code><technical_language>un-conditionally showing network message checking is actual of error</technical_language>

Target:
public void onFailure(@NonNull final Call<T> call, @NonNull final Throwable error) { if (progressCallback != null) { progressCallback.finishProcess(); } if (messageCallback != null && callTrigger != null && !call.isCanceled()) { messageCallback.onMessage(callTrigger.getMessageType(), ErrorUtils.getErrorMessage(error, callTrigger, context)); } if (errorNotification != null) { if (refreshListener != null) { errorNotification.showError(context, error, R.string.lbl_reload, new View.OnClickListener() { @Override public void onClick(View v) { if (NetworkUtil.isConnected(context)) { refreshListener.onRefresh(); } } }); } else { errorNotification.showError(context, error); } } onFailure(error); onFinish(); }
Source:
<code>public void addLocalAuthentication(UserEntity userEntity, String password, boolean persist) throws AmbariException { validatePassword(password); String encodedPassword = passwordEncoder.encode(password); addAuthentication(userEntity, UserAuthenticationType.LOCAL, encodedPassword, <START> new Validator() { <END> @Override public void validate(UserEntity userEntity, String key) throws AmbariException { List<UserAuthenticationEntity> authenticationEntities = userEntity.getAuthenticationEntities(); for (UserAuthenticationEntity entity : authenticationEntities) { if (entity.getAuthenticationType() == UserAuthenticationType.LOCAL) { throw new AmbariException("The authentication type already exists for this user"); } } } }, persist); }</code><technical_language>do lambda approach</technical_language>

Target:
public void addLocalAuthentication(UserEntity userEntity, String password, boolean persist) throws AmbariException { validatePassword(password); String encodedPassword = passwordEncoder.encode(password); addAuthentication(userEntity, UserAuthenticationType.LOCAL, encodedPassword, (user, key) -> { List<UserAuthenticationEntity> authenticationEntities = user.getAuthenticationEntities(); for (UserAuthenticationEntity entity : authenticationEntities) { if (entity.getAuthenticationType() == UserAuthenticationType.LOCAL) { throw new AmbariException("The authentication type already exists for this user"); } } }, persist); }
Source:
<code>private static void checkSingleData(XmlContext context, Element data) { for (String name : PATH_ATTR_LIST) { if (data.hasAttributeNS(ANDROID_URI, name)) { Attr attr = data.getAttributeNodeNS(ANDROID_URI, name); String path = tryLookUpStringInResource(context, attr.getValue()); if (!path.startsWith("/")) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), <START> "android:" + name + " attribute should start with /"); <END> } } } if (data.hasAttributeNS(ANDROID_URI, ATTRIBUTE_PORT)) { Attr attr = data.getAttributeNodeNS(ANDROID_URI, ATTRIBUTE_PORT); try { String port = tryLookUpStringInResource(context, attr.getValue()); Integer.parseInt(port); } catch (NumberFormatException e) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), "android:port is not a legal number"); } } NamedNodeMap attrs = data.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { Node item = attrs.item(i); if (item.getNodeType() == Node.ATTRIBUTE_NODE) { Attr attr = (Attr) attrs.item(i); if (attr.getValue().isEmpty()) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), attr.getName() + " cannot be empty"); } } } }</code><technical_language>include path variable clear users considered looked-up (e.g. if shown @string/foo replace @string/foo resolved to)</technical_language>

Target:
private static void checkSingleData(XmlContext context, Element data) { for (String name : PATH_ATTR_LIST) { if (data.hasAttributeNS(ANDROID_URI, name)) { Attr attr = data.getAttributeNodeNS(ANDROID_URI, name); String path = replaceUrlWithValue(context, attr.getValue()); if (!path.startsWith("/") && !path.startsWith(SdkConstants.PREFIX_RESOURCE_REF)) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), "android:" + name + " attribute should start with '/', which is :" + path); } } } if (data.hasAttributeNS(ANDROID_URI, ATTRIBUTE_PORT)) { Attr attr = data.getAttributeNodeNS(ANDROID_URI, ATTRIBUTE_PORT); try { String port = replaceUrlWithValue(context, attr.getValue()); Integer.parseInt(port); } catch (NumberFormatException e) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), "android:port is not a legal number"); } } NamedNodeMap attrs = data.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { Node item = attrs.item(i); if (item.getNodeType() == Node.ATTRIBUTE_NODE) { Attr attr = (Attr) attrs.item(i); if (attr.getValue().isEmpty()) { context.report(ISSUE_ERROR, attr, context.getLocation(attr), attr.getName() + " cannot be empty"); } } } }
Source:
<code>public void testWorkIdempotentConcurrent() throws InterruptedException { MetricsTracker tracker = new MetricsTracker(); tracker.assertDiff(0, 0, 0, 0); SleepWork work1 = new SleepWork(getDurationMillis()); SleepWork work2 = new SleepWork(getDurationMillis()); service.schedule(work1); service.schedule(work1); service.schedule(work1); service.schedule(work2); service.schedule(work2); service.schedule(work2); <START> assertTrue(service.awaitCompletion(getDurationMillis() * 3, TimeUnit.MILLISECONDS)); <END> tracker.assertDiff(0, 0, 6, 0); }</code><technical_language>in theory takes 2s, if takes 3s work means work1 is executed twice. timeout 3s try "getDurationMillis() * 3 - 200"</technical_language>

Target:
public void testWorkIdempotentConcurrent() throws InterruptedException { MetricsTracker tracker = new MetricsTracker(); tracker.assertDiff(0, 0, 0, 0); SleepWork work1 = new SleepWork(getDurationMillis()); SleepWork work2 = new SleepWork(getDurationMillis()); service.schedule(work1); service.schedule(work1); service.schedule(work1); service.schedule(work2); service.schedule(work2); service.schedule(work2); assertTrue(service.awaitCompletion(getDurationMillis() * 3 - 200, TimeUnit.MILLISECONDS)); tracker.assertDiff(0, 0, 6, 0); }
Source:
<code>public Host lookup(final String hostName) { <START> if (cache == null || userConfigFile.hasChanged()) <END> updateCache(); Host h = cache.get(hostName); if (h == null) h = new Host(); if (h.patternsApplied) return h; for (final Map.Entry<String, Host> e : cache.entrySet()) { if (!isHostPattern(e.getKey())) continue; if (!isHostMatch(e.getKey(), hostName)) continue; h.copyFrom(e.getValue()); } if (h.hostName == null) h.hostName = hostName; if (h.user == null) h.user = OpenSshConfig.userName(); if (h.port == 0) h.port = OpenSshConfig.SSH_PORT; h.patternsApplied = true; return h; }</code><technical_language>This thread safe. caller wrong cache instance, a partially initialized one. cache volatile, need some synchronization cache field running updateCache() method replace contents a new map. This work synchronized of a single refresh() method</technical_language>

Target:
public Host lookup(final String hostName) { if (userConfigFile.hasChanged()) updateCache(); Host h = cache.get(hostName); if (h == null) h = new Host(); if (h.patternsApplied) return h; for (final Map.Entry<String, Host> e : cache.entrySet()) { if (!isHostPattern(e.getKey())) continue; if (!isHostMatch(e.getKey(), hostName)) continue; h.copyFrom(e.getValue()); } if (h.hostName == null) h.hostName = hostName; if (h.user == null) h.user = OpenSshConfig.userName(); if (h.port == 0) h.port = OpenSshConfig.SSH_PORT; h.patternsApplied = true; return h; }
Source:
<code>private static String[][] uncheckedApproveSignature(ScriptApproval target, String signature) { try { return target.approveSignature(signature); } catch (IOException e) { <START> throw new UncheckedIOException(e); <END> } }</code><technical_language>This is a bad idea, JCasC fail in unpredictable way. I expect explicit failure happen. If is possible, log a warning system log</technical_language>

Target:
private static String[][] uncheckedApproveSignature(ScriptApproval target, String signature) { try { return target.approveSignature(signature); } catch (IOException e) { LOGGER.warning("Could not approve signature: " + signature + " ScriptApproval threw IOException: " + e.getMessage()); throw new UncheckedIOException(e); } }
Source:
<code>public void putMetrics(MetricsRecord metricsRecord) { try { CollectorRegistry registry = new CollectorRegistry(); for (AbstractMetric metrics : metricsRecord.metrics()) { if (metrics.type() == COUNTER || metrics.type() == GAUGE) { String key = getMetricsName( metricsRecord.name(), metrics.name()).replace(" ", ""); int tagSize = metricsRecord.tags().size(); String[] labelNames = new String[tagSize]; String[] labelValues = new String[tagSize]; int index = 0; for (MetricsTag tag : metricsRecord.tags()) { String tagName = tag.name().toLowerCase(); if (NUM_OPEN_CONNECTION_SPERUSER.equals(tagName)) { continue; } labelNames[index] = tagName; labelValues[index] = tag.value() == null ? NULL : tag.value(); index++; } switch (metrics.type()) { case GAUGE: Gauge.build(key, key) .labelNames(labelNames) .register(registry) .labels(labelValues) .set(metrics.value().doubleValue()); break; case COUNTER: Counter.build(key, key) .labelNames(labelNames) .register(registry) .labels(labelValues) .inc(metrics.value().doubleValue()); break; default: break; } <START> LOG.debug( <END> "register succeed, metrics name is: " + key + " Type is :" + metrics.type().toString() + " tag is: " + Arrays.toString(labelNames) + " tagValue is " + Arrays.toString(labelValues) + " Value is : " + metrics.value().toString()); } } pg.push(registry, jobName, groupingKey); LOG.info("pushing succeed"); } catch (Exception e) { LOG.error("pushing job's metrics to gateway is failed ", e); } }</code><technical_language>expensive. Wrap LOG.isDebugEnabled</technical_language>

Target:
public void putMetrics(MetricsRecord metricsRecord) { try { CollectorRegistry registry = new CollectorRegistry(); for (AbstractMetric metrics : metricsRecord.metrics()) { if (metrics.type() == COUNTER || metrics.type() == GAUGE) { String key = getMetricsName( metricsRecord.name(), metrics.name()).replace(" ", ""); int tagSize = metricsRecord.tags().size(); String[] labelNames = new String[tagSize]; String[] labelValues = new String[tagSize]; int index = 0; for (MetricsTag tag : metricsRecord.tags()) { String tagName = tag.name().toLowerCase(); if (NUM_OPEN_CONNECTION_SPERUSER.equals(tagName)) { continue; } labelNames[index] = tagName; labelValues[index] = tag.value() == null ? NULL : tag.value(); index++; } switch (metrics.type()) { case GAUGE: Gauge.build(key, key) .labelNames(labelNames) .register(registry) .labels(labelValues) .set(metrics.value().doubleValue()); break; case COUNTER: Counter.build(key, key) .labelNames(labelNames) .register(registry) .labels(labelValues) .inc(metrics.value().doubleValue()); break; default: break; } if (LOG.isDebugEnabled()) { LOG.debug("register succeed, metrics name is: Type is :{} tag is: tagValue is Value is : {}" , key, metrics.type(), Arrays.toString(labelNames), Arrays.toString(labelValues), metrics.value()); } } } pg.push(registry, jobName, groupingKey); } catch (Exception e) { LOG.error("pushing job's metrics to gateway is failed ", e); } }
Source:
<code>public static String rpad(String base, Integer len, String pad) { if (len < 0) { return null; } else if (len == 0) { return ""; } <START> <END> char[] data = new char[len]; char[] baseChars = base.toCharArray(); char[] padChars = pad.toCharArray(); int pos = 0; while (pos < base.length() && pos < len) { data[pos] = baseChars[pos]; pos += 1; } while (pos < len) { int i = 0; while (i < pad.length() && i < len - pos) { data[pos + i] = padChars[i]; i += 1; } pos += pad.length(); } return new String(data); }</code><technical_language>I guava commons-lang string padding functions, do compare implementations? (Not a suggestion of those, curious choice)</technical_language>

Target:
public static String rpad(String base, Integer len, String pad) { if (len < 0) { return null; } else if (len == 0) { return ""; } char[] data = new char[len]; int pos = 0; for ( ; pos < base.length() && pos < len; pos++) { data[pos] = base.charAt(pos); } for ( ; pos < len; pos += pad.length()) { for (int i = 0; i < pad.length() && i < len - pos; i++) { data[pos + i] = pad.charAt(i); } } return new String(data); }
Source:
<code>public void run() { path = withoutQuery(path); try { ByteBuffer content = null; if (!exists()) { notFound(); } else if ((content = fileBytes()) != null) { serve(guessMimeType(path), content, control, response, request); } else { if (!path.endsWith("/")) { <START> response.status(301).header("Location", path + "/").end(); <END> return; } if ((content = welcomeBytes()) != null) { serve(guessMimeType(welcomeFileName), content, control, response, request); } else if (isDirectoryListingEnabled && (content = directoryListingBytes()) != null) { serve(guessMimeType(".html"), content, control, response, request); } else { notFound(); } } } catch (IOException e) { error(e); } }</code><technical_language>safer maintain original query here. For example, suppose another user handler in place performs some custom authentication based URI query, redirect strip away. i.e. this request: /foo?key=123 redirect to: /foo/?key=123</technical_language>

Target:
public void run() { String pathWithQuery = path; path = withoutQuery(path); try { ByteBuffer content = null; if (!exists()) { notFound(); return; } if (isDirectory()) { if (!path.endsWith("/")) { response.status(301).header("Location", path + "/" + extractQuery(pathWithQuery)).end(); return; } else if ((content = welcomeBytes()) != null) { serve(guessMimeType(welcomeFileName), content, control, response, request); return; } else if (isDirectoryListingEnabled && (content = directoryListingBytes()) != null) { serve(guessMimeType(".html"), content, control, response, request); return; } } else if ((content = fileBytes()) != null) { serve(guessMimeType(path), content, control, response, request); return; } else if ((content = welcomeBytes()) != null) { serve(guessMimeType(welcomeFileName), content, control, response, request); return; } notFound(); } catch (IOException e) { error(e); } }
Source:
<code>public String getDisplayNameForValue(final String value) { <START> for (Map.Entry<String, String> entry : mapDisplayValuesToValues.entrySet()) { <END> if (entry.getValue().equals(value)) { return entry.getKey(); } } return value; }</code><technical_language>inlined a single line Streams</technical_language>

Target:
public String getDisplayNameForValue(final String value) { return mapDisplayValuesToValues.entrySet().stream() .filter(v -> v.getValue().equals(value)) .map(Map.Entry::getKey) .findFirst() .orElse(value); }
Source:
<code>LatLon getWorkPointLatLon() { LatLon workPointLatLon; if (hasWorkPoint()) { workPointLatLon = new LatLon(getWorkPoint().getLatitude(), getWorkPoint().getLongitude()); } else { <START> workPointLatLon = new LatLon(0, 0); <END> } return workPointLatLon; }</code><technical_language>If is point - return null</technical_language>

Target:
public LatLon getWorkPointLatLon() { LatLon workPointLatLon; if (hasWorkPoint()) { workPointLatLon = new LatLon(getWorkPoint().getLatitude(), getWorkPoint().getLongitude()); } else { workPointLatLon = null; } return workPointLatLon; }
Source:
<code>private void bridgePollableToSubscribableChannel(MessageChannel pollableChannel, MessageChannel subscribableChannel) { ConsumerEndpointFactoryBean consumerEndpointFactoryBean = new ConsumerEndpointFactoryBean(); consumerEndpointFactoryBean.setInputChannel(pollableChannel); PollerMetadata pollerMetadata = new PollerMetadata(); pollerMetadata.setTrigger(new PeriodicTrigger(1000)); consumerEndpointFactoryBean.setPollerMetadata(pollerMetadata); consumerEndpointFactoryBean .setHandler(new MessageChannelBinderSupport.DirectHandler( subscribableChannel)); consumerEndpointFactoryBean.setBeanFactory(beanFactory); try { consumerEndpointFactoryBean.afterPropertiesSet(); } catch (Exception e) { <START> e.printStackTrace(); <END> } consumerEndpointFactoryBean.start(); }</code><technical_language>IllegalStateException(e) here</technical_language>

Target:
private void bridgePollableToSubscribableChannel(MessageChannel pollableChannel, MessageChannel subscribableChannel) { ConsumerEndpointFactoryBean consumerEndpointFactoryBean = new ConsumerEndpointFactoryBean(); consumerEndpointFactoryBean.setInputChannel(pollableChannel); PollerMetadata pollerMetadata = new PollerMetadata(); pollerMetadata.setTrigger(new PeriodicTrigger(pollableBridgeDefaultFrequency)); consumerEndpointFactoryBean.setPollerMetadata(pollerMetadata); consumerEndpointFactoryBean .setHandler(new MessageChannelBinderSupport.DirectHandler( subscribableChannel)); consumerEndpointFactoryBean.setBeanFactory(beanFactory); try { consumerEndpointFactoryBean.afterPropertiesSet(); } catch (Exception e) { throw new IllegalStateException(e); } consumerEndpointFactoryBean.start(); }
Source:
<code><START> public EnginesPreferencePage() { <END> }</code><technical_language>call super(); explicitly</technical_language>

Target:
public EnginesPreferencePage() { super(); }
Source:
<code>private GitModelObject extractFromCache(TreeWalk tw) throws IOException { DirCacheIterator cacheIterator = tw.getTree(dirCacheIteratorNth, DirCacheIterator.class); if (cacheIterator == null) return null; DirCacheEntry cacheEntry = cacheIterator.getDirCacheEntry(); if (cacheEntry == null) return null; if (shouldIncludeEntry(tw)) { String path = tw.getPathString(); ObjectId repoId = tw.getObjectId(BASE_NTH); ObjectId cacheId = tw.getObjectId(REMOTE_NTH); <START> if (path.split("/").length > 1) END> return handleCacheTree(repoId, cacheId, path); return fileFactory.createFileModel(this, baseCommit, repoId, cacheId, getLocation().append(path)); } return null; }</code><technical_language>faster ask for path.indexOf('/')? need substrings beeing created stop occurence</technical_language>

Target:
private GitModelObject extractFromCache(TreeWalk tw) throws IOException { DirCacheIterator cacheIterator = tw.getTree(dirCacheIteratorNth, DirCacheIterator.class); if (cacheIterator == null) return null; DirCacheEntry cacheEntry = cacheIterator.getDirCacheEntry(); if (cacheEntry == null) return null; if (shouldIncludeEntry(tw)) { String path = tw.getPathString(); ObjectId repoId = tw.getObjectId(BASE_NTH); ObjectId cacheId = tw.getObjectId(REMOTE_NTH); if (path.contains("/")) return handleCacheTree(repoId, cacheId, path); return fileFactory.createFileModel(this, baseCommit, repoId, cacheId, getLocation().append(path)); } return null; }
Source:
<code><START> public void writeToParcel(Parcel parcel, int i) { <END> parcel.writeParcelable(amCreateAccountResult, 0); parcel.writeParcelable(legacyCreateAccountResult, 0); }</code><technical_language>I this parameter is meant flags passed parcel.writeParcelable calls</technical_language>

Target:
public void writeToParcel(Parcel parcel, int i) { parcel.writeParcelable(amCreateAccountResult, i); parcel.writeParcelable(legacyCreateAccountResult, i); }
Source:
<code>public ImageDescriptor getImageDescripterFromPath(String path) { <START> return Objects.requireNonNull(AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path)); <END> }</code><technical_language>This null if image is absent, here, return @Nullable, method signature is public @Nullable ImageDescriptor getImageDescripterFromPath(String path) Then, this method is called, if image exists, put Objects.requireNonNull</technical_language>

Target:
public @Nullable ImageDescriptor getImageDescripterFromPath(String path) { return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); }
Source:
<code>public Versions() { <START> <END> ClassLoader classLoader = EnvironmentInformation.class.getClassLoader(); try(InputStream propFile = classLoader.getResourceAsStream(PROP_FILE)) { if (propFile != null) { Properties properties = new Properties(); properties.load(propFile); projectVersion = getProperty(properties, "project.version"); scalaVersion = getProperty(properties, "scala.binary.version"); gitCommitId = getProperty(properties, "git.commit.id"); gitCommitIdAbbrev = getProperty(properties, "git.commit.id.abbrev"); DateTimeFormatter gitDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); DateTimeFormatter BERLIN_DATE_TIME = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Europe/Berlin")); try { String propGitCommitTime = properties.getProperty("git.commit.time", DEFAULT_TIME_STRING); gitCommitTime = gitDateTimeFormatter.parse(propGitCommitTime, Instant::from); gitCommitTimeStr = BERLIN_DATE_TIME.format(gitCommitTime); String propGitBuildTime = properties.getProperty("git.build.time", DEFAULT_TIME_STRING); gitBuildTime = gitDateTimeFormatter.parse(propGitBuildTime, Instant::from); gitBuildTimeStr = BERLIN_DATE_TIME.format(gitBuildTime); } catch (DateTimeParseException dtpe) { LOG.error("{} : {}", FAIL_MESSAGE, dtpe); throw new IllegalStateException(FAIL_MESSAGE); } } } catch(IOException ioe) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot determine code revision: Unable to read version property file.: {}", ioe.getMessage()); } else { LOG.info("Cannot determine code revision: Unable to read version property file.: {}", ioe.getMessage()); } } }</code><technical_language>suggestion</technical_language>

Target:
public Versions() { ClassLoader classLoader = EnvironmentInformation.class.getClassLoader(); try (InputStream propFile = classLoader.getResourceAsStream(PROP_FILE)) { if (propFile != null) { Properties properties = new Properties(); properties.load(propFile); projectVersion = getProperty(properties, "project.version", UNKNOWN); scalaVersion = getProperty(properties, "scala.binary.version", UNKNOWN); gitCommitId = getProperty(properties, "git.commit.id", UNKNOWN_COMMIT_ID); gitCommitIdAbbrev = getProperty(properties, "git.commit.id.abbrev", UNKNOWN_COMMIT_ID_ABBREV); DateTimeFormatter gitDateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); DateTimeFormatter berlinDateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Europe/Berlin")); try { String propGitCommitTime = getProperty(properties, "git.commit.time", DEFAULT_TIME_STRING); gitCommitTime = gitDateTimeFormatter.parse(propGitCommitTime, Instant::from); gitCommitTimeStr = berlinDateTime.format(gitCommitTime); String propGitBuildTime = getProperty(properties, "git.build.time", DEFAULT_TIME_STRING); gitBuildTime = gitDateTimeFormatter.parse(propGitBuildTime, Instant::from); gitBuildTimeStr = berlinDateTime.format(gitBuildTime); } catch (DateTimeParseException dtpe) { LOG.error("{} : {}", FAIL_MESSAGE, dtpe); throw new IllegalStateException(FAIL_MESSAGE); } } } catch (IOException ioe) { LOG.info("Cannot determine code revision: Unable to read version property file.: {}", ioe.getMessage()); } }
Source:
<code>public Response getPropertyByPath(@PathParam("clusterId") String clusterId, @PathParam("path") String path) { path = "/" + path; if (!ZooKeeperAccessor.isPathValid(path)) { <START> LOG.error("The propertyStore path is invalid for cluster {}", path, clusterId); <END> return badRequest( "Invalid path string. Valid path strings use slash as the directory separator and names the location of ZNode"); } final String recordPath = PropertyPathBuilder.propertyStore(clusterId) + path; ZkBaseDataAccessor<byte[]> propertyStoreDataAccessor = getByteArrayDataAccessor(); if (propertyStoreDataAccessor.exists(recordPath, AccessOption.PERSISTENT)) { byte[] bytes = propertyStoreDataAccessor.get(recordPath, null, AccessOption.PERSISTENT); ZNRecord znRecord = (ZNRecord) ZN_RECORD_SERIALIZER.deserialize(bytes); if (znRecord == null) { ObjectNode jsonNode = OBJECT_MAPPER.createObjectNode(); jsonNode.put(CONTENT_KEY, new String(bytes)); return JSONRepresentation(jsonNode); } return JSONRepresentation(znRecord); } else { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity(String.format("The property store path %s doesn't exist", recordPath)).build()); } }</code><technical_language>Nit, I this error message is appropriate. I remembered @lei-xia reviewed this in previous ticket, this path invalidation is error in server. keeping info (or warn) good enough</technical_language>

Target:
public Response getPropertyByPath(@PathParam("clusterId") String clusterId, @PathParam("path") String path) { path = "/" + path; if (!ZooKeeperAccessor.isPathValid(path)) { LOG.info("The propertyStore path is invalid for cluster {}", path, clusterId); return badRequest( "Invalid path string. Valid path strings use slash as the directory separator and names the location of ZNode"); } final String recordPath = PropertyPathBuilder.propertyStore(clusterId) + path; ZkBaseDataAccessor<byte[]> propertyStoreDataAccessor = getByteArrayDataAccessor(); if (propertyStoreDataAccessor.exists(recordPath, AccessOption.PERSISTENT)) { byte[] bytes = propertyStoreDataAccessor.get(recordPath, null, AccessOption.PERSISTENT); ZNRecord znRecord = (ZNRecord) ZN_RECORD_SERIALIZER.deserialize(bytes); if (znRecord == null) { ObjectNode jsonNode = OBJECT_MAPPER.createObjectNode(); jsonNode.put(CONTENT_KEY, new String(bytes)); return JSONRepresentation(jsonNode); } return JSONRepresentation(znRecord); } else { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity(String.format("The property store path %s doesn't exist", recordPath)).build()); } }
Source:
<code>public Object[][] getMetricClasses(){ return new Object[][]{ {TargetedPcrMetrics.class}, {HsMetrics.class}, {TargetMetrics.class}, {CollectRawWgsMetrics.RawWgsMetrics.class}, {CollectWgsMetricsWithNonZeroCoverage.WgsMetricsWithNonZeroCoverage.class} <START> }; <END> }</code><technical_language>please intellij auto-indent this</technical_language>

Target:
public Iterator<Object[]> getMetricClasses() { final ClassFinder classFinder = new ClassFinder(); classFinder.find("picard", MetricBase.class); return classFinder.getClasses().stream() .map(c -> new Object[]{c}) .iterator(); }
Source:
<code>public void registerService(final ServiceDescription description) { if (mdnsClient == null) { servicesToRegisterQueue.add(description); } else { Runnable runnable = new Runnable() { @Override public void run() { try { <START> logger.debug("Registering new service at port {}", description.serviceType, <END> description.servicePort); mdnsClient.registerService(description); } catch (IOException e) { logger.error(e.getMessage()); } catch (IllegalStateException e) { logger.debug("Not registering service {}, because service is already deactivated!", description.serviceType); } } }; Executors.newSingleThreadExecutor().execute(runnable); } }</code><technical_language>remove this log message duplicates in mdnsClient</technical_language>

Target:
public void registerService(final ServiceDescription description) { if (mdnsClient == null) { servicesToRegisterQueue.add(description); } else { Runnable runnable = new Runnable() { @Override public void run() { try { mdnsClient.registerService(description); } catch (IOException e) { logger.error(e.getMessage()); } catch (IllegalStateException e) { logger.debug("Not registering service {}, because service is already deactivated!", description.serviceType); } } }; Executors.newSingleThreadExecutor().execute(runnable); } }
Source:
<code>public void accept(final Socket socket) throws IOException { <START> throw new NotImplementedException(); <END> }</code><technical_language>@prondzyn UnsupportedOperationException instead, avoid importing commons-lang library</technical_language>

Target:
public void accept(final Socket socket) throws IOException { throw new UnsupportedOperationException(); }
Source:
<code>private void loadInitialState(ITmfStateProvider provider) { for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; final ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException(); } <START> StateSnapshot snapshot = StateSnapshot.read(Paths.get(trace.getPath()), ss.getSSID()); <END> if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); ITmfStateInterval interval = Objects.requireNonNull(attributeSnapshot.getValue()); Object initialState = interval.getValue(); ssb.modifyAttribute(Math.max(interval.getStartTime(), ssb.getStartTime()), initialState, quark); } } } }</code><technical_language>If trace is a text trace need trace's parent folder</technical_language>

Target:
private void loadInitialState(ITmfStateProvider provider) { final ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException("Trace is null. It should be impossible to load states. "); } File path = new File(trace.getPath()); path = path.isDirectory() ? path : path.getParentFile(); if (path == null) { throw new IllegalStateException("Trace does not seem to have a file backing it : " + trace); } for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; StateSnapshot snapshot = StateSnapshot.read(path.toPath(), ss.getSSID()); if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); ITmfStateInterval interval = Objects.requireNonNull(attributeSnapshot.getValue()); Object initialState = interval.getValue(); ssb.modifyAttribute(Math.max(interval.getStartTime(), ssb.getStartTime()), initialState, quark); } } } }
Source:
<code>public List<DiskOfferingVO> listAllBySizeAndProvisioningType(long size, Storage.ProvisioningType provisioningType) { StringBuilder sql = new StringBuilder(SizeDiskOfferingSearch); TransactionLegacy txn = TransactionLegacy.currentTxn(); List<DiskOfferingVO> offerings = new ArrayList<>(); <START> try(PreparedStatement pstmt = txn.prepareStatement(sql.toString());){ <END> if(pstmt != null) { pstmt.setLong(1, size); pstmt.setString(2, provisioningType.toString()); try(ResultSet rs = pstmt.executeQuery();) { while (rs.next()) { offerings.add(toEntityBean(rs, false)); } }catch (SQLException e) { throw new CloudRuntimeException("Exception while listing disk offerings by size: " + e.getMessage(), e); } } return offerings; } catch (SQLException e) { throw new CloudRuntimeException("Exception while listing disk offerings by size: " + e.getMessage(), e); } }</code><technical_language>Unnecessary semicolon line 164</technical_language>

Target:
public List<DiskOfferingVO> listAllBySizeAndProvisioningType(long size, Storage.ProvisioningType provisioningType) { StringBuilder sql = new StringBuilder(SizeDiskOfferingSearch); TransactionLegacy txn = TransactionLegacy.currentTxn(); List<DiskOfferingVO> offerings = new ArrayList<>(); try(PreparedStatement pstmt = txn.prepareStatement(sql.toString());){ if(pstmt != null) { pstmt.setLong(1, size); pstmt.setString(2, provisioningType.toString()); try(ResultSet rs = pstmt.executeQuery()) { while (rs.next()) { offerings.add(toEntityBean(rs, false)); } } catch (SQLException e) { throw new CloudRuntimeException("Exception while listing disk offerings by size: " + e.getMessage(), e); } } return offerings; } catch (SQLException e) { throw new CloudRuntimeException("Exception while listing disk offerings by size: " + e.getMessage(), e); } }
Source:
<code>public void nullMessageProcessPhaseInRegistry() throws Exception { when(mockMuleContext.getTransactionManager()).thenReturn(null); <START> when(mockMuleContext.getConfiguration().getId()).thenReturn("appName"); <END> processAndVerifyDefaultPhasesUsingRegistryPhases(null); }</code><technical_language>move this a @Before method</technical_language>

Target:
public void nullMessageProcessPhaseInRegistry() throws Exception { when(mockMuleContext.getTransactionManager()).thenReturn(null); processAndVerifyDefaultPhasesUsingRegistryPhases(null); }
Source:
<code>protected void subscribeActual(SingleObserver<? super T> observer) { Disposable d = Disposables.empty(); observer.onSubscribe(d); if (d.isDisposed()) { return; } T value; try { <START> value = ObjectHelper.requireNonNull(callable.call(), "Callable returned null"); <END> } catch (Throwable ex) { Exceptions.throwIfFatal(ex); if (!d.isDisposed()) { observer.onError(ex); } else { RxJavaPlugins.onError(ex); } return; } if (!d.isDisposed()) { observer.onSuccess(value); } }</code><technical_language>error message wrong. [Travis CI](<LINK_0></technical_language>

Target:
protected void subscribeActual(SingleObserver<? super T> observer) { Disposable d = Disposables.empty(); observer.onSubscribe(d); if (d.isDisposed()) { return; } T value; try { value = ObjectHelper.requireNonNull(callable.call(), "The callable returned a null value"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); if (!d.isDisposed()) { observer.onError(ex); } else { RxJavaPlugins.onError(ex); } return; } if (!d.isDisposed()) { observer.onSuccess(value); } }
Source:
<code>private static void markRbFailed() { <START> Prefs.setRequestSuccessCounter(-1); <END> }</code><technical_language>Consider a constant symbol for -1 error value</technical_language>

Target:
private static void markRbFailed() { Prefs.setRequestSuccessCounter(FAILED); }
Source:
<code>private PackedRefList readPackedRefs() throws IOException { <START> while (true) { <END> final FileSnapshot snapshot = FileSnapshot.save(packedRefsFile); final BufferedReader br; final MessageDigest digest = Constants.newMessageDigest(); try { br = new BufferedReader(new InputStreamReader( new DigestInputStream(new FileInputStream(packedRefsFile), digest), CHARSET)); } catch (FileNotFoundException noPackedRefs) { return PackedRefList.NO_PACKED_REFS; } try { return new PackedRefList(parsePackedRefs(br), snapshot, ObjectId.fromRaw(digest.digest())); } catch (IOException e) { if (isStaleFileHandle(e)) { continue; } throw e; } finally { br.close(); } } }</code><technical_language>add a potentially endless loop here? some iterations and/or some time spent retrying I expect this method throws excetion</technical_language>

Target:
private PackedRefList readPackedRefs() throws IOException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot snapshot = FileSnapshot.save(packedRefsFile); final BufferedReader br; final MessageDigest digest = Constants.newMessageDigest(); try { br = new BufferedReader(new InputStreamReader( new DigestInputStream(new FileInputStream(packedRefsFile), digest), CHARSET)); } catch (FileNotFoundException noPackedRefs) { return PackedRefList.NO_PACKED_REFS; } try { return new PackedRefList(parsePackedRefs(br), snapshot, ObjectId.fromRaw(digest.digest())); } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { retries++; continue; } throw e; } finally { br.close(); } } }
Source:
<code><START> public static void before() { <END> SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), TRACE_TYPE); fEditorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); }</code><technical_language>inline instead of this</technical_language>

Target:
public void before() { SWTBotUtils.openTrace(TRACE_PROJECT_NAME, fTestFile.getAbsolutePath(), TRACE_TYPE); fEditorBot = SWTBotUtils.activateEditor(fBot, fTestFile.getName()); }
Source:
<code>ClientFactory clientFactory() { ClientFactoryBuilder builder = new ClientFactoryBuilder() <START> .useHttp2Preface(false); <END> clientFactoryCustomizer().accept(builder); return builder.build(); }</code><technical_language>intentional remove shutdownClientOnClose</technical_language>

Target:
ClientFactory clientFactory() { ClientFactoryBuilder builder = new ClientFactoryBuilder() .workerGroup(EventLoopGroups.newEventLoopGroup( Flags.numCommonWorkers(), "armeria-common-worker", true), true) .useHttp2Preface(false); clientFactoryCustomizer().accept(builder); return builder.build(); }
Source:
<code>default CustomAttribute[] getAttributes() { <START> return null; <END> }</code><technical_language>[] instead of null in order avoid NPE check</technical_language>

Target:
default CustomAttribute[] getAttributes() { return new CustomAttribute[]{}; }
Source:
<code>public void update(PopulatorContext context) throws PopulatorException { DefaultHttpClient httpclient = new DefaultHttpClient(); try { URL xcri = new URL(context.getURI()); InputStream input = null; <START> if ("file".equals(xcri.getProtocol())) { <END> input = xcri.openStream(); } else { HttpHost targetHost = new HttpHost(xcri.getHost(), xcri.getPort(), xcri.getProtocol()); httpclient.getCredentialsProvider().setCredentials( new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials(context.getUser(), context.getPassword())); HttpGet httpget = new HttpGet(xcri.toURI()); HttpResponse response = httpclient.execute(targetHost, httpget); HttpEntity entity = response.getEntity(); if (HttpStatus.SC_OK != response.getStatusLine().getStatusCode()) { throw new IllegalStateException( "Invalid response ["+response.getStatusLine().getStatusCode()+"]"); } input = entity.getContent(); } if (null == input) { throw new PopulatorException("No Input for Importer"); } process(context.getName(), input); } catch (MalformedURLException e) { log.warn("MalformedURLException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (IllegalStateException e) { log.warn("IllegalStateException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (IOException e) { log.warn("IOException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (URISyntaxException e) { log.warn("URISyntaxException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (JDOMException e) { log.warn("JDOMException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (InvalidElementException e) { log.warn("InvalidElementException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } finally { httpclient.getConnectionManager().shutdown(); } }</code><technical_language>I support file protocol live service provides a read aribitary files filesystem (eg security.properties). easily exploit this get output in browser, worth risk</technical_language>

Target:
public void update(PopulatorContext context) throws PopulatorException { try { InputStream input = populatorInput.getInput(context); if (null == input) { throw new PopulatorException("No Input for Importer"); } process(context, input); } catch (MalformedURLException e) { log.warn("MalformedURLException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (IllegalStateException e) { log.warn("IllegalStateException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (IOException e) { log.warn("IOException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (JDOMException e) { log.warn("JDOMException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } catch (InvalidElementException e) { log.warn("InvalidElementException ["+context.getURI()+"]", e); throw new PopulatorException(e.getLocalizedMessage()); } }
Source:
<code>public void validate(FailureCollector collector) { if (containsMacro(STORAGE_LEVEL)) { return; } <START> String[] allowedStrings = {"DISK_ONLY", "DISK_ONLY_2", "MEMORY_ONLY", "MEMORY_ONLY_2", "MEMORY_ONLY_SER", <END> "MEMORY_ONLY_SER_2", "MEMORY_AND_DISK", "MEMORY_AND_DISK_2", "MEMORY_AND_DISK_SER", "MEMORY_AND_DISK_SER_2"}; if (storageLevel.isEmpty()) { collector.addFailure("Storage level is a required value. ", "Please select the desired storage level.") .withConfigProperty(STORAGE_LEVEL); } else if (!Arrays.asList(allowedStrings).contains(storageLevel.toUpperCase())) { collector .addFailure("Invalid value for Storage Level ", "Please select one of the valid values from the dropdown.") .withConfigProperty(STORAGE_LEVEL); } }</code><technical_language>a Set Set<String> allowed = new HashSet<>(Arrays.asList( "DISK_ONLY", "DISK_ONLY_2", ... ));</technical_language>

Target:
public void validate(FailureCollector collector) { if (containsMacro(STORAGE_LEVEL)) { return; } Set<String> allowed = new HashSet<>(Arrays.asList( "DISK_ONLY", "DISK_ONLY_2", "MEMORY_ONLY", "MEMORY_ONLY_2", "MEMORY_ONLY_SER", "MEMORY_ONLY_SER_2", "MEMORY_AND_DISK", "MEMORY_AND_DISK_2", "MEMORY_AND_DISK_SER", "MEMORY_AND_DISK_SER_2")); if (!allowed.contains(storageLevel.toUpperCase())) { collector .addFailure("Invalid value for Storage Level.", "Please provide one of the following allowed values: " + allowed.toString()) .withConfigProperty(STORAGE_LEVEL); } }
Source:
<code>private void removeObjectsWithPrefix(String containerAndPrefix) { int separatorIndex = containerAndPrefix.indexOf('/'); if (separatorIndex < 0) { throw new IllegalArgumentException("No / separator found in \"" + containerAndPrefix + "\""); <START> } <END> String container = containerAndPrefix.substring(0, separatorIndex); String prefix = containerAndPrefix.substring(separatorIndex + 1); removeObjectsWithPrefix(container, prefix); }</code><technical_language>[template version of checkArgument](<LINK_0>, java.lang.String, java.lang.Object...%29) Splitter</technical_language>

Target:
private void removeObjectsWithPrefix(String containerAndPrefix) { String[] parts = splitContainerAndKey(containerAndPrefix); String container = parts[0]; String prefix = parts[1]; removeObjectsWithPrefix(container, prefix); }
Source:
<code><START> private List<DiskImage> getAllDisks(List<DiskImage> newDisksList, List<DiskImage> cloneDisksList) { <END> List<DiskImage> disksList = new ArrayList<>(); disksList.addAll(newDisksList); disksList.addAll(cloneDisksList); return disksList; }</code><technical_language>static</technical_language>

Target:
private static List<DiskImage> getAllDisks(List<DiskImage> newDisksList, List<DiskImage> cloneDisksList) { List<DiskImage> disksList = new ArrayList<>(); disksList.addAll(newDisksList); disksList.addAll(cloneDisksList); return disksList; }