Skip to content

Commit 958d3f3

Browse files
committed
Fixing queryCount when its larger then MAX_VALUE
1 parent ac61a5a commit 958d3f3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main/java/picoded/dstack/DataObjectMap.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,17 @@ default String[] getFromKeyName_id(String keyName, String orderByStr, int offset
318318

319319
/**
320320
* Get the size of the current DataObjectMap
321+
*
322+
* Note that if the dataset size is larger then Integer.MAX_VALUE
323+
* it is clamped accordingly to the MAX_VALUE
321324
**/
322325
@Override
323326
default int size() {
324-
return queryCount(null,null);
327+
long s = queryCount(null,null);
328+
if( s > Integer.MAX_VALUE ) {
329+
return Integer.MAX_VALUE;
330+
}
331+
return (int)s;
325332
}
326333

327334
/**

0 commit comments

Comments
 (0)