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

Don't use env variable SONARQUBE_HOME to create .cnesreport #329

Open
dmartos-abs opened this issue Sep 22, 2022 · 2 comments
Open

Don't use env variable SONARQUBE_HOME to create .cnesreport #329

dmartos-abs opened this issue Sep 22, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@dmartos-abs
Copy link

Describe the bug

Plugin don't use env variable SONARQUBE_HOME and always create directory /home/sonarqube/.cnesreport (perhaps doesn't exist)

To reproduce

Deploy SonarQube with different home directory (p.e: /opt/sonarqube)

Expected behavior

Plugin must create directory ${SONARQUBE_HOME}/.cnesreport and work with it

Screenshots & log

2022.09.22 11:28:50 INFO ce[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube 2022.09.22 11:28:51 INFO ce[][o.s.c.c.CePluginRepository] Load plugins 2022.09.22 11:28:52 INFO ce[][o.s.c.c.ComputeEngineContainerImpl] Running Community edition 2022.09.22 11:28:52 INFO ce[][o.s.ce.app.CeServer] Compute Engine is operational 2022.09.22 11:28:52 INFO app[][o.s.a.SchedulerImpl] Process[ce] is up 2022.09.22 11:28:52 INFO app[][o.s.a.SchedulerImpl] SonarQube is up Can't load log handler "java.util.logging.FileHandler" java.nio.file.NoSuchFileException: /home/sonarqube/.cnesreport/log/cnesreport-0.log.lck java.nio.file.NoSuchFileException: /home/sonarqube/.cnesreport/log/cnesreport-0.log.lck at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixFileSystemProvider.newFileChannel(Unknown Source)

User environment

AKS: v1.12.6
SonarQube: 7.9-LTS ( sonarqube:7.9-community )
Sonar CNES Report Plugin: 3.3.1

@obriat
Copy link

obriat commented Jul 31, 2023

The plugin should check if the directory exists and has correct permissions to write in it.
If not it should try to create it with the correct permissions. If this could not be done, them display a user friendly message and log the error in sonar.log.

If this folder is only used for logging, why not just create a ${SONARQUBE_HOME}/logs/cnesreport.log file or use the recommended class : org.sonar.api.utils.log.Logger (see https://docs.sonarsource.com/sonarqube/8.9/extension-guide/developing-a-plugin/plugin-basics/#logging) ?

@ku4eto
Copy link

ku4eto commented Feb 25, 2024

Getting
Caused by: java.lang.ExceptionInInitializerError: Exception java.security.AccessControlException: access denied ("java.io.FilePermission" "/opt/sonarqube-9.9.4.87374/.cnesreport" "write") [in thread "http-nio-127.0.0.1-8080-exec-3"]
The sonarqube folder is referenced by the main java process with a symlink (/opt/sonarqube > /opt/sonarqube-x.x.x).
Follows symlinks ok, but simply cannot create the folder/file, despite having actual perms to do it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants