Skip to content

Commit

Permalink
Added check in serializer
Browse files Browse the repository at this point in the history
if writer's schema greater than reader raise an exception
  • Loading branch information
abh1nay committed Oct 15, 2012
1 parent 1ba1779 commit f2bfbc0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Expand Up @@ -91,6 +91,9 @@ public Object toObject(byte[] bytes) {

Integer version = Integer.valueOf(bytes[0]);

if(version > newestVersion)
throw new SerializationException("Client needs to rebootstrap! \n Writer's schema version greater than Reader");

Schema typeDefWriter = Schema.parse(typeDefVersions.get(version));

byte[] dataBytes = new byte[bytes.length - 1];
Expand Down
@@ -1,3 +1,19 @@
/*
* Copyright 2011 LinkedIn, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

package voldemort.serialization.avro.versioned;

import java.io.File;
Expand Down

0 comments on commit f2bfbc0

Please sign in to comment.