Giter VIP home page Giter VIP logo

Comments (5)

jqyp avatar jqyp commented on August 16, 2024

I can't reproduce the problem:
Screenshot 2020-05-08 at 22 58 49
You have enabled the “Dodgy code (STYLE)“ checkbox and a “FindNullDeref“ one, right?

Dodgy code (STYLE) FindNullDeref
Screenshot 2020-05-09 at 00 12 57 Screenshot 2020-05-08 at 22 37 12

If it's that, provide a minimal code example for which IntelliJ SpotBugs plugin doesn't catch a bug.

from spotbugs-intellij-plugin.

RogerVFbr avatar RogerVFbr commented on August 16, 2024

We have a similar issue. Spotbugs Maven plugin finds many bugs that Intellij's plugin doesn't . In our platform, both instances are producing different results. InteliiJ's is configured to consider all "Reports" and "Detectors", while Maven's is running on default settings. In the depicted example we are using an "inclusion" xml file to narrow down the results and quicken the test. It's configuration works properly via Maven and seems to be working normally in Intellij as well. The project has no suppression annotations. The problem has been reproduced locally both in 2019.3 and 2020.1 versions on 2 different computers. We use OSX Catalina, Java 1.8. Plugin version is 1.1.0.

Unfortunately, I could not yet reproduce the problem on a minimal code example. It seems you need a mass of occurrences for the problem to arise.

Screen Shot 2020-05-13 at 16 47 55

Screen Shot 2020-05-13 at 16 48 32

Screen Shot 2020-05-13 at 16 58 32

Screen Shot 2020-05-13 at 16 58 52

Screen Shot 2020-05-13 at 17 01 26

from spotbugs-intellij-plugin.

TheLoneKing avatar TheLoneKing commented on August 16, 2024

@jqyp Yes, I have enabled all necessary settings.

report_settings

detector_settings

Here's the result of scanning the code with Spotbugs Intellij plugin (problem is in addNewItems method):
plugin_no_error

Same code scanned with maven plugin reports error:
mvn_error

from spotbugs-intellij-plugin.

marcopelegrini avatar marcopelegrini commented on August 16, 2024

I can simulate this using a simple SpringBoot Application:

image

image

image

BTW, the error is a false positive, trimAllWhitespace is null safe

from spotbugs-intellij-plugin.

TremotinoVolante avatar TremotinoVolante commented on August 16, 2024

Hi, same problem here :/

We had an exercise at university to learn about SpotBugs and the SpotBugs via maven plugin

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.2.0</version>
<dependencies>
    <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs</artifactId>
        <version>4.2.3</version>
    </dependency>
</dependencies>
</plugin>

works fine: it finds all bugs in the exercise. But the "SpotBugs plugin 1.2.4 with SpotBugs version 4.1.3" finds not a single bug. They are also quite obvious: even IntelliJ highlights them.
What am I doing wrong?

I can also provide a minimal working code example:

public class Student {

    private String firstName;

    public Student(String firstName) {
        setFirstName(firstName);
    }

    public void setFirstName(String firstName) {
        this.firstName.replaceAll("[^A-Za-z]", "");
    }

    public static void main(String[] args) {
        Student oliver = new Student("Oliver");
    }
}

the bug is in line 10: this.firstName.replaceAll("[^A-Za-z]", ""); instead of this.firstName=firstName.replaceAll("[^A-Za-z]", "");

The Sputbugs IDEA plugin is just giving me this answer:
Screenshot 2021-07-09 at 11 21 43

it says no class files found but if I click on "more" it says the class Student has been analysed.
image

maven on the other side:
Screenshot 2021-07-09 at 11 31 01

I'm using both maven and IDEA plugin with default setting.

Im using:
IntelliJ IDEA 2021.1.3 (Ultimate Edition)
Build #IU-211.7628.21, built on June 30, 2021
Non-Bundled Plugins: org.jetbrains.plugins.spotbugs (1.2.4),

from spotbugs-intellij-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.