}
if (protocolVersion.get() > MAX_PROTOCOL_VERSION) {
logger.log(Level.WARNING, String.format("Unknown protocol version: %d! Not parsing Sone.", protocolVersion.get()));
- throw new InvalidProtocolVersion();
+ throw new SoneTooNew();
}
}
}
+ public static class SoneTooNew extends RuntimeException {
+
+ }
+
public static class MalformedXml extends RuntimeException {
}
import net.pterodactylus.sone.core.SoneParser.MalformedDimension;
import net.pterodactylus.sone.core.SoneParser.MalformedTime;
import net.pterodactylus.sone.core.SoneParser.MalformedXml;
+import net.pterodactylus.sone.core.SoneParser.SoneTooNew;
import net.pterodactylus.sone.data.Client;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.Post;
soneParser.parseSone(database, originalSone, getXml("negative-protocol-version"));
}
- @Test(expected = InvalidProtocolVersion.class)
+ @Test(expected = SoneTooNew.class)
public void verifyThatATooLargeProtocolVersionCausesAnError() {
soneParser.parseSone(database, originalSone, getXml("too-large-protocol-version"));
}