Permalink
Browse files

added findbugs to the build

  • Loading branch information...
ceki committed Aug 31, 2012
1 parent abff3ab commit 2c04fd4e467e8e37d75ceb5314e19a170d6b8da1
View
@@ -0,0 +1,71 @@
+<FindBugsFilter>
+
+ <Match>
+ <Class name="ch.qos.logback.core.util.Loader" />
+ <Bug pattern="DMI_COLLECTION_OF_URLS" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.core.encoder.LayoutWrappingEncoder" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.core.net.SyslogAppenderBase" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.core.util.FileUtil" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.classic.net.SyslogAppender" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.classic.net.JMSQueueSink" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.classic.net.JMSTopicSink" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.access.servlet.TeeHttpServletRequest" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.access.servlet.TeeHttpServletResponse" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.access.spi.AccessEvent" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+ <Match>
+ <Class name="ch.qos.logback.access.spi.Util" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+
+ <Match>
+ <Class name="~chapters.*" />
+ </Match>
+
+ <!-- ========= Safely ignorable ====== -->
+
+ <Match>
+ <Class name="ch.qos.logback.core.encoder.EchoEncoder" />
+ <Bug pattern="DM_DEFAULT_ENCODING" />
+ </Match>
+
+</FindBugsFilter>
+
@@ -25,14 +25,14 @@
* line.
*/
public void process(Converter<IAccessEvent> head) {
+ if(head == null)
+ throw new IllegalArgumentException("Empty converter chain");
+
+ // if head != null, then tail != null as well
Converter<IAccessEvent> tail = ConverterUtil.findTail(head);
Converter<IAccessEvent> newLineConverter = new LineSeparatorConverter();
- if (tail == null) {
- head = newLineConverter;
- } else {
- if (!(tail instanceof LineSeparatorConverter)) {
+ if (!(tail instanceof LineSeparatorConverter)) {
tail.setNext(newLineConverter);
- }
}
}
}
View
@@ -176,18 +176,6 @@
</instructions>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>${findbugs.version}</version>
- <configuration>
- <threshold>High</threshold>
- <!--<trace>true</trace>-->
- <!--<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>-->
- </configuration>
- </plugin>
-
</plugins>
</build>
@@ -139,6 +139,15 @@ public boolean equals(Object o) {
&& (leftTruncate == r.leftTruncate);
}
+ @Override
+ public int hashCode() {
+ int result = min;
+ result = 31 * result + max;
+ result = 31 * result + (leftPad ? 1 : 0);
+ result = 31 * result + (leftTruncate ? 1 : 0);
+ return result;
+ }
+
public String toString() {
return "FormatInfo(" + min + ", " + max + ", " + leftPad + ", "
+ leftTruncate + ")";
@@ -30,7 +30,6 @@ public void setChildNode(Node childNode) {
}
public boolean equals(Object o) {
- //System.out.println("CompositeNode.equals()");
if(!super.equals(o)) {
return false;
}
@@ -42,8 +41,13 @@ public boolean equals(Object o) {
return (childNode != null) ? childNode.equals(r.childNode)
: (r.childNode == null);
}
-
- public String toString() {
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ public String toString() {
StringBuffer buf = new StringBuffer();
if(childNode != null) {
buf.append("CompositeNode("+childNode+")");
@@ -48,4 +48,11 @@ public boolean equals(Object o) {
return (formatInfo != null ? formatInfo.equals(r.formatInfo)
: r.formatInfo == null);
}
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (formatInfo != null ? formatInfo.hashCode() : 0);
+ return result;
+ }
}
@@ -67,7 +67,14 @@ public boolean equals(Object o) {
&& (next != null ? next.equals(r.next) : r.next == null);
}
- String printNext() {
+ @Override
+ public int hashCode() {
+ int result = type;
+ result = 31 * result + (value != null ? value.hashCode() : 0);
+ return result;
+ }
+
+ String printNext() {
if (next != null) {
return " -> " + next;
} else {
@@ -36,7 +36,6 @@ public void setOptions(List<String> optionList) {
}
public boolean equals(Object o) {
- // System.out.println("Keyword.equals()");
if (!super.equals(o)) {
return false;
}
@@ -50,6 +49,11 @@ public boolean equals(Object o) {
: r.optionList == null);
}
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
public String toString() {
StringBuffer buf = new StringBuffer();
if (optionList == null) {
View
10 pom.xml
@@ -320,6 +320,16 @@
<version>2.15.2</version>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>${findbugs.version}</version>
+ <configuration>
+ <threshold>High</threshold>
+ <!--<trace>true</trace>-->
+ <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
<!-- ================ site plugin ==================== -->
<plugin>

0 comments on commit 2c04fd4

Please sign in to comment.