Open JishnuGoyal opened 2 months ago
Hi @ironmark3 @Hemanthr1 , for this issue, my approach involves handling the exception where "authentication" object is null and where the "user" object retrieved is null. Additionally, I have added an exception handling for any other unexpected exception. Please provide feedback on the same.
This is my first pull request on this project - apologies in advance for something that i miss, though I tried to cover most things. Let me know where things can be improved :)
@ironmark3 @Hemanthr1 I would like to let you know that I haven't been able to test these changes on my local machine, because when I tried to run mvn clean install
, or mvn spring-boot:run
, I got
release version 17 not supported
error:
Do you have any insight why this might occur?
@siffat-quash Review this PR and help with testing locally
jishnu@jishnus-ubuntu:~/opensource/quash-max$ cd backend jishnu@jishnus-ubuntu:~/opensource/quash-max/backend$ mvn clean install [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.quashbugs:quash:jar:0.0.1-SNAPSHOT [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.boot:spring-boot-starter-security:jar -> duplicate declaration of version (?) @ line 82, column 21 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.projectlombok:lombok:jar -> version (?) vs edge-SNAPSHOT @ line 142, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------< com.quashbugs:quash >------------------------- [INFO] Building quash 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ quash --- [INFO] Deleting /home/jishnu/opensource/quash-max/backend/target [INFO] [INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ quash --- [INFO] Copying 1 resource from src/main/resources to target/classes [INFO] Copying 5 resources from src/main/resources to target/classes [INFO] [INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ quash --- [INFO] Changes detected - recompiling the module! :source [INFO] Compiling 115 source files with javac [debug release 17] to target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.086 s [INFO] Finished at: 2024-09-03T21:45:08+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project quash: Fatal error compiling: error: release version 17 not supported -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Quash Pull Request
Description
This pull request refactors the
UserController
by replacing the use of authentication.isAuthenticated() with exception handling using try-catch blocks. The goal is to enhance the robustness and stability of the controller by ensuring proper handling of potential authentication-related errors.Fixes #20
Type of Change
Please check the relevant option(s)
Component
Please check the relevant option(s)
Changes Made
Provide a bullet-point list of the key changes made in this PR
NullPointerException
to handle cases where the authentication object might be null.How Has This Been Tested?
Describe the tests you ran to verify your changes. Provide instructions to reproduce and list any relevant details for your test configuration.
Test Configuration:
Checklist
Please check all applicable items
Additional Notes
Please review the changes and provide feedback. This refactor should not affect the functionality of the controller but is intended to make the code more robust and maintainable.
Screenshots (if appropriate)
If your changes include visual updates, please add before/after screenshots here.