diff --git a/lib/xdrgen/generators/java.rb b/lib/xdrgen/generators/java.rb index e56d3af7a..20f59ec62 100644 --- a/lib/xdrgen/generators/java.rb +++ b/lib/xdrgen/generators/java.rb @@ -2,7 +2,6 @@ module Xdrgen module Generators - class Java < Xdrgen::Generators::Base def generate @@ -834,7 +833,7 @@ def decode_type(decl) when AST::Typespecs::Bool ; "stream.readInt() == 1 ? true : false" when AST::Typespecs::String ; - "XdrString.decode(stream, #{decl.size})" + "XdrString.decode(stream, #{decl.size || 'Integer.MAX_VALUE'})" when AST::Typespecs::Simple ; "#{name decl.type.resolved_type}.decode(stream)" when AST::Concerns::NestedDefinition ; diff --git a/spec/output/generator_spec_java/struct.x/MyStruct.java b/spec/output/generator_spec_java/struct.x/MyStruct.java index 297c08fc6..9fb7496c7 100644 --- a/spec/output/generator_spec_java/struct.x/MyStruct.java +++ b/spec/output/generator_spec_java/struct.x/MyStruct.java @@ -76,7 +76,7 @@ public static MyStruct decode(XdrDataInputStream stream) throws IOException { int someOpaquesize = 10; decodedMyStruct.someOpaque = new byte[someOpaquesize]; stream.read(decodedMyStruct.someOpaque, 0, someOpaquesize); - decodedMyStruct.someString = XdrString.decode(stream, ); + decodedMyStruct.someString = XdrString.decode(stream, Integer.MAX_VALUE); decodedMyStruct.maxString = XdrString.decode(stream, 100); return decodedMyStruct; } diff --git a/spec/output/generator_spec_java/test.x/Str2.java b/spec/output/generator_spec_java/test.x/Str2.java index ad7921eea..12bfdad3d 100644 --- a/spec/output/generator_spec_java/test.x/Str2.java +++ b/spec/output/generator_spec_java/test.x/Str2.java @@ -39,7 +39,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { } public static Str2 decode(XdrDataInputStream stream) throws IOException { Str2 decodedStr2 = new Str2(); - decodedStr2.str2 = XdrString.decode(stream, ); + decodedStr2.str2 = XdrString.decode(stream, Integer.MAX_VALUE); return decodedStr2; }