Skip to content

Commit ebaf1b6

Browse files
committed
Fixed some checkstyle suppressions
1 parent 0d26eee commit ebaf1b6

File tree

3 files changed

+127
-122
lines changed

3 files changed

+127
-122
lines changed

quality_assurance/checkstyle_rules.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
33

4-
<!--
5-
This configuration file was written by the eclipse-cs plugin configuration editor
4+
<!--
5+
This configuration file was written by the eclipse-cs plugin configuration editor
66
-->
7-
<!--
8-
Checkstyle-Configuration: Metafacture
9-
Description: none
7+
<!--
8+
Checkstyle-Configuration: Metafacture
9+
Description: none
1010
-->
1111
<module name="Checker">
1212
<property name="severity" value="warning"/>

src/main/java/org/culturegraph/mf/stream/pipe/ObjectExceptionCatcher.java

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,61 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.culturegraph.mf.stream.pipe;
17-
18-
import org.culturegraph.mf.framework.DefaultObjectPipe;
19-
import org.culturegraph.mf.framework.ObjectReceiver;
20-
import org.culturegraph.mf.framework.annotations.Description;
21-
import org.culturegraph.mf.framework.annotations.In;
22-
import org.culturegraph.mf.framework.annotations.Out;
23-
import org.slf4j.Logger;
24-
import org.slf4j.LoggerFactory;
25-
26-
27-
/**
28-
* Wraps the call to the process method of the downstream module
29-
* in a try catch block with Exception as the catch-block's
30-
* argument type. This module is supposed to stop any exception
31-
* from downstream modules to travel further upstream. If an
32-
* exception is caught, a log message with log level "error" is
33-
* written.
34-
*
35-
* @param <T> object type
36-
*
37-
* @author Christoph Böhme
38-
*/
39-
@Description("passes objects through and catches exceptions.")
40-
@In(Object.class)
41-
@Out(Object.class)
42-
public final class ObjectExceptionCatcher<T> extends
43-
DefaultObjectPipe<T, ObjectReceiver<T>> {
44-
45-
private static final Logger LOG = LoggerFactory.getLogger(ObjectExceptionCatcher.class);
46-
private static final String MSG_PATTERN = "{}{}";
47-
48-
private final String logPrefix;
49-
50-
public ObjectExceptionCatcher() {
51-
this("");
52-
}
53-
54-
public ObjectExceptionCatcher(final String logPrefix) {
55-
super();
56-
this.logPrefix = logPrefix;
57-
}
58-
59-
@Override
60-
public void process(final T obj) {
61-
try {
62-
getReceiver().process(obj);
63-
} catch(final Exception e) { // NO CHECKSTYLE: IllegalCatch
64-
// This module is supposed to intercept _all_ exceptions
65-
// thrown by downstream modules. Hence, we have to catch
66-
// Exception.
67-
LOG.error(MSG_PATTERN, logPrefix, obj);
68-
LOG.error(MSG_PATTERN, logPrefix, e);
69-
}
70-
}
71-
72-
}
16+
package org.culturegraph.mf.stream.pipe;
17+
18+
import org.culturegraph.mf.framework.DefaultObjectPipe;
19+
import org.culturegraph.mf.framework.ObjectReceiver;
20+
import org.culturegraph.mf.framework.annotations.Description;
21+
import org.culturegraph.mf.framework.annotations.In;
22+
import org.culturegraph.mf.framework.annotations.Out;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
26+
27+
/**
28+
* Wraps the call to the process method of the downstream module
29+
* in a try catch block with Exception as the catch-block's
30+
* argument type. This module is supposed to stop any exception
31+
* from downstream modules to travel further upstream. If an
32+
* exception is caught, a log message with log level "error" is
33+
* written.
34+
*
35+
* @param <T> object type
36+
*
37+
* @author Christoph Böhme
38+
*/
39+
@Description("passes objects through and catches exceptions.")
40+
@In(Object.class)
41+
@Out(Object.class)
42+
public final class ObjectExceptionCatcher<T> extends
43+
DefaultObjectPipe<T, ObjectReceiver<T>> {
44+
45+
private static final Logger LOG = LoggerFactory.getLogger(ObjectExceptionCatcher.class);
46+
private static final String MSG_PATTERN = "{}{}";
47+
48+
private final String logPrefix;
49+
50+
public ObjectExceptionCatcher() {
51+
this("");
52+
}
53+
54+
public ObjectExceptionCatcher(final String logPrefix) {
55+
super();
56+
this.logPrefix = logPrefix;
57+
}
58+
59+
@Override
60+
public void process(final T obj) {
61+
try {
62+
getReceiver().process(obj);
63+
} catch(final Exception e) {
64+
// NO CHECKSTYLE IllegalCatch FOR -1 LINES:
65+
// This module is supposed to intercept _all_ exceptions
66+
// thrown by downstream modules. Hence, we have to catch
67+
// Exception.
68+
LOG.error(MSG_PATTERN, logPrefix, obj);
69+
LOG.error(MSG_PATTERN, logPrefix, e);
70+
}
71+
}
72+
73+
}

src/main/java/org/culturegraph/mf/stream/pipe/ObjectExceptionLogger.java

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,63 +13,67 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.culturegraph.mf.stream.pipe;
17-
18-
import org.culturegraph.mf.framework.DefaultObjectPipe;
19-
import org.culturegraph.mf.framework.ObjectReceiver;
20-
import org.culturegraph.mf.framework.annotations.Description;
21-
import org.culturegraph.mf.framework.annotations.In;
22-
import org.culturegraph.mf.framework.annotations.Out;
23-
import org.slf4j.Logger;
24-
import org.slf4j.LoggerFactory;
25-
26-
27-
/**
28-
* Logs the string representation of every object.
29-
*
30-
* @param <T> object type
31-
*
32-
* @author Christoph Böhme
33-
*
34-
*/
35-
@Description("logs objects with the toString method")
36-
@In(Object.class)
37-
@Out(Object.class)
38-
public final class ObjectExceptionLogger<T>
39-
extends DefaultObjectPipe<T, ObjectReceiver<T>> {
40-
41-
private static final Logger LOG = LoggerFactory.getLogger(ObjectExceptionLogger.class);
42-
43-
private final String logPrefix;
44-
45-
public ObjectExceptionLogger() {
46-
this("");
47-
}
48-
49-
public ObjectExceptionLogger(final String logPrefix) {
50-
super();
51-
this.logPrefix = logPrefix;
52-
}
53-
54-
@Override
55-
public void process(final T obj) {
56-
57-
try{
58-
getReceiver().process(obj);
59-
}catch(Exception e){
60-
LOG.error(logPrefix, e);
61-
}
62-
63-
}
64-
65-
@Override
66-
protected void onResetStream() {
67-
LOG.debug("{}resetStream", logPrefix);
68-
}
69-
70-
@Override
71-
protected void onCloseStream() {
72-
LOG.debug("{}closeStream", logPrefix);
73-
}
74-
75-
}
16+
package org.culturegraph.mf.stream.pipe;
17+
18+
import org.culturegraph.mf.framework.DefaultObjectPipe;
19+
import org.culturegraph.mf.framework.ObjectReceiver;
20+
import org.culturegraph.mf.framework.annotations.Description;
21+
import org.culturegraph.mf.framework.annotations.In;
22+
import org.culturegraph.mf.framework.annotations.Out;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
26+
27+
/**
28+
* Logs the string representation of every object.
29+
*
30+
* @param <T> object type
31+
*
32+
* @author Christoph Böhme
33+
*
34+
*/
35+
@Description("logs objects with the toString method")
36+
@In(Object.class)
37+
@Out(Object.class)
38+
public final class ObjectExceptionLogger<T>
39+
extends DefaultObjectPipe<T, ObjectReceiver<T>> {
40+
41+
private static final Logger LOG = LoggerFactory.getLogger(ObjectExceptionLogger.class);
42+
43+
private final String logPrefix;
44+
45+
public ObjectExceptionLogger() {
46+
this("");
47+
}
48+
49+
public ObjectExceptionLogger(final String logPrefix) {
50+
super();
51+
this.logPrefix = logPrefix;
52+
}
53+
54+
@Override
55+
public void process(final T obj) {
56+
57+
try{
58+
getReceiver().process(obj);
59+
}catch(Exception e){
60+
// NO CHECKSTYLE IllegalCatch FOR -1 LINES:
61+
// This module is supposed to intercept _all_ exceptions
62+
// thrown by downstream modules. Hence, we have to catch
63+
// Exception.
64+
LOG.error(logPrefix, e);
65+
}
66+
67+
}
68+
69+
@Override
70+
protected void onResetStream() {
71+
LOG.debug("{}resetStream", logPrefix);
72+
}
73+
74+
@Override
75+
protected void onCloseStream() {
76+
LOG.debug("{}closeStream", logPrefix);
77+
}
78+
79+
}

0 commit comments

Comments
 (0)