Status: New
Labels: Type-Defect Priority-Medium

New issue 491 by Optional field throws NullPointerException when not set values.

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:

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to