auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<String> getPossibleAncestorRevisionIDs(String docId, String revId, int limit) { int generation = CouchUtils.generationFromRevId(revId); if (generation <= 1) return null; int sqlLimit = limit > 0 ? (int)limit : -1; String sql = "SELECT revid FROM revs, docs WHERE docs.docid=?"+ " and revs.deleted=0 and revs.json not null and revs.doc_id = docs.doc_id"+ " ORDER BY revs.sequence DESC"; ArrayList<String> ids = new ArrayList<String>(); try { Cursor c = this.sqlDb.rawQuery(sql, new String[]{docId}); while (c.moveToNext() && limit-- > 0) { String ancestorRevId = c.getString(0); int ancestorGeneration = CouchUtils.generationFromRevId(ancestorRevId); if (ancestorGeneration < generation) { ids.add(ancestorRevId); } } } catch(SQLException sqe) { return null; } <START> return ids; <END> }</code><technical_language>Logic is wrong here: - limit correctly applied (you reach zero limit ids limit items) - sqlLimit more</technical_language>

Target:
public List<String> getPossibleAncestorRevisionIDs(String docId, String revId, int limit) { int generation = CouchUtils.generationFromRevId(revId); if (generation <= 1) return null; String sql = "SELECT revid FROM revs, docs WHERE docs.docid=?"+ " and revs.deleted=0 and revs.json not null and revs.doc_id = docs.doc_id"+ " ORDER BY revs.sequence DESC"; ArrayList<String> ids = new ArrayList<String>(); try { Cursor c = this.sqlDb.rawQuery(sql, new String[]{docId}); while (c.moveToNext() && limit > 0) { String ancestorRevId = c.getString(0); int ancestorGeneration = CouchUtils.generationFromRevId(ancestorRevId); if (ancestorGeneration < generation) { ids.add(ancestorRevId); limit--; } } } catch(SQLException sqe) { return null; } return ids; }
Source:
<code>private static PointValue randomPoint( int index, int dimension ) { CoordinateReferenceSystem crs = <START> index % 2 == 0 ? <END> dimension == 2 ? WGS84 : WGS84_3D : dimension == 2 ? Cartesian : Cartesian_3D; return unsafePointValue( crs, random().doubles( dimension, Double.MIN_VALUE, Double.MAX_VALUE ).toArray() ); }</code><technical_language>For increased readability I prefer outer if **not** written x ? y : z notation</technical_language>

Target:
private static PointValue randomPoint( int index, int dimension ) { CoordinateReferenceSystem crs; if ( index % 2 == 0 ) { crs = dimension == 2 ? WGS84 : WGS84_3D; } else { crs = dimension == 2 ? Cartesian : Cartesian_3D; } return unsafePointValue( crs, random().doubles( dimension, Double.MIN_VALUE, Double.MAX_VALUE ).toArray() ); }
Source:
<code><START> public TransactionEntity getChargeTransaction() { <END> return transactions.stream().filter(byChargeTransactions()).findFirst().orElseThrow( () -> new IllegalStateException("Payment Request has been initialised without a charge transaction") ); }</code><technical_language>Ideally this called simple getCharge() address this called "charge" in system</technical_language>

Target:
public ChargeTransactionEntity getChargeTransaction() { return (ChargeTransactionEntity)transactions.stream().filter(byChargeTransactions()).findFirst().orElseThrow( () -> new IllegalStateException("Payment Request has been initialised without a charge transaction") ); }
Source:
<code><START> public int getGeneration() { <END> return _generation; }</code><technical_language>if package private</technical_language>

Target:
int getGeneration() { return _generation; }
Source:
<code>private void validateAllowWebPayment(JsonNode payload) { String op = payload.get(FIELD_OPERATION).asText(); if (!op.equalsIgnoreCase("replace")) { throw new ValidationException(Collections.singletonList(format("Operation [%s] is not valid for path [%s]", op, FIELD_EMAIL_COLLECTION_MODE))); } JsonNode valueNode = payload.get(FIELD_VALUE); if(null == valueNode || valueNode.isNull()) { throw new ValidationException(Collections.singletonList(format("Field [%s] is required", FIELD_VALUE))); } String booleanString = valueNode.asText(); <START> if (!booleanString.equalsIgnoreCase("false") && !booleanString.equalsIgnoreCase("true")) <END> throw new ValidationException(Collections.singletonList(format("Value [%s] is not valid for [%s]", booleanString, FIELD_ALLOW_WEB_PAYMENTS))); }</code><technical_language>this is a bit oof #justjavathings</technical_language>

Target:
private void validateAllowWebPayment(JsonNode payload) { throwIfInvalidFieldOperation(FIELD_ALLOW_WEB_PAYMENTS, payload, REPLACE_OP); throwIfNullFieldValue(payload.get(FIELD_VALUE)); String booleanString = payload.get(FIELD_VALUE).asText().toLowerCase(); if (!booleanString.equals("false") && !booleanString.equals("true")) throw new ValidationException(Collections.singletonList(format("Value [%s] is not valid for [%s]", booleanString, FIELD_ALLOW_WEB_PAYMENTS))); }
Source:
<code>private String getSkuTierFromSkuName(String skuName) { <START> if (Set.of("GP_Gen5_2", "GP_Gen5_4", "GP_Gen5_8", "GP_Gen5_16", "GP_Gen5_32").contains(skuName)) { return "GeneralPurpose"; } else if (Set.of("MO_Gen5_2", "MO_Gen5_4", "MO_Gen5_8", "MO_Gen5_16", "MO_Gen5_32").contains(skuName)) { return "MemoryOptimized"; <END> } else { return null; } }</code><technical_language>values in private static fields</technical_language>

Target:
private String getSkuTierFromSkuName(String skuName) { if (GENERAL_PURPOSE_INSTANCE_TYPES.contains(skuName)) { return GENERAL_PURPOSE; } else if (MEMORY_OPTIMIZED_INSTANCE_TYPES.contains(skuName)) { return MEMORY_OPTIMIZED; } else { return null; } }
Source:
<code>public String storeData(String cookieData) { try { String token = generateToken(); ensureSpaceExists(); <START> s3StorageProvider.addHiddenContent(this.hiddenSpaceName, token, "application/json", <END> IOUtil.writeStringToStream(cookieData)); return token; } catch (Exception e) { throw new DuraCloudRuntimeException(e); } }</code><technical_language>nice a constant for "application/json"</technical_language>

Target:
public String storeData(String cookieData) { try { String token = generateToken(); ensureSpaceExists(); s3StorageProvider.addHiddenContent(this.hiddenSpaceName, token, Constants.MEDIA_TYPE_APPLICATION_JSON, IOUtil.writeStringToStream(cookieData)); return token; } catch (Exception e) { throw new DuraCloudRuntimeException(e); } }
Source:
<code>public void testUnmarshallGlobalVariables() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_GLOBALVARIABLES); assertDiagram(diagram, 1); assertEquals("Global Variables", diagram.getMetadata().getTitle()); GlobalVariables variables = null; <START> Iterator<Element> it = nodesIterator(diagram); <END> while (it.hasNext()) { Element element = it.next(); if (element.getContent() instanceof View) { Object oDefinition = ((View) element.getContent()).getDefinition(); if (oDefinition instanceof BPMNDiagram) { BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition; variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); break; } } } assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("__-CvwCveEemCffTTkSwXXQ"); assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram); BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition(); assertTrue(bpmnDiagram.getDiagramSet() != null); assertTrue(bpmnDiagram.getDiagramSet().getGlobalVariables() != null); variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); }</code><technical_language>IMO moving this logic out test scope, create some helper method in some other new class out there, call here. Also, IIRC I this code in some other places, if duplicated somewhere? If so, refactor call static helper method? Thx</technical_language>

Target:
public void testUnmarshallGlobalVariables() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_GLOBALVARIABLES); assertDiagram(diagram, 1); assertEquals("Global Variables", diagram.getMetadata().getTitle()); BPMNDiagramImpl bpmnDiagram = getBpmnDiagram(diagram); GlobalVariables variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("__-CvwCveEemCffTTkSwXXQ"); assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram); bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition(); assertTrue(bpmnDiagram.getDiagramSet() != null); assertTrue(bpmnDiagram.getDiagramSet().getGlobalVariables() != null); variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); }
Source:
<code>private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); hooks.doRefUpdatedHook( destBranch, branchUpdate, <START> accountCache.get(getSubmitter(mergeTip.patchsetId).getAccountId()).getAccount()); <END> break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }</code><technical_language>afraid this NPE. for getSubmitter return null ambiguous available. leads a null input get, NPE</technical_language>

Target:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); Account account = null; final PatchSetApproval submitter = getSubmitter(mergeTip.patchsetId); if (submitter != null) { account = accountCache.get(submitter.getAccountId()).getAccount(); } hooks.doRefUpdatedHook(destBranch, branchUpdate, account); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }
Source:
<code>protected void _burySiblings(Card card) { ArrayList<Long> toBury = new ArrayList<>(); JSONObject nconf = _newConf(card); boolean buryNew = nconf.optBoolean("bury", true); JSONObject rconf = _revConf(card); boolean buryRev = rconf.optBoolean("bury", true); Cursor cur = null; try { cur = mCol.getDb().getDatabase().query( "select id, queue from cards where nid=? and id!=? "+ "and (queue=" + Consts.QUEUE_TYPE_NEW + " or (queue=" + Consts.QUEUE_TYPE_REV + " and due<=?))", new Object[] {card.getNid(), card.getId(), mToday}); while (cur.moveToNext()) { long cid = cur.getLong(0); int queue = cur.getInt(1); if (queue == Consts.QUEUE_TYPE_REV) { if (buryRev) { toBury.add(cid); } mRevQueue.remove(cid); } else { if (buryNew) { toBury.add(cid); } mNewQueue.remove(cid); } <START> if (mNextCard != null && mNextCard.getId() == cid && ((buryRev && mNextCard.getQueue() == Consts.QUEUE_TYPE_REV)) || ((buryNew && mNextCard.getQueue() == Consts.QUEUE_TYPE_NEW))) { <END> mNextCard = null; backgroundNextCard(); } } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } if (toBury.size() > 0) { buryCards(Utils.arrayList2array(toBury),false); } }</code><technical_language>If I read this correctly is exact in Sched.java, mentioned is pretty in-depth. this a method in SchedV2, call both? duplicated</technical_language>

Target:
protected void _burySiblings(Card card) { ArrayList<Long> toBury = new ArrayList<>(); JSONObject nconf = _newConf(card); boolean buryNew = nconf.optBoolean("bury", true); JSONObject rconf = _revConf(card); boolean buryRev = rconf.optBoolean("bury", true); Cursor cur = null; try { cur = mCol.getDb().getDatabase().query( "select id, queue from cards where nid=? and id!=? "+ "and (queue=" + Consts.QUEUE_TYPE_NEW + " or (queue=" + Consts.QUEUE_TYPE_REV + " and due<=?))", new Object[] {card.getNid(), card.getId(), mToday}); while (cur.moveToNext()) { long cid = cur.getLong(0); int queue = cur.getInt(1); List<Long> queue_object; if (queue == Consts.QUEUE_TYPE_REV) { queue_object = mRevQueue; if (buryRev) { toBury.add(cid); } } else { queue_object = mNewQueue; if (buryNew) { toBury.add(cid); } } queue_object.remove(cid); if (mNextCard != null && mNextCard.getId() == cid) { mNextCard = null; } } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } if (!toBury.isEmpty()) { buryCards(Utils.arrayList2array(toBury),false); } }
Source:
<code>public LeaderElectionMetricAggregator(MetricsManager metricsManager) { weightedGaugeP99 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeP95 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeMean = SlidingWindowWeightedMeanGauge.create(); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactMean", weightedGaugeMean); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP95", weightedGaugeP95); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP99", weightedGaugeP99); Histogram leaderElectionHistogram = metricsManager.registerOrGetHistogram( LeaderElectionMetricAggregator.class, "leaderElectionDurationEstimate", () -> new Histogram(new SlidingTimeWindowArrayReservoir(5, TimeUnit.MINUTES))); <START> leaderElectionDurationAccumulator = new LeaderElectionDurationAccumulator(leaderElectionHistogram::update, 10); <END> }</code><technical_language>nit: extract a constant for this number? Possibly for some reason I mind for reservoir</technical_language>

Target:
public LeaderElectionMetricAggregator(MetricsManager metricsManager) { weightedGaugeP99 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeP95 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeMean = SlidingWindowWeightedMeanGauge.create(); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactMean", weightedGaugeMean); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP95", weightedGaugeP95); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP99", weightedGaugeP99); Histogram leaderElectionHistogram = metricsManager.registerOrGetHistogram( LeaderElectionMetricAggregator.class, "leaderElectionDurationEstimate", () -> new Histogram(new SlidingTimeWindowArrayReservoir(5, TimeUnit.MINUTES))); leaderElectionDurationAccumulator = new LeaderElectionDurationAccumulator(leaderElectionHistogram::update, CONFIDENCE_THRESHOLD); }
Source:
<code><START> private Widget resolveDefault(Widget widget) { <END> if (widget instanceof Default) { if (widget.getItem() != null) { Item item = itemRegistry.get(widget.getItem()); if (item != null) { Widget defaultWidget = getDefaultWidget(item.getClass(), item.getName()); if (defaultWidget != null) { defaultWidget.setItem(item.getName()); return defaultWidget; } } } } return null; }</code><technical_language>code simpler (less <code>if</code>s above) if - <code>return widget;</code> if is instance of Default - change method give fallback: <code>private Widget resolveDefault(Widget widget, Widget fallback)</code> <code>return fallback;</code> end (so resolveDefault(widget, null) resolveDefault(widget, widget)</technical_language>

Target:
private Widget resolveDefault(Widget widget) { if (!(widget instanceof Default)) { return widget; } else { if (widget.getItem() != null) { Item item = itemRegistry.get(widget.getItem()); if (item != null) { Widget defaultWidget = getDefaultWidget(item.getClass(), item.getName()); if (defaultWidget != null) { defaultWidget.setItem(item.getName()); return defaultWidget; } } } return null; } }
Source:
<code><START> protected static TestGeneric<String>.InnerGeneric<Integer> testGenericInnerInt() { <END> return null; }</code><technical_language>ahh, is</technical_language>

Target:
protected static TestGeneric<Short>.InnerGeneric<Integer> testGenericInnerInt() { return null; }
Source:
<code>public VM update(VM incoming) { validateEnums(VM.class, incoming); validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); VM vm = get(); if(!clusterId.toString().equals(vm.getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid)); if (incoming.getCpuProfile() != null && vm.getCpuProfile() != null && ObjectUtils.equals(incoming.getCpuProfile().getId(), vm.getCpuProfile().getId())) { incoming.getCpuProfile().setId(null); <START> } <END> } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy() && incoming.getPlacementPolicy().isSetHost() && incoming.getPlacementPolicy().getHost().isSetName() && !incoming.getPlacementPolicy().getHost().isSetId()) { incoming.getPlacementPolicy().getHost().setId(getHostId(incoming.getPlacementPolicy().getHost().getName())); } } else { incoming.setPlacementPolicy(null); } return removeRestrictedInfo( performUpdate(incoming, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider())); }</code><technical_language>Move this logic "getParameters" method of "UpdateParametersProvider" class</technical_language>

Target:
public VM update(VM incoming) { validateEnums(VM.class, incoming); validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); VM vm = get(); if(!clusterId.toString().equals(vm.getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid)); } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy() && incoming.getPlacementPolicy().isSetHost() && incoming.getPlacementPolicy().getHost().isSetName() && !incoming.getPlacementPolicy().getHost().isSetId()) { incoming.getPlacementPolicy().getHost().setId(getHostId(incoming.getPlacementPolicy().getHost().getName())); } } else { incoming.setPlacementPolicy(null); } return removeRestrictedInfo( performUpdate(incoming, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider())); }
Source:
<code>public void setup(OperatorContext context) { List<FieldInfo> fieldInfos = super.getFieldInfos(); JsonNode configArray; try { ObjectMapper mapper = new ObjectMapper(); configArray = mapper.readTree(configJsonString); for (int i = 0; i < configArray.size(); i++) { JsonNode node = configArray.get(i); fieldInfos.add(new FieldInfo(node.get("dbColumnName").asText(), node.get("input").asText(), null)); } } catch (IOException e) { <START> throw new RuntimeException("Error loading config json file."); <END> } windowTimeSec = (context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS) * 1.0) / 1000.0; super.setup(context); }</code><technical_language>Add "e" param RuntimeException well. mask exception is caught. Please edit to: throw new RuntimeException("Error loading config json file.", e);</technical_language>

Target:
public void setup(OperatorContext context) { List<FieldInfo> fieldInfos = super.getFieldInfos(); JsonNode configArray; try { ObjectMapper mapper = new ObjectMapper(); configArray = mapper.readTree(configJsonString); for (int i = 0; i < configArray.size(); i++) { JsonNode node = configArray.get(i); fieldInfos.add(new FieldInfo(node.get("dbColumnName").asText(), node.get("input").asText(), null)); } } catch (IOException e) { throw new RuntimeException("Error loading config json file.", e); } windowTimeSec = (context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS) * 1.0) / 1000.0; super.setup(context); }
Source:
<code>public MessageWriter(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry) throws Exception { mConfig = config; mOffsetTracker = offsetTracker; mFileRegistry = fileRegistry; <START> if (mConfig.getFileExtension() != null) { <END> mFileExtension = mConfig.getFileExtension(); } else if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) { mCodec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec()); mFileExtension = mCodec.getDefaultExtension(); } else { mFileExtension = ""; } mLocalPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); mGeneration = mConfig.getGeneration(); }</code><technical_language>need compare null empty string</technical_language>

Target:
public MessageWriter(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry) throws Exception { mConfig = config; mOffsetTracker = offsetTracker; mFileRegistry = fileRegistry; if (mConfig.getFileExtension() != null && !mConfig.getFileExtension().isEmpty()) { mFileExtension = mConfig.getFileExtension(); } else if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) { mCodec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec()); mFileExtension = mCodec.getDefaultExtension(); } else { mFileExtension = ""; } mLocalPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); mGeneration = mConfig.getGeneration(); }
Source:
<code>public TrackingToken upperBound(TrackingToken other) { Assert.isTrue(other instanceof MultiSourceTrackingToken, () -> "Incompatible token type provided."); MultiSourceTrackingToken otherMultiToken = (MultiSourceTrackingToken) other; Assert.isTrue(otherMultiToken.trackingTokens.keySet().equals(this.trackingTokens.keySet()), () -> "MultiSourceTrackingTokens contain different keys"); Map<String, TrackingToken> tokenMap = new HashMap<>(); otherMultiToken.trackingTokens.forEach((key, otherToken) -> <START> tokenMap.put(key, trackingTokens.get(key).upperBound(otherToken)) <END> ); return new MultiSourceTrackingToken(tokenMap); }</code><technical_language>Suggestion: lambda-fy this bit similarly I pointed out createHeadToken() method</technical_language>

Target:
public TrackingToken upperBound(TrackingToken other) { Assert.isTrue(other instanceof MultiSourceTrackingToken, () -> "Incompatible token type provided."); MultiSourceTrackingToken otherMultiToken = (MultiSourceTrackingToken) other; Assert.isTrue(otherMultiToken.trackingTokens.keySet().equals(this.trackingTokens.keySet()), () -> "MultiSourceTrackingTokens contain different keys"); Map<String, TrackingToken> tokenMap = new HashMap<>(); otherMultiToken.trackingTokens.forEach((tokenSourceName, otherToken) -> tokenMap.put(tokenSourceName, trackingTokens.get(tokenSourceName).upperBound(otherToken)) ); return new MultiSourceTrackingToken(tokenMap); }
Source:
<code>public Tag update(Tag incoming) { if (parent.isSetParentName(incoming)) { incoming.getParent().getTag().setId(parent.getParentId(incoming)); } String existingParentId = getEntity(new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), true).getparent_id() <START> .toString(); <END> if (isSetParent(incoming) && !existingParentId.equals(incoming.getParent().getTag().getId())) { moveTag(asGuid(incoming.getParent().getTag().getId())); } return performUpdate(incoming, new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), VdcActionType.UpdateTag, new UpdateParametersProvider()); }</code><technical_language>please this.get() instead</technical_language>

Target:
public Tag update(Tag incoming) { if (parent.isSetParentName(incoming)) { incoming.getParent().getTag().setId(parent.getParentId(incoming)); } Tag existingTag = get(); String existingTagParentId = existingTag.isSetParent() && existingTag.getParent().isSetTag() && existingTag.getParent().getTag().isSetId() ? existingTag.getParent() .getTag() .getId() : null; if (isSetParent(incoming) && !incoming.getParent().getTag().getId().equals(existingTagParentId)) { moveTag(asGuid(incoming.getParent().getTag().getId())); } return performUpdate(incoming, new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), VdcActionType.UpdateTag, new UpdateParametersProvider()); }
Source:
<code>public List<Breakpoint> getAllBreakpoints() throws DebuggerException { List<BreakpointRequest> breakpointRequests; try { breakpointRequests = getEventManager().breakpointRequests(); } catch (DebuggerException e) { Throwable cause = e.getCause(); if (cause instanceof VMCannotBeModifiedException) { return emptyList(); } throw e; } List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size()); for (BreakpointRequest breakpointRequest : breakpointRequests) { com.sun.jdi.Location location = breakpointRequest.location(); breakPoints.add( newDto(BreakpointDto.class) .withEnabled(true) <START> .withBreakpointConfiguration( <END> newDto(BreakpointConfigurationDto.class) .withHitCount((Integer) breakpointRequest.getProperty("hit_count"))) .withLocation(asDto(new JdbLocation(location)))); } breakPoints.sort(BREAKPOINT_COMPARATOR); return breakPoints; }</code><technical_language>Filter breakpoints hitCount = -1</technical_language>

Target:
public List<Breakpoint> getAllBreakpoints() throws DebuggerException { List<BreakpointRequest> breakpointRequests; try { breakpointRequests = getEventManager().breakpointRequests(); } catch (DebuggerException e) { Throwable cause = e.getCause(); if (cause instanceof VMCannotBeModifiedException) { return emptyList(); } throw e; } List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size()); for (BreakpointRequest breakpointRequest : breakpointRequests) { com.sun.jdi.Location location = breakpointRequest.location(); breakPoints.add( newDto(BreakpointDto.class) .withEnabled(true) .withLocation(asDto(new JdbLocation(location)))); } breakPoints.sort(BREAKPOINT_COMPARATOR); return breakPoints; }
Source:
<code>public IntegrationMBeanExporter mbeanExporter() { IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); setupDomain(exporter); setupServer(exporter); exporter.setRegistrationPolicy(this.attributes.<RegistrationPolicy>getEnum("registration")); <START> exporter.setComponentNamePatterns(this.attributes.getStringArray("managedComponents")); <END> return exporter; }</code><technical_language>Placeholders for patterns too</technical_language>

Target:
public IntegrationMBeanExporter mbeanExporter() { IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); exporter.setRegistrationPolicy(this.attributes.<RegistrationPolicy>getEnum("registration")); setupDomain(exporter); setupServer(exporter); setupComponentNamePatterns(exporter); return exporter; }
Source:
<code>public BpmnModelResource getBpmnModel(@PathVariable String id) { BpmnModel bpmnModel = repositoryService.getBpmnModel(id); <START> return bpmnModelResourceAssembler.toResource(new MetaBpmnModel(id, bpmnModel)); <END> }</code><technical_language>@daisuke-yoshimoto here, return json content of process definition. In return svg content it</technical_language>

Target:
public String getBpmnModel(@PathVariable String id) { BpmnModel bpmnModel = repositoryService.getBpmnModel(id); ObjectNode json = new BpmnJsonConverter().convertToJson(bpmnModel); return json.toString(); }
Source:
<code>public void initializePersistenceStrategy(Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes) { <START> if ( config.getPersistenceStrategy() == org.hibernate.ogm.datastore.infinispan.options.PersistenceStrategy.CACHE_PER_KIND ) { <END> persistenceStrategy = PersistenceStrategy.getPerKindStrategy( externalCacheManager, config.getConfigurationUrl(), jtaPlatform ); } else { persistenceStrategy = PersistenceStrategy.getPerTableStrategy( externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); } this.externalCacheManager = null; this.jtaPlatform = null; }</code><technical_language>important I moved this selection in PersistenceStrategy class, like: persistenceStrategy = PersistenceStrategy.getStrategy( externalCacheManager, config.getConfigurationUrl(), jtaPlatform, config.getPersistenceStrategy(), factory ); EDIT: Added missing parameter</technical_language>

Target:
public void initializePersistenceStrategy(Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes) { persistenceStrategy = PersistenceStrategy.getInstance( config.getPersistenceStrategy(), externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); this.externalCacheManager = null; this.jtaPlatform = null; }
Source:
<code>public static TObject javaToThrift(Object object) { ByteBuffer bytes; Type type = null; if(object instanceof Boolean) { bytes = ByteBuffer.allocate(1); bytes.put((boolean) object ? (byte) 1 : (byte) 0); type = Type.BOOLEAN; } else if(object instanceof Double) { bytes = ByteBuffer.allocate(8); bytes.putDouble((double) object); type = Type.DOUBLE; } else if(object instanceof Float) { bytes = ByteBuffer.allocate(4); bytes.putFloat((float) object); type = Type.FLOAT; } else if(object instanceof Link) { bytes = ByteBuffer.allocate(8); bytes.putLong(((Link) object).longValue()); type = Type.LINK; } else if(object instanceof Long) { bytes = ByteBuffer.allocate(8); bytes.putLong((long) object); type = Type.LONG; } else if(object instanceof Integer) { bytes = ByteBuffer.allocate(4); bytes.putInt((int) object); type = Type.INTEGER; } else if(object instanceof Catchphrase) { bytes = ByteBuffer.wrap( <START> ((Catchphrase) object).stringValue() <END> .getBytes(StandardCharsets.UTF_8)); type = Type.CATCHPHRASE; } else { bytes = ByteBuffer.wrap(object.toString().getBytes( StandardCharsets.UTF_8)); type = Type.STRING; } bytes.rewind(); return new TObject(bytes, type); }</code><technical_language>need cast object</technical_language>

Target:
public static TObject javaToThrift(Object object) { ByteBuffer bytes; Type type = null; if(object instanceof Boolean) { bytes = ByteBuffer.allocate(1); bytes.put((boolean) object ? (byte) 1 : (byte) 0); type = Type.BOOLEAN; } else if(object instanceof Double) { bytes = ByteBuffer.allocate(8); bytes.putDouble((double) object); type = Type.DOUBLE; } else if(object instanceof Float) { bytes = ByteBuffer.allocate(4); bytes.putFloat((float) object); type = Type.FLOAT; } else if(object instanceof Link) { bytes = ByteBuffer.allocate(8); bytes.putLong(((Link) object).longValue()); type = Type.LINK; } else if(object instanceof Long) { bytes = ByteBuffer.allocate(8); bytes.putLong((long) object); type = Type.LONG; } else if(object instanceof Integer) { bytes = ByteBuffer.allocate(4); bytes.putInt((int) object); type = Type.INTEGER; } else if(object instanceof Tag) { bytes = ByteBuffer.wrap(object.toString() .getBytes(StandardCharsets.UTF_8)); type = Type.TAG; } else { bytes = ByteBuffer.wrap(object.toString().getBytes( StandardCharsets.UTF_8)); type = Type.STRING; } bytes.rewind(); return new TObject(bytes, type); }
Source:
<code>public void createDefaultFactory() throws Exception { ConfigurationFactory<Example> factory = factoryFactory.create(Example.class, validator, Jackson.newObjectMapper(), "dw"); <START> final Example example = factory.build(new FileConfigurationSourceProvider(), validFile.getPath()); <END> assertThat(example.getName()) .isEqualTo("Coda Hale"); }</code><technical_language>Is this change required default method in interface</technical_language>

Target:
public void createDefaultFactory() throws Exception { ConfigurationFactory<Example> factory = factoryFactory.create(Example.class, validator, Jackson.newObjectMapper(), "dw"); final Example example = factory.build(validFile); assertThat(example.getName()) .isEqualTo("Coda Hale"); }
Source:
<code>private IAuditLogger getAuditLogger(ParameterizedClass logger) throws ConfigurationException { if (logger.class_name != null) { return FBUtilities.newAuditLogger(logger.class_name, logger.parameters); } <START> return FBUtilities.newAuditLogger(BinAuditLogger.class.getName(), null); <END> }</code><technical_language>nit: null this inconsistent usage of Collections.emptyMap() in other places in this PR for class parameters</technical_language>

Target:
private IAuditLogger getAuditLogger(ParameterizedClass logger) throws ConfigurationException { if (logger.class_name != null) { return FBUtilities.newAuditLogger(logger.class_name, logger.parameters == null ? Collections.emptyMap() : logger.parameters); } return FBUtilities.newAuditLogger(BinAuditLogger.class.getName(), Collections.emptyMap()); }
Source:
<code>public void testExpressionsWithTrailingWhitespace() { String propertyValue = "${key} "; <START> ModelType attributeType = ModelType.EXPRESSION; <END> ModelNode mn = ParseUtils.parseAttributeValue(propertyValue, true, attributeType); assertEquals("wrong ModelType,", ModelType.EXPRESSION, mn.getType()); String parsedPropertyValue = mn.asExpression().getExpressionString(); assertEquals("wrong parsedAttributeValue,", propertyValue, parsedPropertyValue); }</code><technical_language>@jbaesner I this ModelType.STRING</technical_language>

Target:
public void testExpressionsWithTrailingWhitespace() { String propertyValue = "${key} "; ModelType attributeType = ModelType.STRING; ModelNode mn = ParseUtils.parseAttributeValue(propertyValue, true, attributeType); assertEquals("wrong ModelType,", ModelType.EXPRESSION, mn.getType()); String parsedPropertyValue = mn.asExpression().getExpressionString(); assertEquals("wrong parsedAttributeValue,", propertyValue, parsedPropertyValue); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> setContentView(R.layout.activity_main); <END> if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.fragmentContainer, findAnalyzeHotspotsFragment(), AnalyzeHotspotsFragment.class.getSimpleName()) .commit(); } }</code><technical_language>a case savedInstanceState null? If yes, handle case</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); Point center = new Point(-13671170, 5693633, SpatialReferences.getWebMercator()); map.setInitialViewpoint(new Viewpoint(center, 57779)); mMapView.setMap(map); FloatingActionButton calendarFab = findViewById(R.id.calendarButton); calendarFab.setOnClickListener(v -> showDateRangeDialog()); mGeoprocessingTask = new GeoprocessingTask(getString(R.string.hotspot_911_calls_url)); mGeoprocessingTask.loadAsync(); showDateRangeDialog(); }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()){ boolean languagePageShown = isLangPageShown(request); if (!file.equals(originalFile) && !file.getAbsolutePath().equals(replaceLocaleWithOtherLocale(originalFile.getAbsolutePath(), locale, locale))) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if (!languagePageShown) { setLangPageShown(response, true); request.setAttribute(LocaleFilter.LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); <START> final ServletContext forwardContext = getServletContext().getContext(localeDocsMissing); <END> final RequestDispatcher dispatcher = forwardContext.getRequestDispatcher(localeDocsMissing); dispatcher.forward(request, response); } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }</code><technical_language>forwardContext null, check it</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()) { boolean languagePageShown = isLangPageShown(request); if (!file.equals(originalFile) && !file.getAbsolutePath().equals(replaceLocaleWithOtherLocale(originalFile.getAbsolutePath(), locale, locale))) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if (!languagePageShown) { setLangPageShown(response, true); request.setAttribute(LocaleFilter.LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); final ServletContext forwardContext = getServletContext().getContext(localeDocsMissing); if (forwardContext != null) { final RequestDispatcher dispatcher = forwardContext.getRequestDispatcher(localeDocsMissing); if (dispatcher != null) { dispatcher.forward(request, response); } else { log.error("Unable to determine dispatcher"); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "unable to determine dispatcher"); } } else { log.error("Unable to determine forwarding context"); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "unable to determine forward context"); } } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }
Source:
<code>public HashBasedNumberedShardSpec( @JsonProperty("partitionNum") int partitionNum, @JsonProperty("partitions") int partitions ) { super(partitionNum, partitions); <START> hashFunction = Hashing.murmur3_32(); <END> }</code><technical_language>this configurable? configurable</technical_language>

Target:
public HashBasedNumberedShardSpec( @JsonProperty("partitionNum") int partitionNum, @JsonProperty("partitions") int partitions ) { super(partitionNum, partitions); }
Source:
<code>public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes context) { byte[] inToken = new byte[0]; try { gssContext = getGssContext(); if (!gssContext.isEstablished()) { inToken = gssContext.initSecContext(inToken, 0, inToken.length); } if (inToken.length > 0) { log.debug("Successfully established GSSContext with source name: %s and target name: %s", gssContext.getSrcName(), gssContext.getTargName()); String spnegoToken = NEGOTIATE + " " + String.valueOf(B64Code.encode(inToken)); URI requestUri = request.getURI(); URI baseUri = new URI(requestUri.getScheme(), requestUri.getHost(), null, null); return new SpnegoResult(headerInfo.getHeader(), baseUri, spnegoToken); } else { log.warn("Failed to establish GSSContext for request %s!", request.getURI()); } <START> gssContext.dispose(); <END> return null; } catch (URISyntaxException | UnknownHostException | LoginException | GSSException e) { throw new AuthenticationException(e); } }</code><technical_language>This done in a finally block</technical_language>

Target:
public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes context) { URI requestUri = request.getURI(); try (CloseableGSSContext gssContext = new CloseableGSSContext(krb5RemoteServiceName, krb5Keytab, krb5CredentialCache, krb5Principal, requestUri)) { byte[] token = gssContext.getContext().initSecContext(new byte[0], 0, 0); if (token != null) { log.debug("Successfully established GSSContext with source name: %s and target name: %s", gssContext.getContext().getSrcName(), gssContext.getContext().getTargName()); String tokenValue = format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token)); URI baseUri = UriUtil.normalizedUri(requestUri); return new SpnegoResult(headerInfo.getHeader(), baseUri, tokenValue); } throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri)); } catch (GSSException e) { throw new AuthenticationException(e); } }
Source:
<code>public void noModsTest() throws Exception { String title = "new title"; <START> when(binaryObj.getBinaryStream()).thenReturn(null); <END> service.editTitle(agent, pid, title); verify(operationsMessageSender).sendUpdateDescriptionOperation(anyString(), pidsCaptor.capture()); Collection<PID> pids = pidsCaptor.getValue(); assertEquals(pids.size(), 1); assertTrue(pids.contains(pid)); }</code><technical_language>i want do when(contentObj.getDescription()).thenReturn(null) closer expected behavior. stubbing wins, problem overriding default test init method</technical_language>

Target:
public void noModsTest() throws Exception { String title = "new title"; when(contentObj.getDescription()).thenReturn(null); service.editTitle(agent, pid, title); verify(operationsMessageSender).sendUpdateDescriptionOperation(anyString(), pidsCaptor.capture()); Collection<PID> pids = pidsCaptor.getValue(); assertEquals(1, pids.size()); assertTrue(pids.contains(pid)); Document updatedDoc = getUpdatedDescriptionDocument(); assertTrue(hasTitleValue(updatedDoc, title)); }
Source:
<code>public static URI fromString(String candidate) { try { Long.parseLong(candidate); return Vlan.toUri(candidate); } catch (NumberFormatException nfe) { if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) { return Native.toUri(candidate); } if (UuidUtils.validateUUID(candidate)){ <START> return null; <END> } try { URI uri = new URI(candidate); BroadcastDomainType tiep = getSchemeValue(uri); if (tiep.scheme != null && tiep.scheme.equals(uri.getScheme())) { return uri; } else { throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType."); } } catch (URISyntaxException e) { throw new CloudRuntimeException("string is not a broadcast URI: " + candidate); } } }</code><technical_language>other thing, a method validates a UUID? missing something, wound't UuidUtils.validateUUID(candidate) if candidate is a UUID not? If so, instead of construction try { Long.parse(...); } catch (NumberFormatException nfe) { (...) }</technical_language>

Target:
public static URI fromString(String candidate) { try { Long.parseLong(candidate); return Vlan.toUri(candidate); } catch (NumberFormatException nfe) { if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) { return Native.toUri(candidate); } try { URI uri = new URI(candidate); BroadcastDomainType tiep = getSchemeValue(uri); if (tiep.scheme != null && tiep.scheme.equals(uri.getScheme())) { return uri; } else { throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType."); } } catch (URISyntaxException e) { throw new CloudRuntimeException("string is not a broadcast URI: " + candidate); } } }
Source:
<code>public Optional<RangePredicateExpectations<ZonedDateTime>> getRangePredicateExpectations() { return Optional.of( new RangePredicateExpectations<>( LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), <START> LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), <END> LocalDateTime.of( 2018, 3, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ) ) ); }</code><technical_language>mix multiple timezones? idea is trigger a failure, easy for tests pass... In particular, I local date/times ordered, ordered account time zones</technical_language>

Target:
public Optional<RangePredicateExpectations<ZonedDateTime>> getRangePredicateExpectations() { return Optional.of( new RangePredicateExpectations<>( LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ) ) ); }
Source:
<code>private static Take fallback(final Take take) { return new TkFallback( take, new FbChain( new FbStatus(404, new TkFixed(new RsNotFound())), new Fallback() { @Override public Iterator<Response> route(final RqFallback req) { final String exc = ExceptionUtils.getStackTrace( req.throwable() ); Logger.info(this, "Exception thrown\n%s", exc); return Collections.singleton( <START> Response.class.cast( <END> new RsHTML( String.format( "oops, something went wrong!\n%s", exc ) ) ) ).iterator(); } } ) ); }</code><technical_language>do Collection.<Response>singleton(..</technical_language>

Target:
private static Take fallback(final Take take) { return new TkFallback( take, new FbChain( new FbStatus(404, new TkFixed(new RsNotFound())), new FbError() ) ); }
Source:
<code>private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { <START> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); <END> } else if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }</code><technical_language>"vmNotInPreview" method error message VM_IN_PREVIEW, "validate" method adds error message validation error messages of command, need add "failCanDoAction". Basically, instead of "failCanDoAction" "return false"</technical_language>

Target:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } else if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }