File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
src/main/java/com/slicingdice/jslicer/utils/validators Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 11# Change Log
22
3+ ## [ 2.0.2]
4+ ### Updated
5+ - Correct data extraction validator to accept columns: all
6+
37## [ 2.0.1]
48### Updated
59- Improve exception throwing in case of JSON parsing error.
Original file line number Diff line number Diff line change 1717
1818import com .slicingdice .jslicer .exceptions .client .InvalidQueryException ;
1919import com .slicingdice .jslicer .exceptions .client .MaxLimitException ;
20+ import org .json .JSONArray ;
2021import org .json .JSONObject ;
2122
2223import java .util .Iterator ;
@@ -48,9 +49,20 @@ private boolean validKeys() {
4849 throw new InvalidQueryException ("The key 'limit' in query has a invalid value." );
4950 }
5051 } else if (key .equals ("columns" )) {
51- if (this .data .getJSONArray ("columns" ).length () > 10 ) {
52- throw new MaxLimitException ("The key 'columns' in data extraction result must" +
53- " have up to 10 columns." );
52+ final Object columns = this .data .get ("columns" );
53+ if (columns instanceof JSONArray ) {
54+ if (((JSONArray ) columns ).length () > 10 ) {
55+ throw new MaxLimitException ("The key 'columns' in data extraction result" +
56+ " must have up to 10 columns." );
57+ }
58+ } else if (columns instanceof String ) {
59+ if (!columns .equals ("all" )) {
60+ throw new InvalidQueryException ("The key 'columns' should be a list of" +
61+ " columns or the keyword 'all'" );
62+ }
63+ } else {
64+ throw new InvalidQueryException ("The key 'columns' should be a list of" +
65+ " columns or the keyword 'all'" );
5466 }
5567 }
5668 }
You can’t perform that action at this time.
0 commit comments