Merge pull request #214 from mishako/dbrosius-patch

Fix small code problems
This commit is contained in:
mishako 2016-01-06 00:21:21 +01:00
commit d71cf44849
4 changed files with 15 additions and 9 deletions

View file

@ -204,11 +204,14 @@ public class WireFeedInput {
public WireFeed build(final File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException {
WireFeed feed;
Reader reader = new FileReader(file);
if (xmlHealerOn) {
reader = new XmlFixerReader(reader);
try {
if (xmlHealerOn) {
reader = new XmlFixerReader(reader);
}
feed = this.build(reader);
} finally {
reader.close();
}
feed = this.build(reader);
reader.close();
return feed;
}

View file

@ -185,8 +185,11 @@ public class WireFeedOutput {
*/
public void output(final WireFeed feed, final File file, final boolean prettyPrint) throws IllegalArgumentException, IOException, FeedException {
final Writer writer = new FileWriter(file);
this.output(feed, writer, prettyPrint);
writer.close();
try {
this.output(feed, writer, prettyPrint);
} finally {
writer.close();
}
}
/**

View file

@ -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,
final InputStream is, final boolean lenient) throws IOException {
String encoding;
if (lenient & xmlEnc != null) {
if (lenient && xmlEnc != null) {
encoding = xmlEnc;
} else {
final boolean appXml = isAppXml(cTMime);

View file

@ -283,7 +283,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
final String rel = link.getRel();
if (rel != null) {
final Attribute relAttribute = new Attribute("rel", rel.toString());
final Attribute relAttribute = new Attribute("rel", rel);
linkElement.setAttribute(relAttribute);
}
@ -351,7 +351,7 @@ public class Atom03Generator extends BaseWireFeedGenerator {
final String mode = content.getMode();
if (mode != null) {
final Attribute modeAttribute = new Attribute("mode", mode.toString());
final Attribute modeAttribute = new Attribute("mode", mode);
contentElement.setAttribute(modeAttribute);
}