import net.pterodactylus.util.xml.SimpleXML;
import net.pterodactylus.util.xml.XML;
+import com.google.common.annotations.VisibleForTesting;
import org.w3c.dom.Document;
import freenet.client.FetchResult;
* The requested URI
* @return The parsed Sone, or {@code null} if the Sone could not be parsed
*/
- public Sone parseSone(Sone originalSone, FetchResult fetchResult, FreenetURI requestUri) {
+ private Sone parseSone(Sone originalSone, FetchResult fetchResult, FreenetURI requestUri) {
logger.log(Level.FINEST, String.format("Parsing FetchResult (%d bytes, %s) for %s…", fetchResult.size(), fetchResult.getMimeType(), originalSone));
Bucket soneBucket = fetchResult.asBucket();
InputStream soneInputStream = null;
* @throws SoneException
* if a parse error occurs, or the protocol is invalid
*/
- public Sone parseSone(Sone originalSone, InputStream soneInputStream) throws SoneException {
+ @VisibleForTesting
+ protected Sone parseSone(Sone originalSone, InputStream soneInputStream) throws SoneException {
/* TODO - impose a size limit? */
Document document;
String title = albumXml.getValue("title", null);
String description = albumXml.getValue("description", "");
String albumImageId = albumXml.getValue("album-image", null);
- if ((id == null) || (title == null) || (description == null)) {
+ if ((id == null) || (title == null)) {
logger.log(Level.WARNING, String.format("Downloaded Sone %s contains invalid album!", sone));
return null;
}