[ 
https://issues.apache.org/jira/browse/ATLAS-2310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16298452#comment-16298452
 ] 

Péter Gergő Barna commented on ATLAS-2310:
------------------------------------------

An actual occurrence of this problem when Atlas runs in HA mode and the 
hive-import.sh fails with HTTP status 400 (Bad Request) Response Body 
({"error":"Entity type cannot be null"}) because the /api/atlas/entities 
request is being sent to the passive node which redirects the request to the 
active node with the wrong URL encoding.


logs, passive node:

{noformat}
2017-12-19 11:04:26,916 INFO  - [pool-2-thread-17:] ~ Not active. Redirecting 
to 
https://passive.node:21443/api/atlas/entities?type%3Dhive_db%26property%3DqualifiedName%26value%3Dcreatedbsr9sxiha7s%40cl1%26doAs%3Dhrt_qa
 (ActiveServerFilter:143)

{noformat}

active node:

{noformat}
017-12-19 11:04:27,008 INFO  - [pool-2-thread-14:hrt_qa:GET/api/atlas/entities] 
~ Request from authenticated user: hrt_qa, 
URL=/api/atlas/entities?type%3Dhive_db%26property%3DqualifiedName%26value%3Dcreatedbsr9sxiha7s%40cl1%26doAs%3Dhrt_qa
 (AtlasAuthenticati
onFilter:318)
2017-12-19 11:04:27,009 ERROR - [pool-2-thread-14 - 
7e8cc701-8a56-4a21-83cd-d0d02b4f0587:hrt_qa:GET/api/atlas/entities] ~ Entity 
type cannot be null (EntityResource:729)
java.lang.NullPointerException: Entity type cannot be null
        at 
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228)
        at 
org.apache.atlas.web.resources.EntityResource.getEntityListByType(EntityResource.java:713)
        at 
org.apache.atlas.web.resources.EntityResource.getEntity(EntityResource.java:761)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
{noformat}


> In HA, the passive node redirects the request with wrong URL encoding 
> ----------------------------------------------------------------------
>
>                 Key: ATLAS-2310
>                 URL: https://issues.apache.org/jira/browse/ATLAS-2310
>             Project: Atlas
>          Issue Type: Bug
>    Affects Versions: 0.8.1
>            Reporter: Péter Gergő Barna
>            Assignee: Péter Gergő Barna
>         Attachments: ATLAS-2310.patch
>
>
> In HA, the passive node redirects the request with wrong URL encoding. 
> Instead of encoding only the values, the whole query is encoded as a single 
> string.
> url = "http://atlas.node.com:21000/api/atlas/entites?type=My type&name=My 
> name"
> wrong result after encoding:
> http://atlas.node.com:21000/api/atlas/entites?type%3DMy+type%26name%3DMy+name
> expected result after encoding:
> http://atlas.node.com:21000/api/atlas/entites?type=My%20type&name=My%20name
> in the code, instead of 
> https://github.com/apache/atlas/blob/master/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java#L132
> {noformat}
> queryString = URLEncoder.encode(queryString, "UTF-8");
> {noformat}
> we should do something like 
> {noformat}
> import org.springframework.web.util.UriUtils
> queryString = UriUtils.encodeQuery(queryString, "UTF-8")
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to