Migrated logging to SLF4J
This commit is contained in:
parent
1c009f66bb
commit
ccc764b2b5
4 changed files with 45 additions and 17 deletions
5
pom.xml
5
pom.xml
|
@ -52,6 +52,11 @@
|
|||
<groupId>com.rometools</groupId>
|
||||
<artifactId>rome</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -22,7 +22,9 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.WireFeed;
|
||||
import com.sun.syndication.feed.opml.Attribute;
|
||||
|
@ -46,7 +48,9 @@ import com.sun.syndication.feed.synd.SyndPersonImpl;
|
|||
* @author cooper
|
||||
*/
|
||||
public class ConverterForOPML10 implements Converter {
|
||||
private static final Logger LOG = Logger.getLogger(ConverterForOPML10.class.getName().toString());
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ConverterForOPML10.class);
|
||||
|
||||
public static final String URI_TREE = "urn:rome.tree";
|
||||
public static final String URI_ATTRIBUTE = "urn:rome.attribute#";
|
||||
|
||||
|
@ -73,7 +77,8 @@ public class ConverterForOPML10 implements Converter {
|
|||
* <p>
|
||||
*
|
||||
* @param feed real feed to copy/convert.
|
||||
* @param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real feed.
|
||||
* @param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real
|
||||
* feed.
|
||||
*/
|
||||
@Override
|
||||
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
|
||||
|
@ -200,8 +205,12 @@ public class ConverterForOPML10 implements Converter {
|
|||
final List<SyndEntry> entries = Collections.synchronizedList(syndFeed.getEntries());
|
||||
|
||||
final HashMap<String, Outline> entriesByNode = new HashMap<String, Outline>();
|
||||
final ArrayList<OutlineHolder> doAfterPass = new ArrayList<OutlineHolder>(); // this will hold entries that we can't parent the first time.
|
||||
final ArrayList<Outline> root = new ArrayList<Outline>(); // this holds root level outlines;
|
||||
|
||||
// this will hold entries that we can't parent the first time.
|
||||
final ArrayList<OutlineHolder> doAfterPass = new ArrayList<OutlineHolder>();
|
||||
|
||||
// this holds root level outlines;
|
||||
final ArrayList<Outline> root = new ArrayList<Outline>();
|
||||
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
final SyndEntry entry = entries.get(i);
|
||||
|
@ -294,7 +303,7 @@ public class ConverterForOPML10 implements Converter {
|
|||
|
||||
if (parent == null) {
|
||||
root.add(o.outline);
|
||||
LOG.warning("Unable to find parent node :" + o.parent);
|
||||
LOG.warn("Unable to find parent node: {}", o.parent);
|
||||
} else {
|
||||
parent.getChildren().add(o.outline);
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Document;
|
||||
import org.jdom2.Element;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.WireFeed;
|
||||
import com.sun.syndication.feed.opml.Attribute;
|
||||
|
@ -39,7 +39,8 @@ import com.sun.syndication.io.WireFeedParser;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
||||
private static Logger LOG = Logger.getLogger(OPML10Parser.class.getName());
|
||||
|
||||
private static Logger LOG = LoggerFactory.getLogger(OPML10Parser.class);
|
||||
|
||||
/** Creates a new instance of Opml10Parser */
|
||||
public OPML10Parser() {
|
||||
|
@ -108,7 +109,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
opml.setWindowBottom(readInteger(head.getChildText("windowBottom")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse windowBottom", nfe);
|
||||
LOG.warn("Unable to parse windowBottom", nfe);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse windowBottom", nfe);
|
||||
|
@ -118,13 +119,13 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
opml.setWindowLeft(readInteger(head.getChildText("windowLeft")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse windowLeft", nfe);
|
||||
LOG.warn("Unable to parse windowLeft", nfe);
|
||||
}
|
||||
|
||||
try {
|
||||
opml.setWindowRight(readInteger(head.getChildText("windowRight")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse windowRight", nfe);
|
||||
LOG.warn("Unable to parse windowRight", nfe);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse windowRight", nfe);
|
||||
|
@ -134,7 +135,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
opml.setWindowLeft(readInteger(head.getChildText("windowLeft")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse windowLeft", nfe);
|
||||
LOG.warn("Unable to parse windowLeft", nfe);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse windowLeft", nfe);
|
||||
|
@ -144,7 +145,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
opml.setWindowTop(readInteger(head.getChildText("windowTop")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse windowTop", nfe);
|
||||
LOG.warn("Unable to parse windowTop", nfe);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse windowTop", nfe);
|
||||
|
@ -154,7 +155,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
opml.setExpansionState(readIntArray(head.getChildText("expansionState")));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
LOG.log(Level.WARNING, "Unable to parse expansionState", nfe);
|
||||
LOG.warn("Unable to parse expansionState", nfe);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse expansionState", nfe);
|
||||
|
@ -194,7 +195,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
outline.setBreakpoint(readBoolean(e.getAttributeValue("isBreakpoint")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Unable to parse isBreakpoint value", ex);
|
||||
LOG.warn("Unable to parse isBreakpoint value", ex);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse isBreakpoint value", ex);
|
||||
|
@ -204,7 +205,7 @@ public class OPML10Parser extends BaseWireFeedParser implements WireFeedParser {
|
|||
try {
|
||||
outline.setComment(readBoolean(e.getAttributeValue("isComment")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Unable to parse isComment value", ex);
|
||||
LOG.warn("Unable to parse isComment value", ex);
|
||||
|
||||
if (validate) {
|
||||
throw new FeedException("Unable to parse isComment value", ex);
|
||||
|
|
13
src/test/resources/logback-test.xml
Normal file
13
src/test/resources/logback-test.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="warn">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
Loading…
Reference in a new issue