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

findbug fix

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