8339769: Incorrect error message during startup if working directory does not exist

Reviewed-by: naoto, dholmes, alanb
This commit is contained in:
Justin Lu 2024-09-16 17:26:47 +00:00
parent 1640bd2676
commit 65b9abaa29

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -521,11 +521,14 @@ GetJavaProperties(JNIEnv *env)
{
char buf[MAXPATHLEN];
errno = 0;
if (getcwd(buf, sizeof(buf)) == NULL)
if (getcwd(buf, sizeof(buf)) == NULL) {
JNU_ThrowByName(env, "java/lang/Error",
"Properties init: Could not determine current working directory.");
else
"Properties init: Could not determine current working directory.");
return NULL;
}
else {
sprops.user_dir = strdup(buf);
}
}
sprops.file_separator = "/";