auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static PsiElement searchInSameFile(@NotNull HaxeFileModel file, @NotNull String name) { List<HaxeClassModel> models = file.getClassModels(); final HaxeModel result = Stream.concat( models.stream().filter(model -> name.equals(model.getName())), models.stream().filter(HaxeClassModel::isEnum) .map(model -> model.getField(name)) <START> .filter(Objects::nonNull)) <END> .findFirst() .orElse(null); return result != null ? result.getBasePsi() : null; }</code><technical_language>This is a criticism; a realization of frailty: I hate I read this kind of stuff times I get it. straightforward me, I fear this style of code is lead maintenance headaches -- I wrong! get it. I if is a structure this code better? java final Stream modelStream = models.stream().filter(model -> name.equals(model.getName()); final Stream enumStream = models.stream().filter(HaxeClassModel::isEnum) .map(model -> model.getField(name)) .filter(Objects::nonNull)); final HaxeModel result = Stream.concat(modelStream, enumStream) .findFirst() .orElse(null); do think? strive for this style multiple streams interacting</technical_language>

Target:
public static PsiElement searchInSameFile(@NotNull HaxeFileModel file, @NotNull String name) { List<HaxeClassModel> models = file.getClassModels(); final Stream<HaxeClassModel> classesStream = models.stream().filter(model -> name.equals(model.getName())); final Stream<HaxeFieldModel> enumsStream = models.stream().filter(HaxeClassModel::isEnum) .map(model -> model.getField(name)) .filter(Objects::nonNull); final HaxeModel result = Stream.concat(classesStream, enumsStream) .findFirst() .orElse(null); return result != null ? result.getBasePsi() : null; }
Source:
<code>private boolean isSpecificDockerfileLocationSet(DockerFixture f) { <START> return f.dockerfile() != null && !"".equals(f.dockerfile().trim()); <END> }</code><technical_language>Annotation values null, @DockerFixture( , dockerfile=" ") user mistake, comparing "" is deprecated. This method inlined java !f.dockerfile().isEmpty()</technical_language>

Target:
private boolean isSpecificDockerfileLocationSet(DockerFixture f) { return !f.dockerfileFolder().isEmpty(); }
Source:
<code>public void testDynamicLoading() throws IOException, ClassNotFoundException { final String generatedJar = generatejar(); File file = new File(generatedJar); final Class<?> pojo = URLClassLoader.newInstance(new URL[]{file.toURI().toURL()}).loadClass("POJO"); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { TestGeneratorInputOperator genNode = dag.addOperator("genNode", TestGeneratorInputOperator.class); genNode.setMaxTuples(2); DynamicLoader dynamicLoader = dag.addOperator("DynamicLoader", new DynamicLoader()); dynamicLoader.setClass("POJO"); dag.addStream("fromNode1", genNode.outport, dynamicLoader.in); dag.setInputPortAttribute(dynamicLoader.in, Context.PortContext.TUPLE_CLASS, pojo); conf.set(LIBJARS_CONF_KEY_NAME, generatedJar); } }; <START> LocalMode.runApp(app, 10000); <END> FileUtils.forceDelete(new File("src/test/resources/dynamicJar/POJO.class")); FileUtils.forceDelete(new File("src/test/resources/dynamicJar/testPOJO.jar")); }</code><technical_language>Please structure unit tests wait for expected result instead of waiting for arbitrary time. examples in Malhar for this</technical_language>

Target:
public void testDynamicLoading() throws Exception { String generatedJar = generatejar("POJO"); URLClassLoader uCl = URLClassLoader.newInstance(new URL[] {new File(generatedJar).toURI().toURL()}); Class<?> pojo = uCl.loadClass("POJO"); DynamicLoaderApp app = new DynamicLoaderApp(); app.generatedJar = generatedJar; app.pojo = pojo; LocalMode lma = LocalMode.newInstance(); lma.prepareDAG(app, new Configuration()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); DynamicLoaderApp.latch.await(); Assert.assertTrue(DynamicLoaderApp.passed); lc.shutdown(); }
Source:
<code>public QueryResponse getFiles(@RequestParam("species") String species) <START> throws UnknownHostException, IllegalOpenCGACredentialsException, IOException { <END> initializeQueryOptions(); VariantSourceDBAdaptor variantSourceMongoDbAdaptor = DBAdaptorConnector.getVariantSourceDBAdaptor(species); return setQueryResponse(variantSourceMongoDbAdaptor.getAllSources(queryOptions)); }</code><technical_language>UnknownHostException removed</technical_language>

Target:
public QueryResponse getFiles(@RequestParam("species") String species) throws IllegalOpenCGACredentialsException, IOException { initializeQueryOptions(); VariantSourceDBAdaptor variantSourceMongoDbAdaptor = DBAdaptorConnector.getVariantSourceDBAdaptor(species); return setQueryResponse(variantSourceMongoDbAdaptor.getAllSources(queryOptions)); }
Source:
<code>public BulkheadEventsEndpointResponse getEventsFilteredByBulkheadName( @Selector String bulkheadName) { <START> java.util.List<BulkheadEventDTO> response = getBulkheadEvent(bulkheadName).stream() <END> .map(BulkheadEventDTOFactory::createBulkheadEventDTO) .collect(Collectors.toList()); return new BulkheadEventsEndpointResponse(response); }</code><technical_language>remove qualified name</technical_language>

Target:
public BulkheadEventsEndpointResponse getEventsFilteredByBulkheadName( @Selector String bulkheadName) { List<BulkheadEventDTO> response = getBulkheadEvent(bulkheadName).stream() .map(BulkheadEventDTOFactory::createBulkheadEventDTO) .collect(Collectors.toList()); return new BulkheadEventsEndpointResponse(response); }
Source:
<code>public void buildSlnCmdLineArgumentsTest() { FreeStyleJob job = msBuildJob("/msbuild_plugin/slnProject/", "project.sln", "/verbosity:detailed"); Build b = job.scheduleBuild(); b.shouldSucceed(); String console = b.getConsole(); assertThat(console, Matchers.containsString("Build succeeded.")); <START> assertThat(console, Matchers.containsString("Done Building Project")); <END> }</code><technical_language>btw - allOf(...) is a good asserting multiple matchers object</technical_language>

Target:
public void buildSlnCmdLineArgumentsTest() { FreeStyleJob job = msBuildJob("/msbuild_plugin/slnProject/", "project.sln", "/verbosity:detailed"); Build b = job.scheduleBuild(); b.shouldSucceed(); String console = b.getConsole(); assertThat(console, containsString("Build succeeded.")); assertThat(console, containsString("Done Building Project")); }
Source:
<code>public void writeTaskContainerMapping(String taskName, String containerId, TaskMode taskMode) { String existingContainerId = taskNameToContainerId.get(taskName); if (existingContainerId != null && !existingContainerId.equals(containerId)) { <START> LOG.info("Task \"{}\" moved from container to container {}", new Object[]{taskName, existingContainerId, containerId}); <END> } else { LOG.debug("Task \"{}\" assigned to container {}", taskName, containerId); } if (containerId == null) { taskContainerMappingMetadataStore.delete(taskName); taskModeMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } else { taskContainerMappingMetadataStore.put(taskName, containerIdSerde.toBytes(containerId)); taskModeMappingMetadataStore.put(taskName, taskModeSerde.toBytes(taskMode.toString())); taskNameToContainerId.put(taskName, containerId); } }</code><technical_language>Minor: update logs include mode</technical_language>

Target:
public void writeTaskContainerMapping(String taskName, String containerId, TaskMode taskMode) { String existingContainerId = taskNameToContainerId.get(taskName); if (existingContainerId != null && !existingContainerId.equals(containerId)) { LOG.info("Task \"{}\" in mode moved from container to container {}", new Object[]{taskName, taskMode, existingContainerId, containerId}); } else { LOG.debug("Task \"{}\" in mode assigned to container {}", taskName, taskMode, containerId); } if (containerId == null) { taskContainerMappingMetadataStore.delete(taskName); taskModeMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } else { taskContainerMappingMetadataStore.put(taskName, containerIdSerde.toBytes(containerId)); taskModeMappingMetadataStore.put(taskName, taskModeSerde.toBytes(taskMode.toString())); taskNameToContainerId.put(taskName, containerId); } }
Source:
<code>public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { log.debug("Obtaining STT"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); <START> postLogin.setHeader("Accept", ContentType.APPLICATION_JSON.toString()); <END> final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { throw new GoodDataAuthException("Unable to login: " + status); } final String sst = TokenUtils.extractSST(response); if (sst == null) { throw new GoodDataAuthException("Unable to login. Missing SST Set-Cookie header."); } return sst; } finally { postLogin.releaseConnection(); } }</code><technical_language>please consider [HttpHeaders constant](<LINK_0></technical_language>

Target:
public String obtainSst(final HttpClient httpClient, final HttpHost httpHost) throws IOException { log.debug("Obtaining STT"); final HttpPost postLogin = new HttpPost(LOGIN_URL); try { final HttpEntity requestEntity = new StringEntity(createLoginJson(), ContentType.APPLICATION_JSON); postLogin.setEntity(requestEntity); postLogin.setHeader(HttpHeaders.ACCEPT, YAML_CONTENT_TYPE); final HttpResponse response = httpClient.execute(httpHost, postLogin); int status = response.getStatusLine().getStatusCode(); if (status != HttpStatus.SC_OK) { throw new GoodDataAuthException("Unable to login: " + status); } return TokenUtils.extractToken(response); } finally { postLogin.releaseConnection(); } }
Source:
<code>void generateKeyPair(String workspaceId) { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); signatureKeyDao.create(kp); LOG.debug( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); } catch (NoSuchAlgorithmException | ConflictException | ServerException ex) { LOG.error( <START> "Unable to generate signature keypairs for ws {}. Cause: {}", <END> workspaceId, ex.getMessage()); } }</code><technical_language>Actually, is keypair for a workspace, it</technical_language>

Target:
SignatureKeyPair generateKeyPair(String workspaceId) throws NoSuchAlgorithmException, ServerException, ConflictException { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); final KeyPair pair = kpg.generateKeyPair(); final SignatureKeyPairImpl kp = new SignatureKeyPairImpl(workspaceId, pair.getPublic(), pair.getPrivate()); LOG.debug( "Generated signature key pair with ws id and algorithm {}.", kp.getWorkspaceId(), algorithm); return signatureKeyDao.create(kp); } catch (NoSuchAlgorithmException | ConflictException | ServerException ex) { LOG.error( "Unable to generate signature keypair for ws {}. Cause: {}", workspaceId, ex.getMessage()); throw ex; } }
Source:
<code>public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); <START> if (storage_pool != null && storage_pool.getcompatibility_version().compareTo(Version.v3_1) >= 0) { <END> addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); } return con; }</code><technical_language>is another check if operation is allowed version, instead of hardcoding this in code, configuration, check out example in: CreateStorageDomainVDSCommand</technical_language>

Target:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); con.put("id", (connection.getid() != null) ? connection.getid() : Guid.Empty.toString()); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && Version.v3_1.compareTo(storage_pool.getcompatibility_version()) <= 0) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addIfNotNullOrEmpty(con, connection.getNfsVersion(), "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }
Source:
<code>public static void check() { log.debug("mapOne:{}", mapOne); log.debug("mapTwo:{}", mapTwo); log.debug("mapThree:{}", mapThree); assertWithMessage( "The compared maps are not close enough: mapTwo: %s, mapThree: %s", mapTwo, mapThree) .that(mapTwo) <START> .comparingValuesUsing(Correspondence.tolerance(1.0E-4)) <END> .equals(mapThree); }</code><technical_language>a read [this page](<LINK_0> Truth website sort of general-rule-of-thumb tolerance aiming test against? I ask I a tolerance of 1.0E-4 pretty reasonable, I able reduce a smaller number if values in mapTwo tend small</technical_language>

Target:
public static void check() { log.debug("mapOne:{}", mapOne); log.debug("mapTwo:{}", mapTwo); log.debug("mapThree:{}", mapThree); assertThat(mapTwo.keySet()).isEqualTo(mapThree.keySet()); for (String key : mapTwo.keySet()) { Point p2 = mapTwo.get(key); Point p3 = mapThree.get(key); assertThat(p2.x).isWithin(1.0E-3).of(p3.x); assertThat(p2.y).isWithin(1.0E-3).of(p3.y); } }
Source:
<code>protected ImportValidator getImportValidator() { <START> return new ImportValidator(getParameters()); <END> }</code><technical_language>new time</technical_language>

Target:
protected ImportValidator getImportValidator() { if (importValidator == null) { importValidator = new ImportValidator(getParameters()); } return importValidator; }
Source:
<code>public void after() { STUDY.setExternalIdValidationEnabled(false); <START> EXT_ID.setSubstudyId(null); <END> BridgeUtils.setRequestContext(null); }</code><technical_language>Similarly, modify constants. instead member variables reinitialize test</technical_language>

Target:
public void after() { BridgeUtils.setRequestContext(null); }
Source:
<code>public static <M, K, WV> Window<M, K, WV> keyedTumblingWindow(Function<? super M, ? extends K> keyFn, Duration interval, Supplier<? extends WV> initialValue, FoldLeftFunction<? super M, WV> foldFn) { Trigger<M> defaultTrigger = new TimeTrigger<>(interval); <START> return new WindowInternal<>(defaultTrigger, initialValue::get, new FoldLeftFunction<M, WV>() { <END> @Override public WV apply(M message, WV oldValue) { return foldFn.apply(message, oldValue); } @Override public void init(Config config, TaskContext context) { foldFn.init(config, context); } }, keyFn::apply, null, WindowType.TUMBLING); }</code><technical_language>Issue: create wrapper functions here</technical_language>

Target:
public static <M, K, WV> Window<M, K, WV> keyedTumblingWindow(Function<? super M, ? extends K> keyFn, Duration interval, Supplier<? extends WV> initialValue, FoldLeftFunction<? super M, WV> foldFn) { Trigger<M> defaultTrigger = new TimeTrigger<>(interval); return new WindowInternal<>(defaultTrigger, (Supplier<WV>) initialValue, (FoldLeftFunction<M, WV>) foldFn, (Function<M, K>) keyFn, null, WindowType.TUMBLING); }
Source:
<code>public LabelAndConfigurationOutputFormatterCallback( ExtendedEventHandler eventHandler, CqueryOptions options, OutputStream out, SkyframeExecutor skyframeExecutor, TargetAccessor<ConfiguredTarget> accessor, boolean showKind) { <START> super(eventHandler, options, out, skyframeExecutor, accessor, showKind); <END> }</code><technical_language>I need showKind this line: private LabelAndConfigurationOutputFormatterCallback, CqueryThreadsafeCallback (or need know) exists. do want set private final field again, i.e. this.showKind = showKind</technical_language>

Target:
public LabelAndConfigurationOutputFormatterCallback( ExtendedEventHandler eventHandler, CqueryOptions options, OutputStream out, SkyframeExecutor skyframeExecutor, TargetAccessor<ConfiguredTarget> accessor, boolean showKind ) { super(eventHandler, options, out, skyframeExecutor, accessor); this.showKind = showKind; }
Source:
<code>public void enableUser(ByteBuffer username) { <START> if(disabledUsers.contains(username)) { <END> Iterator<ByteBuffer> it = disabledUsers.iterator(); while (it.hasNext()) { ByteBuffer user = it.next(); if (username.equals(user)) { it.remove(); break; } } } }</code><technical_language>iterate set, contains method. yet, remove method check if is contained</technical_language>

Target:
public void enableUser(ByteBuffer username) { long stamp = lock.writeLock(); try { short uid = getUidByUsername0(username); credentials.put(uid, ENABLED, true); } finally { lock.unlockWrite(stamp); } }
Source:
<code>public void testGt() { int v = 100; ConcreteIntPredicate gtP = gt(100); assertFalse(gtP.test(v)); assertFalse(gtP.test(v - 1)); assertTrue(gtP.test(v + 1)); assertEquals(gt(v), gtP); assertEquals(gt(v).hashCode(), gtP.hashCode()); assertNotEquals(lt(v), gtP); <START> assertNotEquals(lt(v).hashCode(), gtP.hashCode()); <END> assertNotEquals(gt(v + 1), gtP); assertNotEquals(gt(v + 1).hashCode(), gtP.hashCode()); assertEquals(gtP.toString(), "> 100"); }</code><technical_language>looked good tests? remove them? Hash collision</technical_language>

Target:
public void testGt() { int v = 100; ConcreteIntPredicate gtP = gt(100); assertFalse(gtP.test(v)); assertFalse(gtP.test(v - 1)); assertTrue(gtP.test(v + 1)); assertEquals(gt(v), gtP); assertEquals(gt(v).hashCode(), gtP.hashCode()); assertNotEquals(lt(v), gtP); assertNotEquals(gt(v + 1), gtP); assertEquals(gtP.toString(), "> 100"); }
Source:
<code>private List<DimFilter> makeBoundDimFilters() { List<DimFilter> boundDimFilters = new ArrayList<>(); for (Interval interval : intervals) { BoundDimFilter boundDimFilter = new BoundDimFilter( dimension, String.valueOf(interval.getStartMillis()), String.valueOf(interval.getEndMillis()), false, <START> false, <END> null, extractionFn, StringComparators.NUMERIC ); boundDimFilters.add(boundDimFilter); } return boundDimFilters; }</code><technical_language>ISO8601 intervals inclusive of start exclusive of end</technical_language>

Target:
private List<DimFilter> makeBoundDimFilters() { List<DimFilter> boundDimFilters = new ArrayList<>(); for (Pair<Long, Long> interval : intervalLongs) { BoundDimFilter boundDimFilter = new BoundDimFilter( dimension, String.valueOf(interval.lhs), String.valueOf(interval.rhs), false, true, null, extractionFn, StringComparators.NUMERIC ); boundDimFilters.add(boundDimFilter); } return boundDimFilters; }
Source:
<code><START> public void setAttributesAsText(Object element, String text) { <END> mSuper.setAttributesAsText(element, text); }</code><technical_language>hmm this follow pattern of other methods in this class? e.g. onSetAttributesAsText(E, String) method? In this case follow pattern set getNodeType() onGetNodeType(): default implementation of onGetNodeType() calls mSuper's implementation</technical_language>

Target:
public final void setAttributesAsText(Object element, String text) { onSetAttributesAsText((E)element, text); }
Source:
<code>public String contentAccessMode() { <START> return getContentAccessMode() == null ? "entitlement" : getContentAccessMode(); <END> }</code><technical_language>This a constant for default content access mode string definition. constant referenced mode defined constant is used</technical_language>

Target:
public String contentAccessMode() { return StringUtils.isEmpty(getContentAccessMode()) ? ContentAccessCertServiceAdapter.DEFAULT_CONTENT_ACCESS_MODE : getContentAccessMode(); }
Source:
<code>public void testInsertTemplateToUnregisteredEntity() { final String ovfExtraData = "<ovf> Some extra OVF data </ovf>"; OvfEntityData ovfEntityData = new OvfEntityData(FixturesTool.VM_TEMPLATE_RHEL5, "AnyVM", VmEntityType.TEMPLATE, ArchitectureType.x86_64, Version.v3_4, FixturesTool.STORAGE_DOAMIN_NFS2_1, null, ovfExtraData); dao.saveOVFData(ovfEntityData); List<OvfEntityData> fetchedOvfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOAMIN_NFS2_1); <START> assertFalse(fetchedOvfEntityData.isEmpty()); <END> assertTrue("The entity type should be template", fetchedOvfEntityData.get(0).getEntityType().isTemplateType()); assertTrue("The entity OVF extra data should be updated", fetchedOvfEntityData.get(0).getOvfExtraData() .equals(ovfExtraData)); }</code><technical_language>expect element, assert size is 1</technical_language>

Target:
public void testInsertTemplateToUnregisteredEntity() { final String ovfExtraData = "<ovf> Some extra OVF data </ovf>"; OvfEntityData ovfEntityData = new OvfEntityData(FixturesTool.VM_TEMPLATE_RHEL5, "AnyVM", VmEntityType.TEMPLATE, ArchitectureType.x86_64, Version.v3_4, FixturesTool.STORAGE_DOAMIN_NFS2_1, null, ovfExtraData); dao.saveOVFData(ovfEntityData); List<OvfEntityData> fetchedOvfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_TEMPLATE_RHEL5, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertTrue(fetchedOvfEntityData.size() == 1); assertTrue("The entity type should be template", fetchedOvfEntityData.get(0).getEntityType().isTemplateType()); assertTrue("The entity OVF extra data should be updated", fetchedOvfEntityData.get(0).getOvfExtraData() .equals(ovfExtraData)); }
Source:
<code>public void postWithUsernameAndTokenInBasicAuthHeader() throws Exception { FreeStyleProject p = j.createFreeStyleProject("bar"); j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); User.get("foo"); WebClient wc = createClientForUser("foo"); WebRequest wr = new WebRequest(new URL(j.getURL(), "job/bar/build"), HttpMethod.POST); <START> wc.addCrumb(wr); <END> assertEquals(201, wc.getPage(wr).getWebResponse().getStatusCode()); j.waitUntilNoActivity(); Cause.UserIdCause triggeredBy = p.getBuildByNumber(1).getCause(Cause.UserIdCause.class); assertEquals("foo", triggeredBy.getUserId()); }</code><technical_language>This unnecessary 2.96 so: Basic authenticated requests API token need a crumb anymore</technical_language>

Target:
public void postWithUsernameAndTokenInBasicAuthHeader() throws Exception { FreeStyleProject p = j.createFreeStyleProject("bar"); j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); User.get("foo"); WebClient wc = createClientForUser("foo"); WebRequest wr = new WebRequest(new URL(j.getURL(), "job/bar/build"), HttpMethod.POST); assertEquals(201, wc.getPage(wr).getWebResponse().getStatusCode()); j.waitUntilNoActivity(); Cause.UserIdCause triggeredBy = p.getBuildByNumber(1).getCause(Cause.UserIdCause.class); assertEquals("foo", triggeredBy.getUserId()); }
Source:
<code>public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentsInfo = getRequestParamValue(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO); Assumption.assertNotNull(studentsInfo); <START> <END> new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getCourse(courseId)); try { InstructorCourseEnrollResultPageData pageData = new InstructorCourseEnrollResultPageData(account); pageData.courseId = courseId; pageData.students = enrollAndProcessResultForDisplay(studentsInfo, courseId); statusToAdmin = "Students Enrolled in Course <span class=\"bold\">[" + courseId + "]:</span><br>" + (studentsInfo).replace("\n", "<br>"); return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL_RESULT, pageData); } catch (EnrollException | InvalidParametersException e) { setStatusForException(e); statusToAdmin += "<br>Enrollment string entered by user:<br>" + (studentsInfo).replace("\n", "<br>"); InstructorCourseEnrollPageData pageData = new InstructorCourseEnrollPageData(account); pageData.courseId = courseId; pageData.enrollStudents = studentsInfo; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, pageData); } }</code><technical_language>original line is correct. suspect Browser send null parameters conditions (e.g. reloading a page expired page). In cases, assertPostParamNotNull results in a drastic error message user instead of server error message. In fact assertPostParamNotNull in other places too. yet</technical_language>

Target:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentsInfo = getRequestParamValue(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO); Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENTS_ENROLLMENT_INFO, studentsInfo); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getCourse(courseId)); try { InstructorCourseEnrollResultPageData pageData = new InstructorCourseEnrollResultPageData(account); pageData.courseId = courseId; pageData.students = enrollAndProcessResultForDisplay(studentsInfo, courseId); statusToAdmin = "Students Enrolled in Course <span class=\"bold\">[" + courseId + "]:</span><br>" + (studentsInfo).replace("\n", "<br>"); return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL_RESULT, pageData); } catch (EnrollException | InvalidParametersException e) { setStatusForException(e); statusToAdmin += "<br>Enrollment string entered by user:<br>" + (studentsInfo).replace("\n", "<br>"); InstructorCourseEnrollPageData pageData = new InstructorCourseEnrollPageData(account); pageData.courseId = courseId; pageData.enrollStudents = studentsInfo; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, pageData); } }
Source:
<code>protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (storage_server_connections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } <START> return isDiskPassPciAndIdeLimit(getParameters().getDiskInfo()); <END> }</code><technical_language>some meaningful return code/error message I failed</technical_language>

Target:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (storage_server_connections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } return true; }
Source:
<code>protected static boolean validFieldName(String fieldName) { <START> String[] parts = fieldName.contains(".") ? fieldName.split("\\.") : new String[]{fieldName}; <END> for (String part: parts) { if (part.startsWith("$")) { String msg = String.format("Field names cannot start with a $ in field %s", part); logger.log(Level.SEVERE, msg); return false; } } return true; }</code><technical_language>need a contains check here, "mike".split("\\.") ==> [mike]</technical_language>

Target:
protected static boolean validFieldName(String fieldName) { String[] parts = fieldName.split("\\."); for (String part: parts) { if (part.startsWith("$")) { String msg = String.format("Field names cannot start with a $ in field %s", part); logger.log(Level.SEVERE, msg); return false; } } return true; }
Source:
<code>PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.time = time; <START> putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); <END> correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread", new ChunkFiller(), false); chunkFillerThread.start(); }</code><technical_language>a set backed a map</technical_language>

Target:
PutManager(ClusterMap clusterMap, ResponseHandler responseHandler, NotificationSystem notificationSystem, RouterConfig routerConfig, NonBlockingRouterMetrics routerMetrics, Time time) { this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.notificationSystem = notificationSystem; this.routerConfig = routerConfig; this.routerMetrics = routerMetrics; this.time = time; putOperations = Collections.newSetFromMap(new ConcurrentHashMap<PutOperation, Boolean>()); correlationIdToPutOperation = new HashMap<Integer, PutOperation>(); chunkFillerThread = Utils.newThread("ChunkFillerThread", new ChunkFiller(), true); chunkFillerThread.start(); }
Source:
<code>public SliceArrayBlock(int positionCount, Slice[] values) { this.positionCount = positionCount; if (values.length < positionCount) { <START> throw new IllegalArgumentException("values length is less than positionCount"); <END> } this.values = values; sizeInBytes = getSliceArraySizeInBytes(values); retainedSizeInBytes = INSTANCE_SIZE + getSliceArrayRetainedSizeInBytes(values); }</code><technical_language>this additional parameter (if possible) discussed in person</technical_language>

Target:
public SliceArrayBlock(int positionCount, Slice[] values) { this.positionCount = positionCount; if (values.length < positionCount) { throw new IllegalArgumentException("values length is less than positionCount"); } this.values = values; sizeInBytes = getSliceArraySizeInBytes(values, 0, values.length); retainedSizeInBytes = INSTANCE_SIZE + getSliceArrayRetainedSizeInBytes(values); }
Source:
<code>private WinRmClient(URL endpoint, String authenticationScheme) { this.authenticationScheme = authenticationScheme != null ? authenticationScheme : AuthSchemes.BASIC; this.endpoint = endpoint; <START> if (this.authenticationScheme.equals(AuthSchemes.NTLM)) { <END> Bus bus = BusFactory.getDefaultBus(); bus.getProperties().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bus.getProperties().put(AsyncHTTPConduitFactory.USE_POLICY, "ALWAYS"); } }</code><technical_language>split auth checks BASIC rest (which includes NTLM Kerberos right now). reason is Kerberos is handled identically NTLM, need differentiate two</technical_language>

Target:
private WinRmClient(URL endpoint, String authenticationScheme) { this.authenticationScheme = authenticationScheme != null ? authenticationScheme : AuthSchemes.NTLM; this.endpoint = endpoint; if (!this.authenticationScheme.equals(AuthSchemes.BASIC)) { Bus bus = BusFactory.getDefaultBus(); bus.getProperties().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bus.getProperties().put(AsyncHTTPConduitFactory.USE_POLICY, "ALWAYS"); } }
Source:
<code>private int updateInput(byte[] input, int offset, int len, boolean isFinal, byte[] output) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { int outputLen = 0; while (len > bufferSize) { updateData(input, offset, bufferSize, false); int remaining = outBuffer.remaining(); outBuffer.get(output, outputLen, remaining); outputLen += remaining; len -= bufferSize; offset += bufferSize; } <START> updateData(input, offset, len, isFinal); <END> return outputLen; }</code><technical_language>Is good check? if(len > 0 || isFinal) { updateData(input, offset, len, isFinal); }</technical_language>

Target:
private int updateInput(byte[] input, int offset, int len, boolean isFinal, byte[] output) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { int outputLen = 0; while (len > bufferSize) { updateData(input, offset, bufferSize, false); int remaining = outBuffer.remaining(); outBuffer.get(output, outputLen, remaining); outputLen += remaining; len -= bufferSize; offset += bufferSize; } if (len > 0 || isFinal) { updateData(input, offset, len, isFinal); } return outputLen; }
Source:
<code>private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final String nameOrEmail: reviewersToRemove) { final Account account = accountResolver.find(nameOrEmail); if (account == null) { writeError("error: reviewer does not exist \"" + nameOrEmail + "\"\n"); continue; } Account.Id accountId = account.getId(); final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { if (resultError.getType() == ReviewerResult.Error.Type.COULD_NOT_REMOVE) { final String message = resultError.getName(); String regex = accountId + "$"; <START> if (message.matches("^.* " + regex)) { <END> writeError("error: " + message.replaceAll(regex, "\"" + nameOrEmail + "\"\n")); } else { writeError("error: " + "\"" + nameOrEmail + "\" could not be removed\n"); } ok = false; } } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; String message; switch (resultError.getType()) { case ACCOUNT_NOT_FOUND: message = "account not found"; break; case ACCOUNT_INACTIVE: message = "account inactive"; break; case CHANGE_NOT_VISIBLE: message = "change is not visible to user"; break; default: message = "could not add reviewer"; } writeError("error: " + message + "\"" + resultError.getName() + "\"\n"); } return ok; }</code><technical_language>This regex work required anymore other change, right</technical_language>

Target:
private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final String nameOrEmail: reviewersToRemove) { final Account account = accountResolver.find(nameOrEmail); if (account == null) { writeError("error", "reviewer does not exist \"" + nameOrEmail + "\""); continue; } Account.Id accountId = account.getId(); final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { String message; switch (resultError.getType()) { case REMOVE_NOT_PERMITTED: message = "Not permitted to remove"; case COULD_NOT_REMOVE: default: message = "Could not remove"; } writeError("error", message + " \"" + nameOrEmail + "\""); ok = false; } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; String message; switch (resultError.getType()) { case ACCOUNT_NOT_FOUND: message = "account not found"; break; case ACCOUNT_INACTIVE: message = "account inactive"; break; case CHANGE_NOT_VISIBLE: message = "change is not visible to user"; break; default: message = "could not add reviewer"; } writeError("error", message + "\"" + resultError.getName() + "\"\n"); } return ok; }
Source:
<code>private void updateFavPointBox() { final int favCount = cache.getFavoritePoints(); <START> if (favCount >= 0 && !cache.getType().isEvent()) { <END> favoriteLine.left.setVisibility(View.VISIBLE); final int findsCount = cache.getFindsCount(); if (findsCount > 0) { favoriteLine.right.setText(res.getString(R.string.favorite_count_percent, favCount, (float) (favCount * 100) / findsCount)); } else { favoriteLine.right.setText(res.getString(R.string.favorite_count, favCount)); } } else { favoriteLine.left.setVisibility(View.GONE); } final LinearLayout layout = ButterKnife.findById(view, R.id.favpoint_box); final boolean supportsFavoritePoints = cache.supportsFavoritePoints(); layout.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE); if (!supportsFavoritePoints || cache.isOwner() || !Settings.isGCPremiumMember()) { return; } final ImageButton buttonAdd = ButterKnife.findById(view, R.id.add_to_favpoint); final ImageButton buttonRemove = ButterKnife.findById(view, R.id.remove_from_favpoint); final TextView text = ButterKnife.findById(view, R.id.favpoint_text); if (cache.isFavorite()) { buttonAdd.setVisibility(View.GONE); buttonRemove.setVisibility(View.VISIBLE); text.setText(R.string.cache_favpoint_on); } else { buttonAdd.setVisibility(View.VISIBLE); buttonRemove.setVisibility(View.GONE); text.setText(R.string.cache_favpoint_not_on); } if (!cache.isFound()) { buttonAdd.setEnabled(false); buttonAdd.setVisibility(View.GONE); buttonRemove.setEnabled(false); buttonRemove.setVisibility(View.GONE); } }</code><technical_language>suggestion if (favCount >= 0 && !cache.isEventCache()) {</technical_language>

Target:
private void updateFavPointBox() { final int favCount = cache.getFavoritePoints(); if (favCount >= 0 && !cache.isEventCache()) { favoriteLine.left.setVisibility(View.VISIBLE); final int findsCount = cache.getFindsCount(); if (findsCount > 0) { favoriteLine.right.setText(res.getString(R.string.favorite_count_percent, favCount, (float) (favCount * 100) / findsCount)); } else { favoriteLine.right.setText(res.getString(R.string.favorite_count, favCount)); } } else { favoriteLine.left.setVisibility(View.GONE); } final LinearLayout layout = ButterKnife.findById(view, R.id.favpoint_box); final boolean supportsFavoritePoints = cache.supportsFavoritePoints(); layout.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE); if (!supportsFavoritePoints || cache.isOwner() || !Settings.isGCPremiumMember()) { return; } final ImageButton buttonAdd = ButterKnife.findById(view, R.id.add_to_favpoint); final ImageButton buttonRemove = ButterKnife.findById(view, R.id.remove_from_favpoint); final TextView text = ButterKnife.findById(view, R.id.favpoint_text); if (cache.isFavorite()) { buttonAdd.setVisibility(View.GONE); buttonRemove.setVisibility(View.VISIBLE); text.setText(R.string.cache_favpoint_on); } else { buttonAdd.setVisibility(View.VISIBLE); buttonRemove.setVisibility(View.GONE); text.setText(R.string.cache_favpoint_not_on); } if (!cache.isFound()) { buttonAdd.setEnabled(false); buttonAdd.setVisibility(View.GONE); buttonRemove.setEnabled(false); buttonRemove.setVisibility(View.GONE); } }
Source:
<code>public AttributeSet filter(Attachment attachment) { List<Attribute> attrs = new ArrayList<>(); for (Attribute attr : getAttributes()) { if (attr.getAttachment() == attachment) { attrs.add(attr); } } <START> return new AttributeSet(attrs.toArray(new Attribute[attrs.size()])); <END> }</code><technical_language>I add a constructor Collection<Attribute> avoid create unnecessary array. ObjectModel a bit idea</technical_language>

Target:
public AttributeSet filter(Attachment attachment) { List<Attribute> attrs = new ArrayList<>(); for (Attribute attr : getAttributes()) { if (attr.getAttachment() == attachment) { attrs.add(attr); } } return new AttributeSet(attrs); }
Source:
<code>private void getClusterState( List<DiagnosticsReportSource> sources ) { if ( clusterStateDirectory == null ) { sources.add( DiagnosticsReportSources.newDiagnosticsString( "ccstate.txt", () -> "error creating ClusterStateDirectory: " + clusterStateException.getMessage() ) ); return; } for ( File file : fs.listFiles( clusterStateDirectory ) ) { <START> if ( file.getName().equals( RAFT_LOG_DIRECTORY_NAME ) ) <END> { continue; } addDirectory( "ccstate", file, sources ); } }</code><technical_language>a good idea supply filename filter instead 'fs.listFiles' argument</technical_language>

Target:
private void getClusterState( List<DiagnosticsReportSource> sources ) { if ( clusterStateDirectory == null ) { sources.add( DiagnosticsReportSources.newDiagnosticsString( "ccstate.txt", () -> "error creating ClusterStateDirectory: " + clusterStateException.getMessage() ) ); return; } for ( File file : fs.listFiles( clusterStateDirectory, ( dir, name ) -> !name.equals( RAFT_LOG_DIRECTORY_NAME ) ) ) { addDirectory( "ccstate", file, sources ); } }
Source:
<code>public void onTrimMemory(int level) { if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { <START> isInBackground = true; <END> } if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE) { MemoryCacheHelper.trimMemory(); } }</code><technical_language>I need this variable, [with level if app is in background](<LINK_0></technical_language>

Target:
public void onTrimMemory(int level) { if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE) { MemoryCacheHelper.trimMemory(); } }
Source:
<code>public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.raising.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); <START> Elevator.raising.set(false); <END> }</code><technical_language>before, elevator</technical_language>

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.lowering.set(false); Elevator.raising.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); Elevator.raising.set(false); Elevator.lowering.set(true); }
Source:
<code>protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = null; Object retval = null; String methodName = method.getDeclaringClass().getName() + "." + MethodExecutionResult.methodToString(method) + "." + ((instance == null) ? "" : " On instance of: " + instance.getClass().getName()); Class<?> retType = method.getReturnType(); try { convertedArgs = convertArgs(method, args); } catch (SlimError e) { throw e; } catch (Exception e) { throw e; } try { retval = callMethod(instance, method, convertedArgs); } catch (Exception e) { <START> System.out.println("InvokeMethod failed during invocation, you may want to check if the correct method signature has been identified by Slim: " + " : " + methodName); <END> throw e; } return new MethodExecutionResult(retval, retType); }</code><technical_language>Instead of writing System.out more create a logger (e.g. private static final Logger LOG = Logger.getLogger(SimpleInteraction.class.getName()); ) LOG.warn(...</technical_language>

Target:
protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = null; Object retval = null; Class<?> retType = method.getReturnType(); try { convertedArgs = convertArgs(method, args); } catch (Exception e) { String methodName = method.getDeclaringClass().getName() + "." + MethodExecutionResult.methodToString(method) + "." + ((instance == null) ? "" : " On instance of: " + instance.getClass().getName()); return new MethodExecutionResult.InvalidParameters(methodName, e); } retval = callMethod(instance, method, convertedArgs); return new MethodExecutionResult(retval, retType); }
Source:
<code>public void close(int code, String reason) { if ((transportConnection.getConnection() != null) && (transportConnection.getConnection().isOpen())) { transportConnection.close(code, reason); try { this.webSocketClient.getFactory().stop(); } catch (Exception ex) { log.error("error while stopping websocketfactory", ex); } <START> log.info("transport closed"); <END> } }</code><technical_language>debug level</technical_language>

Target:
public void close(int code, String reason) { if ((transportConnection.getConnection() != null) && (transportConnection.getConnection().isOpen())) { transportConnection.close(code, reason); try { this.webSocketClient.getFactory().stop(); } catch (Exception ex) { log.error("error while stopping websocketfactory", ex); } log.debug("transport closed"); } }
Source:
<code>protected boolean canDoAction() { serverService = getGlusterServerServiceDao().get(getParameters().getServerServiceId()); <START> <END> if (serverService == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_SERVICE_NOT_FOUND); } if (serverService.getStatus() == manageActionDetailsMap.get(getParameters().getActionType()).getStatus()) { addCanDoActionMessage(manageActionDetailsMap.get(getParameters().getActionType()).getStatusMsg()); addCanDoActionMessage(String.format("$server %1$s", serverService.getHostName())); addCanDoActionMessage(String.format("$service %1$s", serverService.getServiceName())); return false; } return true; }</code><technical_language>I this code need written handle start/stop more servers. serverService id parameter for. I suggest a list of service names parameter. This support start/stop of more services a server cluster depending is set in passed parameters</technical_language>

Target:
protected boolean canDoAction() { clusterId = getParameters().getClusterId(); serverId = getParameters().getServerId(); serviceType = getParameters().getServiceType(); actionType = getParameters().getActionType(); if (!actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START) || !actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE); } if (serviceType != ServiceType.NFS && serviceType != ServiceType.SHD) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_SERVICE_TYPE); } if (Guid.isNullOrEmpty(clusterId) && Guid.isNullOrEmpty(serverId)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL); } return true; }