avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcrea...@apache.org
Subject svn commit: r1239227 - in /avro/trunk: CHANGES.txt lang/c/src/avrocat.c
Date Wed, 01 Feb 2012 17:38:32 GMT
Author: dcreager
Date: Wed Feb  1 17:38:31 2012
New Revision: 1239227

URL: http://svn.apache.org/viewvc?rev=1239227&view=rev
Log:
AVRO-1014. C: Check for errors producing JSON output in avrocat.

Contributed by Lucas Martin-King.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/c/src/avrocat.c

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1239227&r1=1239226&r2=1239227&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Feb  1 17:38:31 2012
@@ -92,6 +92,9 @@ Avro 1.6.2 (unreleased)
     AVRO-986. Java: DataFileReader correctly handles sync marker
     appearing within file header. (cutting via dcreager)
 
+    AVRO-1014. C: Check for errors producing JSON output in avrocat.
+    (Lucas Martin-King via dcreager)
+
 Avro 1.6.1 (8 November 2011)
 
   INCOMPATIBLE CHANGES

Modified: avro/trunk/lang/c/src/avrocat.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/avrocat.c?rev=1239227&r1=1239226&r2=1239227&view=diff
==============================================================================
--- avro/trunk/lang/c/src/avrocat.c (original)
+++ avro/trunk/lang/c/src/avrocat.c Wed Feb  1 17:38:31 2012
@@ -55,9 +55,15 @@ process_file(const char *filename)
 
 	while (avro_file_reader_read_value(reader, &value) == 0) {
 		char  *json;
-		avro_value_to_json(&value, 1, &json);
-		printf("%s\n", json);
-		free(json);
+
+		if (avro_value_to_json(&value, 1, &json)) {
+			fprintf(stderr, "Error converting value to JSON: %s\n",
+				avro_strerror());
+		} else {
+			printf("%s\n", json);
+			free(json);
+		}
+
 		avro_value_reset(&value);
 	}
 



Mime
View raw message