teragrep / pth_06

Teragrep Datasource for Apache Spark
GNU Affero General Public License v3.0
0 stars 5 forks source link

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

Open StrongestNumber9 opened 2 months ago

StrongestNumber9 commented 2 months ago

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