adizanni / ExportToHASS

Sweethome3D Plugin for Home Assistant Export
GNU General Public License v3.0
52 stars 5 forks source link

Plugin won't proceed to do anything (Permission error to load SaveDialog) #7

Closed diamant-x closed 2 years ago

diamant-x commented 2 years ago

Hi, I've installed your plugin correctly. I see it listed under tools. However, when I click it nothing happen. I've run it with the Java console and saw the following error pop up. I've tried both running the program as a normal user and as administrator, without success in any of them. I'm running Windows 10.

Based on the trace it seems that it fails even to load the SaveDialog. I'm running the web version of SweetHome3D through

javaws.exe -localfile -offline '-J-Djnlp.application.href=http://www.sweethome3d.com/SweetHome3D.jnlp'

as documented in the official website https://www.sweethome3d.com/download.jsp to use it with Java Web Start.

Thanks!

Error trace:

Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\username\Downloads" "read")
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkRead(Unknown Source)
    at java.io.File.exists(Unknown Source)
    at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)
    at javax.swing.JFileChooser.setSelectedFile(Unknown Source)
    at com.eteks.sweethome3d.swing.FileContentManager.showFileChooser(Unknown Source)
    at com.eteks.sweethome3d.swing.FileContentManager.showSaveDialog(Unknown Source)
    at com.eteks.sweethome3d.plugin.exporthass.ExportHass$ExportHassAction.execute(ExportHass.java:95)
    at com.eteks.sweethome3d.swing.HomePane$ActionAdapter.actionPerformed(Unknown Source)
    at com.eteks.sweethome3d.swing.ResourceAction$AbstractDecoratedAction.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
adizanni commented 2 years ago

Hello @diamant-x, sorry to answer late. I've never tested the Web based deployment of SH3D. THe problem could be that versions of the plugin and sh3d are not in synch or any other thing. I will look into it during the week-end

adizanni commented 2 years ago

Hello @diamant-x, I start by saying that I'm able to reproduce the issue

adizanni commented 2 years ago

Hello @diamant-x as I suspected also other plugins that are interacting with the filesystem (ex this one: https://www.sweethome3d.com/plugins/ExportToHTML5-1.6.sh3p) are not working with the Web Start edition. I do not catch the error but this plugin is catching and showing this:

[](url Screenshot plugin Export To HTML 5 )

I'm worried the only way is to install the portable version (which is as lightweight as the Web Start one).

diamant-x commented 2 years ago

Thanks for checking. I'll double check with the installable version. Although the web java version was convenient thanks to not needing to I stall anything.

diamant-x commented 2 years ago

Hi, I confirm it works if using the installable version of sweethome3D. Thanks!

Also,l could you elaborate on the sentence: "If you want an object to group together all the components with a unique name you just append a '#' to the end of the object name." from the Readme?

Thanks!

adizanni commented 2 years ago

Hello @diamant-x, imagine you have a big complex object that when exported is composed by 100s of object ids. If you put a # at the end of the name of the object in SH3D and you export via the plugin, it will generate one single object id for the whole object. Ex: you have a car or a mannequin, those objects are composed by hundreds of sub-objects; if you want to use hide entity to make the object invisible based on the state of the object, you have the possibility to do an object group (tedious when you have a lot of sub-objects) or you can use a # at the end of the name to avoid the object grouping and use only one id. Of course if you still want to access a part of the object because, for instance, you want to change the color of the winshield of a car or open the car door, then the sharp will not be good for you.

adizanni commented 2 years ago

I will close this because the Web Start is not compatible with plugins and this is not an issue.