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

Error Report Information #9

Open
SeanCarrick opened this issue Mar 15, 2020 · 5 comments
Open

Error Report Information #9

SeanCarrick opened this issue Mar 15, 2020 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@SeanCarrick
Copy link
Collaborator

I tested the error reporting that generates a detailed report of the error in the .northwind/var/err folder in the user's home folder. The generated report looks like the sample below. Please, look it over and give me suggestions of any other information that should be gathered into it. Thanks for your input!

Sample error report:

Error Location: com.pekinsoft.northwind.desktop.MainFrame.ExitMenuItemActionPerformed

--------------------------------------------------------------------------------

Exception:  java.lang.Exception
Message:     null
Stacktrace:
com_pekinsoft_northwind_desktop/com.pekinsoft.northwind.desktop.MainFrame.ExitMenuItemActionPerformed(MainFrame.java:252)
com_pekinsoft_northwind_desktop/com.pekinsoft.northwind.desktop.MainFrame$3.actionPerformed(MainFrame.java:222)
java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
java.desktop/java.awt.Component.processEvent(Component.java:6397)
java.desktop/java.awt.Container.processEvent(Container.java:2263)
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
--------------------------------------------------------------------------------

                        S Y S T E M   I N F O R M A T I O N

OS..................Windows 10
OS Version.........10.0
Architecture.......amd64

                          J A V A   I N F O R M A T I O N

Java Virtual Machine.....Java HotSpot(TM) 64-Bit Server VM
Java VM Version..........12.0.2+10
Java Runtime Name........Java(TM) SE Runtime Environment
Java Runtime Version.....12.0.2+10
Java Specification.......Java Platform API Specification
Java Spec. Version.......12
Java Vendor..............Oracle Corporation
Java Version.............12.0.2
Java Version Date........2019-07-16
Java Class Path..........
Java Class Version.......56.0
Java Library Path........C:\Program Files\Java\jdk-12.0.2\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Anaconda3;D:\Anaconda3\Library\mingw-w64\bin;D:\Anaconda3\Library\usr\bin;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Integ\AppData\Local\Microsoft\WindowsApps;D:\JetBrains\PyCharm Community Edition 2019.2.2\bin;;C:\Program Files\Java\jdk-12.0.2\bin\;;.

                          

User Country.............US
User Language............en

~~~ END OF ERROR REPORT ~~~
@SeanCarrick SeanCarrick added the question Further information is requested label Mar 15, 2020
@jkovalsky
Copy link
Contributor

This is way too good to give some feedback. Approved. :)

@SeanCarrick
Copy link
Collaborator Author

Thank you for that! However, I did notice something missing: Northwind Traders information. I figure that it would be nice to know which Edition, Version, and Build the error happened in, so that we'd know if the error had possibly been fixed already in a later build than the one the error is occurring in, so I took the liberty of adding that information, as well.

Here's the sample:

Error Location: com.pekinsoft.northwind.basic.Application.exit

--------------------------------------------------------------------------------

Exception:  java.lang.Exception
Message:     Test Exception...
Stacktrace:
com_pekinsoft_northwind_basic/com.pekinsoft.northwind.basic.Application.exit(Application.java:275)
com_pekinsoft_northwind_desktop/com.pekinsoft.northwind.desktop.MainFrame.ExitMenuItemActionPerformed(MainFrame.java:273)
com_pekinsoft_northwind_desktop/com.pekinsoft.northwind.desktop.MainFrame$4.actionPerformed(MainFrame.java:237)
java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
java.desktop/java.awt.Component.processEvent(Component.java:6397)
java.desktop/java.awt.Container.processEvent(Container.java:2263)
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762)
java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
--------------------------------------------------------------------------------

                     N O R T H W I N D   I N F O R M A T I O N

Edition...............Basic Edition
Version...............0.1.1
Build.................1610

                        S Y S T E M   I N F O R M A T I O N

OS.................Windows 10
OS Version.........10.0
Architecture.......amd64

                          J A V A   I N F O R M A T I O N

Java Virtual Machine.....Java HotSpot(TM) 64-Bit Server VM
Java VM Version..........12.0.2+10
Java Runtime Name........Java(TM) SE Runtime Environment
Java Runtime Version.....12.0.2+10
Java Specification.......Java Platform API Specification
Java Spec. Version.......12
Java Vendor..............Oracle Corporation
Java Version.............12.0.2
Java Version Date........2019-07-16
Java Class Path..........
Java Class Version.......56.0
Java Library Path........C:\Program Files\Java\jdk-12.0.2\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Anaconda3;D:\Anaconda3\Library\mingw-w64\bin;D:\Anaconda3\Library\usr\bin;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Integ\AppData\Local\Microsoft\WindowsApps;D:\JetBrains\PyCharm Community Edition 2019.2.2\bin;;C:\Program Files\Java\jdk-12.0.2\bin\;;.

                          

User Country.............US
User Language............en

~~~ END OF ERROR REPORT ~~~

FYI: I have set this reporting feature up to give the file the name of the class, followed by the word "class", and the timestamp of the error (for uniqueness). For example, the name of the generated file for the above error is: Application_class_2020-03-17-17-52-49.err. I believe that will be a descriptive enough file name so that a user could find it and attach it to an email message to send to us. Or, for us to be able to locate it for automatic bug reporting.

If you think this improvement is good and that this error report will work, then feel free to close this Issue. Thanks, Jiri!

@jkovalsky
Copy link
Contributor

That's a marvellous idea. I would then suggest to also include a list of all Northwind modules that are plugged in. I am working on a proof of concept on a private branch which I plan to push to the Git repository for your review by the end of the week at the latest if things go fine as so far.

@SeanCarrick
Copy link
Collaborator Author

Excellent idea. I'm looking forward to seeing your proof of concept! I will actually be at home this weekend, also, so I will be able to pull the repository down to my Linux system and get a feel for it on that OS as well.

@SeanCarrick
Copy link
Collaborator Author

OK. I have modified the Logger.critical function to take an Object[] parameter that contains the names and version numbers of the modules that are installed in the ${HOME}/.netbeans/modules folder. This is now how the error log file, MainFrame_class_2020-03-21-21-33-30.err, looks:

Error Location: com.pekinsoft.northwind.desktop.MainFrame.main

--------------------------------------------------------------------------------

Exception:  java.lang.Exception
Message:     Testing modules listing...
Stacktrace:
com_pekinsoft_northwind_desktop/com.pekinsoft.northwind.desktop.MainFrame$5.run(MainFrame.java:376)
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
--------------------------------------------------------------------------------

                     N O R T H W I N D   I N F O R M A T I O N

Edition...............Basic Edition
Version...............0.1.1
Build.................1616
Installed Modules:
	about[ v. 0.1 ]
	Accounting[ v. 0.1 ]
	Basic[ v. 0.1 ]
	Basic.Modules[ v. 0.1 ]
	Desktop[ v. 0.1 ]
	Utilities[ v. 0.1 ]
	about[ v. 0.1 ]
	Accounting[ v. 0.1 ]
	Basic[ v. 0.1 ]
	Basic.Modules[ v. 0.1 ]
	Desktop[ v. 0.1 ]
	Utilities[ v. 0.1 ]

                        S Y S T E M   I N F O R M A T I O N

OS.................Windows 10
OS Version.........10.0
Architecture.......amd64

                          J A V A   I N F O R M A T I O N

Java Virtual Machine.....Java HotSpot(TM) 64-Bit Server VM
Java VM Version..........12.0.2+10
Java Runtime Name........Java(TM) SE Runtime Environment
Java Runtime Version.....12.0.2+10
Java Specification.......Java Platform API Specification
Java Spec. Version.......12
Java Vendor..............Oracle Corporation
Java Version.............12.0.2
Java Version Date........2019-07-16
Java Class Path..........
Java Class Version.......56.0
Java Library Path........C:\Program Files\Java\jdk-12.0.2\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\Anaconda3;D:\Anaconda3\Library\mingw-w64\bin;D:\Anaconda3\Library\usr\bin;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Integ\AppData\Local\Microsoft\WindowsApps;D:\JetBrains\PyCharm Community Edition 2019.2.2\bin;;C:\Program Files\Java\jdk-12.0.2\bin\;;.

                          

User Country.............US
User Language............en

~~~ END OF ERROR REPORT ~~~

As you can see by the entry Basic.Modules [ v. 0.1 ], I moved your Module and ModulesManager classes to their own module, due to cyclic dependence issues. However, after I had done that, I still had the cyclic dependence issues for logging the module names, so I opted to use the following, instead of the array of modules itself:

ArrayList<String> modules = new ArrayList();
ModulesManager.getDefault().loadModules();
Iterator<Module> mods = ModulesManager.getDefault().getModules();

while (mods.hasNext() ) {
    String e = mods.next().toString();
    modules.add(e);
}

With that, I added the following method to your Module class:

    @Override
    public String toString() {
        return this.name + "[ v. " + version + " ]";
    }

To get the module names into the error file, I simply took them into the Logger.critical function as an array of Objects by using the ArrayList.toArray() method and calling the .toString() method on the array element. The effective code that prints the installed modules is:

        src.append("\nInstalled Modules:");
        
        for (Object module : modules) {
            src.append("\n\t");
            src.append(module.toString());
        }

Even though the Module and ModulesManager classes no longer need to be in their own module, I have not yet moved them back to the basic module, though I can. It's just that to do so is a pain, as the refactoring does not completely work out with modular Java programs, apparently.

Let me know what you think. I'm going to go ahead and push the modifications up to the repository and call it a night.

SeanCarrick added a commit that referenced this issue Mar 22, 2020
As explained in my last comment on Issue #9, I have updated the `Logger.critical` method to include the list of installed modules in the error log.

I also added a `manifest.xml` file to the default package of all modules except for `com_pekinsoft_northwind`, as it only contains the `Startup` class.

Also, @jkovalsy, there is a logical issue with the following code:

```java
        // Let's customize the main menu bar by loaded modules
        while (modules.hasNext()) {
            Module module = modules.next();
            MenuProvider menuProvider = (MenuProvider) module.getInstanceOf("com.pekinsoft.northwind.basic.MenuProvider");
            jMenuBar1.add(menuProvider.getMenu(this.MainDesktop));
        }
```

The problem is that, with the other modules in the `${HOME}/.northwind/modules` folder, `NullPointerException`s are thrown if the module does not contain a `menuProvider` object. Since that is your block of code, I thought that I would let you know this and, perhaps, you can add a check for the `menuProvider` within this block.

I am calling it a night. Tomorrow, I will move the `Module` and `ModulesManager` classes back to the `com_pekinsoft_northwind_basic` module, and remove the `com_pekinsoft_northwind_basic_modules` module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants