RFR: 8490: Include numeric types without Persister in "Add Filter from Attribute" menu [v7]
youngledo
duke at openjdk.org
Wed Feb 4 02:02:04 UTC 2026
> ### Problem
>
> Attributes with numeric ContentTypes that don't have a Persister (such as primitive types: byte, short, int, long, float, double, char) are
> excluded from the "Add Filter from Attribute" context menu in the Event Browser's filter editor.
>
> #### Steps to reproduce:
> 1. Open a JFR file containing events with primitive numeric fields (e.g., Spring Framework's FlightRecorderStartupEvent with long eventId and
> long parentId)
> 2. In Event Browser, right-click on a column → Select "Show Filter"
> 3. Right-click on the filter area → Select "Add Filter from Attribute"
> 4. Expected: All filterable attributes should appear in the menu
> 5. Actual: Primitive numeric type attributes are missing from the menu
>
> <img width="2420" height="1362" alt="image" src="https://github.com/user-attachments/assets/70bcb795-7a7b-42f0-a83e-e34cb8e50361" />
>
> #### Root Cause
>
> The getPersistableAttributes() method in DataPageToolkit.java (line 1006-1007) filters attributes based on whether their ContentType has a
> Persister:
>
> ```java
> .filter(a -> a.equals(JfrAttributes.EVENT_TYPE) || (a.getContentType() instanceof RangeContentType)
> || (a.getContentType().getPersister() != null))
> ```
>
> However, primitive numeric types use these ContentTypes which don't have a Persister:
> - UnitLookup.RAW_NUMBER - used by all primitive numeric types (byte, short, int, long, float, double, char)
> - UnitLookup.RAW_LONG - used by some custom Long attributes
> - UnitLookup.COUNT, UnitLookup.INDEX, UnitLookup.IDENTIFIER - legacy numeric types
>
> These types return null from getPersister() (see ContentType.java:99-101), causing them to be filtered out.
>
> ### Why this is incorrect:
>
> Even though these types cannot be persisted to strings, they fully support filtering via ItemFilters.equals(). Excluding them from the filter
> menu is inconsistent with their actual capabilities.
>
> ### Solution
>
> Add a helper method isFilterableNumericType() to identify numeric ContentTypes that support filtering even without a Persister, and include them
> in the filter:
>
> private static boolean isFilterableNumericType(IAttribute<?> attribute) {
> org.openjdk.jmc.common.unit.ContentType<?> ct = attribute.getContentType();
> return ct.equals(UnitLookup.RAW_NUMBER) || ct.equals(UnitLookup.RAW_LONG)|| ct.equals(UnitLookup.COUNT) || ct.equals(UnitLookup.INDEX)
> || ct.equals(UnitLookup.IDENTIFIER);
> }
>
>
> Update the filter condition to include these types:
>
> .filter(a -> a.equals(...
youngledo has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision:
- Merge remote-tracking branch 'upstream/master' into event-browser-menu
- Restore .classpath files required for Eclipse IDE development
This commit restores the .classpath files that were previously removed.
These files are essential for JMC development in Eclipse IDE due to the
project's hybrid nature as both a Maven and PDE/OSGi application.
- Update copyright year to 2026
- Remove .claude/settings.local.json from version control
This file should not be tracked as it contains local settings.
Added .claude/ to .gitignore to prevent future commits.
Co-Authored-By: Claude Sonnet 4.5 <noreply at anthropic.com>
- 8527: Add AGENTS.md file
Reviewed-by: aptmac
- 8512: Fixing various minor typos and nits
Reviewed-by: aptmac, clanger
- 8526: Update third parties for 10.0.0
Reviewed-by: aptmac
- 8479: Update jolokia third party for JMC 10.0.0
Reviewed-by: schaturvedi
- 8489: Inaccurate Chinese translations on TLAB page
Reviewed-by: aptmac
- Fix: Add proper error handling for empty input in numeric filters
Modified both UnitLookup and CommonCellEditors to properly handle empty or invalid
input when editing numeric type filters, preventing "Unhandled event loop exception" errors.
Changes:
1. UnitLookup.java:
- Added try-catch blocks to parsePersisted() and parseInteractive() methods
- Catch NumberFormatException and throw IllegalArgumentException with clear message
- Applied to RAW_NUMBER, RAW_LONG, COUNT, INDEX, and IDENTIFIER types
2. CommonCellEditors.java:
- Added catch block for IllegalArgumentException and NumberFormatException
- Displays error message in UI when user enters invalid value
- Prevents unhandled exception from crashing the UI
This ensures a user-friendly experience when editing numeric filters, especially
when clearing input fields.
- ... and 7 more: https://git.openjdk.org/jmc/compare/4ccc0926...2a33d0e5
-------------
Changes:
- all: https://git.openjdk.org/jmc/pull/699/files
- new: https://git.openjdk.org/jmc/pull/699/files/6510b3bd..2a33d0e5
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jmc&pr=699&range=06
- incr: https://webrevs.openjdk.org/?repo=jmc&pr=699&range=05-06
Stats: 1609 lines in 31 files changed: 1162 ins; 409 del; 38 mod
Patch: https://git.openjdk.org/jmc/pull/699.diff
Fetch: git fetch https://git.openjdk.org/jmc.git pull/699/head:pull/699
PR: https://git.openjdk.org/jmc/pull/699
More information about the jmc-dev
mailing list