Subhrat Chaudhary created RANGER-4664:
-----------------------------------------
Summary: SQL Exception is thrown, if resource is null in POST
sharedResource API
Key: RANGER-4664
URL: https://issues.apache.org/jira/browse/RANGER-4664
Project: Ranger
Issue Type: Bug
Components: admin
Reporter: Subhrat Chaudhary
If resource is not passed in sharedResource request body (POST API
/service/gds/resource):
{code:java}
{
"name": "SHR4",
"dataShareId": 5,
"resource": { }
}{code}
Following error is received:
{code:java}
{
"statusCode": 1,
"msgDesc": "Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.7.12.v20230209-e5c4074ef3):
org.eclipse.persistence.exceptions.DatabaseException\nInternal Exception:
java.sql.SQLIntegrityConstraintViolationException: (conn=106) Column 'resource'
cannot be null\nError Code: 1048\nCall: INSERT INTO x_gds_shared_resource
(access_types, ADDED_BY_ID, additional_info, condition_expr, CREATE_TIME,
data_share_id, description, guid, is_enabled, name, options, profiles,
resource, resource_signature, row_filter, sub_resource, sub_resource_masks,
sub_resource_type, UPDATE_TIME, UPD_BY_ID, version) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n\tbind => [21 parameters
bound]\nQuery: ValueReadQuery(name=\"X_GDS_SHARED_RESOURCE_SEQ\" sql=\"SELECT
LAST_INSERT_ID()\")"
}{code}
Ideally in response, HTTP Status code 400 (Bad request) should be thrown with
custom error message.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)