View previous topic :: View next topic |
Author |
Message |
Barf Expert
Joined: 24 Oct 2008 Posts: 1416 Location: Munich, Germany |
Posted: Sun Mar 31, 2024 11:59 am Post subject: Bug im RMIR with filename without directory |
|
|
If RMIR is started from the command line with an rmir file without directory as argument, the program will crash with a NPE:
Code: | 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)
|
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
Code: |
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)
|
I'll be happy to check it in if desired. |
|
Back to top |
|
|
mathdon Expert
Joined: 22 Jul 2008 Posts: 4524 Location: Cambridge, UK |
Posted: Mon Apr 01, 2024 5:22 am Post subject: |
|
|
Barf wrote: | If RMIR is started from the command line with an rmir file without directory as argument, the program will crash with a NPE: ... Possible fix ... I'll be happy to check it in if desired. |
Yes please. I have other matters to deal with at present and so am unable to spend time on RMIR. _________________ Graham |
|
Back to top |
|
|
|