Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-12193

objectschema export creates empty files for objecttypes without objects

    XMLWordPrintable

Details

    Description

      Issue Summary

      When running objectschema export it will create a zip file with data about the object schema and for every objecttype it will create a file containing the data towards the objects.
      If an objecttype has no objects it creates an empty file instead of a file containing one line with the attributes for this objecttype.
      This will lead to an error when trying to use this zip file for an import.

      This happens with Jira Service Management 5.0 and later as well as with the Marketplace plugin version 8.10.4 and later

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Have an objectschema that has objecttypes with objects, but also at least one objecttype without any object
      2. Go to Assets -> Configure -> Import/Export
      3. Select Object Schema Export
      4. Give a name for the file and select the object schema
      5. Select Object schema with objects
      6. Run the export

      Expected Results

      The exported file can be used for object schema import with objects on same or different instance with same version of Jira/Assets. 
      There are no files of zero byte size.

      Actual Results

      For every objecttype without object there is a zero byte size csv file.
      On import (with objects) you see error

      The import might be incomplete.
      The below exception is thrown in the insight_objectschema_import.log file:

      2022-11-25 09:36:29,658 [insight-InsightThreadGroup-worker-thread-5] | Importing object for object type: Host, id 108, and attribute size: 4
      2022-11-25 09:36:29,659 [insight-InsightThreadGroup-worker-thread-5] | Error when importing object schema and objects, object schema id: 7
      java.lang.NullPointerException
          at java.base/java.util.Objects.requireNonNull(Objects.java:221)
          at java.base/java.util.Arrays$ArrayList.<init>(Arrays.java:4323)
          at java.base/java.util.Arrays.asList(Arrays.java:4310)
          at com.riadalabs.jira.plugins.insight.services.imports.schema.ObjectSchemaImportServiceImpl.importObjects(ObjectSchemaImportServiceImpl.java:1394)
      

      Checking on the csv files inside the export (zip) file you see one or more files with zero bytes

      Workaround

      You can fix the import by removing the offending empty files from the zip file. To do this use the following steps:

      1. Unzip the exported objectschema file
      2. remove all csv files that are empty (zero byte size)
      3. zip the remaining files again
      4. use the newly created zip file for the import

      KB Article Assets: Using objectschema import to import schema and objects fails with java.lang.NullPointerException has been created for this

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cpostma@atlassian.com Conny Postma
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync