kshchepanovskyi / protostuff-googlecode-exported Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/protostuff
License: Apache License 2.0
Automatically exported from code.google.com/p/protostuff
License: Apache License 2.0
Like protobuf, it should support empty messages.
Original issue reported on code.google.com by [email protected]
on 4 Feb 2011 at 5:15
What steps will reproduce the problem?
1. Create a class with a field of type Object
2. Try to create a schema for it using Runtime.getSchema().
What is the expected output? What do you see instead?
I expect it to work. It throws an NPE instead.
What version of the product are you using? On what operating system?
1.0.0.M7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 27 Jan 2011 at 4:23
Attachments:
Validation missing (for required fields) when nested messages are
"group_encoded"
Original issue reported on code.google.com by [email protected]
on 24 Jun 2010 at 2:28
If a .proto file imports several other .proto files that are defined in the
same package, the parser only remembers the messages defined in the last .proto
file. I would expect to be able to reference messages defined in any of the
imported .proto files; this is how things work using Google's protoc compiler.
Compiling p1.proto from the attached .zip file will illustrate the problem.
Original issue reported on code.google.com by [email protected]
on 4 Nov 2010 at 11:12
Attachments:
Using trunk
I am setting
static {
// must enable to support inheritance on non-abstract base types.
System.setProperty("protostuff.runtime.morph_non_final_pojos", "true");
}
which results in XML generated with numbered tags <127> which does not conform
to XML standards and thus when i try o deserialize it gives,
com.dyuproject.protostuff.XmlInputException:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,78]
Message: The content of elements must consist of well-formed character data or
markup.
I guess it is complaining of the <127> tag
<?xml version="1.0"
encoding="UTF-8"?><RequestContainer><m_request><Request><127>com.hello.request</
127>
Original issue reported on code.google.com by [email protected]
on 28 Jan 2011 at 6:25
The current SVN has problems with the descriptor.proto from protobuf-
2.3.0
My investigation so far - it doesn't like forward references to messages
defined later in the file.
It doesn't like lines like:
optional string package = 2; // e.g. "foo", "foo.bar", etc.
or
repeated ServiceDescriptorProto service = 6;
complaining about the names 'package' and 'service'
In another file in the open source waveserver, we have
package rpc;
which is also not allowed.
It complains about a ; at the end of an Enum such as
Enum Type {
... values ...
};
It would be useful if error messages like
[java] line 30:8 mismatched input 'rpc' expecting set null
[java] line 35:7 mismatched input 'google.protobuf.MethodOptions'
expecting ID
included the filename as well as the line number.
finally, it doesn't like
Original issue reported on code.google.com by [email protected]
on 12 May 2010 at 5:55
I'm seeing an ArrayIndexOutOfBoundsException in StringSerializer.writeUTF8.
$ scala -classpath protostuff-api-1.0.0.M3.jar:protostuff-core-1.0.0.M3.jar
crash.scala
java.lang.ArrayIndexOutOfBoundsException: 2047
at com.dyuproject.protostuff.StringSerializer.writeUTF8(StringSerializer.java:462)
at com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:741)
at com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:883)
at com.dyuproject.protostuff.BufferedOutput.writeString(BufferedOutput.java:206)
at Main$$anon$1.<init>(crash.scala:15)
at Main$.main(crash.scala:1)
at Main.main(crash.scala)
crash.scala:
import com.dyuproject.protostuff._
def repeat(ch:Char, times:Int):String = {
val sb = new StringBuilder
(1 to times).foreach{i => sb.append(ch)}
sb.toString
}
val bufferSize = 2048
val buffer = LinkedBuffer.allocate(bufferSize)
val output = new BufferedOutput(buffer, false/*encodeNestedMessageAsGroup*/)
output.writeString(1/*tag*/, repeat('a', bufferSize-6), false /*repeated*/)
output.writeString(2/*tag*/, repeat('a', bufferSize-2), false /*repeated*/)
Original issue reported on code.google.com by [email protected]
on 10 Sep 2010 at 8:32
Attachments:
What steps will reproduce the problem?
1. Call writeListTo with input containing arrays
2.
3.
What is the expected output? What do you see instead?
Throws an expcetion
org.codehaus.jackson.JsonGenerationException: Current context not an ARRAY
but OBJECT
What version of the product are you using? On what operating system?
r700
Please provide any additional information below.
I've attached a patch to r700 that adds a test case to reproduce the issue.
Original issue reported on code.google.com by [email protected]
on 11 May 2010 at 6:02
Attachments:
This was suggested on the google groups.
The compiler option "generate_stringify_method" would enable it.
Original issue reported on code.google.com by [email protected]
on 8 May 2010 at 3:50
Patch provided by [email protected]
Original issue reported on code.google.com by [email protected]
on 6 Mar 2010 at 7:48
Attachments:
When generating the code for GWT overlays from protobuf classes there might
be a general problem with enum types. For each instance of an enum type
there will be a static final variable in the generated code. The problem is
that these variables always have the type 'Status' instead of its enum type.
Original issue reported on code.google.com by [email protected]
on 20 Jan 2010 at 8:59
This is an add-on feature.
Original issue reported on code.google.com by [email protected]
on 19 Jun 2010 at 7:39
The metadata should be kept and would be useful for generating code.
Original issue reported on code.google.com by [email protected]
on 31 Dec 2010 at 6:51
What steps will reproduce the problem?
1. Create two .proto files: "Main.proto" and "Utils.proto". Have Main.proto
import Utils.proto and use one of its types.
2. Generate JSON files using Protostuff.
3. The resulting Java class MainJSON.java doesn't compile because it
attempts to use the Convertors defined in UtilsJSON.java, but it doesn't
import that class.
The full solution to this problem would be to automatically identify which
modules refer to other modules and add the appropriate "import" directive
in the Java files. That looks like it would be a nontrivial change because
Protostuff would have to look at all the modules as a whole, instead of one
at a time.
Instead, I have created a simpler fix that relies on the developer to
specify the dependencies explicitly. It's in the attached patch. This patch
does the following:
I added an option called "imports" to modules.properties. This option
contains the full names of the JSON classes that the module relies upon. In
the resulting Java files, this translated into "import" directives.
For example:
modules = utils,main
utils.fullClassname = com.example.foo.Utils
utils.outputPackage = com.example.foo.json
utils.outputDir = generated
utils.generator = json
utils.encoding = UTF-8
main.fullClassname = com.example.foo.Main
main.outputPackage = com.example.foo.json
main.outputDir = generated
main.generator = json
main.encoding = UTF-8
main.imports = com.example.foo.json.Utils
Original issue reported on code.google.com by [email protected]
on 23 Jan 2010 at 7:36
Attachments:
To enable, -Dprotostuff.runtime.enums_by_name=true
By default, its number is used. (protobuf compatibility)
Original issue reported on code.google.com by [email protected]
on 20 Oct 2010 at 4:58
Currently, the getters of the gwt-overlays doesn't return the actual
primitive values of fields that aren't set.
The logical default value(includes default values specified from proto)
should be returned.
Original issue reported on code.google.com by [email protected]
on 5 May 2010 at 12:05
Does protostuff-runtime support Self referential classes? I tried serializing
java.lang.Throwable and it contains a member of type Throwable. The getSchema
method gave me a stack overflow error. I got the same error for the simple test
below.
public class CyclicClassTest extends AbstractTest{
public void testSerialization(){
Schema<LinkList> schema = RuntimeSchema.getSchema(LinkList.class);
}
}
class LinkList{
private LinkList m_node;
private int m_value;
public LinkList(){}
public LinkList getNode() {
return m_node;
}
public void setNode(LinkList node) {
m_node = node;
}
public int getValue() {
return m_value;
}
public void setValue(int value) {
m_value = value;
}
}
The error i got in both cases is mentioned below.
java.lang.StackOverflowError
at java.lang.reflect.Field.<init>(Field.java:104)
at java.lang.reflect.Field.copy(Field.java:127)
at java.lang.reflect.ReflectAccess.copyField(ReflectAccess.java:122)
at java.lang.Class.copyFields(Class.java:2739)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at com.dyuproject.protostuff.runtime.RuntimeSchema.fill(RuntimeSchema.java:253)
at com.dyuproject.protostuff.runtime.RuntimeSchema.findInstanceFields(RuntimeSchema.java:244)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:145)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1125)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:163)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1125)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:163)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1125)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:163)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1125)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:163)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1125)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:163)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:122)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:328)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:85)
Original issue reported on code.google.com by [email protected]
on 18 Jan 2011 at 10:03
Should be pretty doable
Original issue reported on code.google.com by [email protected]
on 27 Jun 2010 at 5:27
This should allow users to create customized code generators for their
service/rpc stubs/impls
Original issue reported on code.google.com by [email protected]
on 19 Jun 2010 at 7:44
Details at
http://groups.google.com/group/protostuff/browse_thread/thread/77a87dad588cea6b
Original issue reported on code.google.com by [email protected]
on 16 Jan 2011 at 6:32
First of all, thanks for this very helpful library that works great as a
binding between protobuf Java classes (v2.2.0a) and GWT.
Nevertheless I found some issues in the generated code.
When generating the Java code for JSON (de)serialization I get an
'Duplicate local variable' problem in a switch-case statement of the
mergeFrom(...) method. One have to fix this by hand putting some braces in
each case block to open a new scope for that duplicated variable.
Original issue reported on code.google.com by [email protected]
on 20 Jan 2010 at 8:36
I may be being naive, but isn't this (in RuntimeSchema) just DCL?
Schema<T> schema = this.schema;
if (schema==null)
{
synchronized(this)
{
if((schema = this.schema) == null)
{
...
Original issue reported on code.google.com by [email protected]
on 27 Jan 2011 at 3:32
What steps will reproduce the problem?
Using protostuff-compiler-1.0.0.M1-jarjar.jar, compile a simple proto file like:
message Foo {
optional string some_field = 1;
repeated string some_other_field = 2;
}
What is the expected output? What do you see instead?
Expected: a bean generated for this proto file
Actual: get this exception...
Exception in thread "main" java.lang.RuntimeException:
java.lang.NullPointerException
at com.dyuproject.protostuff.parser.ProtoUtil.parseProto(ProtoUtil.java:59)
at com.dyuproject.protostuff.compiler.STCodeGenerator.compile(STCodeGenerator.java:162)
at com.dyuproject.protostuff.compiler.CompilerMain.compile(CompilerMain.java:170)
at com.dyuproject.protostuff.compiler.CompilerMain.main(CompilerMain.java:222)
Caused by: java.lang.NullPointerException
at com.dyuproject.protostuff.parser.Proto.postParse(Proto.java:171)
at com.dyuproject.protostuff.parser.ProtoParser.parse(ProtoParser.java:179)
at com.dyuproject.protostuff.parser.ProtoUtil.loadFrom(ProtoUtil.java:47)
at com.dyuproject.protostuff.parser.ProtoUtil.loadFrom(ProtoUtil.java:69)
at com.dyuproject.protostuff.parser.ProtoUtil.parseProto(ProtoUtil.java:55)
What version of the product are you using? On what operating system?
Using: protostuff-compiler-1.0.0.M1-jarjar.jar
On Ubuntu 9.10, Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Please provide any additional information below.
If I add "package foo;" to the top of the proto file, the compiler generates
the bean.
So this is not a major issue, but perhaps the compiler could display a more
informative error message.
Original issue reported on code.google.com by [email protected]
on 18 Jun 2010 at 2:39
E.g
message TestMultipleExtensionRanges {
extensions 42;
extensions 4143 to 4243;
extensions 65536 to max;
}
It throws a warning upon parsing the first field and discards it.
Original issue reported on code.google.com by [email protected]
on 27 Oct 2010 at 12:17
There's a typo in there.
IOUtil.mergeFrom should be called instead of IOUtil.mergeDelimitedFrom.
Original issue reported on code.google.com by [email protected]
on 27 Oct 2010 at 11:39
If you have a protobuf file with nested messages:
message Parent {
message Child {
required string foo = 1;
}
required Child bar = 1;
}
... sometimes (depending on the java compiler's mood) the reflection code will
fail with a NoSuchMethodException.
The bug is in LiteRuntime.class line 46:
public ModelMeta create(Class<? extends AbstractMessageLite> messageClass)
{
Class<? extends Builder<?>> builderClass =
(Class<? extends Builder<?>>)messageClass.getDeclaredClasses()[0];
The code assumes Parent.Builder will be the first declared class in Parent.
Sometimes it is, but sometimes Parent.Child will be the first declared class,
and it crashes trying to call Parent.Child.getBar() instead of
Parent.Builder.getBar().
Original issue reported on code.google.com by [email protected]
on 1 Sep 2010 at 5:29
These methods
get<ArrayFieldName>
get<ArrayFieldName>Count
add<ArrayFieldName>
are generated as java code.
If it were written as native javascript, it would speed up in dev mode (i
manipulate with big arrays in my code).
Possible workaround in gwt_overlay.stg:
public native <map_singular_value.(field.javaType)> get<field.name;
format="PC">(int index) /*-{
var array = this["<field:field_name_or_number(field=it,options=options)>"];
return array && array.length ? array[index] : null;
}-*/;
public native int get<field.name; format="PC">Count() /*-{
var array = this["<field:field_name_or_number(field=it,options=options)>"];
return array ? array.length : 0;
}-*/;
public native void add<field.name;
format="PC">(<map_singular_value.(field.javaType)> <var(val=field.name,
fmt="CC", options=options)>) /*-{
var array = this["<field:field_name_or_number(field=it,options=options)>"];
if (!array) {
array = [];
this["<field:field_name_or_number(field=it,options=options)>"] = array;
}
array.push(<var(val=field.name, fmt="CC", options=options)>);
}-*/;
Original issue reported on code.google.com by [email protected]
on 27 Oct 2010 at 7:27
What steps will reproduce the problem?
1. Add an option to override the java package name in modules.properties
2.
3.
What is the expected output? What do you see instead?
According to the documentation, it's possible to override the generated
package name (${oldname}=${newname}), but it doesn't seem to work.
I tried:
foo.options=the.old.name=the.new.name
foo.options=the.old.name:the.new.name
foo.options=${the.old.name}:${the.new.name}
foo.the.old.name=the.new.name
foo.${the.old.name}=${the.new.name}
None of them worked.
What version of the product are you using? On what operating system?
r681
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 May 2010 at 3:39
The end array "]" should be written if the inner message's field is repeated.
Original issue reported on code.google.com by [email protected]
on 5 May 2010 at 1:19
There is not any problems when deployed on the browser.
On hosted mode, the technique from
http://timepedia.blogspot.com/2009/04/gwts-type-system-is-more-powerful-than.htm
l
throws exceptions on hosted mode.
The solution is to have a "dev_mode" compiler option to generate code that
solves the hosted mode issue.
Original issue reported on code.google.com by [email protected]
on 10 May 2010 at 8:47
Running "svn st" displays a great number of uncommitted files found in the
"target" directories. This patch uses the "svn:ignore" property to make
Subversion ignore all the "target" directories.
Original issue reported on code.google.com by [email protected]
on 23 Jan 2010 at 7:41
Attachments:
What steps will reproduce the problem?
1. Define some enum message in proto file
2. Try to instantiate it in gwt code
What version of the product are you using? On what operating system?
GWT 2.0, protostuff 1.0.0.M4
What is the expected output? What do you see instead?
Gwt throws exception:
Something other than a Java object was returned from JSNI method
'@ru.finam.gwt.charts.client.bean.Candle1$Type::create(I)': JS value of type
int, expected java.lang.Object
In other words proto enum gets int in javascript object and gwt doesn't like
that
public static class Type extends JavaScriptObject {
public static final Type type1 = create(1);
public static final Type type2 = create(2);
public static final Type type3 = create(3);
private static native Type create(int number) /*-{
return number; <-- Exception thrown after this!!!
}-*/;
protected Type() {}
public final native int getNumber() /*-{
return this;
}-*/;
}
Original issue reported on code.google.com by [email protected]
on 24 Sep 2010 at 2:06
This happens when writing to an OutputStream with multiple utf8 strings that
exceeds the buffer size.
Original issue reported on code.google.com by [email protected]
on 16 Jan 2011 at 5:49
Basically:
clearFoo() {
delete this["foo"];
}
Original issue reported on code.google.com by [email protected]
on 9 Mar 2010 at 3:26
What steps will reproduce the problem?
Run the ExternalizableTest as attached.
What is the expected output? What do you see instead?
Before Externalized = Foo [base=Base:Base Default SubBase:New SubBase - SHOULD
BE DESERILIZED, list=[New String], s=Foo Default]
Byte Array = 88
Externalized = Foo [base=Base:Base Default SubBase:SubBase Default, list=[New String], s=Foo Default]
NewFoo = Foo [base=Base:Base Default SubBase:SubBase Default, list=[New
String], s=Foo Default]
What version of the product are you using? On what operating system?
1.0.0.M4
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 14 Sep 2010 at 10:38
Attachments:
There doesn't seem to be any support for protobuf extensions. It would be nice
to have the ability to generate code for supporting this.
Specifically, I'd like to have the extension meta-data available in the string
templates during "compile".
An example:
message Foo {
required string name = 1;
extension 100 to max;
}
message Bar {
required int32 age = 1;
extend Foo {
optional Bar bar = 100;
}
}
I'd like to get a GWT Overlay for Foo like so:
public class Foo {
[...]
public native void setExtension(String name, JavaScriptObject instance) /*-{
this['name'] = instance;
}-*/
public native JavaScriptObject getExtension(String name);
[...]
}
public class Bar {
// Or something similar
public static final String bar_ext = "Bar.bar";
public static final int bar_ext_id = 1000;
[...]
}
Original issue reported on code.google.com by [email protected]
on 9 Jul 2010 at 4:09
Currently, it automatically throws an exception if a field is unknown.
Original issue reported on code.google.com by [email protected]
on 10 May 2010 at 1:49
foo.options = ${oldPackage}:${newPackage}, hello:world
The oldPackage matched will be replaced by the newPackage.
This can be useful to group certain protos together for certain scenarios.
Original issue reported on code.google.com by [email protected]
on 10 May 2010 at 5:33
What steps will reproduce the problem?
Run the test in attached file. When there are two subclasses of Base,
exception happens no matter how the registration is changed.
What is the expected output? What do you see instead?
java.lang.RuntimeException: java.lang.IllegalArgumentException: Can not set
java.lang.String field com.foo.testproject.SubBase2.sub to
com.foo.testproject.SubBase
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$9$1.writeTo(RuntimeFieldFactory.java:1206)
at com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:177)
at com.dyuproject.protostuff.BufferedOutput.writeObject(BufferedOutput.java:246)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$16$2.writeTo(RuntimeFieldFactory.java:1884)
at com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:177)
at com.dyuproject.protostuff.IOUtil.writeDelimitedTo(IOUtil.java:475)
at com.dyuproject.protostuff.IOUtil.writeDelimitedTo(IOUtil.java:460)
at com.foo.testproject.Foo.writeExternal(Foo.java:71)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at com.foo.testproject.ExternalizableTest.doSerialization(ExternalizableTest.java:42)
at com.foo.testproject.ExternalizableTest.testExternalizable(ExternalizableTest.java:29)
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.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.String
field com.foo.testproject.SubBase2.sub to com.foo.testproject.SubBase
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:358)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$9$1.writeTo(RuntimeFieldFactory.java:1200)
... 35 more
What version of the product are you using? On what operating system?
1.0.0.M4
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2010 at 6:26
Attachments:
For enums, the default value is the first value listed in the enum's type
definition. (unless explicitly set)
Original issue reported on code.google.com by [email protected]
on 5 May 2010 at 12:09
What steps will reproduce the problem?
1. Create a protobuf message with an enum
2. Generate the GWT binding (non-numeric)
3. The generated enum class uses the field numbers only
What is the expected output? What do you see instead?
I would expect the generated enum class to use the enum's name to map the
enum instances instead of the enum's field number.
What version of the product are you using? On what operating system?
1.0.0.M1
Original issue reported on code.google.com by [email protected]
on 7 Jun 2010 at 6:55
What steps will reproduce the problem?
public class Foo implements Externalizable {
private List<String> list;
...
}
Foo foo = new Foo();
foo.setList(new ArrayList<String>());
What is the expected output? What do you see instead?
Empty list becomes null after the roundtrip
Before Externalized = Foo [list=[]]
NewFoo = Foo [list=null]
What version of the product are you using? On what operating system?
1.0.0.M3
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 14 Sep 2010 at 5:39
When the protostuff maven plugin is invoked on a child project by the parent
project, the <output> base directory is relative to the project's parent, while
all other file references are relative to the project.
1. Create a super-pom and child project / module.
2. In the module's POM, configure the plugin
3. In protomodules/protomodule, references to <source> and <outputDir> will be
relative to the project's basedir, while <output> is relative to the parent's
basedir. If <output> is defined as
src/main/resources/com/mycompany/my-output.java
4. invoke clean,install from the parent.
Expectations:
the project will find src/main/resources.
Result:
the project searches under the parent's src/main/resources
If the targets are called from the module directory, everything runs as
expected.
As a workaround, reference using maven variables (e.g.
${project.basedir}/src/main/resources)
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 31 Jan 2011 at 10:53
Could the generated protobuffers for GWT have a common base class? Just
means that I don't need to pass things around as a JavaScriptObject.
In addition, could they get a way of determining the protocol buffer's name?
In real protobuffers, this is exposed as getTypeDescriptor().getName() (and
getFullName()). If you're trying to do a protocol with multiple protobuffers,
this would make life a lot easier...
Original issue reported on code.google.com by [email protected]
on 13 May 2010 at 8:42
Hi,
i saw the PolymorphicSerializationTesT and it works fine when the base class is
Abstract. When the base class is not declared abstract it does not work. Is it
going to supported? Here is a small test case i wrote for testing inheritance .
The test fails but when the InputDevice is declared abstract it passes.
public class InheritanceTest extends AbstractTest {
public static class InputDevice{
private String name;
public InputDevice(){}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final InputDevice other = (InputDevice) obj;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
return hash;
}
}
public static class Mouse extends InputDevice{
private int numberOfButtons;
public Mouse(){}
public int getNumberOfButtons() {
return numberOfButtons;
}
public void setNumberOfButtons(int numberOfButtons) {
this.numberOfButtons = numberOfButtons;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Mouse other = (Mouse) obj;
if (this.numberOfButtons != other.numberOfButtons) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 83 * hash + this.numberOfButtons;
return hash;
}
}
public static class KeyBoard extends InputDevice{
private int numberOfKeys;
public KeyBoard(){}
public int getNumberOfKeys() {
return numberOfKeys;
}
public void setNumberOfKeys(int numberOfKeys) {
this.numberOfKeys = numberOfKeys;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final KeyBoard other = (KeyBoard) obj;
if (this.numberOfKeys != other.numberOfKeys) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + this.numberOfKeys;
return hash;
}
}
public static class InputSystem{
List<InputDevice> inputDevices;
public InputSystem(){}
public List<InputDevice> getInputDevices() {
return inputDevices;
}
public void setInputDevices(List<InputDevice> inputDevices) {
this.inputDevices = inputDevices;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final InputSystem other = (InputSystem) obj;
if (this.inputDevices != other.inputDevices && (this.inputDevices == null || !this.inputDevices.equals(other.inputDevices))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 67 * hash + (this.inputDevices != null ? this.inputDevices.hashCode() : 0);
return hash;
}
}
public void testInheritance() throws IOException{
Schema<InputSystem> schema = RuntimeSchema.getSchema(InputSystem.class);
InputSystem sys = new InputSystem();
KeyBoard kb = new KeyBoard();
Mouse ms = new Mouse();
kb.setName("Test");
kb.setNumberOfKeys(10);
ms.setName("Test1");
ms.setNumberOfButtons(2);
List<InputDevice> devices = new ArrayList<InputDevice>();
devices.add(ms);
devices.add(kb);
sys.setInputDevices(devices);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ProtobufIOUtil.writeTo(out, sys, schema, buf());
byte[] listData = out.toByteArray();
InputSystem deserSystem = new InputSystem();
ByteArrayInputStream in = new ByteArrayInputStream(listData);
ProtobufIOUtil.mergeFrom(in, deserSystem, schema,buf());
assertEquals(sys, deserSystem);
}
}
Original issue reported on code.google.com by [email protected]
on 20 Jan 2011 at 8:11
What steps will reproduce the problem?
1. Create a JSON string where one of the fields' values is null.
2. Use ProtobufJSON.parseFrom() to parse the string.
3. In the resulting Protobuf object, the field will contain the literal
string "null".
The expected result is for the field to have the Java null value.
The attached patch corrects this behavior. (And it eliminates an extra
semicolon that causes compiler warnings.)
Original issue reported on code.google.com by [email protected]
on 23 Jan 2010 at 7:09
Attachments:
I would like to be able to add some extra methods to the generated code, and
think it would be good if I could specify a template rather than having to one
of the two predefined options, e.g. rather than
String template = (module.getOption("separate_schema") == null) ? "java_bean" :
"java_bean_separate_schema";
can it be changed to:
String template = module.getOption("template_name") ;
if(template == null){
template = (module.getOption("separate_schema") == null) ? "java_bean" : "java_bean_separate_schema";
}
Or something along those lines..?
Original issue reported on code.google.com by [email protected]
on 25 Jan 2011 at 2:23
What steps will reproduce the problem?
1.Add a class member with type interface, e.g. "private Collection<String>
collection;"
What is the expected output? What do you see instead?
Caused by: java.lang.NullPointerException
at com.dyuproject.protostuff.runtime.RuntimeSchema.fill(RuntimeSchema.java:189)
at com.dyuproject.protostuff.runtime.RuntimeSchema.fill(RuntimeSchema.java:190)
at com.dyuproject.protostuff.runtime.RuntimeSchema.findInstanceFields(RuntimeSchema.java:183)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:101)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:267)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:77)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14$1.<init>(RuntimeFieldFactory.java:1498)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$14.create(RuntimeFieldFactory.java:1496)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:111)
at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:85)
at com.dyuproject.protostuff.runtime.RuntimeSchema$Lazy.getSchema(RuntimeSchema.java:267)
at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:77)
What version of the product are you using? On what operating system?
1.0.0.M3
Please provide any additional information below.
When typeClass is interface java.util.Collection, typeClass.getSuperclass()
returns null. And the next nested call results in NPE.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2010 at 9:56
protostuff 1.0.0M4
GWT 2.0.4
If we compile simple proto file:
package foo;
option optimize_for = LITE_RUNTIME;
message Start {
optional string guid = 1;
}
with properties:
modules = foo
foo.source = foo.proto
foo.outputDir = ../java
foo.output = gwt_overlay
foo.encoding = UTF-8
foo.generator = gwt_numeric_json
foo.options =
numeric:true,generate_helper_methods:true,dev_mode:true,use_global_json:true
we get Start.java looking like this (i removed javadoc for small size):
public final class Start extends JavaScriptObject {
public static native Start create() /*-{
return { <---- this one could be as "return {};" though it's not an error
};
}-*/;
public static native JsArray<Start> createArray() /*-{
return [];
}-*/;
public static native Start get(JavaScriptObject jso) /*-{
return jso;
}-*/;
public static native JsArray<Start> getArray(JavaScriptObject jso) /*-{
return jso;
}-*/;
public static native Start parse(String json) /*-{
return eval("(" + json + ")");
}-*/;
public static native JsArray<Start> parseArray(String json) /*-{
return eval("(" + json + ")");
}-*/;
public static native String stringify(Start obj) /*-{
var buf = [];
var _1 = obj["1
"];
if(_1 != null)
buf.push("\"1 <---- unnecessary line wrap
\":\"" + _1 + "\"");
return buf.length == 0 ? "{}" : "{" + buf.join(",") + "}";
}-*/;
public static native boolean isInitialized(Start obj) /*-{
return true;
}-*/;
protected Start() {}
// getters and setters
// guid
public native String getGuid() /*-{
return this["1 <---- unnecessary line wrap
"] || "";
}-*/;
public native void setGuid(String guid) /*-{
this["1 <---- unnecessary line wrap
"] = guid;
}-*/;
public native void clearGuid() /*-{
delete this["1 <---- unnecessary line wrap
"];
}-*/;
public native boolean hasGuid() /*-{
return this["1 <---- unnecessary line wrap
"] != null;
}-*/;
}
And this class won't be compiled with gwt js compiler because of methods
stringify, getGuid, setGuid, clearGuid, hasGuid
All of them have similar problem - unnecessary line wrap like this one:
return this["1
"] != null;
should be as return this["1"] != null;
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 2:22
What steps will reproduce the problem?
Try serialize bean with java.util.Date field to json with RuntimeSchema
What is the expected output? What do you see instead?
JSON expected with unix timestamp for field.
But got
Exception in thread "main" java.lang.RuntimeException:
java.lang.IllegalAccessException: Class
com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1 can not access a
member of class com.tradetools.tradeplatform.servicemanager.launchers.TestBean
with modifiers "private"
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1.writeTo(RuntimeFieldFactory.java:2705)
at com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:187)
at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:388)
at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:352)
at com.tradetools.tradeplatform.servicemanager.launchers.TestProtoStuff.main(TestProtoStuff.java:30)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.IllegalAccessException: Class
com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1 can not access a
member of class com.tradetools.tradeplatform.servicemanager.launchers.TestBean
with modifiers "private"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.reflect.Field.doSecurityCheck(Field.java:960)
at java.lang.reflect.Field.getFieldAccessor(Field.java:896)
at java.lang.reflect.Field.get(Field.java:358)
at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1.writeTo(RuntimeFieldFactory.java:2695)
... 9 more
What version of the product are you using? On what operating system?
1.0.0.M7
Please provide any additional information below.
Test source code in attachment
Original issue reported on code.google.com by [email protected]
on 27 Jan 2011 at 11:22
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.