Java Tutorial

Working with Scan Results

In this section, you will learn about the Scan Results table.

When Globalyzer scanned your code, it generated a table in the Scan Results view. This table is saved in the local database you set up during the Globalyzer installation.

Basic features of a Scan Results table include:

  • show results of each individual type of issue
  • display and set i18n priority and prediction
  • show reason for issue's default status
  • sort issues
  • search for common issues

These features are described next.

Show a Specific Issue Type

There are up to four issue types that Globalyzer scans for: Embedded Strings, Locale-Sensitive Methods, General Patterns, and Static File References. To show the scan results for one of these types, select it from the Results dropdown.

Each row in the table shows the following:

  • Status: the status/priority of an i18n issue is set either by the Globalyzer scans or by the user. In the screen above, you see in red active i18n issues with a priority, either 'C' to indicate string concatenation, or a number from 1 to 5. There are also filtered issues based on the filtering rules configured for the scan.
  • Prediction: initially dash, but can be set to determine if issue is a real issue or a false positive issue.
  • File: the file where the issue has been found.
  • Line: the line number where the issue is located in the file.
  • Issue: the issue uncovered by the scan.
  • Code Line: the context of the issue, the entire line.
  • Reason: why this issue was identified or filtered.

Note that until you run a scan for the first time, the table will be empty for all the result types. Also, to add or remove scan types, go to the Scan=>Manage Scans... dialog. Click on the Tutorial Java Scan item and hit Next to navigate to the Globalyzer Scanning page for this Scan. Then, check or uncheck Detection types. When you uncheck a detection type, it will no longer appear in the Scan Results dropdown.

Display and Set I18n Priority and Prediction

Take a look at your latest Embedded String Scan Results. Active issues have a priority, either 'C' to indicate string concatenation, or a number ranging from 1 to 5, with 1 being the highest. These priorities allow you to focus on the i18n issues that have the highest probability of being a true issue. Globalyzer sets the priority by comparing the words in the string to dictionary words and, depending on the number of words that match and whether there are non-letters in the string, sets a priority for the Active issue. For example, in our Java scan, you'll notice that there are Active issues that have priorities of 1 and 2.

Now select the Manage Scan Views... menu item in the Scan Views dropdown.

.

A dialog pops up with a number of configuration options to see results based on status, priority, prediction, and on regular expression. Initially the View Name section will be set to the default, All Scan Issues. All Scan Issues shows all active i18n issues with a priority that includes 'C' and a range from 1 to 5, and with all possible prediction values. Viewing the active results is a good way to work with the relevant issues.


If you want to see all possible issues regardless of their status for instance, select the view named "All" using the View Name field's dropdown button. You will see that all statuses are checked. If you wish, you may modify the number of issues shown by using the Rows per Page dropdown.

Click Apply.

Note the blue circles in the status column (first one on the left) which indicate Globalyzer Filtered Issues. Showing all possible strings allows you to review all issues, including filtered, in order to customize rule sets, etc.

Once you have created views, you can access them quickly via the menu: the current view has a check mark on it. For instance, you could click All Scan Issues to revert back to showing only active issues in the Scan Results table.

Keep the All Scan View for the next part of the tutorial.

To set the priority of any issue, select one or more rows in the table, right-click and select Active and then the desired priority. Priorities help you organize and manage your Scan Results.

To set the prediction of any issue, select one or more rows in the table, right-click and select the appropriate Mark Prediction. Mark a prediction true if you know that the issue is a true issue that needs addressing. Mark a prediction false if you know the issue is a false positive. Mark a prediction pending if you are unsure and want to decide later. Predictions help identify truly active issues from false positives in your Scan Results.


Note: As long as your Rule Set and source file are not modified, Globalyzer will remember the priority and prediction changes that you make. However, if Globalyzer does need to rescan a source file, you may lose these custom settings.


Detection and Filter Reasons

The Reason column indicates why an issue was detected or filtered. In the case of detection, the values will be String for Embedded Strings (or a Retention pattern if a filtered string was retained), Method for locale-sensitive methods, Static File for static file references, and the associated regular expression in the case of General Patterns. If an issue was filtered, the Reason column will usually display the regular expression pattern from the Rule Set's filter. Another value is No dictionary words, when none of the words in an Embedded String issue are found in the dictionary. Understanding why an issue is filtered helps in fine-tuning the filters for your Rule Sets.


Note: Dictionary verification can be controlled through the Window=>Preferences=>Globalyzer dialog. By default, Globalyzer will verify all the Embedded Strings against a dictionary file. Uncheck the Filter Strings Without Dictionary Words checkbox to disable this feature.


Sorting Issues

It can be useful to group the issues by sorting them, especially when the Scan Results table contains thousands of issues. You can sort them by any of the column headings: Status, File, Line, Issue, Code Line and Reason.

1. Make sure that only Active issues are displayed in the Scan Results table. (see above in this section)

2. Click the label for the column you want to sort by (in the screenshot we sort by Issue).

3. Click the label again, and the table is sorted in the reverse order.

Tips:

  • To widen a column, hold down the left mouse button over the column boundary and drag to the left or right.
  • To see information that is obscured by narrow column widths, place the mouse pointer over any column in a row to display the text in a tool tip.

Searching for Issues

Another way to group items is to use the Search in Scan Results feature.

1. Make sure the Results dropdown has Embedded Strings selected in the Scan Results view.

2. Select Scan=>Search in Scan Results... from the Menu Bar. The Find in Results dialog appears.

Note: The Find in Results dialog can also be accessed by right clicking an issue in the Scan Results window and selecting Find in Results... from the dropdown.

3. Enter log in the Search String field. Set Search Column to Code Line. Select the Find All option.

4. Click the Search button.

All of the rows containing log in the Code Line column are selected. Use the scrollbar as needed to see each highlighted row.

Tip: You can use regular expressions in the Search String field of any Search dialog in Globalyzer.

Tip: You can select some or all search results and right click Show In=>Scan Results to select and interact with those issues in the Scan Results view.

In the next section, you will learn other ways to view a subset of the list of Active issues listed in the Scan Results table and how to better analyze, filter and ultimately fix those issues.