Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 525696

Summary: Type error trying to import a file
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: ClientAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: xinyij
Version: 16.0   
Target Milestone: 17.0   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Michael Rennie CLA 2017-10-06 14:10:32 EDT
I tried to import a .zip file, which ended up failing, and then resulted in the following exception be written out in the dev console:

TypeError: Cannot read property 'indexOf' of undefined
    at r.importantChange (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at Object.setUpdateRequired (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at Object.onCreated (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at /devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8
    at Array.forEach (<anonymous>)
    at r.g (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at r.<anonymous> (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at Array.forEach (<anonymous>)
    at r.f (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
    at r.onFileChanged (/devops/code/javascript/plugins/javascriptPlugin.30bd55d6045398c43c8a53c7bc858db1da2abd5b.js:8)
Comment 1 Michael Rennie CLA 2017-10-11 14:36:10 EDT
Digging into this, and it appears the server is not sending a complete onCreated event.

Normally we get an event looking like:
{
  "parent": parent_path
  "result": {...}
  "eventData: {...}
}

but in the case of importing a zip we only get:

{
  "eventData": {...}
}

which carries no information at all about what was created.
Comment 2 Michael Rennie CLA 2017-10-12 14:36:09 EDT
Digging even further and it appears that the server is not sending the event at all - the event is coming from explorer-table (~line 1109) and from fileCommands#uploadFile (~line 109).

I have pushed a fix to the JS project to prevent the exception on the client side while we decide where we want to send the event from for importing. We should also look at the shape of the event(s) in the case where the import is set to unzip and multiple resources are created.

The JS fix:

https://github.com/eclipse/orion.client/commit/7386dae4390b2957229fef61e6f18e2fa6e79861
Comment 3 Michael Rennie CLA 2018-01-31 14:17:42 EST
I'm going to close this fixed. The exception no longer happens and there are no plans to expand the events in the table