[NETCONF-42] default case Created: 29/Jun/15  Updated: 15/Mar/19  Resolved: 15/Dec/15

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Shashidhar Shekar Assignee: Shivani Pathak
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 3886

 Description   

its a good practice to have a default case for all switch statements

public class NetconfChunkAggregator extends ByteToMessageDecoder

in the function --> protected void decode



 Comments   
Comment by Robert Varga [ 13/Nov/15 ]

Move to NETCONFI project.

Comment by Shivani Pathak [ 15/Dec/15 ]

In NetconfChunkAggregator switch statement expression is an Enumerated type. Value for the same is fetched as below:

private State state=State.HEADER_ONE;

Always the first case with label HEADER_ONE will get executed

case HEADER_ONE:

{ final byte b = in.readByte(); checkNewLine(b, "Malformed chunk header encountered (byte 0)"); state = State.HEADER_TWO; initChunk(); break; }

Hence default case is not required as per my analysis.

Please suggest if there is a necessity to do so.

Comment by Tomas Cere [ 15/Dec/15 ]

Looked it over and you are correct, no need for a default case here.

Generated at Wed Feb 07 20:14:01 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.