auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void updateRows(long topicId) { ReplyThread thread = ReplyController.get().getThread(topicId); List<ForumMessage> messages = thread.getMessages(start); int totalCount = ReplyController.get().getThread(topic.id).getTotalCount(); <START> assert messages.size() >= Math.min(ServiceConstants.SHORT_STEP_VALUE, totalCount - start) : "ForumMessageProvider: messages for cell list is not adequate" ; <END> updateRowData(start, messages); updateRowCount(totalCount, true); }</code><technical_language>assert? Edit: This is a question, I meant is: restrict of asserts unit tests</technical_language>

Target:
protected void updateRows(long topicId) { ReplyThread thread = ReplyController.get().getThread(topicId); List<ForumMessage> messages = thread.getMessages(start); int totalCount = ReplyController.get().getThread(topic.id).getTotalCount(); if (messages.size() < Math.min(ServiceConstants.SHORT_STEP_VALUE, totalCount - start)) { throw new RuntimeException("ForumMessageProvider: messages for cell list is not adequate") ; } updateRowData(start, messages); updateRowCount(totalCount, true); }
Source:
<code>public Publisher publish(Event event) { List<Subscription> subscriptions = subscriptionsByEvent.getOrDefault(event.getClass(), emptyList()); if (!subscriptions.isEmpty()) { List<Subscription> toHandle = subscriptions.stream() .filter(subscription -> subscription.matches(event)) .collect(toList()); subscriptions.stream() .filter(subscription -> subscription.needUnsubscribeAfter(event)) .forEach(this::unsubscribe); if (event instanceof Single) { subscriptionsByEvent.remove(event.getClass()); } if (!toHandle.isEmpty()) { <START> executor.execute(new Command(toHandle, event)); <END> } } return this; }</code><technical_language>prefer subscription processed a separate task. EventDispatchThread give correct heads for task execution process</technical_language>

Target:
public Publisher publish(Event event) { List<Subscription> subscriptions = subscriptionsByEvent.getOrDefault(event.getClass(), emptyList()); subscriptions.stream() .filter(subscription -> subscription.matches(event)) .map(subscription -> new Command(subscription, event)) .forEach(executor::execute); subscriptions.stream() .filter(subscription -> subscription.needUnsubscribeAfter(event)) .forEach(this::unsubscribe); if (event instanceof OneOffEvent) { subscriptionsByEvent.remove(event.getClass()); } return this; }
Source:
<code><START> public AdsBaseObject triggerIncontentLeaderboard() { <END> final String incontentLeaderboard = AdsContent.getSlotSelector(AdsContent.INCONTENT_LEADERBOARD); try { new WebDriverWait(driver, 5).until(new ExpectedCondition<Object>() { @Override public Object apply(WebDriver webDriver) { jsActions.execute("$('#mw-content-text h2')[1].scrollIntoView(true);"); return driver.findElements(By.cssSelector(incontentLeaderboard)).size() > 0; } }); } catch (org.openqa.selenium.TimeoutException e) { PageObjectLogging.logError("Incontent leaderboard", e); } return this; }</code><technical_language>a lot of code duplication. of more generic refactor tests a bit? public AdsBase Object triggerAdSlot(String adSlotSelector, String javaScriptTrigger)..</technical_language>

Target:
public AdsBaseObject triggerIncontentLeaderboard() { triggerAdSlot(AdsContent.getSlotSelector(AdsContent.INCONTENT_LEADERBOARD), "$('#mw-content-text h2')[1].scrollIntoView(true);"); return this; }
Source:
<code>public void triggerMisfired(Trigger trigger) { log.warn("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); String id = trigger.getJobKey().getName(); JobStatus js = jobCurator.find(id); if (js == null) { throw new RuntimeException("No JobStatus for job with id of " + id); } if (!trigger.mayFireAgain()) { log.warn("Job not allowed to fire again. Setting state to FAILED.", id); js.setState(JobStatus.JobState.FAILED); js.setResult("Failed run. Will not attempt again."); } else { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); js.setResult("Will reattempt job at or after " + sdf.format(trigger.getNextFireTime())); js.setState(JobStatus.JobState.PENDING); } <START> jobCurator.merge(js); <END> }</code><technical_language>Quartz practices state listener methods a try-catch handle exceptions [1]. If committing JobStatus, violate this practice potentially introduce issues. [1] <LINK_0></technical_language>

Target:
public void triggerMisfired(Trigger trigger) { log.warn("Trigger misfired for for Job: \nKey: {}\nJob Key: {}\nStart: {}\nEnd: {}\n" + "Final Fire Time: {}\nNext Fire Time: {}\nMisfire Instruction: {}\nPriority: {}", trigger.getKey(), trigger.getJobKey(), trigger.getStartTime(), trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getNextFireTime(), trigger.getMisfireInstruction(), trigger.getPriority()); try { String id = trigger.getJobKey().getName(); JobStatus js = jobCurator.find(id); if (js == null) { throw new RuntimeException("No JobStatus for job with id of " + id); } if (!trigger.mayFireAgain()) { log.warn("Job not allowed to fire again. Setting state to FAILED.", id); js.setState(JobStatus.JobState.FAILED); js.setResult("Failed run. Will not attempt again."); } else { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); js.setResult("Will reattempt job at or after " + sdf.format(trigger.getNextFireTime())); js.setState(JobStatus.JobState.PENDING); } jobCurator.merge(js); } catch (Exception e) { log.error("Unable to capture misfire into job status: {}", e.getMessage()); } }
Source:
<code>public MaterialDialog showDiscardChangesDialog() { MaterialDialog discardDialog = new MaterialDialog.Builder(this) .content(R.string.discard_unsaved_changes) .positiveText(R.string.dialog_ok) .negativeText(R.string.dialog_cancel) .onPositive((dialog, which) -> { Timber.i("TemplateEditor:: OK button pressed to confirm discard changes"); clearTempModelFiles(this); mEditedModelFileName = null; mEditedModel = null; finishWithAnimation(ActivityTransitionAnimation.RIGHT); <START> }) <END> .build(); discardDialog.show(); return discardDialog; }</code><technical_language>I necessary set null is it? I code written is omitted, some special reason for setting null, a static variable somewhere. case here, weird arbitrarily superfluous me</technical_language>

Target:
public MaterialDialog showDiscardChangesDialog() { MaterialDialog discardDialog = DiscardChangesDialog.getDefault(this) .onPositive((dialog, which) -> { Timber.i("TemplateEditor:: OK button pressed to confirm discard changes"); TemporaryModel.clearTempModelFiles(); mTempModel = null; finishWithAnimation(ActivityTransitionAnimation.RIGHT); }) .build(); discardDialog.show(); return discardDialog; }
Source:
<code>public GenericRecord toAvro(Schema schema, DocumentModel input) { String logicalType = getLogicalType(schema); GenericRecord record = new GenericData.Record(schema); if (DOCUMENT_MODEL.equals(logicalType)) { record.put(PATH, input.getPathAsString()); record.put(ID, input.getId()); } for (Field field : schema.getFields()) { <START> if (field.name().equals(ID) || field.name().equals(PATH)) { <END> continue; } if (field.schema().getType() == Type.RECORD && (DOCUMENT_MODEL.equals(logicalType) || DOCUMENT_TYPE.equals(logicalType))) { record.put(field.name(), service.toAvro(field.schema(), input)); } else { Property p = input.getProperty(service.decodeName(field.name())); record.put(field.name(), service.toAvro(field.schema(), p)); } } return record; }</code><technical_language>Is preventing treat ID PATH for others properties ? thinking a schema uuid field</technical_language>

Target:
public GenericRecord toAvro(Schema schema, DocumentModel input) { String logicalType = getLogicalType(schema); GenericRecord record = new GenericData.Record(schema); if (DOCUMENT_MODEL.equals(logicalType)) { record.put(PATH, input.getPathAsString()); record.put(UUID, input.getId()); } for (Field field : schema.getFields()) { if (field.name().equals(UUID) || field.name().equals(PATH)) { continue; } if (field.schema().getType() == Type.RECORD && (DOCUMENT_MODEL.equals(logicalType) || DOCUMENT_TYPE.equals(logicalType))) { record.put(field.name(), service.toAvro(field.schema(), input)); } else { Property p = input.getProperty(service.decodeName(field.name())); record.put(field.name(), service.toAvro(field.schema(), p)); } } return record; }
Source:
<code><START> public VersionNumber getNeededDependenciesMinimumJavaVersion() { <END> VersionNumber versionNumber = null; try { versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion("'minimumJavaVersion' was specified for plugin ''{0}'' but unparseable (received {1})", this.name, minimumJavaVersion); } for (Plugin p: getNeededDependencies()) { VersionNumber v = p.getNeededDependenciesMinimumJavaVersion(); if (v == null) { continue; } if (versionNumber == null || v.isNewerThan(versionNumber)) { versionNumber = v; } } return versionNumber; }</code><technical_language>name of method is tricky for me. Do instead, **getMinimumJavaVersionConsideringDependencies** similar? :pray:</technical_language>

Target:
public VersionNumber getNeededDependenciesMinimumJavaVersion() { VersionNumber versionNumber = null; try { versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion(); } for (Plugin p: getNeededDependencies()) { VersionNumber v = p.getNeededDependenciesMinimumJavaVersion(); if (v == null) { continue; } if (versionNumber == null || v.isNewerThan(versionNumber)) { versionNumber = v; } } return versionNumber; }
Source:
<code>private boolean isMandatory(MethodExpression expression) { <START> return expression.getMethod().getWords().get(0).equals(MANDATORY) ? true : false; <END> }</code><technical_language>If this is of "MANDATORY" constant want define a "Name" instead of "String": privates static final Name MANDATORY = NameParser.parseUsingCase("Mandatory"); compare easily: return expression.getMethod().equals(MANDATORY);</technical_language>

Target:
private boolean isMandatory(MethodExpression expression) { return expression.getMethod().equals(MANDATORY) ? true : false; }
Source:
<code>private String receive(TelnetClient client) { StringBuffer strBuffer; try { strBuffer = new StringBuffer(); byte[] buf = new byte[4096]; int len = 0; Thread.sleep(750L); while ((len = client.getInputStream().read(buf)) != 0) { strBuffer.append(new String(buf, 0, len)); Thread.sleep(750L); if (client.getInputStream().available() == 0) break; } return strBuffer.toString(); } catch (Exception e) { <START> logger.warn("Could not send command " + command, e); <END> } return null; }</code><technical_language>change "normal" string concatenation? I "e.toString()" superfluous</technical_language>

Target:
private String receive(TelnetClient client) { StringBuffer strBuffer; try { strBuffer = new StringBuffer(); byte[] buf = new byte[4096]; int len = 0; Thread.sleep(750L); while ((len = client.getInputStream().read(buf)) != 0) { strBuffer.append(new String(buf, 0, len)); Thread.sleep(750L); if (client.getInputStream().available() == 0) break; } return strBuffer.toString(); } catch (Exception e) { logger.warn("Error receiving data", e); } return null; }
Source:
<code>public void registerCache(String name) { CacheDescriptor defaultDescriptor = registry.getCacheDescriptor(DEFAULT_CACHE_ID); if (defaultDescriptor == null) { <START> registerCache(name, DEFAULT_MAX_SIZE, DEFAULT_TTL, new CacheDescriptor()); <END> } else { registerCache(name, defaultDescriptor.clone()); } }</code><technical_language>create default descriptor put in registry</technical_language>

Target:
public void registerCache(String name) { CacheDescriptor defaultDescriptor = registry.getDefaultDescriptor(); defaultDescriptor.name = name; registerCacheDescriptor(defaultDescriptor); maybeStart(name); }
Source:
<code>public void csv_entriesAreEscaped() { CsvEntity csvEntity = new CsvEntity(); Map jsonMap = ImmutableMap.of( "hash", "hash1", "entry", ImmutableMap.of( "key1", "valu\te1", "key2", "val,ue2", "key3", "val\"ue3", "key4", "val\nue4" ) ); JsonNode node = JsonObjectMapper.convert(jsonMap, JsonNode.class); AbstractView view = new SingleResultView("foo", node); Object result = csvEntity.convert(view); <START> assertThat(result.toString(), equalTo("hash,key1,key2,key3,key4\nhash1,valu\te1,\"val,ue2\",\"val\"\"ue3\",\"val\nue4\"")); <END> }</code><technical_language>this right. want a literal newline character here, characters \ n</technical_language>

Target:
public void csv_entriesAreEscaped() { CsvEntity csvEntity = new CsvEntity(); Map jsonMap = ImmutableMap.of( "hash", "hash1", "entry", ImmutableMap.of( "key1", "valu\te1", "key2", "val,ue2", "key3", "val\"ue3", "key4", "val\nue4" ) ); JsonNode node = JsonObjectMapper.convert(jsonMap, JsonNode.class); AbstractView view = new SingleResultView("foo", node); Object result = csvEntity.convert(view); assertThat(result.toString(), equalTo("hash,key1,key2,key3,key4\r\nhash1,valu\te1,\"val,ue2\",\"val\"\"ue3\",\"val\nue4\"")); }
Source:
<code>public Money getMaintenanceCosts() { if (campaignOptions.payForMaintain()) { return getHangar().getUnitsStream() <START> .filter(u -> u.requiresMaintenance() && null != u.getTech()) <END> .map(Unit::getMaintenanceCost) .reduce(Money.zero(), (a, b) -> a.plus(b)); } return Money.zero(); }</code><technical_language>suggestion .filter(u -> u.requiresMaintenance() && (null != u.getTech()))</technical_language>

Target:
public Money getMaintenanceCosts() { if (campaignOptions.payForMaintain()) { return getHangar().getUnitsStream() .filter(u -> u.requiresMaintenance() && (null != u.getTech())) .map(Unit::getMaintenanceCost) .reduce(Money.zero(), (a, b) -> a.plus(b)); } return Money.zero(); }
Source:
<code>public void init() { post( "/feedback", APPLICATION_JSON, (req, res) -> { if (StringUtils.isNotEmpty(emailDestination)) { FeedbackRequest feedback = parseFeedbackRequest(util.safeGetBody(req)); feedback.setAuthUsername(getCurrentUser()); String emailSubject = getEmailSubject(feedback); String emailBody = getEmailBody(feedback); if (emailBody != null) { emailBody = emailBody.replaceAll("\\\\n", "\n"); } else { <START> emailBody = ""; <END> } Session emailSession = smtpClient.createSession(); MimeMessage message = new MimeMessage(emailSession); message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailDestination)); message.setSubject(emailSubject); message.setContent(emailBody, "text/html; charset=utf-8"); smtpClient.send(message); res.body("{}"); res.status(200); return res; } else { res.status(500); res.body("No destination email configured, feedback cannot be submitted."); LOGGER.debug("Feedback submission failed, destination email is not configured."); return res; } }); exception( Exception.class, (e, request, response) -> { response.status(500); response.body("Error submitting feedback"); LOGGER.debug("Feedback submission failed", e); }); enableRouteOverview(); }</code><technical_language>line 92 set message content emailBody set content type text/html. I a blank string is valid text/html. choose other blank string for default. This begs question - Do want send email if body content</technical_language>

Target:
public void init() { post( "/feedback", APPLICATION_JSON, (req, res) -> { if (StringUtils.isNotEmpty(emailDestination)) { FeedbackRequest feedback = parseFeedbackRequest(util.safeGetBody(req)); feedback.setAuthUsername(getCurrentUser()); String emailSubject = getEmailSubject(feedback); String emailBody = getEmailBody(feedback); if (emailBody != null) { emailBody = emailBody.replaceAll("\\\\n", "\n"); } else { emailBody = "<html/>"; } Session emailSession = smtpClient.createSession(); MimeMessage message = new MimeMessage(emailSession); message.addRecipient(Message.RecipientType.TO, new InternetAddress(emailDestination)); message.setSubject(emailSubject); message.setContent(emailBody, "text/html; charset=utf-8"); smtpClient.send(message); res.body("{}"); res.status(200); return res; } else { res.status(500); res.body("No destination email configured, feedback cannot be submitted."); LOGGER.debug("Feedback submission failed, destination email is not configured."); return res; } }); exception( Exception.class, (e, request, response) -> { response.status(500); response.body("Error submitting feedback"); LOGGER.debug("Feedback submission failed", e); }); enableRouteOverview(); }
Source:
<code>public void testDenseVector() { final double[] value1 = {0.1, 0.2, 0.3, 0.4, 0.5}; final double[] value2 = {0.1, 0.3, 0.5, 0.7, 0.9}; final Vector vec1 = factory.createDense(value1); final Vector vec2 = factory.createDense(value2); final Vector vec3 = factory.createDenseOnes(5); final Vector vec4 = factory.createDenseZeros(5); double dotResult = 0; for (int i = 0; i < vec1.length(); i++) { dotResult += vec1.get(i) * vec2.get(i); } assertEquals(dotResult, vec1.dot(vec2), 0.0); final Vector addVec = vec1.add(vec2); vec1.addi(vec2); assertEquals(addVec, vec1); final Vector scaleVec = vec1.scale(1.5); vec1.scalei(1.5); assertEquals(scaleVec, vec1); final Vector addScaleVec = vec1.add(vec2); vec1.axpy(1.0, vec2); assertEquals(addScaleVec, vec1); assertEquals(vec3, vec4.add(1)); vec4.subi(1); vec3.addi(-2); assertEquals(vec3, vec4); final Vector sliceVec = vec1.slice(2, 4); assertEquals(2, sliceVec.length()); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); <START> vec1.set(0, 1.0); <END> assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); }</code><technical_language>Is this test for showing change in sliced vector affects original vector? If so, sliceVec.set(0, 1.0) is more appropriate</technical_language>

Target:
public void testDenseVector() { final double[] value1 = {0.1, 0.2, 0.3, 0.4, 0.5}; final double[] value2 = {0.1, 0.3, 0.5, 0.7, 0.9}; final Vector vec1 = factory.createDense(value1); final Vector vec2 = factory.createDense(value2); final Vector vec3 = factory.createDenseOnes(5); final Vector vec4 = factory.createDenseZeros(5); double dotResult = 0; for (int i = 0; i < vec1.length(); i++) { dotResult += vec1.get(i) * vec2.get(i); } assertEquals(dotResult, vec1.dot(vec2), 0.0); final Vector addVec = vec1.add(vec2); vec1.addi(vec2); assertEquals(addVec, vec1); final Vector scaleVec = vec1.scale(1.5); vec1.scalei(1.5); assertEquals(scaleVec, vec1); final Vector addScaleVec = vec1.add(vec2); vec1.axpy(1.0, vec2); assertEquals(addScaleVec, vec1); assertEquals(vec3, vec4.add(1)); vec4.subi(1); vec3.addi(-2); assertEquals(vec3, vec4); final Vector sliceVec = vec1.slice(2, 4); assertEquals(2, sliceVec.length()); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); sliceVec.set(0, 1.0); assertEquals(vec1.get(2), sliceVec.get(0), EPSILON); assertEquals(vec1.get(3), sliceVec.get(1), EPSILON); }
Source:
<code>public Reply<?> fetchAll() { List<CAPMessage> messages = repository.findAll(); <START> if (messages.isEmpty()) { <END> return Reply.with("Not found available messages").notFound(); } List<CAPMessageDTO> dtos = adaptCAPMessages(messages); return Reply.with(dtos).as(Json.class).ok(); }</code><technical_language>is necessary this message</technical_language>

Target:
public Reply<?> fetchAll() { List<CapMessage> messages = repository.findAll(); List<CapMessageDTO> dtos = adapt(messages); return Reply.with(dtos).as(Json.class).ok(); }
Source:
<code>public static String getTime(long time) { if(time < 0) { return ""; } StringBuilder ret = new StringBuilder(); ret.append(new Date(time).toString()); ret.append(", "); long seconds = (System.currentTimeMillis() - time) / 1000; long day, hou, min, sec; day = seconds / (3600 * 24); seconds -= day * (3600 * 24); hou = seconds / 3600; seconds -= hou * 3600; min = seconds / 60; sec = seconds % 60; if (seconds < 0) { day = Math.abs(day); hou = Math.abs(hou); min = Math.abs(min); sec = Math.abs(sec); ret.append("in "); } if (day > 0) { ret.append(day).append("d "); ret.append(hou).append("h "); } else if (hou > 0) { ret.append(hou).append("h"); ret.append(min).append("mn "); } else if (min > 0) { ret.append(min).append("mn "); } else if (sec > 0) { ret.append(sec).append("s "); } <START> if (seconds > 0) <END> ret.append("ago"); return ret.toString(); }</code><technical_language>Please brackets _if_ for maintainability. If add a statement _if_ _else_ clause remembering add curly braces, code break in unexpected amusing ways</technical_language>

Target:
public static String getTime(long time) { if(time < 0) { return ""; } StringBuilder ret = new StringBuilder(); ret.append(new Date(time).toString()); ret.append(", "); long seconds = (System.currentTimeMillis() - time) / 1000; long day, hou, min, sec; day = seconds / (3600 * 24); seconds -= day * (3600 * 24); hou = seconds / 3600; seconds -= hou * 3600; min = seconds / 60; sec = seconds % 60; if (seconds < 0) { day = Math.abs(day); hou = Math.abs(hou); min = Math.abs(min); sec = Math.abs(sec); ret.append("in "); } if (day > 0) { ret.append(day).append("d "); ret.append(hou).append("h "); } else if (hou > 0) { ret.append(hou).append("h"); ret.append(min).append("mn "); } else if (min > 0) { ret.append(min).append("mn "); } else if (sec > 0) { ret.append(sec).append("s "); } if (seconds > 0) { ret.append("ago"); } return ret.toString(); }
Source:
<code>private Filter filterNotEqual(JSONArray array) { if (array.size() != 3) { throwUnexpectedArgumentCount("!=", 2); } final FilterFactory2 ff = parse.getFilterFactory(); if (parse.isString(array, 1)) { String key = parse.get(json, 1); Object value = parse.value(json, 2); return ff.notEqual(ff.property(key), ff.literal(value), false); } else { Expression expression1 = parse.string(json, 1); Expression expression2 = parse.string(json, 2); <START> return ff.notEqual(expression1, expression2); <END> } }</code><technical_language>Yes, is correct</technical_language>

Target:
private Filter filterNotEqual(JSONArray array) { if (array.size() != 3) { throwUnexpectedArgumentCount("!=", 2); } Expression expression1 = comparisonExpression1(array); Expression expression2 = comparisonExpression2(array); return ff.notEqual(expression1, expression2); }
Source:
<code>public Response alert(@QueryParam("id") List<Long> anomalyIds) { List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByIds(anomalyIds); for (MergedAnomalyResultDTO anomaly : anomalies) { AnomalySubscriptionGroupNotificationDTO anomalySubscriptionGroupNotificationDTO = new AnomalySubscriptionGroupNotificationDTO(); anomalySubscriptionGroupNotificationDTO.setAnomalyId(anomaly.getId()); anomalySubscriptionGroupNotificationDTO.setDetectionConfigId(anomaly.getDetectionConfigId()); <START> anomalySubscriptionGroupNotificationManager.save(anomalySubscriptionGroupNotificationDTO); <END> } return Response.ok().build(); }</code><technical_language>checking if entry exists for anomalies</technical_language>

Target:
public Response alert(@QueryParam("id") List<Long> anomalyIds) { List<MergedAnomalyResultDTO> anomalies = this.anomalyDAO.findByIds(anomalyIds); for (MergedAnomalyResultDTO anomaly : anomalies) { DetectionUtils.renotifyAnomaly(anomaly); } return Response.ok().build(); }
Source:
<code>private void registerContributors(RegistryPageContributor contributor, List<String> objectClassNames) { pages.add(contributor); for (String <START> string : <END> objectClassNames) { manager.registerContributor(contributor, string); } }</code><technical_language>rename className</technical_language>

Target:
private void registerContributors(RegistryPageContributor contributor, List<String> objectClassNames) { pages.add(contributor); for (String className : objectClassNames) { manager.registerContributor(contributor, className); } }
Source:
<code>public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { <START> @NonNull Set<@NonNull Integer> quark = new TreeSet<>(); quark.add(((CounterTreeViewerEntry) entry).getQuark()); <END> counterChartViewer.updateChart(quark); } } }</code><technical_language>element? try singleton set</technical_language>

Target:
public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { counterChartViewer.updateChart(((CounterTreeViewerEntry) entry).getQuark()); } } }
Source:
<code>private void testNumBackendCalls(boolean optimizeFooterRead) throws Exception { final AzureBlobFileSystem fs = getFileSystem(optimizeFooterRead); for (int i = 1; i <= 4; i++) { String fileName = methodName.getMethodName() + i; <START> int fileSize = i * ONE_MB; <END> byte[] fileContent = getRandomBytesArray(fileSize); Path testFilePath = createFileWithContent(fs, fileName, fileContent); int length = AbfsInputStream.FOOTER_SIZE; try (FSDataInputStream iStream = fs.open(testFilePath)) { byte[] buffer = new byte[length]; Map<String, Long> metricMap = fs.getInstrumentationMap(); long requestsMadeBeforeTest = metricMap .get(CONNECTIONS_MADE.getStatName()); iStream.seek(fileSize - 8); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TEN * ONE_KB)); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TWENTY * ONE_KB)); iStream.read(buffer, 0, length); metricMap = fs.getInstrumentationMap(); long requestsMadeAfterTest = metricMap .get(CONNECTIONS_MADE.getStatName()); if (optimizeFooterRead) { assertEquals(1, requestsMadeAfterTest - requestsMadeBeforeTest); } else { assertEquals(3, requestsMadeAfterTest - requestsMadeBeforeTest); } } } }</code><technical_language>For testing of footer read optimized, a file is atleast 3 4 times buffer size. For testing purposes, filesize of 1 mb is good, set buffer a smaller size config</technical_language>

Target:
private void testNumBackendCalls(boolean optimizeFooterRead) throws Exception { for (int i = 1; i <= 4; i++) { int fileSize = i * ONE_MB; final AzureBlobFileSystem fs = getFileSystem(optimizeFooterRead, fileSize); String fileName = methodName.getMethodName() + i; byte[] fileContent = getRandomBytesArray(fileSize); Path testFilePath = createFileWithContent(fs, fileName, fileContent); int length = AbfsInputStream.FOOTER_SIZE; try (FSDataInputStream iStream = fs.open(testFilePath)) { byte[] buffer = new byte[length]; Map<String, Long> metricMap = getInstrumentationMap(fs); long requestsMadeBeforeTest = metricMap .get(CONNECTIONS_MADE.getStatName()); iStream.seek(fileSize - 8); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TEN * ONE_KB)); iStream.read(buffer, 0, length); iStream.seek(fileSize - (TWENTY * ONE_KB)); iStream.read(buffer, 0, length); metricMap = getInstrumentationMap(fs); long requestsMadeAfterTest = metricMap .get(CONNECTIONS_MADE.getStatName()); if (optimizeFooterRead) { assertEquals(1, requestsMadeAfterTest - requestsMadeBeforeTest); } else { assertEquals(3, requestsMadeAfterTest - requestsMadeBeforeTest); } } } }
Source:
<code><START> public static String timestampMillis() { <END> long now = System.currentTimeMillis(); long sec = now / 1000L; long msec = now % 1000L; return String.valueOf(sec) + "." + String.valueOf(msec); }</code><technical_language>this String = String.valueOf(System.currentTimeMillis()); return String.format("%s-%s", now.substring(0, now.length()-3), now.substring(now.length()-3, now.length()));</technical_language>

Target:
public static String timestampMillis() { long now = System.currentTimeMillis(); long secs = TimeUnit.MILLISECONDS.toSeconds(now); long msecs = now - TimeUnit.SECONDS.toMillis(secs); return String.format("%d.%03d", secs, msecs); }
Source:
<code>public int liveMemberCount() { <START> return callsOnInstance(() -> Gossiper.instance.getLiveMembers().size()).call(); <END> }</code><technical_language>add check for Gossiper#isEnabled throw a reasonable exception instead of relying note</technical_language>

Target:
public int liveMemberCount() { return sync(() -> Gossiper.instance.getLiveMembers()).call().size(); }
Source:
<code>void read() { for (int bookieIndex : writeSet) { InetSocketAddress to = ensemble.get(bookieIndex); try { sendReadTo(to, this); } catch (InterruptedException ie) { LOG.error("Interrupted reading entry : ", this, ie); Thread.currentThread().interrupt(); <START> fail(BKException.Code.InterruptedException); <END> return; } } }</code><technical_language>read failure is a fail()? success is good right</technical_language>

Target:
void read() { for (int bookieIndex : writeSet) { BookieSocketAddress to = ensemble.get(bookieIndex); try { sendReadTo(to, this); } catch (InterruptedException ie) { LOG.error("Interrupted reading entry : ", this, ie); Thread.currentThread().interrupt(); fail(BKException.Code.InterruptedException); return; } } }
Source:
<code>protected void perform(HttpAction action) { <START> Cache cache = SPARQL_Query_Cache.getCache(); <END> cache.clear(); ContentType ct = FusekiLib.getContentType(action) ; if ( ct == null ) ct = ctSPARQLUpdate ; if ( matchContentType(ctSPARQLUpdate, ct) ) { executeBody(action) ; return ; } if ( isHtmlForm(ct) ) { executeForm(action) ; return ; } ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ; }</code><technical_language>A more subtle approach clear cache if action through. If fails chance is data, need clear cache</technical_language>

Target:
protected void perform(HttpAction action) { Cache cache = SPARQL_Query_Cache.getCache(SPARQL_Query_Cache.getDatasetUri(action)); cache.clear(); ContentType ct = FusekiLib.getContentType(action) ; if ( ct == null ) ct = ctSPARQLUpdate ; if ( matchContentType(ctSPARQLUpdate, ct) ) { executeBody(action) ; return ; } if ( isHtmlForm(ct) ) { executeForm(action) ; return ; } ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Bad content type: " + action.request.getContentType()) ; }
Source:
<code>private String getErrorCode(String responseBody) { try { JSONObject jsonObj = new JSONObject(responseBody); return jsonObj.getString("error_code"); } catch (JSONException ex) { String error = "Unable to get error_code from 401 response"; logger.warn(error); <START> return error; <END> } }</code><technical_language>semantically return null, add a check for switching it</technical_language>

Target:
private String getErrorCode(String responseBody) { try { JSONObject jsonObj = new JSONObject(responseBody); return jsonObj.getString("error_code"); } catch (JSONException ex) { logger.warn("Unable to get error_code from 401 response"); return null; } }
Source:
<code>private ObjectId writeAndReadBackFromTempFile(ObjectId objectId) throws Exception { File file = File.createTempFile("ObjectIdSerializerTest_", ""); <START> ObjectIdSerializer.write(new FileOutputStream(file), objectId); <END> return ObjectIdSerializer.read(new FileInputStream(file)); }</code><technical_language>close streams</technical_language>

Target:
private ObjectId writeAndReadBackFromTempFile(ObjectId objectId) throws Exception { File file = File.createTempFile("ObjectIdSerializerTest_", ""); try (OutputStream out = new FileOutputStream(file)) { ObjectIdSerializer.write(out, objectId); } try (InputStream in = new FileInputStream(file)) { return ObjectIdSerializer.read(in); } }
Source:
<code><START> public LogCommand add(ObjectId start) throws MissingObjectException, <END> IncorrectObjectTypeException, IOException { return add(true, start); }</code><technical_language>Actually, of ObjectId a parameter AnyObjectId instead. This permits mutable variant passed in. a problem, caller change return. issue here, a lookup of object in RevWalk holding located result. copying given, OK MutableObjectId variant</technical_language>

Target:
public LogCommand add(ObjectId start) throws MissingObjectException, IncorrectObjectTypeException, JGitInternalException { return add(true, start); }
Source:
<code>public Collector<?, ?, ?> build(Type containerType) { Class<? extends Enum> componentType = (Class<? extends Enum>) findGenericParameter(containerType, EnumSet.class) .map(GenericTypes::getErasedType) .orElseThrow(() -> new IllegalStateException("Cannot determine EnumSet element type")); return Collector.of( () -> EnumSet.noneOf(componentType), EnumSet::add, (left, right) -> { if (left.size() < right.size()) { right.addAll(left); return right; } else { left.addAll(right); return left; <START> } <END> }, Function.identity()); }</code><technical_language>This optimization is redundant. JDK implementations of EnumSet override addAll(Collection) check received set is EnumSet, do a bitwise of bit fields quickly combine sets. - <LINK_1> - <LINK_0> - <LINK_2></technical_language>

Target:
public Collector<?, ?, ?> build(Type containerType) { Class<? extends Enum> componentType = (Class<? extends Enum>) findGenericParameter(containerType, EnumSet.class) .map(GenericTypes::getErasedType) .orElseThrow(() -> new IllegalStateException("Cannot determine EnumSet element type")); return Collector.of( () -> EnumSet.noneOf(componentType), EnumSet::add, (left, right) -> { left.addAll(right); return left; }, Function.identity()); }
Source:
<code>public SpatialIndexBuilderOperatorFactory( int operatorId, PlanNodeId planNodeId, List<Type> types, List<Integer> outputChannels, int indexChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<String> kdbTreeJson, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); List<Type> outputTypes = outputChannels.stream() .map(types::get) .collect(toImmutableList()); pagesSpatialIndexFactory = new PagesSpatialIndexFactory(types, outputTypes); this.indexChannel = indexChannel; this.radiusChannel = radiusChannel; this.partitionChannel = requireNonNull(partitionChannel, "partitionChannel is null"); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = requireNonNull(filterFunctionFactory, "filterFunctionFactory is null"); this.pagesIndexFactory = pagesIndexFactory; this.expectedPositions = expectedPositions; <START> kdbTreeJson.ifPresent(json -> this.spatialPartitions.putAll(KDB_TREE_CODEC.fromJson(json).findAllLeafNodes())); <END> }</code><technical_language>This parsing done in planner part, moment read this tree table</technical_language>

Target:
public SpatialIndexBuilderOperatorFactory( int operatorId, PlanNodeId planNodeId, List<Type> types, List<Integer> outputChannels, int indexChannel, Optional<Integer> radiusChannel, Optional<Integer> partitionChannel, SpatialPredicate spatialRelationshipTest, Optional<String> kdbTreeJson, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); List<Type> outputTypes = outputChannels.stream() .map(types::get) .collect(toImmutableList()); pagesSpatialIndexFactory = new PagesSpatialIndexFactory(types, outputTypes); this.indexChannel = indexChannel; this.radiusChannel = radiusChannel; this.partitionChannel = requireNonNull(partitionChannel, "partitionChannel is null"); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = requireNonNull(filterFunctionFactory, "filterFunctionFactory is null"); this.pagesIndexFactory = pagesIndexFactory; this.expectedPositions = expectedPositions; kdbTreeJson.ifPresent(json -> this.spatialPartitions.putAll(KdbTreeUtils.fromJson(json).getLeaves())); }
Source:
<code>private String formatAccountAttribute(AccountAttribute who) { String name = anonymousCowardName; <START> if (who != null && who.name != null) { <END> name = who.name; } return name; }</code><technical_language>This done temporary variable. if (who != null && who.name != null) { return who.name; } return anonymousCowardName;</technical_language>

Target:
private String formatAccountAttribute(AccountAttribute who) { if (who != null && who.name != null) { return who.name; } return anonymousCowardName; }
Source:
<code>public int run() throws IOException { Preconditions.checkArgument(target != null, "A Parquet file is required."); Path inputFile = new Path(target); Map<String, Long> columnSizes = getColumnSizeInBytes(inputFile); Map<String, Float> columnPercentage = getColumnPercentage(columnSizes); if (columns != null && columns.size() > 0) { for (String inputColumn : columns) { long size = 0; float percentage = 0; <START> for (String column : columnSizes.keySet()) { <END> if (column.startsWith(inputColumn)) { size += columnSizes.get(column); percentage += columnPercentage.get(column); } } console.info(inputColumn + "->" + " Size In Bytes: " + size + " Size In Percentage: " + percentage); } } else { for (String column : columnSizes.keySet()) { console.info(column + "->" + " Size In Bytes: " + columnSizes.get(column) + " Size In Percentage: " + columnPercentage.get(column)); } } return 0; }</code><technical_language>I this behavior is misleading. if columns in file id identity want query size of column id? I suggest checking equality simply print result instead of summarizing</technical_language>

Target:
public int run() throws IOException { Preconditions.checkArgument(target != null, "A Parquet file is required."); Path inputFile = new Path(target); Map<String, Long> columnSizes = getColumnSizeInBytes(inputFile); Map<String, Float> columnRatio = getColumnRatio(columnSizes); if (columns != null && columns.size() > 0) { for (String inputColumn : columns) { long size = 0; float ratio = 0; for (String column : columnSizes.keySet()) { if (column.equals(inputColumn) || column.startsWith(inputColumn + ".")) { size += columnSizes.get(column); ratio += columnRatio.get(column); } } console.info(inputColumn + "->" + " Size In Bytes: " + size + " Size In Ratio: " + ratio); } } else { for (String column : columnSizes.keySet()) { console.info(column + "->" + " Size In Bytes: " + columnSizes.get(column) + " Size In Ratio: " + columnRatio.get(column)); } } return 0; }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree block = methodTree.block(); if (block != null) { CloseableVisitor visitor = new CloseableVisitor(methodTree.parameters(), this); block.accept(visitor); for (Tree issueTree : visitor.getIssueTrees()) { Type reportedType = null; if(issueTree.is(Tree.Kind.ASSIGNMENT)) { reportedType = ((AssignmentExpressionTree) issueTree).expression().symbolType(); } else if(issueTree.is(Tree.Kind.VARIABLE)) { reportedType = ((VariableTree) issueTree).initializer().symbolType(); } else if(issueTree.is(Tree.Kind.NEW_CLASS)) { reportedType = ((NewClassTree) issueTree).symbolType(); } <START> addIssue(issueTree, String.format("Close this \"%s\".", reportedType.name())); <END> } } }</code><technical_language>new: ![CRITICAL](<LINK_0> null pointer dereference of reportedType in org.sonar.java.checks.CloseResourceCheck.visitNode(Tree)[![...](<LINK_1>](<LINK_2></technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree block = methodTree.block(); if (block != null) { CloseableVisitor visitor = new CloseableVisitor(methodTree.parameters()); block.accept(visitor); for (Tree issueTree : visitor.getIssueTrees()) { Type reportedType = null; if(issueTree.is(Tree.Kind.ASSIGNMENT)) { reportedType = ((AssignmentExpressionTree) issueTree).expression().symbolType(); } else if(issueTree.is(Tree.Kind.VARIABLE)) { reportedType = ((VariableTree) issueTree).initializer().symbolType(); } else if(issueTree.is(Tree.Kind.NEW_CLASS)) { reportedType = ((NewClassTree) issueTree).symbolType(); } addIssue(issueTree, String.format("Close this \"%s\".", reportedType.name())); } } }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getParameters().getQuotaId(), VdcObjectType.Quota, <START> ActionGroup.CONSUME_QUOTA)); <END> return permissionList; }</code><technical_language>I this is correct. Consider changing a disk QuotaA instead of QuotaB. assume need ManipulateDisk disk, consume QuotaB, no</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getParameters().getQuotaId(), VdcObjectType.Quota, getActionType().getActionGroup())); return permissionList; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { <START> ConditionalBreakpointDialog dialog = new ConditionalBreakpointDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), injector); <END> dialog.create(); dialog.open(); dialog.getReturnCode(); return null; }</code><technical_language>get active workbench shell ExecutionEvent instead of a Java debugger internal class, line HandlerUtil.getActiveWorkbenchShell(event)</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ConditionalBreakpointDialog dialog = new ConditionalBreakpointDialog(HandlerUtil.getActiveShell(event), injector); dialog.create(); dialog.open(); dialog.getReturnCode(); return null; }
Source:
<code>public MutateRowRequest adapt(RowMutations mutations) { <START> Mutation mutation = Mutation.create(); <END> mutationAdapters.rowMutationsAdapter.adapt(mutations, mutation); return toMutateRowRequest(mutations.getRow(), mutation); }</code><technical_language>I a RowMutation model</technical_language>

Target:
public MutateRowRequest adapt(RowMutations mutations) { RowMutation rowMutation = newRowMutationModel(mutations.getRow()); adapt(mutations, rowMutation); return rowMutation.toProto(requestContext); }
Source:
<code>public MojoParameterMetadataProvider(MavenProject project, Plugin plugin) { this.project = project; this.plugin = plugin; maven = (MavenImpl) MavenPlugin.getMaven(); <START> parameters = new HashMap<String, List<MojoParameter>>(); <END> }</code><technical_language>please diamond operator, i.e. "<>", instead of type parameters. reduces clutter code easier maintain</technical_language>

Target:
public MojoParameterMetadataProvider(MavenProject project, Plugin plugin) { this.project = project; this.plugin = plugin; maven = (MavenImpl) MavenPlugin.getMaven(); parameters = new HashMap<>(); }
Source:
<code>private BufferedImage takeScreenshotAsImage(WebDriver webdriver, WebElement element) { if (!(webdriver instanceof TakesScreenshot)) { log.warn("Cannot take screenshot because browser does not support screenshots"); return null; } byte[] screen = ((TakesScreenshot) webdriver).getScreenshotAs(OutputType.BYTES); Point elementLocation = element.getLocation(); try { BufferedImage img = ImageIO.read(new ByteArrayInputStream(screen)); int elementWidth = element.getSize().getWidth(); int elementHeight = element.getSize().getHeight(); if (elementWidth > img.getWidth()) { elementWidth = img.getWidth() - elementLocation.getX(); } if (elementHeight > img.getHeight()) { elementHeight = img.getHeight() - elementLocation.getY(); } return img.getSubimage(elementLocation.getX(), elementLocation.getY(), elementWidth, elementHeight); } catch (IOException e) { <START> log.error("Failed to take screenshot of " + element, e); <END> return null; } catch (RasterFormatException e) { log.warn("Cannot take screenshot because element is not displayed on current screen position"); return null; } }</code><technical_language>Format</technical_language>

Target:
private BufferedImage takeScreenshotAsImage(WebDriver webdriver, WebElement element) { if (!(webdriver instanceof TakesScreenshot)) { log.warn("Cannot take screenshot because browser does not support screenshots"); return null; } byte[] screen = ((TakesScreenshot) webdriver).getScreenshotAs(OutputType.BYTES); Point elementLocation = element.getLocation(); try { BufferedImage img = ImageIO.read(new ByteArrayInputStream(screen)); int elementWidth = element.getSize().getWidth(); int elementHeight = element.getSize().getHeight(); if (elementWidth > img.getWidth()) { elementWidth = img.getWidth() - elementLocation.getX(); } if (elementHeight > img.getHeight()) { elementHeight = img.getHeight() - elementLocation.getY(); } return img.getSubimage(elementLocation.getX(), elementLocation.getY(), elementWidth, elementHeight); } catch (IOException e) { log.error("Failed to take screenshot of {}", element, e); return null; } catch (RasterFormatException e) { log.warn("Cannot take screenshot because element is not displayed on current screen position"); return null; } }
Source:
<code>private void notifyListeners(Repository repository, IndexDiffData indexDiffData) { IndexDiffChangedListener[] tmpListeners; synchronized (listeners) { tmpListeners = listeners .toArray(new IndexDiffChangedListener[listeners.size()]); } <START> for (int i = 0; i < tmpListeners.length; i++) { <END> tmpListeners[i].indexDiffChanged(repository, indexDiffData); } }</code><technical_language>style nit: braces</technical_language>

Target:
private void notifyListeners(Repository repository, IndexDiffData indexDiffData) { IndexDiffChangedListener[] tmpListeners; synchronized (listeners) { tmpListeners = listeners .toArray(new IndexDiffChangedListener[listeners.size()]); } for (int i = 0; i < tmpListeners.length; i++) tmpListeners[i].indexDiffChanged(repository, indexDiffData); }
Source:
<code>private void createImageForMemoryDump() { StorageDomainStatic storageDomainStatic = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, memoryDumpImageGroupId, vm.getTotalMemorySizeInBytes(), <START> HibernateVmCommand.getMemoryVolumeTypeForPool(storageDomainStatic.getStorageType()), <END> VolumeFormat.RAW, memoryDumpVolumeId, "")); if (!retVal.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.VolumeCreationError, "Failed to create image for memory!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_MEMORY_DUMP_TASK_KEY); Guid guid = enclosingCommand.createTask(taskId, retVal.getCreationInfo(), enclosingCommand.getActionType(), VdcObjectType.Storage, storageDomainId); enclosingCommand.getTaskIdList().add(guid); }</code><technical_language>method name getMemoryVolumeTypeForPool is wrong now, call getMemoryVolumeTypeForDomain</technical_language>

Target:
private void createImageForMemoryDump() { StorageDomainStatic storageDomainStatic = DbFacade.getInstance().getStorageDomainStaticDao().get(storageDomainId); VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, memoryDumpImageGroupId, vm.getTotalMemorySizeInBytes(), HibernateVmCommand.getMemoryVolumeTypeForStorageDomain(storageDomainStatic.getStorageType()), VolumeFormat.RAW, memoryDumpVolumeId, "")); if (!retVal.getSucceeded()) { throw new VdcBLLException(VdcBllErrors.VolumeCreationError, "Failed to create image for memory!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_MEMORY_DUMP_TASK_KEY); Guid guid = enclosingCommand.createTask(taskId, retVal.getCreationInfo(), enclosingCommand.getActionType(), VdcObjectType.Storage, storageDomainId); enclosingCommand.getTaskIdList().add(guid); }