Skip to content

Commit

Permalink
fix(rserve): avoid disfunctional JSF page when invalid Rserve port #7000
Browse files Browse the repository at this point in the history


When an invalid port was set, which cannot be transformed to an integer,
the JSF page would kind of freeze: it leaves the user on the grayed out
"action" screen and if you click on it, shows upload page with no files,
so a silent error.

By defaulting to 6311 also for this case and logging an error, this
should improve the UX, but leave a hint for an admin in the logs.
  • Loading branch information
poikilotherm committed Dec 21, 2022
1 parent 04b6326 commit 6a1984d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ dataverse.rserve.port
Port number for Rserve, used for tasks that require use of R (to ingest RData
files and to save tabular data as RData frames).

Defaults to ``6311``.
Defaults to ``6311`` when not configured or no valid integer.

Can also be set via *MicroProfile Config API* sources, e.g. the environment
variable ``DATAVERSE_RSERVE_PORT``.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,14 @@ public RDATAFileReader(TabularDataFileReaderSpi originator) {
// ready to be overridden by a sysadmin. Every time a file would be read with this file reader,
// a new reader will be created, reading from the cached config source settings with minimal overhead.
this.RSERVE_HOST = JvmSettings.RSERVE_HOST.lookup();
this.RSERVE_PORT = JvmSettings.RSERVE_PORT.lookup(Integer.class);
int port;
try {
port = JvmSettings.RSERVE_PORT.lookup(Integer.class);
} catch (IllegalArgumentException e) {
LOG.log(Level.SEVERE, "Could not parse value for " + JvmSettings.RSERVE_PORT.getScopedKey() + ", defaulting to 6311", e);
port = 6311;
}
this.RSERVE_PORT = port;
this.RSERVE_USER = JvmSettings.RSERVE_USER.lookup();
this.RSERVE_PASSWORD = JvmSettings.RSERVE_PASSWORD.lookup();

Expand Down

0 comments on commit 6a1984d

Please sign in to comment.