Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save circuit files #2

Open
dadler64 opened this issue Nov 13, 2019 · 1 comment
Open

Can't save circuit files #2

dadler64 opened this issue Nov 13, 2019 · 1 comment
Assignees
Labels
bug Something isn't working investigate This issue needs some investigating to learn more

Comments

@dadler64
Copy link
Owner

dadler64 commented Nov 13, 2019

OS: [Windows 10]
Version: [2.7.3]

About

When you go to save a file the dialogue shows up and prompts for a name and a location. That whole process seems to work since a file with the name you chose ends up in the directory you chose. The issues comes when something in the program decides to not write to the file and instead just leaves a blank file.

My hypothesis is that there is an issue with the output stream being fed into the XmlWriter class but I will need to investigate more to find the root cause of this issue.

Images

Save dialog:
SavingFile

Empty File:
EmptyFile

Error Log

Below is the error output when the program attempts to save to the requested file.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at com.cburch.logisim.tools.AddTool.sharesSource(AddTool.java:124)
	at com.cburch.logisim.file.XmlWriter.libraryContains(XmlWriter.java:317)
	at com.cburch.logisim.file.XmlWriter.findLibrary(XmlWriter.java:296)
	at com.cburch.logisim.file.XmlWriter.fromTool(XmlWriter.java:174)
	at com.cburch.logisim.file.XmlWriter.fromToolbarData(XmlWriter.java:167)
	at com.cburch.logisim.file.XmlWriter.fromLogisimFile(XmlWriter.java:103)
	at com.cburch.logisim.file.XmlWriter.write(XmlWriter.java:58)
	at com.cburch.logisim.file.LogisimFile.write(LogisimFile.java:382)
	at com.cburch.logisim.file.Loader.save(Loader.java:191)
	at com.cburch.logisim.proj.ProjectActions.doSave(ProjectActions.java:319)
	at com.cburch.logisim.proj.ProjectActions.doSaveAs(ProjectActions.java:302)
	at com.cburch.logisim.proj.ProjectActions.doSave(ProjectActions.java:309)
	at com.cburch.logisim.gui.menu.MenuFile.actionPerformed(MenuFile.java:128)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6397)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	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)
@dadler64 dadler64 added the bug Something isn't working label Nov 13, 2019
@dadler64 dadler64 self-assigned this Nov 13, 2019
@dadler64 dadler64 added the investigate This issue needs some investigating to learn more label Nov 13, 2019
@dadler64 dadler64 pinned this issue Nov 13, 2019
@dadler64
Copy link
Owner Author

UPDATE

TLDR:

Delete the three lines highlighted in the picture below from default.templ to be able to save files.

Analysis:

After quite a bit of investigation this issue has been traced back to a NullPointerException which was occurring when the program was trying to load items in the <toolbar> tags from default.templ which are highlighted below. The NOT, AND, and OR gates in the toolbar seem to create a null ComponentFactory object which needs to be looked into.

default template issue

File containing the three problematic gates.

Debugging Save Issues

Notice the factory: null on line 125 which is attributed to the addTool: "NOT Gate" introduced on line 122

Temporary Solution:

That being said, the workaround to this is to delete those lines to prevent the factory: null in the NOT, AND, and OR gates from popping up. The main side effect of this is that the three gates will not appear in the toolbar above. The workaround for this now is to just use the Gates folder to access those three gates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigate This issue needs some investigating to learn more
Projects
None yet
Development

No branches or pull requests

1 participant