JP1 Remotes Forum Index JP1 Remotes


FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

Bug im RMIR with filename without directory

 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Software
View previous topic :: View next topic  
Author Message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1415
Location: Munich, Germany

                    
PostPosted: Sun Mar 31, 2024 11:59 am    Post subject: Bug im RMIR with filename without directory Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
mathdon
Expert


Joined: 22 Jul 2008
Posts: 4523
Location: Cambridge, UK

                    
PostPosted: Mon Apr 01, 2024 5:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - Software All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

Powered by phpBB © 2001, 2005 phpBB Group
Top 7 Advantages of Playing Online Slots The Evolution of Remote Control