auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void doDistributeCentersHorizontally(Collection<SWTBotGefEditPart> editPartsToDistribute, ZoomLevel zoomLevel, boolean horizontalScrollbar) { editor.select(editPartsToDistribute); SWTBotUtils.waitAllUiEvents(); editor.clickContextMenu(HORIZONTALLY_GAP_CENTER); List<SWTBotGefEditPart> orderedEditParts = centersHorizontallyOrderEditParts(editPartsToDistribute); boolean uniformGaps = true; int i = 0; int expectedGap; if (horizontalScrollbar) { expectedGap = SCROLLBAR_HORIZONTALLY_GAP_CENTER_VALUE; } else { expectedGap = HORIZONTALLY_GAP_CENTER_VALUE; <START> } <END> while (i < orderedEditParts.size() - 1 && uniformGaps) { int gap = editor.getAbsoluteBounds(orderedEditParts.get(i + 1)).getCenter().x - editor.getAbsoluteBounds(orderedEditParts.get(i)).getCenter().x; if (gap != expectedGap) { uniformGaps = false; if (!orderedEditParts.get(i + 1).equals(getLastShape(orderedEditParts, DistributeAction.CENTERS_HORIZONTALLY))) { assertEquals("Not uniform centers horizontally gap", expectedGap, gap); } else { assertEquals("Incorrect centers horizontally gap between the second to last shape and the last shape", gap < expectedGap + (orderedEditParts.size() - 1), gap > expectedGap - (orderedEditParts.size() - 1)); } } i++; } }</code><technical_language>Add message details facilitate debug in case of problem String messsageDetails = " (zoomLevel=" + zoomLevel.getLevel() + ", horizontalScrollbar=" + horizontalScrollbar + ")";</technical_language>

Target:
private void doDistributeCentersHorizontally(Collection<SWTBotGefEditPart> editPartsToDistribute, ZoomLevel zoomLevel, boolean horizontalScrollbar) { editor.select(editPartsToDistribute); SWTBotUtils.waitAllUiEvents(); editor.clickContextMenu(HORIZONTALLY_CENTERS_GAPS_LABEL); List<SWTBotGefEditPart> orderedEditParts = centersHorizontallyOrderEditParts(editPartsToDistribute); boolean uniformGaps = true; int expectedGap; if (horizontalScrollbar) { expectedGap = SCROLLBAR_HORIZONTALLY_CENTER_GAP_VALUE; } else { expectedGap = HORIZONTALLY_CENTER_GAP_VALUE; } String messsageDetails = " (distribute action=" + HORIZONTALLY_CENTERS_GAPS_LABEL + ", zoomLevel=" + zoomLevel.getLevel() + ", horizontalScrollbar=" + horizontalScrollbar + ")"; for (int i = 0; i < orderedEditParts.size() - 1 && uniformGaps; i++) { int gap = editor.getAbsoluteBounds(orderedEditParts.get(i + 1)).getCenter().x - editor.getAbsoluteBounds(orderedEditParts.get(i)).getCenter().x; if (gap != expectedGap) { uniformGaps = false; if ((i + 1) != (orderedEditParts.size() - 1)) { assertEquals("Not uniform center horizontal gap" + messsageDetails, expectedGap, gap); } else { assertEquals("Incorrect center horizontal gap between the second to last shape and the last shape" + messsageDetails, gap < expectedGap + (orderedEditParts.size() - 1), gap > expectedGap - (orderedEditParts.size() - 1)); } } } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractProject other = (AbstractProject) obj; return new EqualsBuilder() .append(alias, other.alias) .append(description, other.description) .append(progress, other.progress) <START> .append(referenceGenome.getId(), other.referenceGenome.getId()) <END> .append(shortName, other.shortName) .isEquals(); }</code><technical_language>issue hashcode</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractProject other = (AbstractProject) obj; return new EqualsBuilder() .append(alias, other.alias) .append(description, other.description) .append(progress, other.progress) .append(referenceGenome, other.referenceGenome) .append(shortName, other.shortName) .isEquals(); }
Source:
<code>public void testCreateStrategiesWithNoDarkClusters() { <START> ClusterInfoProvider clusterInfoProvider = new MockClusterInfoProvider(); <END> Facilities facilities = new MockFacilities(clusterInfoProvider); DarkClusterDispatcher darkClusterDispatcher = new DefaultDarkClusterDispatcherImpl(new MockClient(false)); DarkClusterStrategyFactory strategyFactory = new DarkClusterStrategyFactoryImpl(facilities, SOURCE_CLUSTER_NAME, darkClusterDispatcher, new DoNothingNotifier(), new Random(SEED), new CountingVerifierManager()); strategyFactory.start(); DarkClusterStrategy strategy = strategyFactory.getOrCreate(DARK_CLUSTER_NAME, new DarkClusterConfig()); RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("foo")).build(); boolean requestSent = strategy.handleRequest(dummyRestRequest, dummyRestRequest, new RequestContext()); Assert.assertTrue(strategy instanceof NoOpDarkClusterStrategy); Assert.assertFalse(requestSent, "default empty strategy should not send request"); }</code><technical_language>extract out setup a @BeforeMethod setup method? individual tests more readable slim</technical_language>

Target:
public void testCreateStrategiesWithNoDarkClusters() { DarkClusterStrategy strategy = _strategyFactory.getOrCreate(DARK_CLUSTER_NAME, new DarkClusterConfig()); RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("foo")).build(); boolean requestSent = strategy.handleRequest(dummyRestRequest, dummyRestRequest, new RequestContext()); Assert.assertTrue(strategy instanceof NoOpDarkClusterStrategy); Assert.assertFalse(requestSent, "default empty strategy should not send request"); }
Source:
<code>protected void setActionMessageParameters() { <START> addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); <END> addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }</code><technical_language>add</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }
Source:
<code>public void addKeyListener(KeyListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.addKeyListener(listener); if <START> (this.dropdownTableViewer != <END> null && !this.dropdownTable.isDisposed()) this.dropdownTable.addKeyListener(listener); }</code><technical_language>a check for viewer here? this dropdownTable? table</technical_language>

Target:
public void addKeyListener(KeyListener listener) { if (this.text != null && !this.text.isDisposed()) this.text.addKeyListener(listener); if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addKeyListener(listener); }
Source:
<code>public Response onGet( @QueryParam(value = "dump") @RestDocParam(description = "If given, a dump of the repository is sent") String dump, @QueryParam(value = "reset") @RestDocParam(description = "Resets the repository to the last &ldquo;official&rdquo; known state") String reset, @QueryParam(value = "commit") @RestDocParam(description = "Commits the current state to the repository and pushes it upstream") String commit ) { if (dump != null) { return this.dumpRepository(); } else if (reset != null) { try { ((GitBasedRepository) Prefs.INSTANCE.getRepository()).cleanAndResetHard(); } catch (Exception e) { Response res; res = Response.serverError().entity(e.getMessage()).build(); return res; } return Response.noContent().build(); } else if (commit != null) { try { <START> ((GitBasedRepository) Prefs.INSTANCE.getRepository()).addCommit(null); <END> } catch (Exception e) { Response res; res = Response.serverError().entity(e.getMessage()).build(); return res; } return Response.noContent().build(); } else { Viewable viewable = new Viewable("/jsp/admin/repository.jsp", this); return Response.ok().entity(viewable).build(); } }</code><technical_language>Please add another addCommit method. passing commit admin resource commit message. pass null</technical_language>

Target:
public Response onGet( @QueryParam(value = "dump") @RestDocParam(description = "If given, a dump of the repository is sent") String dump, @QueryParam(value = "reset") @RestDocParam(description = "Resets the repository to the last &ldquo;official&rdquo; known state") String reset, @QueryParam(value = "commit") @RestDocParam(description = "Commits the current state to the repository and pushes it upstream") String commit ) { if (dump != null) { return this.dumpRepository(); } else if (reset != null) { try { ((GitBasedRepository) Prefs.INSTANCE.getRepository()).cleanAndResetHard(); } catch (Exception e) { Response res; res = Response.serverError().entity(e.getMessage()).build(); return res; } return Response.noContent().build(); } else if (commit != null) { try { ((GitBasedRepository) Prefs.INSTANCE.getRepository()).addCommit("Files changed externally"); } catch (Exception e) { Response res; res = Response.serverError().entity(e.getMessage()).build(); return res; } return Response.noContent().build(); } else { Viewable viewable = new Viewable("/jsp/admin/repository.jsp", this); return Response.ok().entity(viewable).build(); } }
Source:
<code>public void put(Collection<SinkRecord> records) { if (records.isEmpty()) { return; } final SinkRecord first = records.iterator().next(); final int recordsCount = records.size(); log.trace( "Received records. First record kafka coordinates:({}-{}-{}). Writing them to the " + "database...", recordsCount, first.topic(), first.kafkaPartition(), first.kafkaOffset() ); try { writer.write(records); } catch (SQLException sqle) { log.warn(sqle.getNextException().getMessage()); log.warn( <START> "Write of records failed, remainingRetries={}", <END> records.size(), remainingRetries, sqle ); if (remainingRetries == 0) { throw new ConnectException(sqle); } else { writer.closeQuietly(); initWriter(); remainingRetries--; context.timeout(config.retryBackoffMs); throw new RetriableException(sqle); } } remainingRetries = config.maxRetries; }</code><technical_language>output this log message for original? Also, next exception a next exception, log of in correct order _after_ existing log message: for (Throwable next : sqle) { log.warn(next); } WDYT</technical_language>

Target:
public void put(Collection<SinkRecord> records) { if (records.isEmpty()) { return; } final SinkRecord first = records.iterator().next(); final int recordsCount = records.size(); log.trace( "Received records. First record kafka coordinates:({}-{}-{}). Writing them to the " + "database...", recordsCount, first.topic(), first.kafkaPartition(), first.kafkaOffset() ); try { writer.write(records); } catch (SQLException sqle) { log.warn( "Write of records failed, remainingRetries={}", records.size(), remainingRetries ); for (Throwable e: sqle) { log.warn(e.getMessage()); } if (remainingRetries == 0) { throw new ConnectException(sqle); } else { writer.closeQuietly(); initWriter(); remainingRetries--; context.timeout(config.retryBackoffMs); throw new RetriableException(sqle); } } remainingRetries = config.maxRetries; }
Source:
<code>public ResponseEntity<?> getSubscriptionStats(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { try { final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); final List<SubscriptionEventTypeStats> subscriptionStat = subscriptionService.createSubscriptionStat(subscription); return status(OK).body(new ItemsWrapper(subscriptionStat)); } catch (final NoSuchSubscriptionException e) { <START> LOG.debug("Failed to find subscription: " + subscriptionId, e); <END> return create(e.asProblem(), request); } catch (final ServiceUnavailableException e) { LOG.error("Error occurred when trying to get subscription stat: " + subscriptionId, e); return create(e.asProblem(), request); } }</code><technical_language>LOG.debug("Failed find subscription: {}", subscriptionId, e); avoid unnecessary string concatenations</technical_language>

Target:
public ResponseEntity<?> getSubscriptionStats(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { try { final Subscription subscription = subscriptionRepository.getSubscription(subscriptionId); final List<SubscriptionEventTypeStats> subscriptionStat = subscriptionService.createSubscriptionStat(subscription); return status(OK).body(new ItemsWrapper(subscriptionStat)); } catch (final NoSuchSubscriptionException e) { LOG.debug("Failed to find subscription: {}", subscriptionId, e); return create(e.asProblem(), request); } catch (final ServiceUnavailableException e) { LOG.error("Error occurred when trying to get subscription stat: {}" + subscriptionId, e); return create(e.asProblem(), request); } }
Source:
<code>protected void doChangeDefautlHost(Guid hostGuid) { <START> if (hostGuid != null && firstRun) <END> { Guid vdsId = hostGuid; if (getModel().getDefaultHost().getItems() != null) { getModel().getDefaultHost().setSelectedItem(Linq.firstOrDefault(getModel().getDefaultHost().getItems(), new Linq.HostPredicate(vdsId))); } getModel().getIsAutoAssign().setEntity(false); } else { getModel().getIsAutoAssign().setEntity(true); } firstRun = false; }</code><technical_language>this work in for example this case: - a VM a cluster pinned some host - Open edit VM dialog change cluster - pin host stay original "firstRun" called inicialization phase a simpler solution check, if host want pinned is present in list of hosts this cluster (getModel().getDefaultHosts()). If is, continue in this logic. If is not, set auto assign true set selected item null</technical_language>

Target:
protected void doChangeDefautlHost(Guid hostGuid) { getModel().getIsAutoAssign().setEntity(true); if (hostGuid != null) { Guid vdsId = hostGuid; if (getModel().getDefaultHost().getItems() != null) { getModel().getDefaultHost().setSelectedItem(Linq.firstOrDefault(getModel().getDefaultHost().getItems(), new Linq.HostPredicate(vdsId))); if (getModel().getDefaultHost().getSelectedItem() != null && getModel().getDefaultHost().getSelectedItem().getId().equals(vdsId)) { getModel().getIsAutoAssign().setEntity(false); } } } }
Source:
<code>public void editProviderLoaderAttributesTest() throws Exception { String providerLoaderName = randomAlphanumeric(5); Address providerLoaderAddress = elyOps.getElytronAddress(PROVIDER_LOADER, providerLoaderName); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL); <START> try { <END> ops.add(providerLoaderAddress, Values.of(MODULE, BC_MODULE_NAME) .and(CLASS_NAMES, new ModelNodeListBuilder(new ModelNode(BC_CLASS_NAME)).build())); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL).getResourceManager() .selectByName(providerLoaderName); page.switchToConfigAreaTab(ATTRIBUTES_LABEL); new ConfigChecker.Builder(client, providerLoaderAddress).configFragment(page.getConfigFragment()) .edit(TEXT, CLASS_NAMES, "") .edit(TEXT, MODULE, ELYTRON_MODULE_NAME) .andSave().verifyFormSaved() .verifyAttributeIsUndefined(CLASS_NAMES) .verifyAttribute(MODULE, ELYTRON_MODULE_NAME); } finally { ops.removeIfExists(providerLoaderAddress); adminOps.reloadIfRequired(); } }</code><technical_language>this method call (second navigation)</technical_language>

Target:
public void editProviderLoaderAttributesTest() throws Exception { String providerLoaderName = randomAlphanumeric(5); Address providerLoaderAddress = elyOps.getElytronAddress(PROVIDER_LOADER, providerLoaderName); try { ops.add(providerLoaderAddress, Values.of(MODULE, BC_MODULE_NAME) .and(CLASS_NAMES, new ModelNodeListBuilder(new ModelNode(BC_CLASS_NAME)).build())); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL).getResourceManager() .selectByName(providerLoaderName); page.switchToConfigAreaTab(ATTRIBUTES_LABEL); new ConfigChecker.Builder(client, providerLoaderAddress).configFragment(page.getConfigFragment()) .edit(TEXT, CLASS_NAMES, "") .edit(TEXT, MODULE, ELYTRON_MODULE_NAME) .andSave().verifyFormSaved() .verifyAttributeIsUndefined(CLASS_NAMES) .verifyAttribute(MODULE, ELYTRON_MODULE_NAME); } finally { ops.removeIfExists(providerLoaderAddress); adminOps.reloadIfRequired(); } }
Source:
<code>public boolean isMobileTopLeaderboardVisible() { try { waitForElementVisibleByElement(mobileTopLeaderboard, 5, 1000); <START> } catch (TimeoutException e) { <END> return false; } return true; }</code><technical_language>move 5 1000 variables. in places</technical_language>

Target:
public boolean isMobileTopLeaderboardVisible() { try { waitForElementVisibleByElement(mobileTopLeaderboard, Settings.TIME_OUT_IN_SEC.value, Settings.CHECK_OUT_IN_MILLI_SEC.value); } catch (TimeoutException e) { return false; } return true; }
Source:
<code>public File getDataDir() { if (StringUtils.isBlank(path)) { File transienStoreHome = new File(Environment.getDefault().getData(), "transientstores"); <START> return new File(transienStoreHome, getName()); <END> } else { return new File(path); } }</code><technical_language>put logic in descriptor, pure data. Do in caller</technical_language>

Target:
public String getDataDir() { return path; }
Source:
<code>public void addRemoteReplicaToLagMetrics(final RemoteReplicaInfo remoteReplicaInfo) { <START> String metricName = remoteReplicaInfo.getReplicaId().getDataNodeId().getHostname() + "-" + <END> remoteReplicaInfo.getReplicaId().getDataNodeId().getPort() + "-" + remoteReplicaInfo.getReplicaId().getReplicaPath() + "-replicaLagInBytes"; Gauge<Long> replicaLag = new Gauge<Long>() { @Override public Long getValue() { return remoteReplicaInfo.getReplicaLagInBytes(); } }; registry.register(MetricRegistry.name(ReplicationMetrics.class, metricName), replicaLag); replicaLagInBytes.add(replicaLag); }</code><technical_language>is this final anymore</technical_language>

Target:
public void addRemoteReplicaToLagMetrics(final RemoteReplicaInfo remoteReplicaInfo) { final String metricName = remoteReplicaInfo.getReplicaId().getDataNodeId().getHostname() + "-" + remoteReplicaInfo.getReplicaId().getDataNodeId().getPort() + "-" + remoteReplicaInfo.getReplicaId().getReplicaPath() + "-replicaLagInBytes"; Gauge<Long> replicaLag = new Gauge<Long>() { @Override public Long getValue() { return remoteReplicaInfo.getReplicaLagInBytes(); } }; registry.register(MetricRegistry.name(ReplicationMetrics.class, metricName), replicaLag); replicaLagInBytes.add(replicaLag); }
Source:
<code>private boolean localRecoveryNeeded(GridDhtPartitionsExchangeFuture fut) { for (CacheGroupContext grp : fut.sharedContext().cache().cacheGroups()) { if (grp.isLocal()) continue; GridAffinityAssignmentCache aff = grp.affinity(); Set<Integer> failedPrimaries = aff.primaryPartitions(fut.exchangeId().eventNode().id(), aff.lastVersion()); <START> Set<Integer> loc = grp.topology().localPartitionMap().keySet(); <END> for (int part : failedPrimaries) { if (loc.contains(part)) return true; } } return false; }</code><technical_language>account owning partitions (avoid renting partitions, moving previous assignment is ideal)</technical_language>

Target:
private boolean localRecoveryNeeded(GridDhtPartitionsExchangeFuture fut) { for (CacheGroupContext grp : fut.sharedContext().cache().cacheGroups()) { if (grp.isLocal()) continue; GridAffinityAssignmentCache aff = grp.affinity(); Set<Integer> failedPrimaries = aff.primaryPartitions(fut.exchangeId().eventNode().id(), aff.lastVersion()); Set<Integer> locBackups = aff.backupPartitions(fut.sharedContext().localNodeId(), aff.lastVersion()); for (int part : failedPrimaries) { if (locBackups.contains(part)) return true; } } return false; }
Source:
<code>private Anchor createDownloadLink() { <START> if (Patch.COMMIT_MSG.equals(path) || emptyFile) { return null; } <END> PatchSet.Id id = (idActive == null) ? other.idActive : idActive; String sideURL = (idActive == null) ? "1" : "0"; String base = GWT.getHostPageBaseURL() + "cat/"; Image image = new Image(Gerrit.RESOURCES.downloadIcon()); Anchor anchor = new Anchor(); anchor.setHref( base + KeyUtil.encode(id.toString() + "," + path) + "^" + sideURL); anchor.setTitle(PatchUtil.C.download()); DOM.insertBefore(anchor.getElement(), image.getElement(), DOM.getFirstChild(anchor.getElement())); return anchor; }</code><technical_language>Pull this out calling method call this method right condition</technical_language>

Target:
private Anchor createDownloadLink() { PatchSet.Id id = (idActive == null) ? other.idActive : idActive; String sideURL = (idActive == null) ? "1" : "0"; String base = GWT.getHostPageBaseURL() + "cat/"; Anchor anchor = new Anchor( new ImageResourceRenderer().render(Gerrit.RESOURCES.downloadIcon()), base + KeyUtil.encode(id.toString() + "," + path) + "^" + sideURL); anchor.setTitle(PatchUtil.C.download()); return anchor; }
Source:
<code>private void clearGraphSelection() { <START> canvasClearSelectionEventEvent.fire(new CanvasClearSelectionEvent(graphUtils.getCanvasHandler())); <END> }</code><technical_language>IDK select _diagram_ clear selections? reason I is if **select** a node with, for example, name "Guilherme" (and Properties Panel shows properties for this node) search for "Michael" this code triggers nodes selected. Properties Panel shows properties for "Guilherme". Selecting _diagram_ Properties Panel consistent preserving highlight of _found_ items. Alternatively IIRC is event call clear Properties Panel. Firing a new DomainObjectSelectionEvent(canvasHandler.get(), new NOPDomainObject() achieve this</technical_language>

Target:
private void clearGraphSelection() { canvasClearSelectionEventEvent.fire(new CanvasClearSelectionEvent(getCanvasHandler())); domainObjectSelectionEvent.fire(new DomainObjectSelectionEvent(getCanvasHandler(), new NOPDomainObject())); }
Source:
<code>private static RecyclerView getRecyclerView() { ViewPager pager = getCurrentActivity().findViewById(R.id.postPager); <START> return (RecyclerView) ((ViewGroup) ((ViewGroup) (pager.getChildAt(pager.getCurrentItem())) <END> .findViewById(R.id.ptr_layout)).getChildAt(0)).getChildAt(0); }</code><technical_language>This tricky - add ID RecyclerView in order able fetch ID instead? If not, ok, wanted check</technical_language>

Target:
private static RecyclerView getRecyclerView() { ViewPager pager = getCurrentActivity().findViewById(R.id.postPager); RecyclerView recyclerView = (RecyclerView) pager.getChildAt(pager.getCurrentItem()) .findViewById(R.id.recycler_view); if (recyclerView == null) { recyclerView = (RecyclerView) ((ViewGroup) ((ViewGroup) (pager.getChildAt(pager.getCurrentItem())) .findViewById(R.id.ptr_layout)).getChildAt(0)).getChildAt(0); } return recyclerView; }
Source:
<code><START> public ArrayList<String[]> getAvailableApplications() { <END> if (availableApplications == null) { availableApplications = new ArrayList<>(); try { InputStream is = new BufferedInputStream( new HttpRequestGenerator().simpleGet(new URL(mRoot + "/apps/manifest"))); byte[] manifest = StreamsUtil.getStreamAsBytes(is); JSONObject object = new JSONObject(new String(manifest)); JSONArray array = object.getJSONArray("applications"); for (int i = 0; i < array.length(); ++i) { JSONObject app = array.getJSONObject(i); String[] appRecord = new String[]{app.getString("name"), app.getString("profile_url")}; availableApplications.add(appRecord); } } catch (IOException | JSONException e) { e.printStackTrace(); } } return availableApplications; }</code><technical_language>nice if this returned ArrayList<Pair<String, String>>, reader elements in array list entry</technical_language>

Target:
public ArrayList<Pair<String, String>> getAvailableApplications() { if (availableApplications == null) { availableApplications = new ArrayList<>(); try { InputStream is = new BufferedInputStream( new HttpRequestGenerator().simpleGet(new URL(serviceUrlRoot + "/apps/manifest"))); byte[] manifest = StreamsUtil.getStreamAsBytes(is); JSONObject object = new JSONObject(new String(manifest)); JSONArray array = object.getJSONArray("applications"); for (int i = 0; i < array.length(); ++i) { JSONObject app = array.getJSONObject(i); Pair<String, String> appRecord = new Pair<>(app.getString("name"), app.getString("profile_url")); availableApplications.add(appRecord); } } catch (IOException | JSONException e) { e.printStackTrace(); } } return availableApplications; }
Source:
<code>Builder(Picasso picasso) { context = picasso.context; callFactory = picasso.callFactory; service = picasso.dispatcher.service; cache = picasso.cache; listener = picasso.listener; requestTransformers.addAll(picasso.requestTransformers); <START> requestHandlers.addAll(picasso.requestHandlers); <END> defaultBitmapConfig = picasso.defaultBitmapConfig; indicatorsEnabled = picasso.indicatorsEnabled; loggingEnabled = picasso.loggingEnabled; isChild = true; }</code><technical_language>this end adding default request handlers again</technical_language>

Target:
Builder(Picasso picasso) { context = picasso.context; callFactory = picasso.callFactory; service = picasso.dispatcher.service; cache = picasso.cache; listener = picasso.listener; requestTransformers.addAll(picasso.requestTransformers); int numRequestHandlers = picasso.requestHandlers.size(); requestHandlers.addAll(picasso.requestHandlers.subList(2, numRequestHandlers - 6)); defaultBitmapConfig = picasso.defaultBitmapConfig; indicatorsEnabled = picasso.indicatorsEnabled; loggingEnabled = picasso.loggingEnabled; }
Source:
<code><START> synchronized void register( LuceneFulltext fulltextIndex ) throws IOException <END> { fulltextIndex.open(); if ( fulltextIndex.getType() == FulltextIndexType.NODES ) { nodeIndices.put( fulltextIndex.getIdentifier(), fulltextIndex ); writableNodeIndices.add( new WritableFulltext( fulltextIndex ) ); nodeProperties.addAll( fulltextIndex.getProperties() ); } else { relationshipIndices.put( fulltextIndex.getIdentifier(), fulltextIndex ); writableRelationshipIndices.add( new WritableFulltext( fulltextIndex ) ); relationshipProperties.addAll( fulltextIndex.getProperties() ); } }</code><technical_language>this is synchronized</technical_language>

Target:
void register( LuceneFulltext fulltextIndex ) throws IOException { fulltextIndex.open(); if ( fulltextIndex.getType() == FulltextIndexType.NODES ) { nodeIndices.put( fulltextIndex.getIdentifier(), fulltextIndex ); writableNodeIndices.add( new WritableFulltext( fulltextIndex ) ); nodeProperties.addAll( fulltextIndex.getProperties() ); } else { relationshipIndices.put( fulltextIndex.getIdentifier(), fulltextIndex ); writableRelationshipIndices.add( new WritableFulltext( fulltextIndex ) ); relationshipProperties.addAll( fulltextIndex.getProperties() ); } }
Source:
<code>public void start() { scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { synchronized (BookieInfoReader.this) { if (LOG.isDebugEnabled()) { LOG.debug("Running periodic BookieInfo scan"); } try { Collection<BookieSocketAddress> updatedBookies = bk.bookieWatcher.getBookies(); bookieInfoMap.updateBookies(updatedBookies); } catch (BKException e) { <START> LOG.info("Got exception while querying bookies from watcher, rerunning after {}s", <END> e, conf.getGetBookieInfoRetryIntervalSeconds()); scheduler.schedule(this, conf.getGetBookieInfoRetryIntervalSeconds(), TimeUnit.SECONDS); return; } if (instanceState.tryStartFull()) { getReadWriteBookieInfo(); } } } }, 0, conf.getGetBookieInfoIntervalSeconds(), TimeUnit.SECONDS); }</code><technical_language>reason put exception parameter? is a common practice in slf4j put exception parameter, need '{}' for exceptions</technical_language>

Target:
public void start() { scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { synchronized (BookieInfoReader.this) { if (LOG.isDebugEnabled()) { LOG.debug("Running periodic BookieInfo scan"); } try { Collection<BookieSocketAddress> updatedBookies = bk.bookieWatcher.getBookies(); bookieInfoMap.updateBookies(updatedBookies); } catch (BKException e) { LOG.info("Got exception while querying bookies from watcher, rerunning after {}s", conf.getGetBookieInfoRetryIntervalSeconds(), e); scheduler.schedule(this, conf.getGetBookieInfoRetryIntervalSeconds(), TimeUnit.SECONDS); return; } if (instanceState.tryStartFull()) { getReadWriteBookieInfo(); } } } }, 0, conf.getGetBookieInfoIntervalSeconds(), TimeUnit.SECONDS); }
Source:
<code>public void makeBucket(String bucketName) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, RegionConflictException, XmlParserException { <START> this.makeBucket(new MakeBucketArgs().builder().bucket(bucketName).build()); <END> }</code><technical_language>Instead of new MakeBucketArgs().builder(), this MakeBucketArgs.builder()</technical_language>

Target:
public void makeBucket(String bucketName) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, RegionConflictException, XmlParserException { this.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build()); }
Source:
<code><START> public BlockCompressedIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { <END> super(path, index); if (!canCreateBlockCompresedIndexedFastaSequence(path)) { throw new SAMException("Invalid block-compressed Fasta file"); } try { stream = new BlockCompressedInputStream(new SeekablePathStream(path)); gzindex = GZIIndex.loadIndex(GZIIndex.resolveIndexNameForBgzipFile(path)); } catch (IOException e) { throw new SAMException("Fasta file should be readable but is not: " + path, e); } }</code><technical_language>add another constructor takes a GZIIIndex instead of discovering it</technical_language>

Target:
public BlockCompressedIndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { this(path, index, loadFastaGziIndex(path)); }
Source:
<code>public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append(LF + LF); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append(LF); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); <START> text.append(section.getHeadline()).append(LF + LF); <END> section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append(LF + LF); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }</code><technical_language>append(LINE_SEPARATOR).append(LINE_SEPARATOR)</technical_language>

Target:
public void preview(IReport report, IStatus status, String serverName, List<IProcessorDescriptor> descriptors, IEclipseContext context, Shell parent) { StringBuilder text = new StringBuilder(); text.append("The following will be send to: ").append(serverName).append(LINE_SEPARATOR).append(LINE_SEPARATOR); List<StyleRange> styleRanges = new ArrayList<>(); for (SectionsProvider sectionsProvider : sectionProviders) { for (Section section : sectionsProvider.createSections(report, status, serverName, descriptors, context, parent)) { if (text.length() > 0) { text.append(LINE_SEPARATOR); } if (section.getHeadlineStyleRanges().isEmpty()) { section.getHeadlineStyleRanges().add(createHeadlineStyleRange(section.getHeadline())); } section.getHeadlineStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getHeadlineStyleRanges()); text.append(section.getHeadline()).append(LINE_SEPARATOR).append(LINE_SEPARATOR); section.getTextStyleRanges().forEach(x -> x.start += text.length()); styleRanges.addAll(section.getTextStyleRanges()); text.append(section.getText().trim()).append(LINE_SEPARATOR).append(LINE_SEPARATOR); } } styledText.setText(text.toString()); styledText.setStyleRanges(styleRanges.toArray(new StyleRange[0])); }
Source:
<code>public RuleResult validate(final PasswordData passwordData) { final RuleResult result = new RuleResult(); final Set<Character> matches = new HashSet<>(); final String text = passwordData.getPassword(); for (char c : text.toCharArray()) { if (Arrays.binarySearch(allowedCharacters, c) < 0 && !matches.contains(c)) { if (MatchBehavior.Contains.equals(matchBehavior) || matchBehavior.match(text, c)) { <START> if (enhancedErrorMessages) { <END> result.addError(ERROR_CODE + "." + (int) c, createRuleResultDetailParameters(c)); } else { result.addError(ERROR_CODE, createRuleResultDetailParameters(c)); } if (!reportAllFailures) { break; } matches.add(c); } } } result.setMetadata(createRuleResultMetadata(passwordData)); return result; }</code><technical_language>This flag feels insurance deployers custom error keys dots. Assuming correct, I respect conservative approach encourage drafting a plan this in future simply emit codes dots in cases</technical_language>

Target:
public RuleResult validate(final PasswordData passwordData) { final RuleResult result = new RuleResult(); final Set<Character> matches = new HashSet<>(); final String text = passwordData.getPassword(); for (char c : text.toCharArray()) { if (Arrays.binarySearch(allowedCharacters, c) < 0 && !matches.contains(c)) { if (MatchBehavior.Contains.equals(matchBehavior) || matchBehavior.match(text, c)) { final String[] codes = {ERROR_CODE + "." + (int) c, ERROR_CODE}; result.addError(codes, createRuleResultDetailParameters(c)); if (!reportAllFailures) { break; } matches.add(c); } } } result.setMetadata(createRuleResultMetadata(passwordData)); return result; }
Source:
<code>public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); CoordinatorLayout coordinatorLayout = (CoordinatorLayout) getActivity().findViewById(R.id.coordinatorLayout); <START> snackbar = Snackbar.make(coordinatorLayout,R.string.no_new_messages,Snackbar.LENGTH_SHORT) <END> .setDuration(1000); }</code><technical_language>Format code (ctrl + alt + L)</technical_language>

Target:
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); CoordinatorLayout coordinatorLayout = (CoordinatorLayout) getActivity().findViewById(R.id.coordinatorLayout); snackbar = Snackbar.make(coordinatorLayout, R.string.no_new_messages, Snackbar.LENGTH_SHORT) .setDuration(1000); FloatingActionButton floatingActionButton = (FloatingActionButton) coordinatorLayout.findViewById(R.id.fab); CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams(); params.setBehavior(new ShrinkBehaviorOfFab()); }
Source:
<code>protected IDocument acquireDocument(IProgressMonitor pm) throws CoreException { SubMonitor subMonitor= SubMonitor.convert(pm, 2); <START> fCUnit.becomeWorkingCopy(subMonitor.newChild(1)); <END> Assert.isTrue(fCUnit.isWorkingCopy(), fCUnit.toString()); return super.acquireDocument(subMonitor.newChild(1)); }</code><technical_language>Change subMonitor.newChild(...) subMonitor.split(...)</technical_language>

Target:
protected IDocument acquireDocument(IProgressMonitor pm) throws CoreException { SubMonitor subMonitor= SubMonitor.convert(pm, 2); fCUnit.becomeWorkingCopy(subMonitor.split(1)); Assert.isTrue(fCUnit.isWorkingCopy(), fCUnit.toString()); return super.acquireDocument(subMonitor.split(1)); }
Source:
<code>public void testRepairMove() { <START> localSession.closeAndDiscardChanges(); <END> UIResource sessionAirdResource = new UIResource(designerProject, REPRESENTATION_MODEL); String repairActionLabel = SiriusEditPlugin.getPlugin().getString("repairActionLabel"); designerProject.mouseRigthClickOnResource(sessionAirdResource, repairActionLabel); SWTBotUtils.waitProgressMonitorClose(OpenRepresentationsFileJob.JOB_LABEL); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); openDiagram(REPRESENTATION_NAME); SWTBotGefConnectionEditPart swtBotGefEditPart1 = (SWTBotGefConnectionEditPart) editor.getEditPart("edge1", DEdgeEditPart.class); SWTBotGefConnectionEditPart swtBotGefEditPart2 = (SWTBotGefConnectionEditPart) editor.getEditPart("edge2", DEdgeEditPart.class); assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart1, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart1, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart2, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart2, new PrecisionPoint(0.5, 0.5)); }</code><technical_language>Instead of closing session here, do open onSetUpAfterOpeningDesignerPerspective</technical_language>

Target:
public void testRepairMove() { UIResource sessionAirdResource = new UIResource(designerProject, REPRESENTATION_MODEL); String repairActionLabel = SiriusEditPlugin.getPlugin().getString("repairActionLabel"); designerProject.mouseRigthClickOnResource(sessionAirdResource, repairActionLabel); SWTBotUtils.waitProgressMonitorClose(OpenRepresentationsFileJob.JOB_LABEL); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); openDiagram(REPRESENTATION_NAME); SWTBotGefConnectionEditPart swtBotGefEditPart1 = (SWTBotGefConnectionEditPart) editor.getEditPart("edge1", DEdgeEditPart.class); SWTBotGefConnectionEditPart swtBotGefEditPart2 = (SWTBotGefConnectionEditPart) editor.getEditPart("edge2", DEdgeEditPart.class); assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart1, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart1, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart2, new PrecisionPoint(0.5, 0.5)); assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart2, new PrecisionPoint(0.5, 0.5)); }
Source:
<code>private boolean ifaceMacCannotBeAddedToMacPool(VmNetworkInterface iface) { <START> return !macPool.isDuplicateMacAddressesAllowed() <END> && !shouldReassignMac(iface) && macPool.isMacInUse(iface.getMacAddress()); }</code><technical_language>verify mac is null avoid NPE? 'ImportVmFromConfigurationCommand' this check</technical_language>

Target:
private boolean ifaceMacCannotBeAddedToMacPool(VmNetworkInterface iface) { return iface.getMacAddress() != null && !macPool.isDuplicateMacAddressesAllowed() && !shouldReassignMac(iface) && macPool.isMacInUse(iface.getMacAddress()); }
Source:
<code>public Response toResponse(DataException e) { LOGGER.error("Hibernate error", e); String message = e.getCause().getMessage().contains("EMAIL") ? "Wrong email" : "Wrong input"; return Response.status(Response.Status.BAD_REQUEST) <START> .entity(ImmutableMap.of("error", message)) <END> .build(); }</code><technical_language>For sake of consistency response built [ErrorMessage](<LINK_0>, if a test class</technical_language>

Target:
public Response toResponse(DataException e) { LOGGER.error("Hibernate error", e); String message = e.getCause().getMessage().contains("EMAIL") ? "Wrong email" : "Wrong input"; return Response.status(Response.Status.BAD_REQUEST) .entity(new ErrorMessage(Response.Status.BAD_REQUEST.getStatusCode(), message)) .build(); }
Source:
<code>public void testGet() throws Exception { Map<String, ? extends NodeMetadata> metadataMap = newLinkedHashMap(uniqueIndex( filter(client.listNodesDetailsMatching(all()), and(inGroup(group), not(TERMINATED))), new Function<NodeMetadata, String>() { @Override public String apply(NodeMetadata from) { return from.getId(); } })); for (NodeMetadata node : nodes) { metadataMap.remove(node.getId()); NodeMetadata metadata = client.getNodeMetadata(node.getId()); assertEquals(metadata.getProviderId(), node.getProviderId()); assertEquals(metadata.getGroup(), node.getGroup()); assertLocationSameOrChild(checkNotNull(metadata.getLocation(), "location of %s", metadata), template.getLocation()); checkImageIdMatchesTemplate(metadata); checkOsMatchesTemplate(metadata); <START> if(metadata.getStatus() == Status.PENDING){Thread.sleep(60000); metadata = client.getNodeMetadata(node.getId());} <END> assert (metadata.getStatus() == Status.RUNNING) : metadata; assertEquals(metadata.getPrivateAddresses().size(), node.getPrivateAddresses().size(), format( "[%s] didn't match: [%s]", metadata.getPrivateAddresses(), node.getPrivateAddresses().size())); assertEquals(metadata.getPublicAddresses().size(), node.getPublicAddresses().size(), format( "[%s] didn't match: [%s]", metadata.getPublicAddresses(), node.getPublicAddresses().size())); } assertNodeZero(metadataMap.values()); }</code><technical_language>this case. contract for createNodesInGroup is default exit in status RUNNING</technical_language>

Target:
public void testGet() throws Exception { Map<String, ? extends NodeMetadata> metadataMap = newLinkedHashMap(uniqueIndex( filter(client.listNodesDetailsMatching(all()), and(inGroup(group), not(TERMINATED))), new Function<NodeMetadata, String>() { @Override public String apply(NodeMetadata from) { return from.getId(); } })); for (NodeMetadata node : nodes) { metadataMap.remove(node.getId()); NodeMetadata metadata = client.getNodeMetadata(node.getId()); assertEquals(metadata.getProviderId(), node.getProviderId()); assertEquals(metadata.getGroup(), node.getGroup()); assertLocationSameOrChild(checkNotNull(metadata.getLocation(), "location of %s", metadata), template.getLocation()); checkImageIdMatchesTemplate(metadata); checkOsMatchesTemplate(metadata); assert (metadata.getStatus() == Status.RUNNING) : metadata; assertEquals(metadata.getPrivateAddresses().size(), node.getPrivateAddresses().size(), format( "[%s] didn't match: [%s]", metadata.getPrivateAddresses(), node.getPrivateAddresses().size())); assertEquals(metadata.getPublicAddresses().size(), node.getPublicAddresses().size(), format( "[%s] didn't match: [%s]", metadata.getPublicAddresses(), node.getPublicAddresses().size())); } assertNodeZero(metadataMap.values()); }
Source:
<code>public void awaitCompletion() { try { if (getQueue() == null) return; <START> while (getQueue() != null && !getQueue().isEmpty()) { <END> processInput(); } getCallerThreadPoolExecutor().awaitTermination(); } catch (Throwable throwable) { throw new RuntimeException("Error occurred while awaiting termination "+throwable.getMessage()); } }</code><technical_language>line 158 checks returns if queue is null, line 161 need check queue is null</technical_language>

Target:
public void awaitCompletion() { try { if (getInputQueue() == null) return; while (!getInputQueue().isEmpty()) { processInput(); } if(getCallerThreadPoolExecutor() != null) getCallerThreadPoolExecutor().awaitTermination(); } catch (Throwable throwable) { throw new RuntimeException("Error occurred while awaiting termination "+throwable.getMessage()); } }
Source:
<code>private void loadValueExtractorsFromServiceLoader() { List<ValueExtractor<?>> valueExtractors; if ( externalClassLoader != null ) { <START> final ClassLoader originalContextClassLoader = run( GetClassLoader.fromContext() ); <END> try { run( SetContextClassLoader.action( externalClassLoader ) ); valueExtractors = run( GetValueExtractorsFromServiceLoader.action() ); } finally { run( SetContextClassLoader.action( originalContextClassLoader ) ); } } else { valueExtractors = run( GetValueExtractorsFromServiceLoader.action() ); } for ( ValueExtractor<?> valueExtractor : valueExtractors ) { validationBootstrapParameters.addValueExtractorDescriptor( new ValueExtractorDescriptor( valueExtractor ) ); } }</code><technical_language>Instead of setting TCCL, suggest pass CL a parameter GetValueExtractorsFromServiceLoader#action(). pass external CL current TCCL. Behavior same, a bit convoluted</technical_language>

Target:
private void loadValueExtractorsFromServiceLoader() { List<ValueExtractor> valueExtractors = run( GetInstancesFromServiceLoader.action( externalClassLoader != null ? externalClassLoader : run( GetClassLoader.fromContext() ), ValueExtractor.class ) ); for ( ValueExtractor<?> valueExtractor : valueExtractors ) { validationBootstrapParameters.addValueExtractorDescriptor( new ValueExtractorDescriptor( valueExtractor ) ); } }
Source:
<code>public void shouldNotGenerateCreateDecimalFormatMethod() { Class clz = BigIntegerMapper.INSTANCE.getClass(); try { Method method = clz.getDeclaredMethod( "createDecimalFormat", String.class ); assertThat( method ).isNull(); } <START> catch ( NoSuchMethodException ex ) { <END> } catch ( SecurityException ex ) { } }</code><technical_language>A bit nitpicking :smile:, GeneratedSource JUnit Rule for this. usages of do</technical_language>

Target:
public void shouldNotGenerateCreateDecimalFormatMethod() { getGeneratedSource().forMapper( BigIntegerMapper.class ).content().doesNotContain( "createDecimalFormat" ); }
Source:
<code>private void waitForConfirm(Message<?> requestMessage, CorrelationData correlationData) { try { Confirm confirm = correlationData.getFuture().get(getConfirmTimeout().toMillis(), TimeUnit.MILLISECONDS); if (!confirm.isAck()) { <START> throw new MessageHandlingException(requestMessage, "Negative publisher confirm received: " + confirm); <END> } if (correlationData.getReturnedMessage() != null) { throw new MessageHandlingException(requestMessage, "Message was returned by the broker"); } } catch (@SuppressWarnings("unused") InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new MessageHandlingException(requestMessage, "Failed to get publisher confirm", e); } catch (TimeoutException e) { throw new MessageTimeoutException(requestMessage, "Timed out awaiting publisher confirm", e); } }</code><technical_language>I fought a BeanDefinition context in exceptions. I is happen in super class automatically throw MessageHandlingException. Please, consider include this for presenting a BeanDefinition context in exception message for end-user experience. throw non-MessageHandlingExceptions</technical_language>

Target:
private void waitForConfirm(Message<?> requestMessage, CorrelationData correlationData) { try { Confirm confirm = correlationData.getFuture().get(this.waitForConfirmTimeout.toMillis(), TimeUnit.MILLISECONDS); if (!confirm.isAck()) { throw new AmqpException("Negative publisher confirm received: " + confirm); } if (correlationData.getReturnedMessage() != null) { throw new AmqpException("Message was returned by the broker"); } } catch (@SuppressWarnings("unused") InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { throw new AmqpException("Failed to get publisher confirm", e); } catch (TimeoutException e) { throw new MessageTimeoutException(requestMessage, this + ": Timed out awaiting publisher confirm", e); } }
Source:
<code>public Response export(Action action) { org.ovirt.engine.core.common.businessentities.VM vm = getEntity( org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new <START> IdQueryParameters(guid), "VM: id=" + guid); <END> String clonedVmName = action.getExportedVmName(); if (StringUtils.isEmpty(action.getExportedVmName())) { clonedVmName = String.format("%s-cloned", vm.getName()); } CloneVmParameters params = new CloneVmParameters(vm, clonedVmName); params.setDestStorageDomainId(getStorageDomainId(action)); ActionType actionType = ActionType.CloneVmNoCollapse; if (action.isSetDiscardSnapshots() && action.isDiscardSnapshots()) { actionType = ActionType.CloneVm; } return doAction(actionType, params, action); }</code><technical_language>New line for consistency readability</technical_language>

Target:
public Response export(Action action) { org.ovirt.engine.core.common.businessentities.VM vm = getEntity( org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), "VM: id=" + guid); String clonedVmName = action.getExportedVmName(); if (StringUtils.isEmpty(action.getExportedVmName())) { clonedVmName = String.format("%s-export", vm.getName()); } CloneVmParameters params = new CloneVmParameters(vm, clonedVmName); params.setDestStorageDomainId(getStorageDomainId(action)); ActionType actionType = action.isSetDiscardSnapshots() && action.isDiscardSnapshots() ? ActionType.CloneVm: ActionType.CloneVmNoCollapse; return doAction(actionType, params, action); }