Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
e4d54817
Commit
e4d54817
authored
Apr 27, 2015
by
Shwetha G S
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #60 from hortonworks/issue57
ISSUE 57 - throw exception if type created with invalid JSON
parents
db8ac80d
8cac97e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
DefaultMetadataService.java
...ache/hadoop/metadata/services/DefaultMetadataService.java
+6
-0
TypesDef.scala
...cala/org/apache/hadoop/metadata/typesystem/TypesDef.scala
+4
-0
No files found.
repository/src/main/java/org/apache/hadoop/metadata/services/DefaultMetadataService.java
View file @
e4d54817
...
...
@@ -43,6 +43,7 @@ import org.codehaus.jettison.json.JSONException;
import
org.codehaus.jettison.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
scala.tools.cmd.Meta
;
import
javax.inject.Inject
;
import
javax.inject.Singleton
;
...
...
@@ -90,9 +91,14 @@ public class DefaultMetadataService implements MetadataService {
public
JSONObject
createType
(
String
typeDefinition
)
throws
MetadataException
{
try
{
Preconditions
.
checkNotNull
(
typeDefinition
,
"type definition cannot be null"
);
Preconditions
.
checkArgument
(!
typeDefinition
.
equals
(
""
),
"type definition cannot be an empty string"
);
TypesDef
typesDef
=
TypesSerialization
.
fromJson
(
typeDefinition
);
if
(
typesDef
.
isEmpty
())
throw
new
MetadataException
(
"Invalid type definition"
);
Map
<
String
,
IDataType
>
typesAdded
=
typeSystem
.
defineTypes
(
typesDef
);
//TODO how do we handle transaction - store failure??
typeStore
.
store
(
typeSystem
,
ImmutableList
.
copyOf
(
typesAdded
.
keySet
()));
...
...
typesystem/src/main/scala/org/apache/hadoop/metadata/typesystem/TypesDef.scala
View file @
e4d54817
...
...
@@ -58,4 +58,8 @@ case class TypesDef(enumTypes: Seq[EnumTypeDefinition],
import
scala.collection.JavaConverters._
classTypes
.
asJava
}
def
isEmpty
()
=
{
enumTypes
.
isEmpty
&
structTypes
.
isEmpty
&
traitTypes
.
isEmpty
&
classTypes
.
isEmpty
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment