Bug 65032 - File/Open recent menu issues
Summary: File/Open recent menu issues
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: Nightly (Please specify date)
Hardware: PC All
: P2 normal (vote)
Target Milestone: JMETER 5.4.1
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-28 00:37 UTC by eR@SeR
Modified: 2021-01-04 18:57 UTC (History)
0 users



Attachments
Open recent menu files (227.19 KB, application/x-zip-compressed)
2020-12-28 00:37 UTC, eR@SeR
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eR@SeR 2020-12-28 00:37:27 UTC
Created attachment 37651 [details]
Open recent menu files

Hello,

AFAIK, to remove jmx file from File/Open recent menu, the user must open the Registry Editor, navigate to Computer\HKEY_CURRENT_USER\Software\JavaSoft\Prefs\org\apache\jmeter\gui\action and find recent_file_x key to delete. There are few issues found:

Precondition: Close JMeter, Delete all recent_file_x keys (if any) using Registry Editor, start JMeter.

1. Open test1, test2 and test3.jmx from attachment. There should be 3 files in Recent menu - test1, test2 and test3, but they are missing (same is in the registry). That was working fine in version 5.3.

Jmeter 5.4.1 38f8738
Microsoft Windows 10 Enterprise 64-bit
java version "14.0.1" 2020-04-14


--------------------------------


Since issue 1 was not present in verion 5.3, I checked version 5.3 and found issues that might be reproducible in Jmeter 5.4.1 as well.

Precondition: Close JMeter, Delete all recent_file_x keys (if any) using Registry Editor, start JMeter.

2. Open test1, test2 and test3 jmx from attachment. There should be 3 tests in Recent menu - test1, test2 and test3. Then do:

Delete recent_file_1 from registry
Restart JMeter
Click on file that is under 2nd line (3 underlined)

Actual:

Test is opened. However, there are 3 recent files but there should be two. File that is under 2nd line (3 underlined) is duplicated, as well in the registry. If clicked on 1st or 3rd line (3 underlined) in Open recent menu list, pop up error "Index: 8, Size: 8" is shown:

WARN o.a.j.g.a.Load: Unexpected error. java.lang.IndexOutOfBoundsException: Index: 8, Size: 8
java.lang.IndexOutOfBoundsException: Index: 8, Size: 8
	at java.util.LinkedList.checkElementIndex(LinkedList.java:559) ~[?:?]
	at java.util.LinkedList.get(LinkedList.java:480) ~[?:?]
	at org.apache.jmeter.gui.action.LoadRecentProject.updateRecentFileMenuItems(LoadRecentProject.java:137) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.util.JMeterMenuBar.setProjectFileLoaded(JMeterMenuBar.java:145) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.MainFrame.setProjectFileLoaded(MainFrame.java:330) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.GuiPackage.setTestPlanFile(GuiPackage.java:732) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.Load.loadProjectFile(Load.java:136) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.Load.loadProjectFile(Load.java:101) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.LoadRecentProject.doActionAfterCheck(LoadRecentProject.java:66) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.AbstractActionWithNoRunningTest.doAction(AbstractActionWithNoRunningTest.java:44) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:87) ~[ApacheJMeter_core.jar:5.3]
	at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:69) ~[ApacheJMeter_core.jar:5.3]
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) ~[?:?]
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [?:?]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) [?:?]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]

Check the images in the attachment.

Expected:

If recent_file_1 is deleted from registry and JMeter restarted, there should be two files, properly ordered (1, 2... etc.) as well in the registry. Both files can be opened.


--------------------------------


3. Open test1, test2 and test3 jmx from attachment. There should be 3 tests in Recent menu - test1, test2 and test3. Then do:

Rename, move or delete one of the test files.
Click on renamed, moved or deleted file.

Actual:

Pop up "C:\Users\NA\Desktop\test1.jmx (The system cannot find the file specified)" is shown.

Expected:

Pop up "C:\Users\NA\Desktop\test1.jmx (The system cannot find the file specified). Would you like to remove the file from the recent list?" is shown, Yes/No buttons are offered.

Jmeter 5.3
Microsoft Windows 10 Enterprise 64-bit
java version "14.0.1" 2020-04-14

There might be a lot of tests in Open Recent menu that cannot be found on destination, so there might be no reason that they should be on that list. In order to remove it from the list, the user must open the Registry Editor, browse the registry location and delete it.

Is there any other way to remove tests from Open recent list that is not by deleting it from the registry? If no, such an option from File menu is welcomed.
Comment 1 Felix Schumacher 2020-12-29 10:28:08 UTC
First question, that comes to my mind, is: Why would you want to clear the list of recent files?
Comment 2 Felix Schumacher 2020-12-29 11:41:42 UTC
Can you try the next build from trunk or nightly?

commit a26ed2fc61b039334e4a065bb5ee6afa48527a0d
AuthorDate: Tue Dec 29 12:39:10 2020 +0100

    When importing example test plan JMeter displays an NullPointerException
    
    The fix has introduced a bug, where newly added files might be left as
    duplicates in the menu.
    
    Bugzilla Id: 64957, 65032
---
 .../jmeter/gui/action/LoadRecentProject.java       | 44 ++++++++++------------
 1 file changed, 20 insertions(+), 24 deletions(-)
Comment 3 eR@SeR 2020-12-29 19:55:30 UTC
Hi,

Issues under points 1 and 2 are fixed. Thank you.

(In reply to Felix Schumacher from comment #1)
> First question, that comes to my mind, is: Why would you want to clear the
> list of recent files?
The answer is under point 3 already. Why should we have tests in the list that do not exist in the pointed location? IMO, we should have JMeter option to remove them or at least to have the Expected result mentioned in point 3, not to browse the registry and have a risk to break something. I've found that someone had the same question here under point 2 http://www.jmeter-archive.org/Auto-Clear-non-existing-recent-Testplans-and-auto-load-certain-Testplan-td5593106.html

While checking point 3 (repeat same steps) I missed to mention in actual/expected results, that the currently opened test gets removed from the tree pane and then pop up is shown. Maybe it could be better to leave the current test opened unless the file location of the clicked test from Recent list is found?

BTW, the maximum shown tests in Recent list is 9. Is this intended?

Jmeter 5.4.1 a26ed2f
Microsoft Windows 10 Pro 64-bit
java version "1.8.0_251"
Comment 4 Felix Schumacher 2020-12-30 09:58:16 UTC
I think the number of 9 elements in the list is intentional, as they map to the keys 1 to 9 on the keyboard as shortcuts in the menu.
Comment 5 Felix Schumacher 2020-12-31 13:40:37 UTC
@all, what do you think of auto-cleaning the recent files list. We could filter out those entries, that we can't read (while generating the menu entries)

That could be problematic, if users accessed files on network/removable drives, which would be removed if the path is not accessible at startup/loading/saving of files.
Comment 6 eR@SeR 2021-01-04 18:57:09 UTC
(In reply to Felix Schumacher from comment #4)
> I think the number of 9 elements in the list is intentional, as they map to
> the keys 1 to 9 on the keyboard as shortcuts in the menu.
Hi,

OK that makes sense.

(In reply to Felix Schumacher from comment #5)
> @all, what do you think of auto-cleaning the recent files list. We could
> filter out those entries, that we can't read (while generating the menu
> entries)
> 
> That could be problematic, if users accessed files on network/removable
> drives, which would be removed if the path is not accessible at
> startup/loading/saving of files.
If auto-cleaning the recent files list might be problematic Pop up dialog could be an alternative and ask the user whether he wants to remove the non-accessible test or not.

Or when the user clicks on the test that is non-existing to show pop up:

(In reply to eR@SeR from comment #0)
> Created attachment 37651 [details]
> Open recent menu files
>
> Pop up "C:\Users\NA\Desktop\test1.jmx (The system cannot find the file
> specified). Would you like to remove the file from the recent list?" is
> shown, Yes/No buttons are offered.
Any solution that avoids the Registry entries manipulation is good one.