AtomLinter/linter-javac

TypeError: Cannot read property 'toLowerCase' of undefined

aaroncarsonart opened this issue · 4 comments

When I create a new file Test.java and save it with the following content:

public class Test
{

}

I get this stack trace error popup:

TypeError: Cannot read property 'toLowerCase' of undefined
TypeError: Cannot read property 'toLowerCase' of undefined
    at new Directory (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/pathwatcher/lib/directory.js:47:39)
    at Object.lint (/Users/acarson/.atom/packages/linter-javac/lib/init.coffee:121:47)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/acarson/.atom/packages/linter/lib/linter-registry.js:63:26)
    at /Users/acarson/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (/Users/acarson/.atom/packages/linter/lib/linter-registry.js:60:18)
    at /Users/acarson/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/acarson/.atom/packages/linter/lib/editor-linter.js:30:20
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/register-default-commands.js:214:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

screen shot 2016-05-24 at 11 33 36 am

@aaroncarsonart: Thanks a lot for reporting, i will take a look why this happens.

Okay, it seems this happens if the Java-file is placed underneath a symbolic link. I am going to investigate further, it might be that this happens due to an issue in the atom-pathwatcher-library.

This is error seems to pop up since we're not dedicated handling symlinks, as the pathwatcher-API efforts. I am working on a patch.

Yeah, that makes sense. I can verify the problem file was in a symbolic link directory. It linked to a location residing on my Dropbox, not sure if that would matter though. (that much is clear from my screenshot)

Thanks for verification - i guess i already have some sort of solution and currently try to figure out how hook into the promised callback chain of hell. I guess you can expect the patch until tomorrow.