Skip to content

Commit 355a985

Browse files
Throw an exception when configuring a negative or zero default size
1 parent 08bb427 commit 355a985

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/javawebstack/orm/ORMConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.javawebstack.orm;
22

33
import org.javawebstack.injector.Injector;
4+
import org.javawebstack.orm.exception.ORMConfigurationException;
45
import org.javawebstack.orm.mapper.DefaultMapper;
56
import org.javawebstack.orm.mapper.TypeMapper;
67

@@ -30,7 +31,10 @@ public ORMConfig setCamelToSnakeCase(boolean camelToSnakeCase) {
3031
return this;
3132
}
3233

33-
public ORMConfig setDefaultSize(int defaultSize) {
34+
public ORMConfig setDefaultSize(int defaultSize) throws ORMConfigurationException {
35+
if(defaultSize <= 0)
36+
throw new ORMConfigurationException("Default size must be positive and non-zero. If this exceptions occurs unexpectedly make sure no overflow is occurring.");
37+
3438
this.defaultSize = defaultSize;
3539
return this;
3640
}

0 commit comments

Comments
 (0)