小编Car*_*eon的帖子

Checkstyle升级后如何验证自定义配置xml

我已将 maven-checkstyle-plugin 从 2.17 升级到 3.1.1,在运行 mvn checkstyle:checkstyle 时,我遇到了许多运行时错误,例如(最困难的部分是错误一次显示 1 - 这意味着您修复了第一个错误,然后第二个错误显示...):

 1. Failed during checkstyle configuration: cannot initialize module TreeWalker - Unable to instantiate 'FileContentsHolder' class,
 2. cannot initialize module TreeWalker - TreeWalker is not allowed as a parent of LineLength Please review 'Parent Module' section for this Check in web documentation if Check is standard.
 3. SuppressionCommentFilter is not allowed as a child in Checker
Run Code Online (Sandbox Code Playgroud)

这是因为升级到最新插件版本后,版本从 6.* 升级到了 8.*。

我试图找到一些验证器来告诉我 XML 不再有效,但我找不到任何验证器,有这样的工具吗?

java checkstyle maven maven-checkstyle-plugin

4
推荐指数
1
解决办法
1596
查看次数

有没有办法使用 aws cloudformation 更新堆栈仅指定更改的参数,并避免对未更改的参数显式使用 UsePreviousValue?

我正在尝试在 AWS Cloudformation CLI 中编写一个通用脚本,它将堆栈的参数 AMI 更新为新值,同时保留其余参数不变。

到目前为止,我尝试这样做:

aws cloudformation update-stack --stack-name asg-xxx-123 --use-previous-template --parameters ParameterKey=ApplicationName,UsePreviousValue=true  ParameterKey=ArtefactVersion,UsePreviousValue=true ParameterKey=MachineImage,ParameterValue=ami-123
Run Code Online (Sandbox Code Playgroud)

请注意,有 2 个参数正在使用UsePreviousValue=true,只有 的值ParameterKey=MachineImage需要更改 - 这工作正常。

但是,由于我需要它作为通用脚本,如何处理某些堆栈具有比上面更多参数的情况(或者甚至有些堆栈具有不同的参数但仍然有ParameterKey=MachineImage)?有没有办法说只更改 的值ParameterKey=MachineImage,而所有其余的都应该使用以前的值而不在 中明确列出--parameters

amazon-web-services aws-cloudformation aws-cli

3
推荐指数
1
解决办法
7695
查看次数

未捕获的异常对Quartz的SimpleThreadPool中的线程的影响

使用Spring的集成API Quartz,对具有未捕获异常的cron作业有什么影响?由于cronbean/worker线程没有捕获异常,这是否意味着该线程已经死亡并且无法返回到SimpleThreadPool?如果它死了并且没有返回池将意味着SimpleThreadPool将需要创建新线程,如果这样多次发生,从而清空池?

这是堆栈跟踪的示例:

org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:276) - Invocation of method 'doCronJob' on target class [abc.package.ServiceImpl] failed
java.io.FileNotFoundException: http://www.website.com
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1457)
    at abc.package.ServiceImpl.doCronJob(ServiceImpl.java:453)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:283)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:272)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:208)
    **at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)**
Run Code Online (Sandbox Code Playgroud)

java spring quartz-scheduler worker-thread threadpool

1
推荐指数
1
解决办法
2875
查看次数

BindingResult用于验证错误,业务错误怎么办?

我知道BindingResult用于与表单相关的验证错误.但是,如果出现业务错误,例如:

public String bulkUpdate(@ModelAttribute form, BindingResult r) {
//do validation, extract selected issues to be bulk updated, etc.
//any form related, binding errors to be put in r

//this part
List<String> results = service.bulkUpdate(issues, newValues);

//where is it appropriate to put the results?
//from experience we just create a request attribute and put it there
request.setAttribute("bulkUpdateErrors", StringUtils.join(results, "<br>"))

//is there an similar generic structure like Errors?
}
Run Code Online (Sandbox Code Playgroud)

在jsp中:

<div id='info'> 
    <c:if test="${not empty bulkUpdateErrors}">
        <spring:message code="bulk.update.warning" /> ${bulkUpdateErrors}
    </c:if>
</div> …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc

1
推荐指数
1
解决办法
5438
查看次数