Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect expression (USELESS_CALL) in Util.java: 115 #44

Open
StrongestNumber9 opened this issue Jun 24, 2024 · 0 comments
Open

Incorrect expression (USELESS_CALL) in Util.java: 115 #44

StrongestNumber9 opened this issue Jun 24, 2024 · 0 comments
Labels
bug Something isn't working Coverity Issues found by coverity

Comments

@StrongestNumber9
Copy link
Contributor

StrongestNumber9 commented Jun 24, 2024

Describe the bug

 *** CID 1594368:  Incorrect expression  (USELESS_CALL)
/src/main/java/com/teragrep/pth_06/planner/walker/Util.java: 115 in com.teragrep.pth_06.planner.walker.Util.relativeTimeModifier(java.sql.Timestamp, java.lang.String)()
109             Matcher matcher = Pattern.compile("^-?\\d+").matcher(value);
110     
111             if (!matcher.find())
112                 throw new NumberFormatException("Unknown relative time modifier string [" + value + "]");
113     
114             long v = Long.parseLong(matcher.group());
>>>     CID 1594368:  Incorrect expression  (USELESS_CALL)
>>>     Calling "matcher.group().length()" is only useful for its return value, which is ignored.
115             matcher.group().length();
116             String unit = value.substring(matcher.group().length(), value.length());
117     
118             LocalDateTime now = timestamp.toLocalDateTime();
119             rv = timestamp.toInstant();
120             if ("s".equalsIgnoreCase(unit) || "sec".equalsIgnoreCase(unit) || "secs".equalsIgnoreCase(unit)

Software version

3.0.1

@StrongestNumber9 StrongestNumber9 added bug Something isn't working Coverity Issues found by coverity labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Coverity Issues found by coverity
Projects
None yet
Development

No branches or pull requests

1 participant