I added a webrev http://cr.openjdk.java.net/~lancea/7097386/webrev.00/ as it might be a bit easier for this review.
Best lance On Sep 13, 2013, at 4:40 PM, Lance Andersen - Oracle wrote: > Hi Everyone, > > Looking for a reviewer for this trivial fix to correct the sample example in > the Predicate javadoc for the evaluate method() > > > ------------------ > !hg > hg diff Predicate.java > diff -r 60d6f60416ca src/share/classes/javax/sql/rowset/Predicate.java > --- a/src/share/classes/javax/sql/rowset/Predicate.java Thu Sep 12 > 13:20:26 2013 -0400 > +++ b/src/share/classes/javax/sql/rowset/Predicate.java Fri Sep 13 > 16:30:07 2013 -0400 > @@ -56,44 +56,42 @@ > * <pre>{@code > * public class Range implements Predicate { > * > - * private Object lo[]; > - * private Object hi[]; > + * private int lo[]; > + * private int hi[]; > * private int idx[]; > * > - * public Range(Object[] lo, Object[] hi, int[] idx) { > + * public Range(int[] lo, int[] hi, int[] idx) { > * this.lo = lo; > * this.hi = hi; > * this.idx = idx; > * } > * > * public boolean evaluate(RowSet rs) { > - * CachedRowSet crs = (CachedRowSet)rs; > - * boolean bool1,bool2; > * > * // Check the present row determine if it lies > * // within the filtering criteria. > * > * for (int i = 0; i < idx.length; i++) { > + * int value = 0; > + * try { > + * value = (Integer) rs.getObject(idx[i]); > + * } catch (SQLException ex) { > + * Logger.getLogger(Range.class.getName()).log(Level.SEVERE, > null, ex); > + * } > * > - * if ((rs.getObject(idx[i]) >= lo[i]) && > - * (rs.getObject(idx[i]) >= hi[i]) { > - * bool1 = true; // within filter constraints > - * } else { > - * bool2 = true; // outside of filter constraints > - * } > - * } > - * > - * if (bool2) { > - * return false; > - * } else { > - * return true; > - * } > + * if (value < lo[i] && value > hi[i]) { > + * // outside of filter constraints > + * return false; > + * } > + * } > + * // Within filter constraints > + * return true; > * } > - * } > + * } > * }</pre> > * <P> > * The example above implements a simple range predicate. Note, that > - * implementations should but are not required to provider > <code>String</code> > + * implementations should but are not required to provide <code>String</code> > * and integer index based constructors to provide for JDBC RowSet > Implementation > * applications that use both column identification conventions. > * > > > ----------------- > > Best > Lance > > Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 > Oracle Java Engineering > 1 Network Drive > Burlington, MA 01803 > lance.ander...@oracle.com >
Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 lance.ander...@oracle.com