Skip to content

"IllegalArgumentException: state should be: writes is not an empty list": upon importing settings without any project Tags #769

@wolfch-elsevier

Description

@wolfch-elsevier

Bug description
Upon importing project settings JSON from a project with zero project tags, we get an error dialog which looks like:
image
...then upon examining the catalina.out log, we see the following stack trace:

java.lang.IllegalArgumentException: state should be: writes is not an empty list
        at com.mongodb.assertions.Assertions.isTrueArgument(Assertions.java:99)
        at com.mongodb.operation.MixedBulkWriteOperation.<init>(MixedBulkWriteOperation.java:113)
        at com.mongodb.internal.operation.Operations.bulkWrite(Operations.java:437)
        at com.mongodb.internal.operation.SyncOperations.bulkWrite(SyncOperations.java:211)
        at com.mongodb.client.internal.MongoCollectionImpl.executeBulkWrite(MongoCollectionImpl.java:471)
        at com.mongodb.client.internal.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:451)
        at com.mongodb.client.internal.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:446)
        at edu.stanford.bmir.protege.web.server.tag.TagRepositoryImpl.saveTags(TagRepositoryImpl.java:120)
        at edu.stanford.bmir.protege.web.server.tag.TagsManager.setProjectTags(TagsManager.java:196)
        at edu.stanford.bmir.protege.web.server.tag.SetProjectTagsActionHandler.execute(SetProjectTagsActionHandler.java:58)
        at edu.stanford.bmir.protege.web.server.tag.SetProjectTagsActionHandler.execute(SetProjectTagsActionHandler.java:25)
        at edu.stanford.bmir.protege.web.server.dispatch.impl.DispatchServiceExecutorImpl.execAction(DispatchServiceExecutorImpl.java:136)
        at edu.stanford.bmir.protege.web.server.dispatch.impl.DispatchServiceExecutorImpl.execute(DispatchServiceExecutorImpl.java:89)
        at edu.stanford.bmir.protege.web.server.api.ActionExecutor.execute(ActionExecutor.java:44)
        at edu.stanford.bmir.protege.web.server.api.resources.ProjectSettingsResource.setProjectSettings(ProjectSettingsResource.java:104)

To Reproduce
Steps to reproduce the behavior:

  1. Create or open a project with zero project tags defined. In other words, select the "Project" drop-down menu and then select the "Tags" menu item - confirm that no project tags are defined.
  2. Again, from "Project" drop-down menu, and select "Export Settings" this will redirect to a page of JSON settings even though it should be a dialog to select a local file to export to. (TODO: enhancement request). Now we have to copy/paste and create the JSON file ourselves.
  3. Now in the target blank project, select the "Project" drop-down menu and select the "Import Settings" menu item; a popup dialog with a free-form textarea field will appear that we are expected to paste the settings JSON, presumably from an editor/viewer app, even though a user would expect a file chooser dialog instead (<==TODO: enhancement request)
  4. See error

Expected behavior
The textarea import diaglog to go away and an import success dialog pops up looking like:
image

Screenshots
If applicable, add screenshots to help explain your problem.

webprotege
branch: version-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs TriageShould be the default status for issues that have been acknowledged, but not yet processed.Type: BugIndicates that WebProtege is not working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions