50% done - Tiny sucky extension to run git commands

sixcorners

  • Posts: 10
Any comments? Source code is included.
I feel that I have to warn anyone reading to not install extensions unless you trust the source because they are allowed to run arbitrary code...

« Last Edit: January 12, 2012, 03:55:57 pm by sixcorners »

Alexin

  • *
  • Posts: 3130
SW fails to load the extension.

Code: [Select]
java.lang.NullPointerException
at stencyl.sw.Initializer.loadExtensions(Initializer.java:76)
at stencyl.sw.Initializer.init(Initializer.java:57)
at stencyl.sw.SW$1.run(SW.java:179)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.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)

Subsequent extensions aren't loaded.
"Find the fun"
alexin@stencyl.com

sixcorners

  • Posts: 10
SW fails to load the extension.

Code: [Select]
java.lang.NullPointerException
at stencyl.sw.Initializer.loadExtensions(Initializer.java:76)
at stencyl.sw.Initializer.init(Initializer.java:57)
at stencyl.sw.SW$1.run(SW.java:179)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.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)

Subsequent extensions aren't loaded.
Uh.. That's not super useful. You put the file in the extensions directory as info.sixcorners.sw.git.Extension.jar right? Is there another error that was .printStackTrace()d into stderr so it skipped the logs entirely? Are you on Windows? Are you using the nightly build or the one you get off the frontpage of this website?
So I downloaded the nightly and it looks like there is a bug that readDataAsBytes() returns null if there isn't an .edata file and I don't check for it. (Which isn't a bug specific to the nightly version, I just didn't have an .edata file in the directory I installed it in. Thank goodness I didn't extract it over my original directory.) Try it again? Works for me now. I'm 30% sure that was the bug you were experiencing.

« Last Edit: January 12, 2012, 04:01:04 pm by sixcorners »

Alexin

  • *
  • Posts: 3130
Not super but still useful it seems.

I put the extension in the respective folder of my workspace, just like any other. The log had the exception above printed twice in a row, so I checked the source and verified the extension was null when loaded. The trace led me to BetterBaseExtension.loadProperties and I stopped there.

I'm on Windows and have my "own" version of SW.

About BaseExtension.readDataAsBytes returning null, it isn't a bug. The IO call is wrapped inside a try-catch and return null in case of failure. I understand the fact this and many other things that aren't documented don't help.

The extensions support was a quick take Jon made and so it needs work. You are the third person to make an extension and you can see there isn't a general interest in them.
"Find the fun"
alexin@stencyl.com

sixcorners

  • Posts: 10
Not super but still useful it seems.

I put the extension in the respective folder of my workspace, just like any other. The log had the exception above printed twice in a row, so I checked the source and verified the extension was null when loaded. The trace led me to BetterBaseExtension.loadProperties and I stopped there.

I'm on Windows and have my "own" version of SW.

About BaseExtension.readDataAsBytes returning null, it isn't a bug. The IO call is wrapped inside a try-catch and return null in case of failure. I understand the fact this and many other things that aren't documented don't help.

The extensions support was a quick take Jon made and so it needs work. You are the third person to make an extension and you can see there isn't a general interest in them.
I meant bug on my end. I don't mind checking for null, almost every time people discuss the pluses or minuses of exceptions they say, "shouldn't they only be used for exceptional conditions" then they compare it to checking return values. I just wasn't used to checking the return value in Java. Actually I'm still not checking for null, just handling the NullPointerException. Anyway, any comments on my source? Once I learn more about swing I can make this thing much less cruddy.