Ticket Created
over 5 years ago

WERETECH-8954

WERETECH-8955

barrelbuild throws java.lang.NullPointerException in linux

Problem

barrelbuild is throwing a null pointer exception when attempting to create a *.barrel file within the same directory. This has been happening while I've been playing around with the LogMonkey barrel from https://github.com/garmin/connectiq-apps/tree/master/barrels/LogMonkey, but is reproducible for any barrel.

OS: linux/debian

SDK: 3.1.8

Steps to reproduce

  1. git clone [email protected]:garmin/connectiq-apps.git
  2. cd connectiq-apps/barrels/LogMonkey
  3. barrelbuild -o LogMonkey.barrel -f monkey.jungle

Example error

$ barrelbuild -o LogMonkey.barrel -f monkey.jungle
ERROR: An unknown error occurred: null
java.lang.NullPointerException
at com.garmin.monkeybrains.BarrelBuilder.writeOutBarrelFile(BarrelBuilder.java:788)
at com.garmin.monkeybrains.BarrelBuilder.buildABarrel(BarrelBuilder.java:327)
at com.garmin.monkeybrains.MonkeyBarrelEntry.run(MonkeyBarrelEntry.java:265)
at com.garmin.monkeybrains.MonkeyBarrelEntry.simpleMain(MonkeyBarrelEntry.java:157)
at com.garmin.monkeybrains.MonkeyBarrelEntry.simpleMain(MonkeyBarrelEntry.java:141)
at com.garmin.monkeybrains.MonkeyBarrelEntry.main(MonkeyBarrelEntry.java:168)
usage: barrelbuild [-a <arg>] [--Eno-invalid-symbol] [-f <arg>] [-h] [-i <arg>]
[-o <arg>] [-p <arg>] [-u <arg>] [-v] [-w]
-a,--apidb <arg> API import file
--Eno-invalid-symbolDo not error when a symbol is found to be invalid
-f,--jungle-files <arg>Jungle files
-h,--help Prints help information
-i,--import-dbg <arg> Import api.debug.xml
-o,--output <arg> Output file to create
-p,--project-info <arg>projectInfo.xml file to use when compiling
-u,--devices <arg> devices.xml file to use when compiling
-v,--version Prints the compiler version
-w,--warn Show compiler warnings

Workarounds

Either create the barrel file, then run barrelbuild:

$ touch LogMonkey.barrel && barrelbuild -o LogMonkey.barrel -f monkey.jungle

Or direct barrelbuild to create the barrel file under some directory:

$ barrelbuild -o bin/LogMonkey.barrel -f monkey.jungle

Notes

  • barreltest does not seem to be affected.
  • I'm able to see the line causing the exception from decompiling monkeybrains.jar
    • I have a proposed fix in mind, but it doesn't seem appropriate to discuss the source code here.
    • My being able to read the decompiled source code seems to be a separate issue.
  • I'm able to see the line causing the exception from decompiling monkeybrains.jar
    > * I have a proposed fix in mind, but it doesn't seem appropriate to discuss the source code here.
    > * My being able to read the decompiled source code seems to be a separate issue.

    I'm not saying this is sufficient to protect us or that I'm going to call the license police, but this:

    4. Prohibited Activity; Limitations
      
    You may not: ... (d) modify, adapt, decompile, reverse engineer,
    disassemble or create derivative works of the Program Materials,
    except as expressly permitted pursuant to this Agreement;

    I've filed bug reports for both issues you've mentioned here. Thanks.