我希望我的GWT小部件在其CSS动画结束时得到通知.
在纯HTML/Javascript中,这可以通过注册事件处理程序来轻松完成:
elem.addEventListener("webkitAnimationEnd", function(){
// do something
}, false);
// add more for Mozilla etc.
Run Code Online (Sandbox Code Playgroud)
我怎么能在GWT中做到这一点?
这种类型的事件对于GWT的DOMImpl类是未知的,因此我不断收到错误" 试图吸收未知事件类型webkitAnimationEnd ".
谢谢!
我有一个A调用EJB的EJB B.用户界面不应等待超过30秒的响应.如果缺少某些数据,则应返回部分响应.
如何在EJB上定义超时(30秒的时间限制)B?
我可以将EJB定义B为Asynchronous返回Future,然后执行Future.get(30, TimeUnit.SECONDS).但这是最好的解决方案吗?
谢谢
PS我使用glassfish 3.1
在我的自定义Eclipse插件中,我将Java类的完全限定类名称作为String,并且想知道它的实际文件路径.实际上,我想知道它所在的源文件夹的名称.
该类可以来自Workspace中的任何Java项目.源文件夹名称是任意的.
我使用Eclipse 3.6.
谢谢!
有没有办法配置Checkstyle,PMD或FindBugs Maven插件来检测这样的代码:
logger.debug("string" + stringVariable);
Run Code Online (Sandbox Code Playgroud)
代替:
logger.debug("format string {}", stringVariable);
Run Code Online (Sandbox Code Playgroud) 以下代码被FindBugs标记为错误.FindBugs说"这种方法可能无法清理(关闭,处理)流,数据库对象或需要显式清理操作的其他资源."
错误标记在该行上output = new FileOutputStream (localFile);
但是我们已经在块中添加了try/finally.
inputStream input =null;
OutputStream output =null;
try {
input = zipFile.getInputStream(entry);
File localFile = new File(unzipFile.getAbsolutePath()
+ File.separator + entryName);
output = new FileOutputStream (localFile); // BUG MARKED HERE
byte[] buffer = new byte[1024 * 8];
int readLen = 0;
while ((readLen = input.read(buffer, 0, 1024 * 8)) != -1) {
output.write(buffer, 0, readLen);
}
output.flush();
output.close();
input.close();
} finally {
if(output!=null) {
output.flush();
output.close();
}
if(input!=null) {
input.close();
}
}
Run Code Online (Sandbox Code Playgroud) 我在IntelliJ Java IDE中运行Gradle构建.该SonarQube亚军摇篮插件与一起使用JaCoCo摇篮插件.
问题:我收到了消息No information about coverage per test.,(不是这篇文章的副本,见下文),并且报道显示在SonarQube中,但仅作为整体百分比,而不是每个文件的详细报告:

难道我做错了什么?这可能是SonarQube中的一个错误(就像最近的Cobertura一样)?
这是我的build.gradle:
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'sonar-runner'
sourceCompatibility = 1.7
project.version = '1.0'
project.group = 'com.acme.sandbox'
project.description = 'just a test project'
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
// JaCoCo test coverage configuration
tasks.withType(Test) { task ->
jacoco {
append = false
}
}
// Sonar configuration …Run Code Online (Sandbox Code Playgroud) 我找不到如何告诉PMD-CPD跳过特定方法的选项.我们使用生成equals()和hashCode()方法,因此这些方法看起来非常相似,并且CPD将很多方法报告为重复代码.
我可以//NOPMD在代码中使用一些注释,但在我看来,如何管理我的代码并不是什么方法.因为我在代码中加入了一个与代码无关的工具.CPD有助于避免编码错误/样式,不应强迫我修改我的代码.
如果有人有一些想法如何解决它,那将会非常有用.
最好的祝愿
我正在尝试安装Checkstyle,包括IntelliJ IDEA中的SevNTU Checkstyle扩展
但是,当我添加配置文件sevntu-checkstyle-default-configuration.xml时出现错误:
org.infernus.idea.checkstyle.exception.CheckStylePluginException: <html><b>The Checkstyle rules file could not be loaded.</b><br>
cannot initialize module TreeWalker - Unable to instantiate com.github.sevntu.checkstyle.checks.design.VariableDeclarationUsageDistanceCheck<br>
The file has been blacklisted for 60s.</html>
at org.infernus.idea.checkstyle.checker.CheckerFactory.blacklistAndShowMessage(CheckerFactory.java:183)
at org.infernus.idea.checkstyle.checker.CheckerFactory.createChecker(CheckerFactory.java:139)
at org.infernus.idea.checkstyle.checker.CheckerFactory.getOrCreateCachedChecker(CheckerFactory.java:84)
at org.infernus.idea.checkstyle.checker.CheckerFactory.checker(CheckerFactory.java:63)
at org.infernus.idea.checkstyle.checker.CheckerFactory.verify(CheckerFactory.java:44)
at org.infernus.idea.checkstyle.ui.LocationDialogue.attemptLoadOfFile(LocationDialogue.java:198)
at org.infernus.idea.checkstyle.ui.LocationDialogue.access$800(LocationDialogue.java:24)
at org.infernus.idea.checkstyle.ui.LocationDialogue$NextAction.actionPerformed(LocationDialogue.java:241)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6525)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278) …Run Code Online (Sandbox Code Playgroud) 是否有可能使用 Checkstyle 插件配置 SonarQube 5.1 以遵守@SuppressWarnings("deprecation")注释。我不想关闭“避免使用不推荐使用的方法”规则,我只想让 SonarQube 尊重@SuppressWarnings注释。
我有一个 Java 代码,我需要在其中使用不推荐使用的createValidator()方法,如下所示:
@SuppressWarnings("deprecation")
@Override
public javax.xml.bind.Validator createValidator() throws JAXBException {
return contextDelegate.createValidator();
}
Run Code Online (Sandbox Code Playgroud)
Java 编译器在编译代码时不会发出警告,但不幸的是,带有 CheckStyle 插件的 SonarQube 出现了一个问题:
squid:CallToDeprecatedMethod
Avoid use of deprecated methods
Run Code Online (Sandbox Code Playgroud) 我正在使用 FindBug,我想了解它为文档目的生成的 .XML 报告。
我得到的样本如下。
<BugInstance type="RANGE_ARRAY_INDEX" priority="2" rank="7" abbrev="RANGE" category="CORRECTNESS" first="1">
Run Code Online (Sandbox Code Playgroud)
因此,似乎RANGE_ARRAY_INDEX类别类型CORRECTNESS具有排名,7因此它是scary一个。那么它总是正确的吗?是RANGE_ARRAY_INDEX永远是scary一个?
我找不到任何提及它们之间关系的资源。
我提到了FindBugs Bug Descriptions和FindBugs 2 站点以及这个没有明确答案的问题
好像我们有几个类别,
和
我们有很多类型,因为它在文档中。
谁可以帮我这个事 ?