Skip to content

Commit 00915a0

Browse files
committed
just catch any Exception
1 parent e78c077 commit 00915a0

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/main/java/ai/spice/Config.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,14 @@ public static URI getCloudHttpAddressUri() throws URISyntaxException {
100100
* @return the maximum memory in bytes, or Long.MAX_VALUE if not set or invalid.
101101
*/
102102
public static long getMaxMemory() {
103-
String maxMemoryStr = System.getenv("SPICE_MAX_MEMORY");
104-
if (maxMemoryStr != null && !maxMemoryStr.isEmpty()) {
105-
try {
106-
long maxMemory = Long.parseLong(maxMemoryStr);
107-
if (maxMemory > 0) {
108-
return maxMemory;
109-
}
110-
} catch (NumberFormatException e) {
111-
// Invalid value, fall back to default
103+
try {
104+
String maxMemoryStr = System.getenv("SPICE_MAX_MEMORY");
105+
long maxMemory = Long.parseLong(maxMemoryStr);
106+
if (maxMemory > 0) {
107+
return maxMemory;
112108
}
109+
} catch (Exception e) {
110+
// Any exception, fall back to default
113111
}
114112
return Long.MAX_VALUE;
115113
}

0 commit comments

Comments
 (0)