Permalink
Browse files

Off by one error could cause 'index out of range error' if the user p…

…rovides more qualifiers than values.
  • Loading branch information...
1 parent f339c86 commit 66d9b7c536dae71ebb6b4d60fb8ae428a51c5b41 Matt Martin committed Jan 25, 2012
@@ -151,7 +151,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
@@ -142,7 +142,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
@@ -142,7 +142,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
@@ -142,7 +142,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
@@ -142,7 +142,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));
@@ -151,7 +151,7 @@ public void put(String table, String[] rows, String[] fams, String[] quals,
for (String fam : fams) {
int v = 0;
for (String qual : quals) {
- String val = vals[v < vals.length ? v : vals.length];
+ String val = vals[v < vals.length ? v : vals.length - 1];
long t = ts[v < ts.length ? v : ts.length - 1];
put.add(Bytes.toBytes(fam), Bytes.toBytes(qual), t,
Bytes.toBytes(val));

0 comments on commit 66d9b7c

Please sign in to comment.