Skip to content

Potential Performance Issue, exception in normal path #712

@jasperpotts

Description

@jasperpotts

Description

I was reading generated protobuf parser code and saw the comment // There's no more fields. Stop the parsing loop. and it made we wonder if this is happening in normal parsing. If it is then we should add a if check on remaining() and avoid the exception for normal operations.

            final int tag;
            try {
                // Read the "tag" byte which gives us the field number for the next field to read
                // and the wire type (way it is encoded on the wire).
                tag = input.readVarInt(false);
            } catch (EOFException e) {
                // There's no more fields. Stop the parsing loop.
                break;
            }

Steps to reproduce

Run parsing test with debugger on the break; line and find if it ever gets reached.

Additional context

No response

Hedera network

No response

Version

0.12.10

Operating system

None

Metadata

Metadata

Labels

BugAn error that causes the feature to behave differently than what was expected based on design.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions