avro git commit: AVRO-1901: Record named Exception generated bad code
Repository: avro Updated Branches: refs/heads/branch-1.7 49f3bf03d -> 3345e1323 AVRO-1901: Record named Exception generated bad code Amending-Author: Ben McCannbackport to branch-1.7. Exception record for share/test/schemas/specialtypes.avdl skipped since branch-1.7 doesn't have AVRO-1614. Closes #188. Signed-off-by: Sean Busbey Project: http://git-wip-us.apache.org/repos/asf/avro/repo Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/3345e132 Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/3345e132 Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/3345e132 Branch: refs/heads/branch-1.7 Commit: 3345e13238d1d0278a4e1da5a9df60356892193c Parents: 49f3bf0 Author: radai-rosenblatt Authored: Fri Jan 13 15:22:57 2017 -0800 Committer: Sean Busbey Committed: Sat Jan 28 03:54:05 2017 -0600 -- .../specific/templates/java/classic/record.vm | 2 +- .../avro/compiler/TestSpecificCompiler.java | 20 +--- .../avro/examples/baseball/Player.java | 2 +- .../tools/src/test/compiler/output/Player.java | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/avro/blob/3345e132/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm -- diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 7298509..1becde0 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -279,7 +279,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or record.${this.mangle($field.name(), $schema.isError())} = fieldSetFlags()[$field.pos()] ? this.${this.mangle($field.name(), $schema.isError())} : (${this.javaType($field.schema())}) defaultValue(fields()[$field.pos()]); #end return record; - } catch (Exception e) { + } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } http://git-wip-us.apache.org/repos/asf/avro/blob/3345e132/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java -- diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java index 7c4fcc2..35c1936 100644 --- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java +++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java @@ -56,6 +56,9 @@ public class TestSpecificCompiler { this.src = new File(this.schemaSrcPath); this.outputDir = AvroTestUtil.tempDirectory(getClass(), "specific-output"); this.outputFile = new File(this.outputDir, "SimpleRecord.java"); +if (outputFile.exists() && !outputFile.delete()) { + throw new IllegalStateException("unable to delete " + outputFile); +} } @After @@ -100,6 +103,7 @@ public class TestSpecificCompiler { assertFalse("Line started with a deprecated field declaration: " + line, line.startsWith("@Deprecated public int value")); } +reader.close(); } @Test @@ -118,6 +122,7 @@ public class TestSpecificCompiler { assertFalse("Line started with a public field declaration: " + line, line.startsWith("public int value")); } +reader.close(); } @Test @@ -140,6 +145,7 @@ public class TestSpecificCompiler { assertFalse("Line started with a deprecated field declaration: " + line, line.startsWith("@Deprecated public int value")); } +reader.close(); } @Test @@ -158,6 +164,7 @@ public class TestSpecificCompiler { foundSetters++; } } +reader.close(); assertEquals("Found the wrong number of setters", 1, foundSetters); } @@ -176,6 +183,7 @@ public class TestSpecificCompiler { assertFalse("No line should include the setter: " + line, line.startsWith("public void setValue(")); } +reader.close(); } @Test @@ -184,14 +192,20 @@ public class TestSpecificCompiler { // Generated file in default encoding compiler.compileToDestination(this.src, this.outputDir); byte[] fileInDefaultEncoding = new byte[(int) this.outputFile.length()]; -new
[20/35] avro git commit: AVRO-1901: Record named Exception generated bad code
AVRO-1901: Record named Exception generated bad code Project: http://git-wip-us.apache.org/repos/asf/avro/repo Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/06f4a122 Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/06f4a122 Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/06f4a122 Branch: refs/heads/branch-1.8 Commit: 06f4a1220af45bbd1e428450cf278bf6795fb402 Parents: 7a15dcd Author: radai-rosenblattAuthored: Tue Sep 6 09:16:42 2016 -0700 Committer: Ryan Blue Committed: Sat Nov 5 13:18:08 2016 -0700 -- CHANGES.txt | 3 +++ .../compiler/specific/SpecificCompiler.java | 1 + .../specific/templates/java/classic/record.vm | 2 +- .../compiler/specific/TestSpecificCompiler.java | 21 +--- .../avro/examples/baseball/Player.java | 2 +- .../tools/src/test/compiler/output/Player.java | 2 +- share/test/schemas/specialtypes.avdl| 3 +++ 7 files changed, 28 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/avro/blob/06f4a122/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index d16b7bf..d82a345 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -57,6 +57,9 @@ Trunk (not yet released) AVRO-1914: Fix licencing errors reported by rat. (Niels Basjes) +AVRO-1901: Record named "Exception" generated bad code. +(Radai Rosenblatt via Niels Basjes) + Avro 1.8.1 (14 May 2016) INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/avro/blob/06f4a122/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java -- diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java index 5b6b3bb..2959493 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java @@ -406,6 +406,7 @@ public class SpecificCompiler { return outputFile; } + //package private for testing purposes String makePath(String name, String space) { if (space == null || space.isEmpty()) { return name + suffix; http://git-wip-us.apache.org/repos/asf/avro/blob/06f4a122/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm -- diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 15ea734..d5ace4d 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -425,7 +425,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or #end #end return record; - } catch (Exception e) { + } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } http://git-wip-us.apache.org/repos/asf/avro/blob/06f4a122/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java -- diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java index 49174a8..07328d3 100644 --- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java +++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java @@ -65,6 +65,9 @@ public class TestSpecificCompiler { this.src = new File(this.schemaSrcPath); this.outputDir = AvroTestUtil.tempDirectory(getClass(), "specific-output"); this.outputFile = new File(this.outputDir, "SimpleRecord.java"); +if (outputFile.exists() && !outputFile.delete()) { + throw new IllegalStateException("unable to delete " + outputFile); +} } @After @@ -143,6 +146,7 @@ public class TestSpecificCompiler { assertFalse("Line started with a deprecated field declaration: " + line, line.startsWith("@Deprecated public int value")); } +reader.close(); } @Test @@ -156,6 +160,7 @@ public class TestSpecificCompiler { while (!foundAllArgsConstructor && (line =
avro git commit: AVRO-1901: Record named Exception generated bad code
Repository: avro Updated Branches: refs/heads/master 27cb9e271 -> be33922c0 AVRO-1901: Record named Exception generated bad code Project: http://git-wip-us.apache.org/repos/asf/avro/repo Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/be33922c Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/be33922c Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/be33922c Branch: refs/heads/master Commit: be33922c03bd229b885fb9d664b55ce308f6ffaf Parents: 27cb9e2 Author: radai-rosenblattAuthored: Tue Sep 6 09:16:42 2016 -0700 Committer: Niels Basjes Committed: Mon Sep 19 10:15:46 2016 +0200 -- CHANGES.txt | 3 +++ .../compiler/specific/SpecificCompiler.java | 1 + .../specific/templates/java/classic/record.vm | 2 +- .../compiler/specific/TestSpecificCompiler.java | 21 +--- .../avro/examples/baseball/Player.java | 2 +- .../tools/src/test/compiler/output/Player.java | 2 +- share/test/schemas/specialtypes.avdl| 3 +++ 7 files changed, 28 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/avro/blob/be33922c/CHANGES.txt -- diff --git a/CHANGES.txt b/CHANGES.txt index aa72209..28fdf93 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -60,6 +60,9 @@ Trunk (not yet released) AVRO-1914: Fix licencing errors reported by rat. (Niels Basjes) +AVRO-1901: Record named "Exception" generated bad code. +(Radai Rosenblatt via Niels Basjes) + Avro 1.8.1 (14 May 2016) INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/avro/blob/be33922c/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java -- diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java index 5b6b3bb..2959493 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java @@ -406,6 +406,7 @@ public class SpecificCompiler { return outputFile; } + //package private for testing purposes String makePath(String name, String space) { if (space == null || space.isEmpty()) { return name + suffix; http://git-wip-us.apache.org/repos/asf/avro/blob/be33922c/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm -- diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 15ea734..d5ace4d 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -425,7 +425,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or #end #end return record; - } catch (Exception e) { + } catch (java.lang.Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } http://git-wip-us.apache.org/repos/asf/avro/blob/be33922c/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java -- diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java index 49174a8..07328d3 100644 --- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java +++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java @@ -65,6 +65,9 @@ public class TestSpecificCompiler { this.src = new File(this.schemaSrcPath); this.outputDir = AvroTestUtil.tempDirectory(getClass(), "specific-output"); this.outputFile = new File(this.outputDir, "SimpleRecord.java"); +if (outputFile.exists() && !outputFile.delete()) { + throw new IllegalStateException("unable to delete " + outputFile); +} } @After @@ -143,6 +146,7 @@ public class TestSpecificCompiler { assertFalse("Line started with a deprecated field declaration: " + line, line.startsWith("@Deprecated public int value")); } +reader.close(); } @Test @@ -156,6 +160,7 @@