Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Findbugs issues: DMI_HARDCODED_ABSOLUTE_FILENAME #102

Closed
mmlinford opened this issue May 2, 2016 · 3 comments
Closed

Findbugs issues: DMI_HARDCODED_ABSOLUTE_FILENAME #102

mmlinford opened this issue May 2, 2016 · 3 comments
Assignees

Comments

@mmlinford
Copy link
Collaborator

Running Findbugs on EWD revealed the following instances of issue DMI_HARDCODED_ABSOLUTE_FILENAME

[INFO] Hard coded reference to an absolute pathname in org.finra.jtaf.ewd.impl.DefaultSessionFactory.getFFBinary(String) [org.finra.jtaf.ewd.impl.DefaultSessionFactory] At DefaultSessionFactory.java:[line 573] DMI_HARDCODED_ABSOLUTE_FILENAME
[INFO] Hard coded reference to an absolute pathname in org.finra.jtaf.ewd.impl.DefaultSessionFactory.getFFBinary(String) [org.finra.jtaf.ewd.impl.DefaultSessionFactory] At DefaultSessionFactory.java:[line 572] DMI_HARDCODED_ABSOLUTE_FILENAME

@santiagos11
Copy link
Collaborator

santiagos11 commented May 8, 2016

This is an array that contains the possible locations of the firefox.exe file in a method that's supposed to return the Firefox binary. I do not see an easy solution here.

File[] possibleLocations = { new File(filePath != null ? filePath : ""), new File("C:\\Program Files\\Mozilla Firefox\\firefox.exe"), new File("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"), };

What do you think?

@mmlinford
Copy link
Collaborator Author

I think that in this case it probably makes sense to filter/suppress the error. The error was probably created to prevent the case where someone just hard-codes a single path and it will explode if it's not there. In our case these hard-coded paths are in a list of default possible locations, and it's expected that the user will specify their own path if the defaults are inadequate.

Also, the suggested workarounds after googling around (such as storing them in properties files) might even be worse.

If we choose to go with a filter I think there is an annotation we can use for findbugs or we can make an exclusion file which we reference in the POM. If we do the latter it will be part of #137 .

@mmlinford
Copy link
Collaborator Author

We'll fix this by creating a filter in #137

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants