Uploaded image for project: 'Teiid Designer'
  1. Teiid Designer
  2. TEIIDDES-2477

Nullpointer in WSConnectionInfoProvider.java when user is null

    Details

    • Steps to Reproduce:
      Hide
      • Importing a REST Web Service and then creating a Source and View model
      • previewing the data generates the following NullPointer.

      java.lang.NullPointerException
      at org.teiid.designer.datatools.profiles.ws.WSConnectionInfoProvider.getTeiidRelatedProperties(WSConnectionInfoProvider.java:101)
      at org.teiid.designer.runtime.TeiidDataSourceFactory.createDataSource(TeiidDataSourceFactory.java:127)
      at org.teiid.designer.runtime.preview.PreviewManager.ensureConnectionInfoIsValid(PreviewManager.java:527)
      at org.teiid.designer.runtime.preview.PreviewManager.previewSetup(PreviewManager.java:1365)
      at org.teiid.designer.runtime.ui.preview.PreviewDataWorker$1.run(PreviewDataWorker.java:233)
      at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

      Show
      Importing a REST Web Service and then creating a Source and View model previewing the data generates the following NullPointer. java.lang.NullPointerException at org.teiid.designer.datatools.profiles.ws.WSConnectionInfoProvider.getTeiidRelatedProperties(WSConnectionInfoProvider.java:101) at org.teiid.designer.runtime.TeiidDataSourceFactory.createDataSource(TeiidDataSourceFactory.java:127) at org.teiid.designer.runtime.preview.PreviewManager.ensureConnectionInfoIsValid(PreviewManager.java:527) at org.teiid.designer.runtime.preview.PreviewManager.previewSetup(PreviewManager.java:1365) at org.teiid.designer.runtime.ui.preview.PreviewDataWorker$1.run(PreviewDataWorker.java:233) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

      Description

      In the file https://github.com/Teiid-Designer/teiid-designer/blob/9.0.x/plugins/org.teiid.designer.datatools/src/org/teiid/designer/datatools/profiles/ws/WSConnectionInfoProvider.java

      @line 101:
      if (null != user &! user.equals(""))

      { //$NON-NLS-1$ connectionProps.setProperty(ICredentialsCommon.USERNAME_PROP_ID, user); }

      It is not correctly captured that user can be null. No short-circuit operator is used and therefore, the right-hand side of the expression is evaluated which gives a NullPointer if user is null.

      Line 101 contains ampersand exclamation mark without a space in between such that short-circuit is not working. ( if (null != user &! user.equals("")) { )
      This should be ( if (null != user && !user.equals("")) { )

      After importing a REST Web Service to create a Source and View model, previewing the data generates the following NullPointer.

      java.lang.NullPointerException
      at org.teiid.designer.datatools.profiles.ws.WSConnectionInfoProvider.getTeiidRelatedProperties(WSConnectionInfoProvider.java:101)
      at org.teiid.designer.runtime.TeiidDataSourceFactory.createDataSource(TeiidDataSourceFactory.java:127)
      at org.teiid.designer.runtime.preview.PreviewManager.ensureConnectionInfoIsValid(PreviewManager.java:527)
      at org.teiid.designer.runtime.preview.PreviewManager.previewSetup(PreviewManager.java:1365)
      at org.teiid.designer.runtime.ui.preview.PreviewDataWorker$1.run(PreviewDataWorker.java:233)
      at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tejones Edwin Jones
                Reporter:
                daan-isaac Daan Creemers
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: