Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cadc-rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sourceCompatibility = 11

group = 'org.opencadc'

version = '1.4.9'
version = '1.4.10'

description = 'OpenCADC REST server library'
def git_url = 'https://github.com/opencadc/core'
Expand Down
10 changes: 9 additions & 1 deletion cadc-rest/src/main/java/ca/nrc/cadc/rest/RestAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,27 +395,35 @@ public Object run()
handleException(ex, 403, "permission denied -- reason: invalid proxy certficate", false, true);
} catch (IllegalArgumentException | UnsupportedOperationException | InlineContentException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
handleException(ex, 400, ex.getMessage(), false, false);
} catch (ResourceNotFoundException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
handleException(ex, 404, ex.getMessage(), false, false);
} catch (ResourceAlreadyExistsException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
handleException(ex, 409, ex.getMessage(), false, false);
} catch (PreconditionFailedException ex) {
logInfo.setSuccess(true);
handleException(ex, 412, ex.getMessage(), false, false);
} catch (ByteLimitExceededException ex) {
logInfo.setSuccess(true);
handleException(ex, 413, ex.getMessage(), false, false);
String msg = "limit: " + ex.getLimit();
logInfo.setMessage("limit: " + msg);
handleException(ex, 413, msg, false, false);
} catch (RangeNotSatisfiableException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
handleException(ex, 416, ex.getMessage(), false, false);
} catch (ExpectationFailedException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
handleException(ex, 417, ex.getMessage(), false, false);
} catch (TransientException ex) {
logInfo.setSuccess(true);
logInfo.setMessage(ex.getMessage());
syncOutput.setHeader(HttpTransfer.SERVICE_RETRY, ex.getRetryDelay());
if (!readable || !writable) {
// exception due to service state: keep logs tidy
Expand Down
2 changes: 1 addition & 1 deletion cadc-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sourceCompatibility = 1.8

group = 'org.opencadc'

version = '1.12.14'
version = '1.12.15'

description = 'OpenCADC core utility library'
def git_url = 'https://github.com/opencadc/core'
Expand Down
22 changes: 13 additions & 9 deletions cadc-util/src/main/java/ca/nrc/cadc/util/ConfigFileReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,7 @@ public class ConfigFileReader {
private final File configFile;
private String commentChars = "#";

/**
* Normal constructor to find the specified config file. This method checks for a
* custom location (ca.nrc.cadc.util.ConfigFileReader.dir system property) and
* defaults to {user.home}/config.
*
* @param filename relative filename for the configuration
*/
public ConfigFileReader(String filename) {
public static File findConfigFile(String filename) {
if (filename == null) {
throw new IllegalArgumentException("filename cannot be null.");
}
Expand All @@ -108,7 +101,18 @@ public ConfigFileReader(String filename) {
configDir = System.getProperty(CONFIG_DIR_SYSTEM_PROPERTY);
}

this.configFile = new File(new File(configDir), filename);
return new File(new File(configDir), filename);
}

/**
* Normal constructor to find the specified config file. This method checks for a
* custom location (ca.nrc.cadc.util.ConfigFileReader.dir system property) and
* defaults to {user.home}/config.
*
* @param filename relative filename for the configuration
*/
public ConfigFileReader(String filename) {
this.configFile = findConfigFile(filename);
}

public ConfigFileReader(File configFile) {
Expand Down
Loading