eXist-db / atom-existdb

Atom editor integration package for eXist-db
MIT License
13 stars 7 forks source link

Uncaught TypeError: Cannot read property 'length' of undefined #5

Open michbarsinai opened 8 years ago

michbarsinai commented 8 years ago

Exception thrown when I created a new function at the bottom of a file. This does not seem to reproduce the error, though.

Atom Version: 1.8.0 System: Mac OS X 10.11.5 Thrown From: existdb package, v0.3.3

Stack Trace

Uncaught TypeError: Cannot read property 'length' of undefined

At /Users/michael/.atom/packages/existdb/lib/existdb.coffee:373

TypeError: Cannot read property 'length' of undefined
    at Object.module.exports.Existdb.xqlint (/Users/michael/.atom/packages/existdb/lib/existdb.coffee:373:13)
    at Object.$.ajax.error (/Users/michael/.atom/packages/existdb/lib/existdb.coffee:340:26)
    at fire (/Users/michael/.atom/packages/existdb/node_modules/jquery/dist/jquery.js:3187:31)
    at Object.self.fireWith [as rejectWith] (/Users/michael/.atom/packages/existdb/node_modules/jquery/dist/jquery.js:3317:7)
    at done (/Users/michael/.atom/packages/existdb/node_modules/jquery/dist/jquery.js:8759:14)
    at XMLHttpRequest.<anonymous> (/Users/michael/.atom/packages/existdb/node_modules/jquery/dist/jquery.js:9115:10)

Commands

     -2:15.1.0 core:move-right (atom-text-editor.editor.power-mode.is-focused)
  3x -2:13.6.0 core:move-left (atom-text-editor.editor.power-mode.is-focused)
  5x -0:20.4.0 core:move-up (atom-text-editor.editor.power-mode.is-focused)
     -0:19.2.0 core:move-to-bottom (atom-text-editor.editor.power-mode.is-focused)
     -0:18.2.0 editor:newline (atom-text-editor.editor.power-mode.is-focused)
 25x -0:17.6.0 core:move-up (atom-text-editor.editor.power-mode.is-focused)
  3x -0:14.5.0 core:select-down (atom-text-editor.editor.power-mode.is-focused)
     -0:13.3.0 core:copy (atom-text-editor.editor.power-mode.is-focused)
     -0:12.9.0 core:move-to-bottom (atom-text-editor.editor.power-mode.is-focused)
     -0:12.2.0 core:paste (atom-text-editor.editor.power-mode.is-focused)
  2x -0:11.8.0 core:move-up (atom-text-editor.editor.power-mode.is-focused)
  5x -0:11.4.0 core:move-right (atom-text-editor.editor.power-mode.is-focused)
     -0:10.5.0 find-and-replace:select-next (atom-text-editor.editor.power-mode.is-focused)
  4x -0:07.1.0 core:delete (atom-text-editor.editor.power-mode.is-focused)
  2x -0:05.3.0 core:move-down (atom-text-editor.editor.power-mode.is-focused)
     -0:04.5.0 editor:newline (atom-text-editor.editor.power-mode.is-focused)

Config

{
  "core": {
    "audioBeep": false,
    "automaticallyUpdate": false,
    "disabledPackages": [
      "atom-color-highlight",
      "linter-js-standard",
      "linter-tidy",
      "data-tags"
    ],
    "packagesWithKeymapsDisabled": [
      "existdb"
    ],
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  }
}

Installed Packages

# User
activate-power-mode, v0.5.2
atom-beautify, v0.29.8
atom-material-syntax, v0.4.6
atom-material-ui, v1.2.13
color-picker, v2.1.1
emmet, v2.4.3
existdb, v0.3.3
highlight-selected, v0.11.2
hyperclick, v0.0.36
language-apache, v1.5.0
language-dot, v1.6.0
language-ejs, v0.2.0
language-freemarker, v0.2.0
language-latex, v0.6.1
language-lisp, v0.2.0
language-plantuml, v0.2.0
language-prolog, v0.10.0
language-racket, v0.4.0
language-restructuredtext, v0.16.0
language-rst, v0.2.1-0
language-scala, v1.1.6
latexer, v0.3.0
linter, v1.11.14
linter-chktex, v1.3.0
linter-csslint, v1.3.2
linter-scalac, v1.4.2
minimap, v4.24.6
minimap-linter, v1.1.1
minimap-selection, v4.4.0
open-recent, v5.0.0
pigments, v0.29.2
plantuml-viewer, v0.7.0
pretty-json, v1.4.1
rst-preview, v1.3.1

# Dev
No dev packages
duncdrum commented 7 years ago

Same error when trying to upload a xml fragment manually using right-click > upload selected. Automatic syncing not working despite .existdb.json file. macOS 10.12.5 eXist-db 3.1.1 atom-server-side 0.2.7 Atom 1.18.0 atom-existdb 0.6

datavectors commented 6 years ago

I see this error message from Atom existdb when trying right click > existdb > Upload selected. Here is my stack trace.

TypeError: Cannot read property 'length' of undefined at EXistTreeView.module.exports.EXistTreeView.upload (/home/dl/.atom/packages/existdb/lib/existdb-tree-view.coffee:411:48) at EXistTreeView.upload (/home/dl/.atom/packages/existdb/lib/existdb-tree-view.coffee:1:1) at EXistTreeView.module.exports.EXistTreeView.uploadSelected (/home/dl/.atom/packages/existdb/lib/existdb-tree-view.coffee:408:18) at HTMLElement.EXistTreeView.disposables.add.atom.commands.add.existdb:upload-selected (/home/dl/.atom/packages/existdb/lib/existdb-tree-view.coffee:97:18) at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:384:49) at CommandRegistry.dispatch (/usr/share/atom/resources/app/src/command-registry.js:273:23) at AtomEnvironment.dispatchContextMenuCommand (/usr/share/atom/resources/app/src/atom-environment.js:1351:25) at EventEmitter.outerCallback (/usr/share/atom/resources/app/src/application-delegate.js:346:53) at emitThree (events.js:136:13) at EventEmitter.emit (events.js:217:7)

============================================

I reported a related issue here.

https://github.com/eXist-db/atom-existdb/issues/33

When will these issues be resolved? In interim I am manually uploading files, bypassing existdb client in Atom.

joewiz commented 6 years ago

@datavectors This is a community project and so would benefit from the expertise and contributions of its users. PRs are welcome!

datavectors commented 6 years ago

Having no experience in debugging Atom packages I am still trying to resolve this error. It appears to be related to loadSync located in /packages/existdb/lib/existdb-tree-view.coffee Line Number: 322 buffer.loadSync()

Deprecation report reads: • The .loadSync instance method is deprecated. • Create a loaded buffer using TextBuffer.loadSync(filePath) instead.

But I don't know how to amend the loadSync code to make it work without errors.

Meanwhile, I have found by experimenting that I can simply drag an xml file located in Atom tree view into eXistdb Database collection. However, I would still like to remove these error messages which may deter other users from adopting this otherwise useful workflow.

duncdrum commented 6 years ago

I spend some time trying to debug this, just fixing the syntax of loadSync won't do, the problem is with the async checks for the string.length contents of the buffer in uploadCurrent(), uploadSelected, and upload functions in existdb-tree-view.coffee

There is a flaw in the async logic that tries to evaluate string properties of the textBuffer that aren't set yet. @wolfgangmm this has been broken since 2016 maybe you can take another look.

As it stands now, right-click uploading does not work, drag n drop does which is a workaround .

duncdrum commented 5 years ago

so this error is only triggered for right-click uploading of xquery files it seems, xml work fine.

lguariento commented 3 years ago

Hello,

I have the same issue.

bwbohl commented 2 years ago

any news on this? Just tried it with a xml file and the problem still seem to exist.

bwbohl commented 2 years ago

also uploading .xsl files produces the error