check should be not null **and** not empty instead of not null **or**
not empty (fixes #28), replaced System.err output by Logger too
This commit is contained in:
parent
75faaa789f
commit
0ceb7c9d9b
1 changed files with 11 additions and 4 deletions
|
@ -31,6 +31,8 @@ import org.rometools.feed.module.georss.geometries.Point;
|
||||||
import org.rometools.feed.module.georss.geometries.Polygon;
|
import org.rometools.feed.module.georss.geometries.Polygon;
|
||||||
import org.rometools.feed.module.georss.geometries.Position;
|
import org.rometools.feed.module.georss.geometries.Position;
|
||||||
import org.rometools.feed.module.georss.geometries.PositionList;
|
import org.rometools.feed.module.georss.geometries.PositionList;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.sun.syndication.feed.module.Module;
|
import com.sun.syndication.feed.module.Module;
|
||||||
import com.sun.syndication.io.ModuleGenerator;
|
import com.sun.syndication.io.ModuleGenerator;
|
||||||
|
@ -43,6 +45,7 @@ import com.sun.syndication.io.ModuleGenerator;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SimpleGenerator implements ModuleGenerator {
|
public class SimpleGenerator implements ModuleGenerator {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(SimpleGenerator.class);
|
||||||
|
|
||||||
private static final Set<Namespace> NAMESPACES;
|
private static final Set<Namespace> NAMESPACES;
|
||||||
static {
|
static {
|
||||||
|
@ -51,6 +54,10 @@ public class SimpleGenerator implements ModuleGenerator {
|
||||||
NAMESPACES = Collections.unmodifiableSet(nss);
|
NAMESPACES = Collections.unmodifiableSet(nss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param posList PositionList to convert
|
||||||
|
* @return String representation
|
||||||
|
*/
|
||||||
private String posListToString(final PositionList posList) {
|
private String posListToString(final PositionList posList) {
|
||||||
final StringBuffer sb = new StringBuffer();
|
final StringBuffer sb = new StringBuffer();
|
||||||
for (int i = 0; i < posList.size(); ++i) {
|
for (int i = 0; i < posList.size(); ++i) {
|
||||||
|
@ -117,10 +124,10 @@ public class SimpleGenerator implements ModuleGenerator {
|
||||||
polygonElement.addContent(posListToString(posList));
|
polygonElement.addContent(posListToString(posList));
|
||||||
element.addContent(polygonElement);
|
element.addContent(polygonElement);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("GeoRSS simple format can't handle rings of type: " + ring.getClass().getName());
|
LOG.error("GeoRSS simple format can't handle rings of type: " + ring.getClass().getName());
|
||||||
}
|
}
|
||||||
if (((Polygon) geometry).getInterior() != null || !((Polygon) geometry).getInterior().isEmpty()) {
|
if (((Polygon) geometry).getInterior() != null && !((Polygon) geometry).getInterior().isEmpty()) {
|
||||||
System.err.println("GeoRSS simple format can't handle interior rings (ignored)");
|
LOG.error("GeoRSS simple format can't handle interior rings (ignored)");
|
||||||
}
|
}
|
||||||
} else if (geometry instanceof Envelope) {
|
} else if (geometry instanceof Envelope) {
|
||||||
final Envelope envelope = (Envelope) geometry;
|
final Envelope envelope = (Envelope) geometry;
|
||||||
|
@ -129,7 +136,7 @@ public class SimpleGenerator implements ModuleGenerator {
|
||||||
+ envelope.getMaxLongitude());
|
+ envelope.getMaxLongitude());
|
||||||
element.addContent(boxElement);
|
element.addContent(boxElement);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("GeoRSS simple format can't handle geometries of type: " + geometry.getClass().getName());
|
LOG.error("GeoRSS simple format can't handle geometries of type: " + geometry.getClass().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue