36
36
import org .metafacture .framework .annotations .In ;
37
37
import org .metafacture .framework .annotations .Out ;
38
38
import org .metafacture .framework .helpers .DefaultObjectPipe ;
39
+ import org .slf4j .Logger ;
40
+ import org .slf4j .LoggerFactory ;
39
41
40
42
/**
41
43
* Decode HTML to metadata events. Each input document represents one record.
@@ -60,6 +62,8 @@ public class HtmlDecoder extends DefaultObjectPipe<Reader, StreamReceiver> {
60
62
private static final String DEFAULT_ATTR_VALS_AS_SUBFIELDS = //
61
63
"meta.name=content&meta.property=content&link.rel=href&a.rel=href" ;
62
64
private Map <String , String > attrValsAsSubfields ;
65
+ private static final Logger LOG =
66
+ LoggerFactory .getLogger (HtmlDecoder .class );
63
67
64
68
public HtmlDecoder () {
65
69
setAttrValsAsSubfields (DEFAULT_ATTR_VALS_AS_SUBFIELDS );
@@ -74,7 +78,7 @@ public void process(final Reader reader) {
74
78
process (document , receiver );
75
79
receiver .endRecord ();
76
80
} catch (IOException e ) {
77
- e . printStackTrace ( );
81
+ LOG . error ( e . getMessage (), e );
78
82
}
79
83
}
80
84
@@ -127,7 +131,7 @@ public void setAttrValsAsSubfields(String mapString) {
127
131
String val = nameValue .length > 1 ? URLDecoder .decode (nameValue [1 ], utf8 ) : "" ;
128
132
attrValsAsSubfields .put (key , val );
129
133
} catch (UnsupportedEncodingException e ) {
130
- e . printStackTrace ( );
134
+ LOG . error ( e . getMessage (), e );
131
135
}
132
136
}
133
137
}
0 commit comments