Can't understand this spotbug error

i am getting this error during build.


what does these mean, and how to resolve it?

This method uses the same code to implement two branches of a conditional branch.
It’s probable you have made a coding mistake, can you please check again?

@Rahul-Crio.do
sir, i have one q,
do i have to keep code of module 1 also, like main readfle in test.java?

my output is coming sir, and i checked it manually its correct

Hey, you do not have to worry about this for now, it will be resolved automatically later.
The error in question is not related to your output, can you please check again, it’s related to your logic, the way you have coded it, make sure your logic is correct. Spot bug errors are present to make your code more efficient.

@Rahul-Crio.do
sir, the only case i can think of is when the end date is before the starting date, also i am getting build failure there, is there a need to take care of this case?, because obviously its not a valid case.

@Rahul-Crio.do
sir, i am not able to figure out any error in my logic, i can share my logic in brief also

This is not a case. If your startDate > endDate API will return empty json array

well i am getting build failed for that case

DLS: Dead store to local variable (DLS_DEAD_LOCAL_STORE)

This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used.

Note that Sun’s javac compiler often generates dead stores for final local variables. Because FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.

Read this ref :
http://findbugs.sourceforge.net/bugDescriptions.html#DLS_DEAD_LOCAL_STORE

this one is resolved,thankyou for this, i am stuck at first one

Actually this not a case I think you’re using conditional statement in your code and there is a duplicate statement. If not let me know.

What I found in documentation is

DB: Method uses the same code for two branches (DB_DUPLICATE_BRANCHES)

This method uses the same code to implement two branches of a conditional branch. Check to ensure that this isn’t a coding mistake.

So, the scenario is the problem in conditional statements you are using to code please check. verify it.

hey what is supposed to happen for invalid dates?
btw thank you very much i found my mistake , it was in if and else.

Learn By Doing:

Call API in different scenarios (by different scenarios I mean dates) using POSTMAN. Check what you’re getting as a response.
Like I said if you put start date > end date in response you will get empty json array. Similarly, check for others.

Are you parsing dates? or passing It as a string?

i am parsing as a string

You’re doing right it must be a string.
are you following these things?
startDate = purchaseDate in portfolio_trade.
endDate = args[1]

yes, i am , how can i handle invalid dates,since its a string not a date, because i am getting build failed for invalid date formats

try this

https://www.tutorialspoint.com/javatime/javatime_localdate_parse1.htm