simonAndre / protobuf-embedded-c

Automatically exported from code.google.com/p/protobuf-embedded-c
0 stars 0 forks source link

Compile fails without "optional" annotations @max_string_length and @max_repeated_length in .proto file #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Repro:
1. Generate a .proto file that has a string type but does not have the 
@max_string_length comment
2. Attempt to compile the .proto file

Expected:
I expected it to compile. Instead I get this exception:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Integer.java:417)
    at java.lang.Integer.parseInt(Integer.java:499)
    at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.getMaximumSerializedSize(EmbeddedCGenerator.java:491)
    at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.compileHeader(EmbeddedCGenerator.java:307)
    at edu.tum.cs.ccts.protobuf.embedded.EmbeddedCGenerator.doGenerate(EmbeddedCGenerator.java:113)
    at edu.tum.cs.ccts.protobuf.embedded.Protoc.main(Protoc.java:126)

This is running 1.0M4 on Java 1.6.0_65 on Max OSX 10.6.

When I add the //@max_string_length=32 annotation it compiles without issue.

A similar exception happens when the //@max_repeated_length annotation is 
missing and you declare an element repeated.

Original issue reported on code.google.com by m...@ikend.com on 31 Dec 2013 at 5:16