You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/08/04 01:03:14 UTC
svn commit: r982062 - in /avro/trunk: CHANGES.txt
lang/java/src/java/org/apache/avro/Schema.java
Author: cutting
Date: Tue Aug 3 23:03:14 2010
New Revision: 982062
URL: http://svn.apache.org/viewvc?rev=982062&view=rev
Log:
AVRO-583. Java: Improve error message when types not correctly nested.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/lang/java/src/java/org/apache/avro/Schema.java
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=982062&r1=982061&r2=982062&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Tue Aug 3 23:03:14 2010
@@ -85,6 +85,9 @@ Avro 1.4.0 (unreleased)
AVRO-601. Java: Add per-field property support. (cutting)
+ AVRO-583. Java: Improve error message when types not correctly
+ nested. (cutting)
+
BUG FIXES
AVRO-502. Memory leak from parsing JSON schema.
Modified: avro/trunk/lang/java/src/java/org/apache/avro/Schema.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/Schema.java?rev=982062&r1=982061&r2=982062&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/Schema.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/Schema.java Tue Aug 3 23:03:14 2010
@@ -930,6 +930,12 @@ public abstract class Schema {
JsonNode fieldTypeNode = field.get("type");
if (fieldTypeNode == null)
throw new SchemaParseException("No field type: "+field);
+ if (fieldTypeNode.isTextual()
+ && names.get(fieldTypeNode.getTextValue()) == null)
+ throw new SchemaParseException
+ (fieldTypeNode+" is not a defined name."
+ +" The type of the \""+fieldName+"\" field must be"
+ +" a defined name or a {\"type\": ...} expression.");
Schema fieldSchema = parse(fieldTypeNode, names);
Field.Order order = Field.Order.ASCENDING;
JsonNode orderNode = field.get("order");