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 {
|
||||
WireFeed feed;
|
||||
Reader reader = new FileReader(file);
|
||||
try {
|
||||
if (xmlHealerOn) {
|
||||
reader = new XmlFixerReader(reader);
|
||||
}
|
||||
feed = this.build(reader);
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
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 {
|
||||
final Writer writer = new FileWriter(file);
|
||||
try {
|
||||
this.output(feed, writer, prettyPrint);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue