6659234: Incorrect check in SerialBlob.getBytes
authorlancea
Thu, 09 Dec 2010 13:01:14 -0500
changeset 7544 85a0e84bb9a0
parent 7543 3a3e3f73b043
child 7545 409091945418
6659234: Incorrect check in SerialBlob.getBytes Reviewed-by: darcy
jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java	Wed Dec 08 20:11:31 2010 -0800
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java	Thu Dec 09 13:01:14 2010 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -166,8 +166,9 @@
             length = (int)len;
         }
 
-        if (pos < 1 || length - pos < 0 ) {
-            throw new SerialException("Invalid arguments: position cannot be less that 1");
+        if (pos < 1 || len - pos < 0 ) {
+            throw new SerialException("Invalid arguments: position cannot be "
+                    + "less than 1 or greater than the length of the SerialBlob");
         }
 
         pos--; // correct pos to array index