提交 99cd9155 编写于 作者: S sean.wang

findbug fix

上级 43242b99
......@@ -29,6 +29,6 @@ public class DefaultAnalyzerFactory extends ContainerHolder implements AnalyzerF
@Override
public void release(Object component) {
release(component);
super.release(component);
}
}
......@@ -55,7 +55,7 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
tree.setMessage(t);
tree.setIpAddress("192.168.8." + i % 4);
t.setDuration(3 * 1000);
t.setTimestamp(start + 1000 * 60 * i);
t.setTimestamp(start + 1000L * 60 * i);
analyzer.process(tree);
analyzer.process(tree);
analyzer.process(tree);
......@@ -95,7 +95,7 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
tree.setHostName("middleware");
tree.setMessage(t);
t.setDuration(3 * 1000);
t.setTimestamp(start + 1000 * 60 * i);
t.setTimestamp(start + 1000L * 60 * i);
analyzer.process(tree);
}
......
......@@ -112,9 +112,10 @@ public class FailureAnalyzerTest extends ComponentTestCase {
if (entries == null) {
System.out.println(minuteStr);
} else {
assertEquals("Check the segment size ", 50, entries.size());
}
assertEquals("Check the segment size ", 50, entries.size());
startDate.setTime(startDate.getTime() + 1000 * 60);
}
}
......@@ -139,7 +140,7 @@ public class FailureAnalyzerTest extends ComponentTestCase {
tree.setIpAddress("127.0.0." + i);
tree.setMessage(t);
t.setDuration(3 * 1000);
t.setTimestamp(start + 1000 * 60 * i);
t.setTimestamp(start + 1000L * 60 * i);
analyzer.process(tree);
// analyzer.process(tree);
}
......
......@@ -7,7 +7,7 @@ public class ClientConfigValidator extends DefaultValidator {
@Override
public void visitConfig(Config config) {
if (!"client".equals(config.getMode())) {
throw new RuntimeException(String.format("Attribute(%)s at path(%s) is required!", "mode", "/config"));
throw new RuntimeException(String.format("Attribute(%s) at path(%s) is required!", "mode", "/config"));
} else if (config.getApp() == null) {
throw new RuntimeException(String.format("Element(%s) at path(%s) is required!", "app", "/config"));
} else if (config.getServers().size() == 0) {
......
......@@ -105,7 +105,7 @@ public class TcpSocketReceiver implements MessageReceiver, LogEnabled {
m_factory.releaseExternalResources();
}
public class MyDecoder extends FrameDecoder {
public static class MyDecoder extends FrameDecoder {
@Override
/**
* return null means not all data is ready, so waiting for next network package.
......
......@@ -80,7 +80,7 @@ public class HtmlMessageCodec implements MessageCodec {
if (counter != null) {
counter.inc();
count += helper.tr1(buf, counter.getCount() % 2 == 1 ? "odd" : "even");
count += helper.tr1(buf, counter.getCount() % 2 != 0 ? "odd" : "even");
} else {
count += helper.tr1(buf, null);
}
......
package com.dianping.cat.demo;
import java.io.File;
import java.util.Random;
import org.junit.After;
import org.junit.Before;
......@@ -44,16 +45,16 @@ public class Demo extends ComponentTestCase {
cat.logEvent("RuntimeException", RuntimeException.class.getName(), "ERROR", null);
cat.logEvent("Exception", Exception.class.getName(), "ERROR", null);
cat.logEvent("RuntimeException", NullPointerException.class.getName(), "ERROR", null);
t.setStatus("0");
Thread.sleep(new Random().nextInt(10) * new Random().nextInt(3));
t.setStatus("error");
t.complete();
}
@Test
public void demo2() throws Exception {
MessageProducer cat = lookup(MessageProducer.class);
Transaction t = cat.newTransaction("SQL", "update-user");
Transaction t = cat.newTransaction("SQL3", "update-user");
Thread.sleep(10);
t.setStatus("error");
t.complete();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册