Bug im RMIR with filename without directory
Posted: Sun Mar 31, 2024 10:59 am
If RMIR is started from the command line with an rmir file without directory as argument, the program will crash with a NPE:
Turns out that the argument file is taken the parent director of (line 4222 in RemoteMaster.java) (is null if argument file has no director) then subsequencly getAbsolutePath() is applied on that null argument.
Possible fix
I'll be happy to check it in if desired.
Code: Select all
Caught exception in RemoteMaster.main()!
java.lang.NullPointerException: Cannot invoke "java.io.File.getAbsolutePath()" because "file" is null
at com.hifiremote.jp1.PropertyFile.setProperty(PropertyFile.java:112)
at com.hifiremote.jp1.RemoteMaster.openFile(RemoteMaster.java:4223)
at com.hifiremote.jp1.RemoteMaster.openFile(RemoteMaster.java:4183)
at com.hifiremote.jp1.RemoteMaster.createAndShowGUI(RemoteMaster.java:7778)
at com.hifiremote.jp1.RemoteMaster.access$84(RemoteMaster.java:7607)
at com.hifiremote.jp1.RemoteMaster$12.run(RemoteMaster.java:7863)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Possible fix
Code: Select all
Index: src/main/java/com/hifiremote/jp1/RemoteMaster.java
===================================================================
--- src/main/java/com/hifiremote/jp1/RemoteMaster.java (revision 2041)
+++ src/main/java/com/hifiremote/jp1/RemoteMaster.java (working copy)
@@ -7654,7 +7654,7 @@
}
else
{
- fileToOpen = new File( parm );
+ fileToOpen = new File( parm ).getCanonicalFile();
if (hasEnding(parm, upgradeEndings, upgradeImportEndings ))
{
if (launchRMIR)