abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnapshot {
private static final Logger LOG = LoggerFactory.getLogger(AbstractVersionedShardDataTreeSnapshot.class);
+ @SuppressWarnings("checkstyle:FallThrough")
static ShardDataTreeSnapshot deserialize(final DataInputStream is) throws IOException {
final PayloadVersion version = PayloadVersion.readFrom(is);
switch (version) {
case TEST_PAST_VERSION:
// These versions are never returned and this code is effectively dead
break;
+ default:
+ throw new IOException("Invalid payload version in snapshot");
}
// Not included as default in above switch to ensure we get warnings when new versions are added
*
* @return The root node.
*/
- abstract @Nonnull NormalizedNode<?, ?> rootNode();
+ @Nonnull
+ abstract NormalizedNode<?, ?> rootNode();
/**
* Return the snapshot payload version. Implementations of this method should return a constant.
*
* @return Snapshot payload version
*/
- abstract @Nonnull PayloadVersion version();
+ @Nonnull
+ abstract PayloadVersion version();
private void versionedSerialize(final DataOutputStream dos, final PayloadVersion version) throws IOException {
switch (version) {
case TEST_FUTURE_VERSION:
case TEST_PAST_VERSION:
break;
-
+ default:
+ throw new IOException("Invalid payload version in snapshot");
}
throw new IOException("Encountered unhandled version" + version);