Manually fixing a problem
If the finding does not have an automated quick fix that you can apply, you can fix the problem manually by editing the code directly in the center pane of the perspective.
To manually fix a finding that you consider a problem:
- In the Code Review view, double-click the finding that you want to fix to see further details about it. Remedial information about how to fix the problem appears in two places: the source code editor and the Code Review Details view.
- The source code editor opens the file that contains the finding. In the editor you can identify changes to make to the code by performing the following tasks:
- Read the highlighted code, which shows the code that you want to modify as it is currently written.
- Put your cursor over the severity level icon in the left margin to see the rule that produced the finding.
- The Code Review Details view provides troubleshooting information about the finding and how to fix it. In the Code Review Details view you can identify changes to make to the code by referencing the following troubleshooting resources:
- Description: Tells you the category and name of the rule that was not adhered to, provides a link to each file that contains the finding, and gives an explanation of why the rule should be adhered to.
- Examples: Shows how the code is currently written.
- Solutions: Shows how to modify the code so that it adheres to the rule.
- Paths: Appears only if the finding results from a deep rule applied during the J2EE Best Practices code review. Deep J2EE rules not only produce findings, but also show the paths that lead to the findings. This tab shows one and sometimes two paths that lead to the finding. It always shows the control flow path, which is the method execution chain. When applicable, it also shows the data flow path, which is the data creation chain.
- In the source code editor, modify the code so that it adheres to the rule.
- Click File > Save.
Parent topic
Fixing a problem found in code review