Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 491 by zhaidang...@gmail.com: Optional field throws NullPointerException when not set values.
http://code.google.com/p/protobuf/issues/detail?id=491

What steps will reproduce the problem?
1. in proto file i defined a field : optional string test;
2. then generated java classes files.
3. in java file , method setTest() has throw new NullPointerException();

What is the expected output? What do you see instead?
it should not include NullPointerException, because it its optional .
if string field is required , this is right.

What version of the product are you using? On what operating system?
Version 2.4.1 and 2.5.0 exe file on win32 ( windows 7 32bit)

Please provide any additional information below.

file setMethod should not include the code if it is optional

   if (value == null) {
    throw new NullPointerException();
  }

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to