auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public <T> UpdateResults update(final T entity, final UpdateOperations<T> operations) { if (entity instanceof Query) { return update((Query<T>) entity, operations); } return update((Query<T>) createQuery(mapper.getMappedClass(entity).getClazz()) .disableValidation() .filter(Mapper.ID_KEY, mapper.getId(entity)), <START> operations); <END> }</code><technical_language>Is this code well-covered tests? spot moved is in ways I understand (like line 715 go, set turn inc?)</technical_language>

Target:
public <T> UpdateResults update(final T entity, final UpdateOperations<T> operations) { if (entity instanceof Query) { return update((Query<T>) entity, operations); } final MappedClass mc = mapper.getMappedClass(entity); Query<?> query = createQuery(mapper.getMappedClass(entity).getClazz()) .disableValidation() .filter(Mapper.ID_KEY, mapper.getId(entity)); if (!mc.getFieldsAnnotatedWith(Version.class).isEmpty()) { final MappedField field = mc.getFieldsAnnotatedWith(Version.class).get(0); query.field(field.getNameToStore()).equal(field.getFieldValue(entity)); } return update((Query<T>) query, operations); }
Source:
<code>public void testPendingReadLacOpMissingExplicitLAC() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, 2, BookKeeper.DigestType.CRC32, pwd); lh.append(data); lh.append(data); lh.append(data); final CompletableFuture<Long> result = new CompletableFuture<>(); PendingReadLacOp pro = new PendingReadLacOp(lh, (rc, lac) -> result.complete(lac)) { @Override public void initiate() { for (int i = 0; i < lh.metadata.currentEnsemble.size(); i++) { <START> final Integer index = new Integer(i); <END> ByteBufList buffer = lh.getDigestManager().computeDigestAndPackageForSending( 2, 1, data.length, Unpooled.wrappedBuffer(data)); bkc.scheduler.schedule(() -> { readLacComplete( 0, lh.getId(), null, Unpooled.copiedBuffer(buffer.toArray()), index); }, 0, TimeUnit.SECONDS); lh.bk.getBookieClient().readLac(lh.metadata.currentEnsemble.get(i), lh.ledgerId, this, i); } } }; pro.initiate(); assertEquals(1, result.get().longValue()); }</code><technical_language>pass "i" in readLacComplate</technical_language>

Target:
public void testPendingReadLacOpMissingExplicitLAC() throws Exception { LedgerHandle lh = bkc.createLedger(3, 3, 2, BookKeeper.DigestType.CRC32, pwd); lh.append(data); lh.append(data); lh.append(data); final CompletableFuture<Long> result = new CompletableFuture<>(); PendingReadLacOp pro = new PendingReadLacOp(lh, (rc, lac) -> result.complete(lac)) { @Override public void initiate() { for (int i = 0; i < lh.metadata.currentEnsemble.size(); i++) { final int index = i; ByteBufList buffer = lh.getDigestManager().computeDigestAndPackageForSending( 2, 1, data.length, Unpooled.wrappedBuffer(data)); bkc.scheduler.schedule(() -> { readLacComplete( 0, lh.getId(), null, Unpooled.copiedBuffer(buffer.toArray()), index); }, 0, TimeUnit.SECONDS); lh.bk.getBookieClient().readLac(lh.metadata.currentEnsemble.get(i), lh.ledgerId, this, i); } } }; pro.initiate(); assertEquals(1, result.get().longValue()); }
Source:
<code>private static CloseableHttpAsyncClient createNoSSLClient() { <START> TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; <END> SSLContext sslContext = null; try { sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); } catch (Exception e) { logger.error("Could not create SSLContext"); } return HttpAsyncClients.custom() .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) .setSSLContext(sslContext).build(); }</code><technical_language>final is missing</technical_language>

Target:
private static CloseableHttpAsyncClient createNoSSLClient() { final TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; try { final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); return HttpAsyncClients.custom() .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) .setSSLContext(sslContext).build(); } catch (Exception e) { logger.error("Could not create SSLContext",e); return null; } }
Source:
<code>public void validateClientId(FacesContext context, UIComponent component, Object value) { <START> OAuth2ClientService clientService = Framework.getService(OAuth2ClientService.class); <END> if (!(component instanceof UIInput && value instanceof String)) { return; } Object currentValue = ((UIInput) component).getValue(); if (currentValue != null && currentValue.equals(value)) { return; } if (clientService.hasClient((String) value)) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ComponentUtils.translate(context, "label.oauth2.existing.clientId"), null); throw new ValidatorException(message); } }</code><technical_language>I moved this if (clientService.hasClient((String) value))</technical_language>

Target:
public void validateClientId(FacesContext context, UIComponent component, Object value) { if (!(component instanceof UIInput && value instanceof String)) { return; } Object currentValue = ((UIInput) component).getValue(); if (currentValue != null && currentValue.equals(value)) { return; } OAuth2ClientService clientService = Framework.getService(OAuth2ClientService.class); if (clientService.hasClient((String) value)) { FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ComponentUtils.translate(context, "label.oauth2.existing.clientId"), null); throw new ValidatorException(message); } }
Source:
<code>public List<GroupInfo> parseGroupInfos(JsonElement result) throws RestApiException { List<GroupInfo> list = null; SortedMap<String, GroupInfo> map = gson.fromJson(result, GROUP_MAP_TYPE); <START> list = new ArrayList(map.values()); <END> return list; }</code><technical_language>Variable need, returned directly. please initialize type (ArrayList<GroupInfo>)</technical_language>

Target:
public List<GroupInfo> parseGroupInfos(JsonElement result) throws RestApiException { SortedMap<String, GroupInfo> map = gson.fromJson(result, GROUP_MAP_TYPE); return new ArrayList(map.values()); }
Source:
<code>private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String fileName = f.getName(); if (FileKey.isGitRepository(f, FS.DETECTED)) { <START> if (fileName.equals(Constants.DOT_GIT)) { <END> continue; } Project.NameKey nameKey = getProjectName(prefix, fileName); if (isUnreasonableName(nameKey)) { log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath()); } else { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }</code><technical_language>This skipped test isGitRepository()</technical_language>

Target:
private void scanProjects(final File dir, final String prefix, final SortedSet<Project.NameKey> names) { final File[] ls = dir.listFiles(); if (ls == null) { return; } for (File f : ls) { String fileName = f.getName(); if (fileName.equals(Constants.DOT_GIT)) { } else if (FileKey.isGitRepository(f, FS.DETECTED)) { Project.NameKey nameKey = getProjectName(prefix, fileName); if (isUnreasonableName(nameKey)) { log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath()); } else { names.add(nameKey); } } else if (f.isDirectory()) { scanProjects(f, prefix + f.getName() + "/", names); } } }
Source:
<code>public void shouldValidateEmailAddress_withValidEmailAddresses() { final List<String> validEmails = new ArrayList<String>(); validEmails.add("prettyandsimple@example.com"); validEmails.add("very.common@example.com"); validEmails.add("disposable.style.email.with+symbol@example.com"); validEmails.add("other.email-with-dash@example.com"); validEmails.add("x@example.com"); validEmails.add("example-indeed@strange-example.com"); validEmails.add("admin@mailserver1"); validEmails.add("#!$%&'*+-/=?^_`{}|~@example.org"); validEmails.add("example@localhost"); validEmails.add("example@s.solutions"); validEmails.add("user@com"); validEmails.add("user@localserver"); validEmails.add("john..doe@example.com"); <START> final List<String> wrongValidatedEmails = new ArrayList<>(); <END> for (final String email : validEmails) { try { Check.isValidEmail(field, email); } catch (final ValidationException e) { wrongValidatedEmails.add(email); } } if (!wrongValidatedEmails.isEmpty()) { fail("Expected to validate the following email addresses, but were actually invalidated: " + wrongValidatedEmails); } }</code><technical_language>Rename this variable invalidatedEmails</technical_language>

Target:
public void shouldValidateEmailAddress_withValidEmailAddresses() { final List<String> validEmails = new ArrayList<String>(); validEmails.add("prettyandsimple@example.com"); validEmails.add("very.common@example.com"); validEmails.add("disposable.style.email.with+symbol@example.com"); validEmails.add("other.email-with-dash@example.com"); validEmails.add("x@example.com"); validEmails.add("example-indeed@strange-example.com"); validEmails.add("admin@mailserver1"); validEmails.add("#!$%&'*+-/=?^_`{}|~@example.org"); validEmails.add("example@localhost"); validEmails.add("example@s.solutions"); validEmails.add("user@com"); validEmails.add("user@localserver"); validEmails.add("john..doe@example.com"); final List<String> invalidatedEmails = new ArrayList<>(); for (final String email : validEmails) { try { Check.isValidEmail(field, email); } catch (final ValidationException e) { invalidatedEmails.add(email); } } if (!invalidatedEmails.isEmpty()) { fail("Expected to validate the following email addresses, but were actually invalidated: " + invalidatedEmails); } }
Source:
<code>public PreviousPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateDataSets") final List<PreviousPeriodDateDataSet> dateDataSets) { <START> this.measureIdentifier = notNull(measureIdentifier, "'measureIdentifier' must not be null!"); <END> this.dateDataSets = notEmpty(dateDataSets, "'dateDataSets' list must not be empty!"); }</code><technical_language>validation</technical_language>

Target:
public PreviousPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateDataSets") final List<PreviousPeriodDateDataSet> dateDataSets) { this.measureIdentifier = notNull(measureIdentifier, "measureIdentifier"); this.dateDataSets = notEmpty(dateDataSets, "dateDataSets"); }
Source:
<code>public void testRejectedExecution() { Client client = new Client(getContext(), "api-key"); for (int k = 0; k < MAX_ALLOWED_TASKS * 2; k++) { client.notify(new Throwable()); <START> } <END> }</code><technical_language>test some time, reports written disk</technical_language>

Target:
public void testRejectedExecution() throws Exception { assertEquals(0, errorStorageDir.listFiles().length); for (int k = 0; k < TASK_COUNT; k++) { client.notify(new Throwable("Rejected Execution")); } File[] files = errorStorageDir.listFiles(); assertTrue(files.length > 0); File errorFile = files[0]; ErrorStoreTest.checkFirstErrorReportFile(errorFile); }
Source:
<code><START> public static void main(String args[]){ <END> List<String> params = new ArrayList<String>(); params.add("--plugin"); params.add(${workflow-name}Decider.class.getCanonicalName()); params.add("--"); params.addAll(Arrays.asList(args)); System.out.println("Parameters: " + Arrays.deepToString(params.toArray())); net.sourceforge.seqware.pipeline.runner.PluginRunner.main(params.toArray(new String[params.size()])); }</code><technical_language>A parameter allowing control of PluginRunner --verbose option helpful</technical_language>

Target:
public static void main(String args[]){ List<String> params = new ArrayList<String>(); if (ArrayUtils.contains(args,"--verbose")){ params.add("--verbose"); } params.add("--plugin"); params.add(${workflow-name}Decider.class.getCanonicalName()); params.add("--"); params.addAll(Arrays.asList(args)); System.out.println("Parameters: " + Arrays.deepToString(params.toArray())); net.sourceforge.seqware.pipeline.runner.PluginRunner.main(params.toArray(new String[params.size()])); }
Source:
<code>private static void initFileSystem() throws IOException { Configuration conf = new Configuration(); <START> conf.set("FS.defaultFS", STORAGE_URL); <END> jailedFileSystem.initialize(LocalFileSystem.getDefaultUri(conf), conf); }</code><technical_language>uppercase fs</technical_language>

Target:
private static void initFileSystem() throws IOException { Configuration conf = new Configuration(); conf.set("fs.defaultFS", STORAGE_URL); jailedFileSystem.initialize(LocalFileSystem.getDefaultUri(conf), conf); }
Source:
<code>protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException { ClassDescriptor baseClassDescriptor = getClassDescriptor(); List<?> extentClassNames = baseClassDescriptor.getExtentClassNames(); <START> if (extentClassNames.size() != 1) { <END> throw new PersistenceBrokerException("The class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should have had exactly 1 extent class, but instead had " + extentClassNames.size()); } String extentClassName = (String) extentClassNames.get(0); ClassDescriptor extentClassDescriptor = baseClassDescriptor.getRepository().getDescriptorFor(extentClassName); if (extentClassDescriptor == null) { throw new PersistenceBrokerException("Could not find " + extentClassName + " extent class descriptor for base class " + baseClassDescriptor.getClassNameOfObject()); } return extentClassDescriptor; }</code><technical_language>this greater 1? I extent classes defined return super's selectClassDescriptor baseClassDescriptor</technical_language>

Target:
protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException { ClassDescriptor baseClassDescriptor = getClassDescriptor(); List<?> extentClassNames = baseClassDescriptor.getExtentClassNames(); if (extentClassNames.size() != 1) { throw new PersistenceBrokerException("The class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should have had exactly 1 extent class, but instead had " + extentClassNames.size() + " extents: " + extentClassNames); } String extentClassName = (String) extentClassNames.get(0); ClassDescriptor extentClassDescriptor = baseClassDescriptor.getRepository().getDescriptorFor(extentClassName); if (extentClassDescriptor == null) { throw new PersistenceBrokerException("Could not find " + extentClassName + " extent class descriptor for base class " + baseClassDescriptor.getClassNameOfObject()); } else if (StringUtils.equals(baseClassDescriptor.getClassNameOfObject(), extentClassDescriptor.getClassNameOfObject())) { throw new PersistenceBrokerException("The base class descriptor for " + baseClassDescriptor.getClassNameOfObject() + " should not have been selected as the implicit descriptor for extent class " + extentClassName); } return extentClassDescriptor; }
Source:
<code>public Scope getScope(String name, int tenantId) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { try (PreparedStatement preparedStatement = connection.prepareStatement(SQLConstants.GET_SCOPE_SQL)) { preparedStatement.setString(1, name); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { if (resultSet.next()) { String displayName = resultSet.getString("DISPLAY_NAME"); String description = resultSet.getString("DESCRIPTION"); Scope scope = new Scope(); scope.setName(displayName); scope.setDescription(description); scope.setKey(name); scope.setRoles(String.join(",", getScopeBindings(connection, name, tenantId))); return scope; } } } catch (SQLException e) { log.error("Error while deleting scopes from db", e); <START> throw new APIManagementException("Error while deleting scopes from db", e, <END> ExceptionCodes.INTERNAL_ERROR); } } catch (SQLException e) { throw new APIManagementException("Error while retrieving database connection", e, ExceptionCodes.INTERNAL_ERROR); } return null; }</code><technical_language>suggestion throw new APIManagementException("Error while retrieving scopes db", e,</technical_language>

Target:
public Scope getScope(String name, int tenantId) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { try (PreparedStatement preparedStatement = connection.prepareStatement(SQLConstants.GET_SCOPE_SQL)) { preparedStatement.setString(1, name); preparedStatement.setInt(2, tenantId); try (ResultSet resultSet = preparedStatement.executeQuery()) { if (resultSet.next()) { String displayName = resultSet.getString("DISPLAY_NAME"); String description = resultSet.getString("DESCRIPTION"); Scope scope = new Scope(); scope.setName(displayName); scope.setDescription(description); scope.setKey(name); scope.setRoles(String.join(",", getScopeBindings(connection, name, tenantId))); return scope; } } } catch (SQLException e) { String msg = String.format("Error while retrieving scope %s from db", name); log.error(msg, e); throw new APIManagementException(msg, e, ExceptionCodes.INTERNAL_ERROR); } } catch (SQLException e) { throw new APIManagementException("Error while retrieving database connection", e, ExceptionCodes.INTERNAL_ERROR); } return null; }
Source:
<code>protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); <START> path.next(); END> StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName()); while (path.hasNext()) { cat.append(".").append(path.next()); } return cat.toString(); }</code><technical_language>do: java Node method = path.next(); logger.debug("Violations method {}: {}", method, violation); hackey ;)</technical_language>

Target:
protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); Node method = path.next(); logger.debug("Constraint violation on method {}: {}", method, violation); StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName()); while (path.hasNext()) { cat.append(".").append(path.next()); } return cat.toString(); }
Source:
<code>public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_RENAME) .setSince("6.6") <START> .setDescription("Rename the main branch of a project") <END> .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("New name of the main branch") .setExampleValue("master") .setRequired(true); }</code><technical_language>Please add permission needed => "Requires 'Administer' permission project"</technical_language>

Target:
public void define(NewController context) { WebService.NewAction action = context.createAction(ACTION_RENAME) .setSince("6.6") .setDescription("Rename the main branch of a project. <br />" + "Requires 'Administer' permission on the specified project.") .setInternal(true) .setPost(true) .setHandler(this); action .createParam(PARAM_PROJECT) .setDescription("Project key") .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setRequired(true); action .createParam(PARAM_BRANCH) .setDescription("New name of the main branch") .setExampleValue("master") .setRequired(true); }
Source:
<code>protected void applyMutation(Mutation uncastMutation) { AssociatedMutation mutation = (AssociatedMutation) uncastMutation; MutatableCode mutatableCode = mutation.mutatableCode; MInsn newArrayInsn = newArrayLengthInsns.get(mutation.newArrayToChangeIdx); int newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); if (newArrayInsnIdx < 0) { newArrayInsn = scanNewArray(mutatableCode); if (newArrayInsn == null) { return; } <START> newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); <END> } MInsn newInsn = new MInsn(); newInsn.insn = new Instruction(); newInsn.insn.info = Instruction.getOpcodeInfo(Opcode.CONST_16); mutatableCode.allocateTemporaryVRegs(1); newArrayInsn.insn.vregB = mutatableCode.getTemporaryVReg(0); newInsn.insn.vregA = (int) newArrayInsn.insn.vregB; newInsn.insn.vregB = rng.nextInt(100); mutatableCode.insertInstructionAt(newInsn, newArrayInsnIdx); Log.info("Changed the length of the array to " + newInsn.insn.vregB); stats.incrementStat("Changed length of new array"); mutatableCode.finishedUsingTemporaryVRegs(); }</code><technical_language>this is I meant. is/was a loop *in* a loop, a loop *after* loop (both in original). I meant is scan instructions in method find a new-array. Then, found, call indexOf, scans instructions, this time find index. index while scanning, in L148, a bit of logic (see in dexfuzz)</technical_language>

Target:
protected void applyMutation(Mutation uncastMutation) { AssociatedMutation mutation = (AssociatedMutation) uncastMutation; MutatableCode mutatableCode = mutation.mutatableCode; MInsn newArrayInsn = newArrayLengthInsns.get(mutation.newArrayToChangeIdx); int newArrayInsnIdx = mutatableCode.getInstructionIndex(newArrayInsn); if (newArrayInsnIdx < 0) { newArrayInsnIdx = scanNewArray(mutatableCode); if (newArrayInsnIdx == -1) { return; } } MInsn newInsn = new MInsn(); newInsn.insn = new Instruction(); newInsn.insn.info = Instruction.getOpcodeInfo(Opcode.CONST_16); mutatableCode.allocateTemporaryVRegs(1); newArrayInsn.insn.vregB = mutatableCode.getTemporaryVReg(0); newInsn.insn.vregA = (int) newArrayInsn.insn.vregB; newInsn.insn.vregB = rng.nextInt(100); mutatableCode.insertInstructionAt(newInsn, newArrayInsnIdx); Log.info("Changed the length of the array to " + newInsn.insn.vregB); stats.incrementStat("Changed length of new array"); mutatableCode.finishedUsingTemporaryVRegs(); }
Source:
<code>public void shouldFillInWarningIfChePluginDoesNotHaveAnyContainersButThereAreRelatedCommands() throws Exception { ChePlugin chePlugin = createChePlugin("plugin"); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); CommandImpl pluginCommand = new CommandImpl("test-command", "echo Hello World!", "custom"); pluginCommand.getAttributes().put("plugin", pluginRef); internalEnvironment.getCommands().add(pluginCommand); applier.apply(internalEnvironment, singletonList(chePlugin)); List<Warning> envWarnings = internalEnvironment.getWarnings(); assertEquals(envWarnings.size(), 1); Warning warning = envWarnings.get(0); <START> assertEquals(warning.getCode(), 44012); <END> assertEquals( warning.getMessage(), "There are configured commands for plugin 'some-id:0.0.3' that doesn't have any containers"); }</code><technical_language>is reuse constants magic numbers</technical_language>

Target:
public void shouldFillInWarningIfChePluginDoesNotHaveAnyContainersButThereAreRelatedCommands() throws Exception { ChePlugin chePlugin = createChePlugin("plugin"); String pluginRef = chePlugin.getId() + ":" + chePlugin.getVersion(); CommandImpl pluginCommand = new CommandImpl("test-command", "echo Hello World!", "custom"); pluginCommand.getAttributes().put("plugin", pluginRef); internalEnvironment.getCommands().add(pluginCommand); applier.apply(internalEnvironment, singletonList(chePlugin)); List<Warning> envWarnings = internalEnvironment.getWarnings(); assertEquals(envWarnings.size(), 1); Warning warning = envWarnings.get(0); assertEquals( warning.getCode(), Warnings.COMMAND_IS_CONFIGURED_IN_PLUGIN_WITHOUT_CONTAINERS_WARNING_CODE); assertEquals( warning.getMessage(), "There are configured commands for plugin 'some-id:0.0.3' that doesn't have any containers"); }
Source:
<code>public void testRunMultipleQueries_ignored_failure() { ArrayList<VdcQueryType> queryTypeList = new ArrayList<VdcQueryType>(); queryTypeList.add(VdcQueryType.Search); ArrayList<VdcQueryParametersBase> queryParamsList = new ArrayList<VdcQueryParametersBase>(); queryParamsList.add(new SearchParameters("*win*", SearchType.VM)); Frontend.RunMultipleQueries(queryTypeList, queryParamsList, mockMultipleQueryCallback, "test", mockService); verify(mockService).RunMultipleQueries(eq(queryTypeList), eq(queryParamsList), callbackMultipleQueries.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); <START> callbackMultipleQueries.getValue().onFailure(exception); <END> }</code><technical_language>assertion end here</technical_language>

Target:
public void testRunMultipleQueries_ignored_failure() { ArrayList<VdcQueryType> queryTypeList = new ArrayList<VdcQueryType>(); queryTypeList.add(VdcQueryType.Search); ArrayList<VdcQueryParametersBase> queryParamsList = new ArrayList<VdcQueryParametersBase>(); queryParamsList.add(new SearchParameters("*win*", SearchType.VM)); Frontend.RunMultipleQueries(queryTypeList, queryParamsList, mockMultipleQueryCallback, "test", mockService); verify(mockService).RunMultipleQueries(eq(queryTypeList), eq(queryParamsList), callbackMultipleQueries.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackMultipleQueries.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), any(FrontendFailureEventArgs.class)); }
Source:
<code>public void onProcessSelectionEvent(@Observes final ProcessDefSelectionEvent event) { String containerId = event.getDeploymentId(); String serverTemplateId = event.getServerTemplateId(); String processId = event.getProcessId(); processImageService.call((String svgContent) -> displayImage(svgContent), <START> (String message, Throwable throwable) -> { <END> displayImage(""); return false; }).getProcessDiagram(serverTemplateId, containerId, processId); }</code><technical_language>I in general avoid remote callback error this suppress other errors. handle spec management call, testing if container is started not</technical_language>

Target:
public void onProcessSelectionEvent(@Observes final ProcessDefSelectionEvent event) { String containerId = event.getDeploymentId(); String serverTemplateId = event.getServerTemplateId(); String processId = event.getProcessId(); processImageService.call((String svgContent) -> displayImage(svgContent)).getProcessDiagram(serverTemplateId, containerId, processId); }
Source:
<code>@Override public void onDisconnect() { if (isBound) { <START> context.unbindService(this); <END> } Intent intent = new Intent(context, FusedLocationProviderService.class); context.stopService(intent); service = null; }</code><technical_language>I set isBound = false here. onServiceDisconnected is called client is unbound normally. docs, onServiceDisconnected is called process hosting service is killed/crashed</technical_language>

Target:
@Override public void onDisconnect() { if (isBound) { context.unbindService(this); isBound = false; } Intent intent = new Intent(context, FusedLocationProviderService.class); context.stopService(intent); service = null; }
Source:
<code>public ResponseEntity<Category> createCategory(@RequestBody @Valid Category category) { String currentUsername = ControllerUtil.getCurrentLoggedUsername(); <START> System.out.println(" >>>> Username: " + currentUsername); <END> AppUser user = appUserDao.findUserByUsername(currentUsername); category.setUser(user); Category responseCategory = categoryDao.save(category); return new ResponseEntity<Category>(responseCategory, HttpStatus.OK); }</code><technical_language>remove System.out.println, logger.info if is necessary</technical_language>

Target:
public ResponseEntity<Category> createCategory(@RequestBody @Valid Category category) { String currentUsername = ControllerUtil.getCurrentLoggedUsername(); AppUser user = appUserDao.findByUsername(currentUsername); category.setUser(user); Category responseCategory = categoryDao.save(category); return new ResponseEntity<Category>(responseCategory, HttpStatus.OK); }
Source:
<code>public String getUpdateFieldLog(String fieldName, String previousValue, String value){ return "Updated "+ fieldName + " {"+ (previousValue != null? "From: '"+ previousValue + "' to: " : "" ) + <START> "'"+ (value != null ? value : "" ) + "'}" ; <END> }</code><technical_language>Correct if I wrong, in case previousValue is null new is 'value' output: Updated fieldName {'value'}. want include 'From... to' clause in cases</technical_language>

Target:
public String getUpdateFieldLog(String fieldName, String previousValue, String value){ return "Updated "+ fieldName + " {From: '"+ (previousValue!=null ? previousValue : "" ) + "' to: '"+ (value!=null ? value : "" ) + "'}" ; }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(keyTable[i]); sb.append(" -> "); <START> sb.append(object.toString()); <END> sb.append("\n"); } } return sb.toString(); }</code><technical_language>object.toString() a null-safe call, while sb.append(Object arg) is 'String.valueOf(arg), a null-safe Object-to-String conversion. call toString() here</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); Object object; for (int i = 0, length = valueTable.length; i < length; i++) { if ((object = valueTable[i]) != null) { sb.append(keyTable[i]); sb.append(" -> "); sb.append(object); sb.append("\n"); } } return sb.toString(); }
Source:
<code>public TypeInference getTypeInference(DataTypeFactory typeFactory) { TypeInference.Builder builder = TypeInference.newBuilder(); <START> builder.outputTypeStrategy(new ResultTypeStrategy(this)); <END> return builder.build(); }</code><technical_language>I guess need a matching input type strategy validation work properly</technical_language>

Target:
public TypeInference getTypeInference(DataTypeFactory typeFactory) { TypeInference.Builder builder = TypeInference.newBuilder(); builder.inputTypeStrategy(new HiveUDFInputStrategy()); builder.outputTypeStrategy(new HiveUDFOutputStrategy()); return builder.build(); }
Source:
<code><START> public PrinterController(Printer printer) { <END> super(printer); }</code><technical_language>In opinion is layer of abstraction. I remove AbstractPrinterController do in PrinterController</technical_language>

Target:
public PrinterController(Printer printer) { this.printer = printer; }
Source:
<code>public Void call() throws Exception { init(); OzoneConfiguration configuration = createOzoneConfiguration(); fileSystem = FileSystem.get(URI.create(rootPath), configuration); Path file = new Path(rootPath + "/" + generateObjectName(0)); try (FSDataInputStream stream = fileSystem.open(file)) { referenceDigest = getDigest(stream); } <START> timer = getMetrics().timer("gile-read"); <END> runTests(this::validateFile); return null; }</code><technical_language>suggestion timer = getMetrics().timer("file-read");</technical_language>

Target:
public Void call() throws Exception { init(); OzoneConfiguration configuration = createOzoneConfiguration(); fileSystem = FileSystem.get(URI.create(rootPath), configuration); Path file = new Path(rootPath + "/" + generateObjectName(0)); try (FSDataInputStream stream = fileSystem.open(file)) { referenceDigest = getDigest(stream); } timer = getMetrics().timer("file-read"); runTests(this::validateFile); return null; }
Source:
<code>private MoveOrCopyImageGroupParameters createCopyParams(DiskImage diskImage) { <START> Guid destImageGroupID = Guid.newGuid(); Guid srcStorageDomainID = diskImage.getStorageIds().get(0); Map<DiskImage, DiskImage> oldToNewDiskImageMap = imagesHandler.mapChainToNewIDs(diskImage.getId(), destImageGroupID, getParameters().getDestStorageDomainId()); getParameters().getSrcToDstChainMap() .put(destImageGroupID, oldToNewDiskImageMap .keySet() .stream() .collect(Collectors.toMap(di -> di.getImageId(), di -> oldToNewDiskImageMap.get(di)))); List<DiskImage> newChain = new ArrayList(oldToNewDiskImageMap.values()); imagesHandler.sortImageList(newChain); <END> MoveOrCopyImageGroupParameters p = new MoveOrCopyImageGroupParameters(diskImage.getImageId(), srcStorageDomainID, getParameters().getDestStorageDomainId(), ImageOperation.Copy); p.setAddImageDomainMapping(false); p.setVolumeFormat(diskImage.getVolumeFormat()); p.setVolumeType(diskImage.getVolumeType()); p.setUseCopyCollapse(false); p.setWipeAfterDelete(diskImage.isWipeAfterDelete()); p.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); p.setParentParameters(getParameters()); p.setParentCommand(getActionType()); p.setJobWeight(Job.MAX_WEIGHT); p.setDestImages(newChain); p.setImageGroupID(diskImage.getId()); p.setDestImageGroupId(destImageGroupID); return p; }</code><technical_language>more readable extract this logic a deferent method getNewImagesChain()</technical_language>

Target:
private MoveOrCopyImageGroupParameters createCopyParams(DiskImage diskImage) { Guid srcStorageDomainID = diskImage.getStorageIds().get(0); Guid destImageGroupID = Guid.newGuid(); List<DiskImage> newChain = prepareImageChainMap(diskImage, destImageGroupID); MoveOrCopyImageGroupParameters p = new MoveOrCopyImageGroupParameters(diskImage.getImageId(), srcStorageDomainID, getParameters().getDestStorageDomainId(), ImageOperation.Copy); p.setAddImageDomainMapping(false); p.setVolumeFormat(diskImage.getVolumeFormat()); p.setVolumeType(diskImage.getVolumeType()); p.setUseCopyCollapse(false); p.setWipeAfterDelete(diskImage.isWipeAfterDelete()); p.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); p.setParentParameters(getParameters()); p.setParentCommand(getActionType()); p.setJobWeight(Job.MAX_WEIGHT); p.setDestImages(newChain); p.setImageGroupID(diskImage.getId()); p.setDestImageGroupId(destImageGroupID); return p; }
Source:
<code>public void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fLocation = File.createTempFile("sample", ".xml"); try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) { braf.writeBytes(TRACE_START); <START> for (int i = 0; i < 100; i++) { <END> braf.writeBytes(makeEvent(i * 100, i % 4)); } braf.writeBytes(TRACE_END); } }</code><technical_language>extract 100 NUM_EVENTS</technical_language>

Target:
public void init() throws IOException { SWTBotUtils.failIfUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new ConsoleAppender(new SimpleLayout())); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToTracingPerspective(); SWTBotUtils.waitForJobs(); fLocation = File.createTempFile("sample", ".xml"); try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) { braf.writeBytes(TRACE_START); for (int i = 0; i < NUM_EVENTS; i++) { braf.writeBytes(makeEvent(i * 100, i % 4)); } braf.writeBytes(TRACE_END); } }
Source:
<code>void populate(final int row, final AccountGroupIncludeByUuid k) { AccountGroup.UUID uuid = k.getIncludeUUID(); CheckBox checkBox = new CheckBox(); table.setWidget(row, 1, checkBox); checkBox.setEnabled(enabled); if (AccountGroup.isInternalGroup(uuid)) { table.setWidget(row, 2, new Hyperlink(groups.get(uuid).getName(), Dispatcher.toGroup(uuid))); table.setText(row, 3, groups.get(uuid).getDescription()); } else { <START> table.setText(row, 2, uuid.get()); <END> table.setText(row, 3, Util.C.externalGroup()); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, k); }</code><technical_language>showing group name here. means a GroupDescription serialized network GroupBackend</technical_language>

Target:
void populate(final int row, final AccountGroupIncludeByUuid k) { AccountGroup.UUID uuid = k.getIncludeUUID(); CheckBox checkBox = new CheckBox(); table.setWidget(row, 1, checkBox); checkBox.setEnabled(enabled); if (AccountGroup.isInternalGroup(uuid)) { table.setWidget(row, 2, new Hyperlink(groups.get(uuid).getName(), Dispatcher.toGroup(uuid))); table.setText(row, 3, groups.get(uuid).getDescription()); } else { table.setText(row, 2, uuid.get()); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, k); }
Source:
<code>private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastDbBackup = getLastBackupByScope(BACKUP_SCOPE.DB); EngineBackupLog lastFilesBackup = getLastBackupByScope(BACKUP_SCOPE.FILES); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : <START> lastFilesBackupDate; <END> long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }</code><technical_language>Please reformat: Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate;</technical_language>

Target:
private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastDbBackup = getLastBackupByScope(BackupScope.DB); EngineBackupLog lastFilesBackup = getLastBackupByScope(BackupScope.FILES); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }
Source:
<code>protected RexCall( RelDataType type, SqlOperator op, List<? extends RexNode> operands) { this.type = Objects.requireNonNull(type); this.op = Objects.requireNonNull(op); this.operands = ImmutableList.copyOf(operands); <START> this.digest = computeDigest(isA(SqlKind.CAST) <END> || isA(SqlKind.NEW_SPECIFICATION)); assert op.getKind() != null : op; assert op.validRexOperands(operands.size(), Litmus.THROW) : this; }</code><technical_language>I avoid public access of digest field. case RexCall is created digest is used. In case digest computation a waste of resources</technical_language>

Target:
protected RexCall( RelDataType type, SqlOperator op, List<? extends RexNode> operands) { this.type = Objects.requireNonNull(type); this.op = Objects.requireNonNull(op); this.operands = ImmutableList.copyOf(operands); assert op.getKind() != null : op; assert op.validRexOperands(operands.size(), Litmus.THROW) : this; }
Source:
<code>private boolean isAllowed(@Nonnull SlimefunBackpack backpack, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return true; } <START> SlimefunItem sfitem = SlimefunItem.getByItem(item); if (backpack instanceof HazmatBackpack && !(sfitem instanceof Radioactive)) { return false; } if (sfitem instanceof Radioactive && !(backpack instanceof HazmatBackpack)) { return false; } <END> return backpack.isItemAllowed(item, sfitem); }</code><technical_language>This logic absolutely happen here... applied in isItemAllowed method of respective backpack, non-nuclear for normal nuclear for hazmat ones</technical_language>

Target:
private boolean isAllowed(@Nonnull SlimefunBackpack backpack, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return true; } return backpack.isItemAllowed(item, SlimefunItem.getByItem(item)); }
Source:
<code>private void init() { Logger.init(this.getApplicationContext()); application = this; registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); Environment env = new Environment(); env.setupEnvironment(this.getApplicationContext()); createImageCache(); <START> CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() <END> .setDefaultFontPath("fonts/fontawesome-webfont-4.3.0.ttf") .build() ); if (Config.getInstance().getSegmentConfig().isEnabled()) { SegmentFactory.makeInstance(this); } if (Config.getInstance().getFabricConfig().isEnabled()) { Fabric.with(this, new Crashlytics()); } if (Config.getInstance().getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(Config.getInstance().getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext()); if ( !isOnZeroRatedNetwork && Config.getInstance().getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(Config.getInstance().getFacebookConfig().getFacebookAppId()); } if ( Config.getInstance().isNotificationEnabled() ){ Config.ParseNotificationConfig parseNotificationConfig = Config.getInstance().getParseNotificationConfig(); if ( parseNotificationConfig.isEnabled() ) { Parse.enableLocalDatastore(this); Parse.initialize(this, parseNotificationConfig.getParseApplicationId(), parseNotificationConfig.getParseClientKey()); tryToUpdateParseForAppUpgrade(this); } } new Storage(this).repairDownloadCompletionData(); EventBus.getDefault().registerSticky(this); }</code><technical_language>this Font Awesome default font for text? right</technical_language>

Target:
private void init() { Logger.init(this.getApplicationContext()); application = this; registerActivityLifecycleCallbacks(new MyActivityLifecycleCallbacks()); Environment env = new Environment(); env.setupEnvironment(this.getApplicationContext()); createImageCache(); if (Config.getInstance().getSegmentConfig().isEnabled()) { SegmentFactory.makeInstance(this); } if (Config.getInstance().getFabricConfig().isEnabled()) { Fabric.with(this, new Crashlytics()); } if (Config.getInstance().getNewRelicConfig().isEnabled()) { NewRelic.withApplicationToken(Config.getInstance().getNewRelicConfig().getNewRelicKey()) .withCrashReportingEnabled(false) .start(this); } boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext()); if ( !isOnZeroRatedNetwork && Config.getInstance().getFacebookConfig().isEnabled()) { com.facebook.Settings.setApplicationId(Config.getInstance().getFacebookConfig().getFacebookAppId()); } if ( Config.getInstance().isNotificationEnabled() ){ Config.ParseNotificationConfig parseNotificationConfig = Config.getInstance().getParseNotificationConfig(); if ( parseNotificationConfig.isEnabled() ) { Parse.enableLocalDatastore(this); Parse.initialize(this, parseNotificationConfig.getParseApplicationId(), parseNotificationConfig.getParseClientKey()); tryToUpdateParseForAppUpgrade(this); } } new Storage(this).repairDownloadCompletionData(); EventBus.getDefault().registerSticky(this); }
Source:
<code>private static String resolveFromAuthorizationHeader(HttpServletRequest request) { String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); <START> if (StringUtils.hasText(authorization) && authorization.toLowerCase().startsWith("bearer")) { <END> Matcher matcher = authorizationPattern.matcher(authorization); if (!matcher.matches()) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, "Bearer token is malformed", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return matcher.group("token"); } return null; }</code><technical_language>more efficient if lowercase entire string compare characters. instead do suggestion if (StringUtils.startsWithIgnoreCase(authorization, "bearer")) {</technical_language>

Target:
private static String resolveFromAuthorizationHeader(HttpServletRequest request) { String authorization = request.getHeader(HttpHeaders.AUTHORIZATION); if (StringUtils.startsWithIgnoreCase(authorization, "bearer")) { Matcher matcher = authorizationPattern.matcher(authorization); if (!matcher.matches()) { BearerTokenError error = new BearerTokenError(BearerTokenErrorCodes.INVALID_TOKEN, HttpStatus.UNAUTHORIZED, "Bearer token is malformed", "<LINK_0>"); throw new OAuth2AuthenticationException(error); } return matcher.group("token"); } return null; }
Source:
<code>private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean kaslrEnabled = vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); boolean secureBootEnabled = vm.getBiosType() == BiosType.Q35_SECURE_BOOT; if (!acpiEnabled && !hypervEnabled && !kaslrEnabled && !secureBootEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); Version version = vm.getCompatibilityVersion(); <START> if (version.getMajor() == 4 && version.getMinor() >= 3) { <END> writer.writeStartElement("synic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("stimer"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); } if (kaslrEnabled) { writer.writeElement("vmcoreinfo"); } if (secureBootEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }</code><technical_language>this is done vdc_option setting hardcoding</technical_language>

Target:
private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean kaslrEnabled = vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); boolean secureBootEnabled = vm.getBiosType() == BiosType.Q35_SECURE_BOOT; if (!acpiEnabled && !hypervEnabled && !kaslrEnabled && !secureBootEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); if (vm.getCompatibilityVersion().greaterOrEquals(Version.v4_3)) { writer.writeStartElement("synic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("stimer"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); } if (kaslrEnabled) { writer.writeElement("vmcoreinfo"); } if (secureBootEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }