Fix small code problems
This commit is contained in:
parent
b0f3908956
commit
dce503bbd6
4 changed files with 15 additions and 9 deletions
|
@ -204,11 +204,14 @@ public class WireFeedInput {
|
||||||
public WireFeed build(final File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException {
|
public WireFeed build(final File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException {
|
||||||
WireFeed feed;
|
WireFeed feed;
|
||||||
Reader reader = new FileReader(file);
|
Reader reader = new FileReader(file);
|
||||||
|
try {
|
||||||
if (xmlHealerOn) {
|
if (xmlHealerOn) {
|
||||||
reader = new XmlFixerReader(reader);
|
reader = new XmlFixerReader(reader);
|
||||||
}
|
}
|
||||||
feed = this.build(reader);
|
feed = this.build(reader);
|
||||||
|
} finally {
|
||||||
reader.close();
|
reader.close();
|
||||||
|
}
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,9 +185,12 @@ public class WireFeedOutput {
|
||||||
*/
|
*/
|
||||||
public void output(final WireFeed feed, final File file, final boolean prettyPrint) throws IllegalArgumentException, IOException, FeedException {
|
public void output(final WireFeed feed, final File file, final boolean prettyPrint) throws IllegalArgumentException, IOException, FeedException {
|
||||||
final Writer writer = new FileWriter(file);
|
final Writer writer = new FileWriter(file);
|
||||||
|
try {
|
||||||
this.output(feed, writer, prettyPrint);
|
this.output(feed, writer, prettyPrint);
|
||||||
|
} finally {
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes to an Writer the XML representation for the given WireFeed.
|
* Writes to an Writer the XML representation for the given WireFeed.
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class XmlReader extends Reader {
|
||||||
private String calculateHttpEncoding(final String cTMime, final String cTEnc, final String bomEnc, final String xmlGuessEnc, final String xmlEnc,
|
private String calculateHttpEncoding(final String cTMime, final String cTEnc, final String bomEnc, final String xmlGuessEnc, final String xmlEnc,
|
||||||
final InputStream is, final boolean lenient) throws IOException {
|
final InputStream is, final boolean lenient) throws IOException {
|
||||||
String encoding;
|
String encoding;
|
||||||
if (lenient & xmlEnc != null) {
|
if (lenient && xmlEnc != null) {
|
||||||
encoding = xmlEnc;
|
encoding = xmlEnc;
|
||||||
} else {
|
} else {
|
||||||
final boolean appXml = isAppXml(cTMime);
|
final boolean appXml = isAppXml(cTMime);
|
||||||
|
|
|
@ -283,7 +283,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
|
|
||||||
final String rel = link.getRel();
|
final String rel = link.getRel();
|
||||||
if (rel != null) {
|
if (rel != null) {
|
||||||
final Attribute relAttribute = new Attribute("rel", rel.toString());
|
final Attribute relAttribute = new Attribute("rel", rel);
|
||||||
linkElement.setAttribute(relAttribute);
|
linkElement.setAttribute(relAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
|
||||||
|
|
||||||
final String mode = content.getMode();
|
final String mode = content.getMode();
|
||||||
if (mode != null) {
|
if (mode != null) {
|
||||||
final Attribute modeAttribute = new Attribute("mode", mode.toString());
|
final Attribute modeAttribute = new Attribute("mode", mode);
|
||||||
contentElement.setAttribute(modeAttribute);
|
contentElement.setAttribute(modeAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue