-
Notifications
You must be signed in to change notification settings - Fork 0
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
TFP-5818: Sjekker at kobling er aktiv da man skal ta skrive lås. Sonar. #2646
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request (TFP-5818) ensures that a kobling (connection) is active when a write lock is taken, in response to Sonar findings. The changes include:
- Adding a conditional clause to the JPQL query in KoblingRepository to only include active koblinger when a write lock is requested.
- Updating the exception signatures for the main methods in both JettyDevServer and JettyServer.
- Removing try-catch blocks in JettyServer.start() to allow exceptions to propagate for improved error visibility.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
domenetjenester/kobling/src/main/java/no/nav/foreldrepenger/abakus/kobling/repository/KoblingRepository.java | Adds a conditional JPQL filter to check if the kobling is active when write lock is needed. |
web/src/test/java/no/nav/foreldrepenger/abakus/jetty/JettyDevServer.java | Removes an unused import and updates the main method’s exception signature. |
web/src/main/java/no/nav/foreldrepenger/abakus/jetty/JettyServer.java | Changes main method and bootStrap exception declarations and removes the try-catch in the start method to propagate exceptions. |
Comments suppressed due to low confidence (1)
domenetjenester/kobling/src/main/java/no/nav/foreldrepenger/abakus/kobling/repository/KoblingRepository.java:46
- [nitpick] Consider renaming the variable 'sql' to 'jpql' to more accurately reflect that the query is a JPQL query, not raw SQL.
var sql = "FROM Kobling k WHERE koblingReferanse = :referanse";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a check to ensure that a kobling (connection) is active before taking a write lock, and makes adjustments to exception handling in the Jetty server startup methods. Key changes include:
- In KoblingRepository.java, the JPQL query is updated to conditionally add an "active" check when a write lock is requested.
- In JettyDevServer.java and JettyServer.java, the main methods and bootStrap method signatures are updated to throw Exception instead of NamingException, and the start() method now propagates exceptions instead of handling them internally.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
domenetjenester/kobling/src/main/java/no/nav/foreldrepenger/abakus/kobling/repository/KoblingRepository.java | Added conditional JPQL modification to check if kobling is active before taking a write lock. |
web/src/test/java/no/nav/foreldrepenger/abakus/jetty/JettyDevServer.java | Removed unused import and updated main method exception clause. |
web/src/main/java/no/nav/foreldrepenger/abakus/jetty/JettyServer.java | Updated main and bootStrap methods to throw Exception and removed exception swallowing in start(). |
Comments suppressed due to low confidence (1)
domenetjenester/kobling/src/main/java/no/nav/foreldrepenger/abakus/kobling/repository/KoblingRepository.java:48
- [nitpick] Ensure that the concatenated JPQL query remains valid as additional conditions may be added in the future. Consider using a StringBuilder or another query-building approach for clarity and maintainability.
jpql += " and k.aktiv = true";
Testet ok lokalt.