[ 
https://issues.apache.org/jira/browse/ATLAS-1681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sharmadha Sainath updated ATLAS-1681:
-------------------------------------
    Description: 
Created an entity type with one of its attribute name empty with the following 
definition with the following JSON:

{code}

{
   "structDefs":[

   ],
   "entityDefs":[
      {
         "category":"ENTITY",
         "updateTime":12345,
         "name":"entity_incorrect",
         "typeVersion":"0.1",
         "attributeDefs":[
            {
               "name":"type_str",
               "isOptional":true,
               "isUnique":false,
               "isIndexable":false,
               "typeName":"string",
               "valuesMaxCount":1,
               "cardinality":"SINGLE",
               "valuesMinCount":0
            },
            {
               "name":"",
               "typeName":"int",
               "isOptional":true,
               "cardinality":"SINGLE",
               "valuesMinCount":-1,
               "valuesMaxCount":-1,
               "isUnique":false,
               "isIndexable":false
            }
         ],
         "superTypes":[

         ],
         "version":12345,
         "guid":"-48964f25979it51334479",
         "createTime":12345,
         "description":"incorrect json"
      }
   ],
   "classificationDefs":[

   ],
   "enumDefs":[

   ]
}

{code}

*Note the second attribute name in the attribute definition*

POSTed the type definition to
{code}
/api/atlas/v2/types/typedefs
{code}

The type is created ,with 200 OK but with exception 
{code}
java.lang.IllegalArgumentException: Attribute name cannot be empty
{code}

(Attached the complete stack trace as a file)

Inconsistency Observed :

1. Types drop down box lists the type entity_incorrect , but clicking on it 
throws "Invalid Expression" exception
 
2. Therafter ,any type creation (entity type , classification etc) is 
succeeding with 200 OK but application.log has exception :
{code}
org.apache.atlas.query.Expressions$UnresolvedException: Unresolved id, 
expression: entity_correct
{code}

Example :
After POSTing the incorrect json to Atlas , created a tag tag_after in UI . It 
succeeded. But Search of tag throws invalid expression and tag Association to 
entity fails with  
{code}
org.apache.atlas.exception.AtlasBaseException: 
org.apache.atlas.repository.RepositoryException: 
org.apache.atlas.typesystem.exception.TypeNotFoundException: Unknown datatype: 
tag_after
{code}

Type registration is affected when Atlas accepts the wrong JSON.

Giving an empty attribute name is not a very common scenario but at what 
conditions such wrong JSONs could be accepted should be looked at.




  was:
Created an entity type with one of its attribute name empty with the following 
definition with the following JSON:

{code}

{
   "structDefs":[

   ],
   "entityDefs":[
      {
         "category":"ENTITY",
         "updateTime":12345,
         "name":"entity_incorrect",
         "typeVersion":"0.1",
         "attributeDefs":[
            {
               "name":"type_str",
               "isOptional":true,
               "isUnique":false,
               "isIndexable":false,
               "typeName":"string",
               "valuesMaxCount":1,
               "cardinality":"SINGLE",
               "valuesMinCount":0
            },
            {
               "name":"",
               "typeName":"int",
               "isOptional":true,
               "cardinality":"SINGLE",
               "valuesMinCount":-1,
               "valuesMaxCount":-1,
               "isUnique":false,
               "isIndexable":false
            }
         ],
         "superTypes":[

         ],
         "version":12345,
         "guid":"-48964f25979it51334479",
         "createTime":12345,
         "description":"incorrect json"
      }
   ],
   "classificationDefs":[

   ],
   "enumDefs":[

   ]
}

{code}

*Note the second attribute name in the attribute definition*

POSTed the type definition to
{code}
/api/atlas/v2/types/typedefs
{code}

The type is created ,with 200 OK but with exception 
{code}
java.lang.IllegalArgumentException: Attribute name cannot be empty
{code}

(Attached the complete stack trace as a file)

Inconsistency Observed :

1. Types drop down box lists the type , but clicking on it throws "Invalid 
Expression" exception
 
2. Therafter ,any type creation (entity type , classification etc) is 
succeeding with 200 OK but application.log has exception :
{code}
org.apache.atlas.query.Expressions$UnresolvedException: Unresolved id, 
expression: entity_correct
{code}

Example :
After POSTing the incorrect json to Atlas , created a tag tag_after in UI . It 
succeeded. But Search of tag throws invalid expression and tag Association to 
entity fails with  
{code}
org.apache.atlas.exception.AtlasBaseException: 
org.apache.atlas.repository.RepositoryException: 
org.apache.atlas.typesystem.exception.TypeNotFoundException: Unknown datatype: 
tag_after
{code}

Type registration is affected when Atlas accepts the wrong JSON.

Giving an empty attribute name is not a very common scenario but at what 
conditions such wrong JSONs could be accepted should be looked at.





> Atlas went into inconsistent state after creating a type with faulty 
> definition
> -------------------------------------------------------------------------------
>
>                 Key: ATLAS-1681
>                 URL: https://issues.apache.org/jira/browse/ATLAS-1681
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>    Affects Versions: trunk, 0.9-incubating
>            Reporter: Sharmadha Sainath
>         Attachments: EmptyAttrNameInTypeDef.txt
>
>
> Created an entity type with one of its attribute name empty with the 
> following definition with the following JSON:
> {code}
> {
>    "structDefs":[
>    ],
>    "entityDefs":[
>       {
>          "category":"ENTITY",
>          "updateTime":12345,
>          "name":"entity_incorrect",
>          "typeVersion":"0.1",
>          "attributeDefs":[
>             {
>                "name":"type_str",
>                "isOptional":true,
>                "isUnique":false,
>                "isIndexable":false,
>                "typeName":"string",
>                "valuesMaxCount":1,
>                "cardinality":"SINGLE",
>                "valuesMinCount":0
>             },
>             {
>                "name":"",
>                "typeName":"int",
>                "isOptional":true,
>                "cardinality":"SINGLE",
>                "valuesMinCount":-1,
>                "valuesMaxCount":-1,
>                "isUnique":false,
>                "isIndexable":false
>             }
>          ],
>          "superTypes":[
>          ],
>          "version":12345,
>          "guid":"-48964f25979it51334479",
>          "createTime":12345,
>          "description":"incorrect json"
>       }
>    ],
>    "classificationDefs":[
>    ],
>    "enumDefs":[
>    ]
> }
> {code}
> *Note the second attribute name in the attribute definition*
> POSTed the type definition to
> {code}
> /api/atlas/v2/types/typedefs
> {code}
> The type is created ,with 200 OK but with exception 
> {code}
> java.lang.IllegalArgumentException: Attribute name cannot be empty
> {code}
> (Attached the complete stack trace as a file)
> Inconsistency Observed :
> 1. Types drop down box lists the type entity_incorrect , but clicking on it 
> throws "Invalid Expression" exception
>  
> 2. Therafter ,any type creation (entity type , classification etc) is 
> succeeding with 200 OK but application.log has exception :
> {code}
> org.apache.atlas.query.Expressions$UnresolvedException: Unresolved id, 
> expression: entity_correct
> {code}
> Example :
> After POSTing the incorrect json to Atlas , created a tag tag_after in UI . 
> It succeeded. But Search of tag throws invalid expression and tag Association 
> to entity fails with  
> {code}
> org.apache.atlas.exception.AtlasBaseException: 
> org.apache.atlas.repository.RepositoryException: 
> org.apache.atlas.typesystem.exception.TypeNotFoundException: Unknown 
> datatype: tag_after
> {code}
> Type registration is affected when Atlas accepts the wrong JSON.
> Giving an empty attribute name is not a very common scenario but at what 
> conditions such wrong JSONs could be accepted should be looked at.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to