auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void doBulkFlush() { try { for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { String n = cacheNameOf(e.getPluginName(), e.getExportName()); if (caches.contains(n)) { try { flushCache.get().apply( new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()), <START> new FlushCache.Input()); <END> } catch (RestApiException err) { stderr.println("error: cannot flush cache \"" + n + "\": " + err.getMessage()); } } } } finally { stderr.flush(); } }</code><technical_language>This introduced in this change, this is wrong: create a constant object in a loop. move new statement of loop</technical_language>

Target:
private void doBulkFlush() { try { for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) { String n = cacheNameOf(e.getPluginName(), e.getExportName()); if (caches.contains(n)) { try { flushCache.get().apply( new CacheResource(e.getPluginName(), e.getExportName(), e.getProvider()), null); } catch (RestApiException err) { stderr.println("error: cannot flush cache \"" + n + "\": " + err.getMessage()); } } } } finally { stderr.flush(); } }
Source:
<code>public void reset() { <START> Boolean goFmt = PropertiesComponent.getInstance().getBoolean(GO_ONSAVE_FMT_KEY, true); <END> Boolean goImports = PropertiesComponent.getInstance().getBoolean(GO_ONSAVE_IMPORTS_KEY, false); doNothingOnSave.setSelected(!goFmt && !goImports); goFmtOnSave.setSelected(goFmt); goimportsOnSave.setSelected(goImports); }</code><technical_language>properties some 'flags' for defining IDEA behaviour. real user settings. Please bring service semantic exportable</technical_language>

Target:
public void reset() { GoApplicationSettings.GoApplicationSettingsBean settingsBean = GoApplicationSettings.getInstance().getState(); doNothingOnSave.setSelected(!settingsBean.goFmtOnSave && !settingsBean.goimportsOnSave); goFmtOnSave.setSelected(settingsBean.goFmtOnSave); goimportsOnSave.setSelected(settingsBean.goimportsOnSave); }
Source:
<code><START> public Bundle getTranslations() { <END> Bundle translations = new Bundle(); Locale defaultLocale = new Locale("en"); Resources currentResources = getResources(); Configuration configuration = currentResources.getConfiguration(); if (configuration.locale.equals(defaultLocale)) { return translations; } DisplayMetrics metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); configuration.locale = defaultLocale; Resources defaultResources = new Resources(getActivity().getAssets(), metrics, configuration); for (Field stringField : R.string.class.getFields()) { int resourceId = 0; try { resourceId = stringField.getInt(R.string.class); } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); continue; } String currentResourceString = currentResources.getString(resourceId); String defaultResourceString = defaultResources.getString(resourceId); if (currentResourceString.length() > 0 && defaultResourceString.length() > 0) { translations.putStringArrayList( defaultResourceString, new ArrayList<>(Arrays.asList(currentResourceString)) ); } } return translations; }</code><technical_language>This is a local method change method access signature private</technical_language>

Target:
public Bundle getTranslations() { Bundle translations = new Bundle(); Locale defaultLocale = new Locale("en"); Resources currentResources = getActivity().getApplicationContext().getResources(); Configuration currentConfiguration = currentResources.getConfiguration(); if (currentConfiguration.locale.equals(defaultLocale)) { return translations; } DisplayMetrics metrics = new DisplayMetrics(); Configuration defaultLocaleConfiguration = new Configuration(currentConfiguration); defaultLocaleConfiguration.setLocale(defaultLocale); getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); Resources defaultResources = new Resources(getActivity().getAssets(), metrics, defaultLocaleConfiguration); Class<?> rString; Package mainPackage = getActivity().getApplication().getClass().getPackage(); if (mainPackage == null) { return translations; } try { rString = getActivity().getApplication().getClassLoader().loadClass(mainPackage.getName() + ".R$string"); } catch (ClassNotFoundException ex) { return translations; } for (Field stringField : rString.getDeclaredFields()) { int resourceId; try { resourceId = stringField.getInt(rString); } catch (IllegalArgumentException | IllegalAccessException iae) { AppLog.e(T.EDITOR, iae); continue; } String fieldName = stringField.getName(); if (!fieldName.startsWith("gutenberg_mobile_")) { continue; } String currentResourceString = currentResources.getString(resourceId); String defaultResourceString = defaultResources.getString(resourceId); if (currentResourceString.length() > 0 && defaultResourceString.length() > 0) { translations.putStringArrayList( defaultResourceString, new ArrayList<>(Arrays.asList(currentResourceString)) ); } } return translations; }
Source:
<code>private void createPath(String parentPath, boolean removeParentsIfCreated) { try { curator.create().creatingParentsIfNeeded().forPath(parentPath); if (removeParentsIfCreated) { parentsIBuilt.add(parentPath); } log.debug("Created parentPath[%s], %s remove on stop.", parentPath, removeParentsIfCreated ? "will" : "will not"); } catch (Exception e) { <START> log.info(e, "Problem creating parentPath[%s], someone else created it first?", parentPath); <END> } }</code><technical_language>log.error</technical_language>

Target:
private void createPath(String parentPath, boolean removeParentsIfCreated) { try { curator.create().creatingParentsIfNeeded().forPath(parentPath); if (removeParentsIfCreated) { parentsIBuilt.add(parentPath); } log.debug("Created parentPath[%s], %s remove on stop() called.", parentPath, removeParentsIfCreated ? "will" : "will not"); } catch (Exception e) { log.error(e, "Problem creating parentPath[%s], someone else created it first?", parentPath); } }
Source:
<code>private void matchCitation(Path file, int lineNumber, String line) { <START> Matcher citeMatch = Pattern.compile(CITE_REGEX).matcher(line); <END> while (citeMatch.find()) { String[] keys = citeMatch.group("key").split(","); for (String key : keys) { Citation citation = new Citation(file, lineNumber, citeMatch.start(), citeMatch.end(), line); if (!result.getCitations().containsKey(key)) { result.getCitations().put(key, new ArrayList<>()); } if (!result.getCitations().get(key).contains(citation)) { result.getCitations().get(key).add(citation); } } } }</code><technical_language>Move Pattern a final variable,too</technical_language>

Target:
private void matchCitation(Path file, int lineNumber, String line) { Matcher citeMatch = CITE_PATTERN.matcher(line); while (citeMatch.find()) { String[] keys = citeMatch.group(CITE_GROUP).split(","); for (String key : keys) { result.addKey(key, file, lineNumber, citeMatch.start(), citeMatch.end(), line); } } }
Source:
<code>public void testTriggerWithComplexActionValues() throws Exception { <START> String json = "{\"id\":12345678,\"title\":\"Test Trigger\",\"active\":true,\"position\":45,\"conditions\":{\"all\":[],\"any\":[{\"field\":\"comment_includes_word\",\"operator\":\"includes\",\"value\":\"@triggerTest\"}]},\"actions\":[{\"field\":\"notification_target\",\"value\":[\"1234567890\",[[\"key1\",\"value1\"],[\"key2\",\"value2\"]]]}],\"createdAt\":null,\"updatedAt\":null}"; <END> Trigger trigger = parseJson(json.getBytes()); assertNotNull(trigger); assertEquals("Test Trigger", trigger.getTitle()); assertEquals(1, trigger.getActions().size()); assertEquals("notification_target", trigger.getActions().get(0).getField()); assertArrayEquals(new Object {"1234567890", Arrays.asList(Arrays.asList("key1", "value1"), Arrays.asList("key2", "value2"))}, trigger.getActions().get(0).getValue()); assertEquals(0, trigger.getConditions().getAll().size()); assertEquals(1, trigger.getConditions().getAny().size()); assertEquals("comment_includes_word", trigger.getConditions().getAny().get(0).getField()); assertEquals("includes", trigger.getConditions().getAny().get(0).getOperator()); assertEquals("@triggerTest", trigger.getConditions().getAny().get(0).getValue()); assertEquals(json, new String(writeJson(trigger))); }</code><technical_language>@Dohbedoh this in others tests move resources files load a readability</technical_language>

Target:
public void testTriggerWithComplexActionValues() throws Exception { String json = Utils.resourceToString(getClass().getName().replace('.', '/') + "/triggerWithComplexActions.json"); Trigger trigger = parseJson(json.getBytes()); assertNotNull(trigger); assertEquals("Test Trigger", trigger.getTitle()); assertEquals(1, trigger.getActions().size()); assertEquals("notification_target", trigger.getActions().get(0).getField()); assertArrayEquals(new Object {"1234567890", Arrays.asList(Arrays.asList("key1", "value1"), Arrays.asList("key2", "value2"))}, trigger.getActions().get(0).getValue()); assertEquals(0, trigger.getConditions().getAll().size()); assertEquals(1, trigger.getConditions().getAny().size()); assertEquals("comment_includes_word", trigger.getConditions().getAny().get(0).getField()); assertEquals("includes", trigger.getConditions().getAny().get(0).getOperator()); assertEquals("@triggerTest", trigger.getConditions().getAny().get(0).getValue()); assertEquals(json, new String(writeJson(trigger))); }
Source:
<code>private void refreshTarget(final Object target) { Display.getDefault().asyncExec(() -> { if <START> (viewer != <END> null) { final TreePath[] treePaths = viewer.getExpandedTreePaths(); viewer.refresh(target, true); viewer.setExpandedTreePaths(treePaths); } }); }</code><technical_language>If this code is allowed run more freely (ie. a connection is up) need guard a viewer disposed, expand a connection offline, run, shut Eclipse leading 'widget is disposed' errors</technical_language>

Target:
private void refreshTarget(final Object target) { Display.getDefault().asyncExec(() -> { if (viewer != null && !viewer.getControl().isDisposed()) { final TreePath[] treePaths = viewer.getExpandedTreePaths(); viewer.refresh(target, true); viewer.setExpandedTreePaths(treePaths); } }); }
Source:
<code>private void handleAddLabel() { <START> int i = 1; <END> }</code><technical_language>Please remove this</technical_language>

Target:
private void handleAddLabel() { }
Source:
<code>private void mockHttpRequestAndResponse() { when(request.getProtocol()).thenReturn(Protocol.HTTP_1_1); MultiHashMap responseHeaders = new MultiHashMap(); <START> responseHeaders.put("Transfer-Encoding", "true"); <END> response = new DefaultHttpResponse(new ResponseStatus(), responseHeaders, new OutputHandlerHttpEntity(this)); when(ctx.getConnection()).thenReturn(connection); when(ctx.getFilterChain()).thenReturn(filterChain); when(connection.getTransport()).thenReturn(transport); when(transport.getMemoryManager()).thenReturn(memoryManager); }</code><technical_language>a constant</technical_language>

Target:
private void mockHttpRequestAndResponse() { when(request.getProtocol()).thenReturn(HTTP_1_1); MultiHashMap responseHeaders = new MultiHashMap(); responseHeaders.put(TRANSFER_ENCODING, TRUE); response = new DefaultHttpResponse(new ResponseStatus(), responseHeaders, new OutputHandlerHttpEntity(this)); when(ctx.getConnection()).thenReturn(connection); when(ctx.getFilterChain()).thenReturn(filterChain); when(connection.getTransport()).thenReturn(transport); when(transport.getMemoryManager()).thenReturn(memoryManager); }
Source:
<code>public static long toLong(byte[] bytes, int offset, final int length) { if (length != SIZEOF_LONG || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG); } <START> return ConverterHolder.getBestConverter().toLong(bytes, offset, length); <END> }</code><technical_language>expectation is time code is JITted JVM able predict ConverterHolder#getBestConverter() is monomorphic returns for invocation. a bit of extra code typecheck branch (and de-opt) if prediction fails, I branches right prediction hints. generated code performance characteristics previous. If this is a concern, a jmh-based microbenchmark confirm</technical_language>

Target:
public static long toLong(byte[] bytes, int offset, final int length) { if (length != SIZEOF_LONG || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_LONG); } return ConverterHolder.BEST_CONVERTER.toLong(bytes, offset, length); }
Source:
<code>default <U> Seq<U> map(Function<? super Tuple2<K, V>, ? extends U> mapper) { Objects.requireNonNull(mapper, "mapper is null"); <START> return Stream.ofAll(iterator()).map(mapper); <END> }</code><technical_language>.</technical_language>

Target:
default <U> Seq<U> map(Function<? super Tuple2<K, V>, ? extends U> mapper) { Objects.requireNonNull(mapper, "mapper is null"); return (Seq<U>) iterator().map(mapper).toStream(); }
Source:
<code>public void process(MessageContainer msg) throws Exception { if (Strings.isNullOrEmpty(msg.getRoutingKey())) { DynamicCounter.increment("emptyRoutingKeyCount"); <START> return; END> } RoutingMap.RoutingInfo info = routingMap.getRoutingInfo(msg.getRoutingKey()); if (info == null) { sinkManager.getSink("default").writeTo(msg); } else if (info.doFilter(msg)) { List<Route> routes = info.getWhere(); for (Route route : routes) { if (route.doFilter(msg)) { if (!Strings.isNullOrEmpty(route.getAlias())) { sinkManager.getSink(route.getSink()).writeTo( new DefaultMessageContainer( new Message(route.getAlias(), msg.getMessage().getPayload()), jsonMapper)); } else { sinkManager.getSink(route.getSink()).writeTo(msg); } } } } }</code><technical_language>increment dropped message count in this case</technical_language>

Target:
public void process(MessageContainer msg) throws Exception { if (Strings.isNullOrEmpty(msg.getRoutingKey())) { DynamicCounter.increment( MonitorConfig.builder(TagKey.DROPPED_COUNT).withTag("reason", "emptyRoutingKey").build()); return; } RoutingMap.RoutingInfo info = routingMap.getRoutingInfo(msg.getRoutingKey()); if (info == null) { sinkManager.getSink("default").writeTo(msg); } else if (info.doFilter(msg)) { List<Route> routes = info.getWhere(); for (Route route : routes) { if (route.doFilter(msg)) { if (!Strings.isNullOrEmpty(route.getAlias())) { sinkManager.getSink(route.getSink()).writeTo( new DefaultMessageContainer( new Message(route.getAlias(), msg.getMessage().getPayload()), jsonMapper)); } else { sinkManager.getSink(route.getSink()).writeTo(msg); } } } } }
Source:
<code>private void printCacheHelp() { log(i("The '" + CACHE.text() + " subcommand' is used to get information about and perform actions with caches. The command has the following syntax:")); nl(); log(i(UTILITY_NAME_WITH_COMMON_OPTIONS + " " + CACHE.text() + "[subcommand] <subcommand_parameters>")); nl(); log(i("The subcommands that take [nodeId] as an argument ('" + LIST.text() + "', '" + CONTENTION.text() + "' and '" + VALIDATE_INDEXES.text() + "') will be executed on the given node or on all server nodes if the option is not specified. Other commands will run on a random server node.")); nl(); nl(); log(i("Subcommands:")); usageCache(LIST, "regexPattern", "[groups|seq]", "[nodeId]", op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE.text())); usageCache(CONTENTION, "minQueueSize", "[nodeId]", "[maxPrint]"); usageCache(IDLE_VERIFY, op(CMD_DUMP), op(CMD_SKIP_ZEROS), "[cache1,...,cacheN]", op(CACHE_KIND), <START> "[ALL|SYSTEM|PERSISTENT|NOT_PERSISTENT]"); <END> usageCache(VALIDATE_INDEXES, "[cache1,...,cacheN]", "[nodeId]", op(or(VI_CHECK_FIRST + " N", VI_CHECK_THROUGH + " K"))); usageCache(DISTRIBUTION, or("nodeId", NULL), "[cacheName1,...,cacheNameN]", op(CMD_USER_ATTRIBUTES, "attName1,...,attrNameN")); usageCache(RESET_LOST_PARTITIONS, "cacheName1,...,cacheNameN"); nl(); }</code><technical_language>op() or() in cache usage. fix cache usage for LIST CONTENTION too</technical_language>

Target:
private void printCacheHelp() { log(i("The '" + CACHE.text() + " subcommand' is used to get information about and perform actions with caches. The command has the following syntax:")); nl(); log(i(UTILITY_NAME_WITH_COMMON_OPTIONS + " " + CACHE.text() + "[subcommand] <subcommand_parameters>")); nl(); log(i("The subcommands that take [nodeId] as an argument ('" + LIST.text() + "', '" + CONTENTION.text() + "' and '" + VALIDATE_INDEXES.text() + "') will be executed on the given node or on all server nodes if the option is not specified. Other commands will run on a random server node.")); nl(); nl(); log(i("Subcommands:")); usageCache(LIST, "regexPattern", op(or("groups","seq")), op("nodeId"), op(CONFIG), op(OUTPUT_FORMAT, MULTI_LINE .text())); usageCache(CONTENTION, "minQueueSize", op("nodeId"), op("maxPrint")); usageCache(IDLE_VERIFY, op(CMD_DUMP), op(CMD_SKIP_ZEROS), "[cache1,...,cacheN]", op(CACHE_FILTER, or(CacheFilterEnum.ALL.toString(), CacheFilterEnum.SYSTEM.toString(), CacheFilterEnum.PERSISTENT.toString(), CacheFilterEnum.NOT_PERSISTENT.toString()))); usageCache(VALIDATE_INDEXES, "[cache1,...,cacheN]", op("nodeId"), op(or(VI_CHECK_FIRST + " N", VI_CHECK_THROUGH + " K"))); usageCache(DISTRIBUTION, or("nodeId", NULL), "[cacheName1,...,cacheNameN]", op(CMD_USER_ATTRIBUTES, "attName1,...,attrNameN")); usageCache(RESET_LOST_PARTITIONS, "cacheName1,...,cacheNameN"); nl(); }
Source:
<code>private void doWork() { ArrayList<TimeRequest> request = new ArrayList<>(); while (true) { try { request.clear(); TimeRequest trh = null; while (trh == null) { if (closed.get()) { return; } trh = queue.poll(1, TimeUnit.SECONDS); } request.add(trh); queue.drainTo(request); long start; long gcStamp; while (true) { try { String currentLeaderId; OracleService.Client localClient; synchronized (this) { currentLeaderId = getOracle(); localClient = client; } final Context timerContext = responseTimer.time(); Stamps stamps = localClient.getTimestamps(env.getFluoApplicationID(), request.size()); <START> start = stamps.stampStart; <END> gcStamp = stamps.gcStamp; String leaderId = getOracle(); if (leaderId != null && !leaderId.equals(currentLeaderId)) { reconnect(); continue; } stampsHistogram.update(request.size()); timerContext.close(); break; } catch (TTransportException tte) { log.info("Oracle connection lost. Retrying..."); reconnect(); } catch (TException e) { log.error("TException occurred in doWork() method", e); } } for (int i = 0; i < request.size(); i++) { TimeRequest tr = request.get(i); tr.timestamp.set(start + i); tr.gcStamp.set(gcStamp); tr.cdl.countDown(); } } catch (InterruptedException e) { if (!closed.get()) { log.error("InterruptedException occurred in doWork() method", e); } else { log.debug("InterruptedException occurred in doWork() method", e); } } catch (Exception e) { log.error("Exception occurred in doWork() method", e); } } }</code><technical_language>name this txStamp</technical_language>

Target:
private void doWork() { ArrayList<TimeRequest> request = new ArrayList<>(); while (true) { try { request.clear(); TimeRequest trh = null; while (trh == null) { if (closed.get()) { return; } trh = queue.poll(1, TimeUnit.SECONDS); } request.add(trh); queue.drainTo(request); long txStampsStart; long gcStamp; while (true) { try { String currentLeaderId; OracleService.Client localClient; synchronized (this) { currentLeaderId = getOracle(); localClient = client; } final Context timerContext = responseTimer.time(); Stamps stamps = localClient.getTimestamps(env.getFluoApplicationID(), request.size()); txStampsStart = stamps.txStampsStart; gcStamp = stamps.gcStamp; String leaderId = getOracle(); if (leaderId != null && !leaderId.equals(currentLeaderId)) { reconnect(); continue; } stampsHistogram.update(request.size()); timerContext.close(); break; } catch (TTransportException tte) { log.info("Oracle connection lost. Retrying..."); reconnect(); } catch (TException e) { log.error("TException occurred in doWork() method", e); } } for (int i = 0; i < request.size(); i++) { TimeRequest tr = request.get(i); tr.stampRef.set(new Stamp(txStampsStart + i, gcStamp)); tr.cdl.countDown(); } } catch (InterruptedException e) { if (!closed.get()) { log.error("InterruptedException occurred in doWork() method", e); } else { log.debug("InterruptedException occurred in doWork() method", e); } } catch (Exception e) { log.error("Exception occurred in doWork() method", e); } } }
Source:
<code>public synchronized void onPackageRemoved(String packageName) { if (!mPackageNameUidMap.containsKey(packageName)) { <START> return; <END> } int uid = mPackageNameUidMap.get(packageName); SparseIntArray netdPermissionsAppIds = new SparseIntArray(); netdPermissionsAppIds.put(uid, INetd.NO_PERMISSIONS); sendPackagesPermissionsToNetd(netdPermissionsAppIds); mPackageNameUidMap.remove(packageName); }</code><technical_language>add a Log.wtf too? get onPackageRemoved for a package about, right</technical_language>

Target:
public void onPackageRemoved(String packageName) { int uid; synchronized (mPackageNameUidMap) { if (!mPackageNameUidMap.containsKey(packageName)) { return; } uid = mPackageNameUidMap.get(packageName); mPackageNameUidMap.remove(packageName); } SparseIntArray netdPermissionsAppIds = new SparseIntArray(); netdPermissionsAppIds.put(uid, INetd.NO_PERMISSIONS); sendPackagePermissionsToNetd(netdPermissionsAppIds); }
Source:
<code>public KafkaContainer(String confluentPlatformVersion) { <START> this(TestcontainersConfiguration.getInstance().getPulsarDockerImageName().withTag(confluentPlatformVersion)); <END> }</code><technical_language>suggestion this(TestcontainersConfiguration.getInstance().getKafkaDockerImageName().withTag(confluentPlatformVersion)); Is this constructor missing a test therefore</technical_language>

Target:
public KafkaContainer(String confluentPlatformVersion) { this(TestcontainersConfiguration.getInstance().getKafkaDockerImageName().withTag(confluentPlatformVersion)); }
Source:
<code>private String getYmlFromPath(String path, String username) throws AppException { DsPath ymlPath = pathValidator.validatePath(this.project, path); ymlPath.validatePathExists(inodes,false); org.apache.hadoop.fs.Path fullPath = ymlPath.getFullPath(); String ymlFileName = fullPath.getName(); <START> DistributedFileSystemOps udfso = null; <END> FSDataInputStream is = null; try { udfso = dfs.getDfsOps(username); is = udfso.open(fullPath); long fileSize = udfso.getFileStatus(fullPath).getLen(); byte[] ymlFileInBytes = new byte[(int) fileSize]; if (fileSize < 10000) { try (DataInputStream dis = new DataInputStream(is)) { dis.readFully(ymlFileInBytes, 0, (int)fileSize); String ymlFileContents = new String(ymlFileInBytes); return ymlFileContents; } } else{ throw new AppException(Response.Status.INTERNAL_SERVER_ERROR. getStatusCode(), ".yml file too large. Maximum size is 10000 bytes."); } } catch(IOException ioe) { throw new AppException(Response.Status.INTERNAL_SERVER_ERROR. getStatusCode(), "Failed to create Anaconda environment from .yml file."); } }</code><technical_language>Close this. ProjectService.java - line 509</technical_language>

Target:
private String getYmlFromPath(String path, String username) throws AppException { DsPath ymlPath = pathValidator.validatePath(this.project, path); ymlPath.validatePathExists(inodes,false); org.apache.hadoop.fs.Path fullPath = ymlPath.getFullPath(); String ymlFileName = fullPath.getName(); DistributedFileSystemOps udfso = null; FSDataInputStream is = null; try { udfso = dfs.getDfsOps(username); is = udfso.open(fullPath); long fileSize = udfso.getFileStatus(fullPath).getLen(); byte[] ymlFileInBytes = new byte[(int) fileSize]; if (fileSize < 10000) { try (DataInputStream dis = new DataInputStream(is)) { dis.readFully(ymlFileInBytes, 0, (int)fileSize); String ymlFileContents = new String(ymlFileInBytes); return ymlFileContents; } } else{ throw new AppException(Response.Status.INTERNAL_SERVER_ERROR. getStatusCode(), ".yml file too large. Maximum size is 10000 bytes."); } } catch(IOException ioe) { throw new AppException(Response.Status.INTERNAL_SERVER_ERROR. getStatusCode(), "Failed to create Anaconda environment from .yml file."); } finally { if (udfso != null) { dfs.closeDfsClient(udfso); } } }
Source:
<code>public IndexedInts get() { final boolean powerOf2 = sizePer == (1 << Integer.numberOfTrailingZeros(sizePer)); if(powerOf2) { if(numBytes == Ints.BYTES) { <START> return new CompressedFullSizeIndexedInts() { <END> @Override public int get(int index) { return get2(index); } }; } else if(numBytes == Shorts.BYTES) { return new CompressedShortSizeIndexedInts() { @Override public int get(int index) { return get2(index); } }; } else if (numBytes == 1) { return new CompressedByteSizeIndexedInts() { @Override public int get(int index) { return get2(index); } }; } else { return new CompressedVSizeIndexedInts() { @Override public int get(int index) { return get2(index); } }; } } else { if(numBytes == Ints.BYTES) { return new CompressedFullSizeIndexedInts(); } else if (numBytes == Shorts.BYTES) { return new CompressedShortSizeIndexedInts(); } else if (numBytes == 1) { return new CompressedByteSizeIndexedInts(); } else { return new CompressedVSizeIndexedInts(); } } }</code><technical_language>This is... interesting</technical_language>

Target:
public IndexedInts get() { if(numBytes == Ints.BYTES) { return new CompressedFullSizeIndexedInts(); } else if (numBytes == Shorts.BYTES) { return new CompressedShortSizeIndexedInts(); } else if (numBytes == 1) { return new CompressedByteSizeIndexedInts(); } else { return new CompressedVSizeIndexedInts(); } }
Source:
<code>private void manageRegions() { if (regionContainersToLayoutWithImpactStatus.isEmpty()) { return; } List<View> newArrayList = Lists.newArrayList(regionContainersToLayoutWithImpactStatus.keySet()); ListIterator<View> <START> regionToLayoutListIterator = <END> newArrayList.listIterator(newArrayList.size()); while (regionToLayoutListIterator.hasPrevious()) { View regionContainer = regionToLayoutListIterator.previous(); if (regionContainer instanceof Node) { if (regionContainersToLayoutWithImpactStatus.get(regionContainer)) { new RegionContainerUpdateLayoutOperation((Node) regionContainer).execute(); } } } regionContainersToLayoutWithImpactStatus.clear(); }</code><technical_language>renamed show iterate RegionContainers</technical_language>

Target:
private void manageRegions() { if (regionsContainersToLayoutWithImpactStatus.isEmpty()) { return; } List<View> newArrayList = Lists.newArrayList(regionsContainersToLayoutWithImpactStatus.keySet()); ListIterator<View> regionsContainersToLayoutListIterator = newArrayList.listIterator(newArrayList.size()); while (regionsContainersToLayoutListIterator.hasPrevious()) { View regionsContainer = regionsContainersToLayoutListIterator.previous(); if (regionsContainer instanceof Node) { if (regionsContainersToLayoutWithImpactStatus.get(regionsContainer)) { new RegionContainerUpdateLayoutOperation((Node) regionsContainer).execute(); } } } regionsContainersToLayoutWithImpactStatus.clear(); }
Source:
<code>public void onRequestComplete(RestRequestMetadata restRequestMetadata) { if (restRequestMetadata != null) { if (requestsInFlight.remove(restRequestMetadata) != null) { restServerMetrics.dequeuedRequestHandlerRequestCompletionRate.mark(); restRequestMetadata.release(); logger.debug("Request completed - {}", restRequestMetadata); <START> } <END> } }</code><technical_language>error metric trigger requests in flight metadata</technical_language>

Target:
public void onRequestComplete(RestRequestMetadata restRequestMetadata) { if (restRequestMetadata != null) { if (requestsInFlight.remove(restRequestMetadata) != null) { restServerMetrics.dequeuedRequestHandlerRequestCompletionRate.mark(); restRequestMetadata.release(); logger.trace("Request completed - {}", restRequestMetadata.getUri()); } } }
Source:
<code>public OLSyntaxNode protocolId() { OLSyntaxNode p = this.protocol; if( p instanceof SumExpressionNode ) { OLSyntaxNode prodNode = ((SumExpressionNode) protocol).operands().iterator().next().value(); p = ((ProductExpressionNode) prodNode).operands().iterator().next().value(); } if( p instanceof InlineTreeExpressionNode ) { <START> return ((InlineTreeExpressionNode) p).rootExpression(); <END> } else { return p; } }</code><technical_language>This is in InputPortInfo. Why? they? If not, wanna extract this code a static method in PortInfo call this method in InputPortInfo</technical_language>

Target:
public String protocolId() { return PortInfo.extractProtocolId( this.protocol ); }
Source:
<code>public final void fetchesSize() throws Exception { final Content content = Mockito.mock(Content.class); Mockito.doReturn( Json.createObjectBuilder() .add("size", 5555) .build() ).when(content).json(); MatcherAssert.assertThat( new Content.Smart(content).size(), <START> Matchers.notNullValue() <END> ); }</code><technical_language>Hey, size is NULL, integer, a scalar type. compare 5555</technical_language>

Target:
public final void fetchesSize() throws Exception { final Content content = Mockito.mock(Content.class); final int prop = 5555; Mockito.doReturn( Json.createObjectBuilder() .add("size", prop) .build() ).when(content).json(); MatcherAssert.assertThat( new Content.Smart(content).size(), Matchers.is(prop) ); }
Source:
<code>public static LibraryTemplateDto asDto(LibraryTemplate from) { LibraryTemplateDto dto = null; if (from instanceof DetailedLibraryTemplate) { dto = asDetailedLibraryTemplateDto((DetailedLibraryTemplate) from); } else { dto = new LibraryTemplateDto(); } dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setProjectId(from.getProject().getId()); dto.setDefaultVolume(from.getDefaultVolume() != null ? from.getDefaultVolume().toString() : ""); dto.setPlatformType(from.getPlatformType() != null ? from.getPlatformType().getKey() : ""); dto.setLibraryTypeId(from.getLibraryType() != null ? from.getLibraryType().getId().toString() : ""); dto.setSelectionTypeId(from.getLibrarySelectionType() != null ? from.getLibrarySelectionType().getId().toString() : ""); dto.setStrategyTypeId(from.getLibraryStrategyType() != null ? from.getLibraryStrategyType().getId().toString() : ""); dto.setKitDescriptorId(from.getKitDescriptor() != null ? from.getKitDescriptor().getId().toString() : ""); <START> dto.setIndexFamilyId(from.getIndexFamily() != null ? from.getIndexFamily().getId().toString() : ""); <END> if (from.getIndexFamily() != null) { if (from.getIndexOnes() != null) { dto.setIndexOneIds(from.getIndexOnes().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getId()))); } if (from.getIndexTwos() != null) { dto.setIndexTwoIds(from.getIndexTwos().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getId()))); } } return dto; }</code><technical_language>empty strings instead of null</technical_language>

Target:
public static LibraryTemplateDto asDto(LibraryTemplate from) { LibraryTemplateDto dto = null; if (from instanceof DetailedLibraryTemplate) { dto = asDetailedLibraryTemplateDto((DetailedLibraryTemplate) from); } else { dto = new LibraryTemplateDto(); } dto.setId(from.getId()); dto.setAlias(from.getAlias()); dto.setProjectIds(from.getProjects().stream().map(Project::getId).collect(Collectors.toList())); dto.setDefaultVolume(from.getDefaultVolume()); dto.setPlatformType(from.getPlatformType() != null ? from.getPlatformType().toString() : null); dto.setLibraryTypeId(from.getLibraryType() != null ? from.getLibraryType().getId() : null); dto.setSelectionTypeId(from.getLibrarySelectionType() != null ? from.getLibrarySelectionType().getId() : null); dto.setStrategyTypeId(from.getLibraryStrategyType() != null ? from.getLibraryStrategyType().getId() : null); dto.setKitDescriptorId(from.getKitDescriptor() != null ? from.getKitDescriptor().getId() : null); dto.setIndexFamilyId(from.getIndexFamily() != null ? from.getIndexFamily().getId() : null); if (from.getIndexFamily() != null) { if (from.getIndexOnes() != null) { dto.setIndexOneIds(from.getIndexOnes().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getId()))); } if (from.getIndexTwos() != null) { dto.setIndexTwoIds(from.getIndexTwos().entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> entry.getValue().getId()))); } } return dto; }
Source:
<code>private void updateStoragePoolFormatType() { final StoragePool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (oldSpVersion.equals(spVersion)) { return; } final StorageFormatType targetFormat = VersionStorageFormatUtil.getPreferredForVersion(spVersion, getMasterDomain() == null ? null : getMasterDomain().getStorageType()); storagePool.setStoragePoolFormatType(targetFormat); TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getStoragePoolDAO().updatePartial(storagePool); <START> if (getMasterDomain() != null) { <END> updateMemberDomainsFormat(targetFormat); } return null; } }); if (_oldStoragePool.getStatus() == StoragePoolStatus.Up && getMasterDomain() != null) { try { runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat)); } catch (VdcBLLException e) { log.warnFormat("Upgrade procees of Storage Pool {0} has encountered a problem due to following reason: {1}", spId, e.getMessage()); AuditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS); } } }</code><technical_language>why</technical_language>

Target:
private void updateStoragePoolFormatType() { final StoragePool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (oldSpVersion.equals(spVersion)) { return; } StorageType spType = storagePool.getStorageType(); final StorageFormatType targetFormat = VersionStorageFormatUtil.getPreferredForVersion(spVersion, spType); storagePool.setStoragePoolFormatType(targetFormat); TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getStoragePoolDAO().updatePartial(storagePool); if (getMasterDomain() != null) { updateMemberDomainsFormat(targetFormat); } return null; } }); if (_oldStoragePool.getStatus() == StoragePoolStatus.Up && getMasterDomain() != null) { try { runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat)); } catch (VdcBLLException e) { log.warnFormat("Upgrade procees of Storage Pool {0} has encountered a problem due to following reason: {1}", spId, e.getMessage()); AuditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS); } } }
Source:
<code>public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (element.is(Tree.Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; if (callExpression.callee().is(Tree.Kind.DOT_MEMBER_EXPRESSION)) { MemberExpressionTree memberExpression = (MemberExpressionTree) callExpression.callee(); ExpressionTree object = memberExpression.object(); if (!isReverseMethod(memberExpression.property())) { return; } if (!object.is(Tree.Kind.IDENTIFIER_REFERENCE)) { return; } ((IdentifierTree) object).symbol().ifPresent(objectSymbol -> { <START> if (isArray(objectSymbol, currentState) && isBeingPassedElsewhere(objectSymbol, element)) <END> this.addUniqueIssue(element, MESSAGE); }); } } }</code><technical_language>@inverno plans add braces here?:)</technical_language>

Target:
public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (element.is(Tree.Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; if (callExpression.callee().is(Tree.Kind.DOT_MEMBER_EXPRESSION)) { MemberExpressionTree memberExpression = (MemberExpressionTree) callExpression.callee(); checkMemberExpression(currentState, callExpression, memberExpression); } } }
Source:
<code>static Discover parse(String s) { <START> if (s == null || s.isEmpty()) <END> return Discover.none; return Discover.valueOf(s); }</code><technical_language>want do: <LINK_0> trims string in case input leading trailing whitespace</technical_language>

Target:
static Discover parse(String s) { if (s == null || (s = s.trim()).isEmpty()) return Discover.none; return Discover.valueOf(s); }
Source:
<code>private Guid getBrickId(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { String[] brickParts = qualifiedBrickName.split(":", -1); <START> if (brickParts.length != 2) { <END> throw new RuntimeException("Invalid brick representation [" + qualifiedBrickName + "]"); } for (GlusterBrickEntity brick : bricksList) { if (brick.getQualifiedName().equals(qualifiedBrickName)) { return brick.getId(); } } return null; }</code><technical_language>This validation is required. expect brick name returned glusterfs (and vdsm) of correct format</technical_language>

Target:
private Guid getBrickId(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { for (GlusterBrickEntity brick : bricksList) { if (brick.getQualifiedName().equals(qualifiedBrickName)) { return brick.getId(); } } return null; }
Source:
<code>protected void onStart() { super.onStart(); mapView.onStart(); <START> sensorManager.registerListener(this, gyro , 200); <END> sensorManager.registerListener(this, magnetic , 200); }</code><technical_language>formatting</technical_language>

Target:
protected void onStart() { super.onStart(); mapView.onStart(); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); sensorControl = new SensorControl(sensorManager); registerSensorListeners(); }
Source:
<code>private RdapObject getRdapObject(final String requestUrl, final RpslObject rpslObject, final LocalDateTime lastChangedTimestamp, @Nullable final RpslObject abuseContact) { RdapObject rdapResponse; final ObjectType rpslObjectType = rpslObject.getType(); switch (rpslObjectType) { case DOMAIN: rdapResponse = createDomain(rpslObject); break; case AUT_NUM: rdapResponse = createAutnumResponse(rpslObject); break; <START> case AS_BLOCK: <END> rdapResponse = createAsBlockResponse(rpslObject); break; case INETNUM: case INET6NUM: rdapResponse = createIp(rpslObject); break; case PERSON: case ROLE: case ORGANISATION: rdapResponse = createEntity(rpslObject); break; default: throw new IllegalArgumentException("Unhandled object type: " + rpslObject.getType()); } if (hasRemark(rpslObject)) { rdapResponse.getRemarks().add(createRemark(rpslObject)); } rdapResponse.getEvents().add(createEvent(lastChangedTimestamp)); rdapResponse.getNotices().addAll(noticeFactory.generateNotices(requestUrl, rpslObject)); if (abuseContact != null) { rdapResponse.getEntitySearchResults().add(createEntity(abuseContact, Role.ABUSE)); } return rdapResponse; }</code><technical_language>as-block test returns 400 bad request, thanks</technical_language>

Target:
private RdapObject getRdapObject(final String requestUrl, final RpslObject rpslObject, final LocalDateTime lastChangedTimestamp, @Nullable final RpslObject abuseContact) { RdapObject rdapResponse; final ObjectType rpslObjectType = rpslObject.getType(); switch (rpslObjectType) { case DOMAIN: rdapResponse = createDomain(rpslObject); break; case AUT_NUM: rdapResponse = createAutnumResponse(rpslObject); break; case AS_BLOCK: rdapResponse = createAsBlockResponse(rpslObject); break; case INETNUM: case INET6NUM: rdapResponse = createIp(rpslObject); break; case PERSON: case ROLE: case MNTNER: case ORGANISATION: rdapResponse = createEntity(rpslObject); break; default: throw new IllegalArgumentException("Unhandled object type: " + rpslObject.getType()); } if (hasRemark(rpslObject)) { rdapResponse.getRemarks().add(createRemark(rpslObject)); } rdapResponse.getEvents().add(createEvent(lastChangedTimestamp)); rdapResponse.getNotices().addAll(noticeFactory.generateNotices(requestUrl, rpslObject)); if (abuseContact != null) { rdapResponse.getEntitySearchResults().add(createEntity(abuseContact, Role.ABUSE)); } return rdapResponse; }
Source:
<code>public Response enableDatasourceSegments( @PathParam("dataSourceName") String dataSourceName, MarkDatasourceSegmentsPayload payload ) { if (payload == null || !payload.isValid()) { return Response.status(Response.Status.BAD_REQUEST).entity( ImmutableMap.of( "error", <START> "Either interval or segments can be specified" <END> ) ).build(); } final ImmutableDruidDataSource dataSource = getDataSource(dataSourceName); if (dataSource == null) { return Response.noContent().build(); } boolean success; try { if (payload.getInterval() != null) { success = databaseSegmentManager.enableSegments(dataSource.getName(), payload.getInterval()); } else { success = databaseSegmentManager.enableSegments(dataSource.getName(), payload.getSegmentIds()); } } catch (Exception e) { return Response.serverError().entity( ImmutableMap.of( "error", "Exception occurred.", "message", e.toString() ) ).build(); } if (!success) { return Response.noContent().build(); } return Response.ok().build(); }</code><technical_language>message "Either a valid interval segmentIds array specified"</technical_language>

Target:
public Response enableDatasourceSegments( @PathParam("dataSourceName") String dataSourceName, MarkDatasourceSegmentsPayload payload ) { if (payload == null || !payload.isValid()) { return Response.status(Response.Status.BAD_REQUEST) .entity("Invalid request payload, either interval or segmentIds array must be specified") .build(); } final ImmutableDruidDataSource dataSource = getDataSource(dataSourceName); if (dataSource == null) { return Response.noContent().build(); } int modified; try { if (payload.getInterval() != null) { modified = databaseSegmentManager.enableSegments(dataSource.getName(), payload.getInterval()); } else { modified = databaseSegmentManager.enableSegments(dataSource.getName(), payload.getSegmentIds()); } } catch (Exception e) { if (e.getCause() instanceof UnknownSegmentIdException) { return Response.status(Response.Status.NOT_FOUND).entity( ImmutableMap.of( "message", e.getCause().getMessage() ) ).build(); } return Response.serverError().entity( ImmutableMap.of( "error", "Exception occurred.", "message", e.getMessage() ) ).build(); } if (modified == 0) { return Response.noContent().build(); } return Response.ok().build(); }
Source:
<code>private VariantEvaluationContext composeNonTruthOverlappingVariantContext(final VariantContext call, final TargetCollection<Target> targets) { <START> final VariantEvaluationContextBuilder result = new VariantEvaluationContextBuilder(); <END> result.loc(call.getContig(), call.getStart(), call.getEnd()); result.attribute(VCFConstants.END_KEY, call.getEnd()); result.id(call.getID()); result.alleles(call.getAlleles()); result.genotypes( call.getGenotypes().stream() .map(g -> composeNonTruthOverlappingGenotype(call, g)) .collect(Collectors.toList())); result.attribute(GenotypeCopyNumberTriStateSegments.NUMBER_OF_TARGETS_KEY, targets.targetCount(call)); result.evidence(null, Collections.singletonList(call)); return result.make(); }</code><technical_language>result is called builder in parallel method below. I prefer builder</technical_language>

Target:
private VariantEvaluationContext composeNonTruthOverlappingVariantContext(final VariantContext call, final TargetCollection<Target> targets) { return composeEvaluationVariantContext(call, call.getAlleles(), s -> composeNonTruthOverlappingGenotype(call, call.getGenotype(s)), targets, null, Collections.singletonList(call)); }
Source:
<code>public void testReloadColumnSortListWhenInitListTable() { ListTable<T> listTable = mock(ListTable.class); when(getView().getListGrid()).thenReturn(listTable); GridPreferencesStore gridPreferencesStore = mock(GridPreferencesStore.class); when(listTable.getGridPreferencesStore()).thenReturn(gridPreferencesStore); GridSortedColumnPreference gridSortedColumnPreference = new GridSortedColumnPreference("test", true); when(gridPreferencesStore.getGridSortedColumnPreference()).thenReturn(gridSortedColumnPreference); ColumnSortList columnSortList = getColumnSortList("startDate", null); when(listTable.getColumnSortList()).thenReturn(columnSortList); ColumnMeta columnMeta = new ColumnMeta(getColumn("test"), "test"); when(listTable.getColumnMetaList()).thenReturn(Arrays.asList(columnMeta)); assertEquals(1, columnSortList.size()); doAnswer(answer -> { <START> Column<T, String> column = new Column<T, String>(new TextCell()) { <END> @Override public String getValue(T domain) { return null; } }; column.setSortable(true); column.setDataStoreName("test"); columnSortList.push(column); return columnSortList.get(0); }).when(getView()).defferredColumnSortListPush(any(),any()); getView().reloadColumnSortList(); assertEquals("test", columnSortList.get(0).getColumn().getDataStoreName()); assertEquals("startDate", columnSortList.get(1).getColumn().getDataStoreName()); assertEquals(2, columnSortList.size()); }</code><technical_language>check if _defferredColumnSortListPush_ called</technical_language>

Target:
public void testReloadColumnSortListWhenInitListTable() { ListTable<T> listTable = mock(ListTable.class); when(getView().getListGrid()).thenReturn(listTable); GridPreferencesStore gridPreferencesStore = mock(GridPreferencesStore.class); when(listTable.getGridPreferencesStore()).thenReturn(gridPreferencesStore); GridSortedColumnPreference gridSortedColumnPreference = new GridSortedColumnPreference("test", true); when(gridPreferencesStore.getGridSortedColumnPreference()).thenReturn(gridSortedColumnPreference); ColumnSortList columnSortList = getColumnSortList("startDate", null); when(listTable.getColumnSortList()).thenReturn(columnSortList); ColumnMeta columnMeta = new ColumnMeta(getColumn("test"), "test"); when(listTable.getColumnMetaList()).thenReturn(Arrays.asList(columnMeta)); assertEquals(1, columnSortList.size()); getView().reloadColumnSortList(); assertEquals("test", columnSortList.get(0).getColumn().getDataStoreName()); assertEquals("startDate", columnSortList.get(1).getColumn().getDataStoreName()); assertEquals(2, columnSortList.size()); }
Source:
<code>protected void configureMoveCommand(final String source, final String destination) { command = new LocalMoveFileCommand(); <START> ((LocalMoveFileCommand) command).setConfiguration(source, destination); <END> }</code><technical_language>Type casting again</technical_language>

Target:
protected void configureMoveCommand(final String source, final String destination) { LocalMoveFileCommand cmd = new LocalMoveFileCommand(); cmd.setConfiguration(source, destination); command.set(cmd); }
Source:
<code>private void hotPlugUnplugCpus() { if (getVm().getNumOfCpus() != getParameters().getVm().getNumOfCpus()) { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetNumberOfCpus, new SetNumberOfCpusVDSCommand.Params( getVm().getRunOnVds(), getVm().getId(), getParameters().getVm().getNumOfCpus())); AuditLogableBase logable = new AuditLogableBase(); logable.setVmId(getVmId()); logable.addCustomValue("numberOfCpus", String.valueOf(getParameters().getVm().getNumOfCpus())); logable.addCustomValue("ErrorMessage", returnValue.getExceptionString() + " " <START> + returnValue.getVdsError().getMessage()); <END> AuditLogDirector.log(logable, returnValue.getSucceeded() ? AuditLogType.SET_NUMBER_OF_CPUS : AuditLogType.FAILED_SET_NUMBER_OF_CPUS); if (!returnValue.getSucceeded()) { newVmStatic.setNumOfSockets(oldVm.getNumOfSockets()); } } }</code><technical_language>i this translated Backend.getInstance() .getVdsErrorsTranslator()</technical_language>

Target:
private void hotPlugUnplugCpus() { int currentSockets = getVm().getNumOfSockets(); int newSockets = getParameters().getVm().getNumOfSockets(); if (getVm().getStatus() == VMStatus.Up && currentSockets != newSockets) { setNumberOfCpusResult = getBackend().runInternalAction( VdcActionType.SetNumberOfCpus, new VmManagementParametersBase(newVmStatic)); getVm().setNumOfSockets(setNumberOfCpusResult.getSucceeded() ? newSockets : currentSockets); } }