zbennis
I'm new here

java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Hallo zusammen,

Die DeleteOperation wirft eine Exception beim Löschen einer Seite, die Deprecated AccessUtil.delete aber nicht.

Ist das ein Bug oder mache ich was falsch?

***********************    DELETE SKRIPT *************************

doDelete() {

        if (se != null) {

                pageName = se.getName();

                se.setLock(false);

                OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);

                DeleteOperation deleteOperation = operationAgent.getOperation(DeleteOperation.TYPE);

                DeleteOperation.Result result = deleteOperation.perform(se);

                if (result.isSuccessful()) {

                    showInfoMessage("Die Seite : " + pageName + " wurde erfolgreich gelöscht");

                    context.doTransition("->End");

                } else {

                    deleteFailedElements = "\nDeleteFailed : " + result.getDeleteFailedElements();

                    lockedFailedElements = "\nLockedFailedElements : " + result.getLockFailedElements();

                    referencedElements = "\nReferencedElements : " + result.getReferencedElements();

                    missingElements = "\nMissingElements : " + result.getMissingPermissionElements();

                    nonChangeablePackagePoolElements = "NonChangeablePackagePoolElements : " +   result.getNonChangeablePackagePoolElements();

                    fails = "\nFails:" + referencedElements + lockedFailedElements + deleteFailedElements + missingElements + nonChangeablePackagePoolElements;

                    text = "Fehler bei löschen der Seite : " + pageName + fails;

                    log(text, RequestOperation.Kind.ERROR);

                    context.doTransition("->End");

                }

       } else {

           showInfoMessage("Die Seite : " + pageName + " wurde nicht gefunden");

       }

}

********************************************************************************

Client Version: 5.2.210108.79507

Java Version: 11.0.9.1 AdoptOpenJDK

FSVersion=5.2.210108.79507#6336;JDK=11.0.9.1 64bit AdoptOpenJDK;OS=Windows 10 10.0 amd64;Date=09.03.2021 15:47:41 (I)

java.lang.IllegalStateException: element ''todelete' (ID=64058, project=2005)' deleted

    at de.espirit.firstspirit.store.access.DefaultStoreElement.updateWorkflowData(DefaultStoreElement.java:664)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doTransition(TaskImpl.java:1233)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doAutomaticActivities(TaskImpl.java:1617)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doTransition(TaskImpl.java:1237)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doAutomaticActivities(TaskImpl.java:1617)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doTransition(TaskImpl.java:1237)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doAutomaticActivities(TaskImpl.java:1617)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doTransition(TaskImpl.java:1237)

    at de.espirit.firstspirit.server.taskmanagement.TaskImpl.doTransition(TaskImpl.java:1085)

    at de.espirit.firstspirit.agency.WorkflowClientAgentImpl.startWorkflow(WorkflowClientAgentImpl.java:500)

    at de.espirit.firstspirit.agency.WorkflowClientAgentImpl.startWorkflow(WorkflowClientAgentImpl.java:100)

    at de.espirit.firstspirit.agency.WorkflowClientAgentImpl.startWorkflow(WorkflowClientAgentImpl.java:110)

    at de.espirit.firstspirit.client.action.WorkflowUtil.startWorkflow(WorkflowUtil.java:66)

    at de.espirit.firstspirit.ui.actions.workflows.WorkflowStartAction.perform(WorkflowStartAction.java:40)

    at de.espirit.firstspirit.ui.actions.swing.SwingAction.actionPerformed(SwingAction.java:150)

    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

    at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)

    at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)

    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

    at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)

    at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)

    at java.desktop/java.awt.Component.processEvent(Unknown Source)

    at java.desktop/java.awt.Container.processEvent(Unknown Source)

    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)

    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)

    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)

    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)

    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)

    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)

    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)

    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)

    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)

    at java.base/java.security.AccessController.doPrivileged(Native Method)

    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)

    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)

    at java.base/java.security.AccessController.doPrivileged(Native Method)

    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)

    at de.espirit.firstspirit.client.AWTDispatchingEventQueue.defaultDispatchEvent(AWTDispatchingEventQueue.java:161)

    at de.espirit.firstspirit.client.AWTDispatchingEventQueue._dispatchEvent(AWTDispatchingEventQueue.java:138)

    at de.espirit.firstspirit.client.AWTDispatchingEventQueue.dispatchEvent(AWTDispatchingEventQueue.java:131)

    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Caused by: de.espirit.firstspirit.access.store.ElementDeletedException

    at de.espirit.firstspirit.store.access.DefaultStoreElement._setLock(DefaultStoreElement.java:479)

    at de.espirit.firstspirit.store.access.DefaultStoreElement._setLock(DefaultStoreElement.java:488)

    at de.espirit.firstspirit.store.access.DefaultStoreElement.setLock(DefaultStoreElement.java:470)

    at de.espirit.firstspirit.store.access.DefaultStoreElement.setLock(DefaultStoreElement.java:461)

    at de.espirit.firstspirit.store.access.DefaultStoreElement.updateWorkflowData(DefaultStoreElement.java:660)

    ... 54 more

Caused by: de.espirit.firstspirit.server.storemanagement.exception.ElementNotFoundException: Element with id 64058 not found in pagestore!

    at de.espirit.firstspirit.store.access.StoreElementLockCache.lockElement(StoreElementLockCache.java:104)

    at de.espirit.firstspirit.store.access.DefaultStoreRoot.lockElement(DefaultStoreRoot.java:639)

    at de.espirit.firstspirit.store.access.DefaultStoreElement._setLock(DefaultStoreElement.java:477)

Labels (1)
1 Solution

Accepted Solutions
zbennis
I'm new here

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

doDelete() {

        se = context.getElement();

        parent = se.getParent();

        if (se != null) {

                pageName = se.getName();

                se.setLock(false);

                OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);

                DeleteOperation deleteOperation = operationAgent.getOperation(DeleteOperation.TYPE);

                DeleteOperation.Result result = deleteOperation.perform(se);

                if (result.isSuccessful()) {

                    if (parent != null) {

                          parent.refresh();

                          context.getGuiHost().gotoTreeNode(parent);

                    }

                    showInfoMessage("Die Seite : " + pageName + " wurde erfolgreich gelöscht");

                    context.doTransition("->End");

                } else {

                    deleteFailedElements = "\nDeleteFailed : " + result.getDeleteFailedElements();

                    lockedFailedElements = "\nLockedFailedElements : " + result.getLockFailedElements();

                    referencedElements = "\nReferencedElements : " + result.getReferencedElements();

                    missingElements = "\nMissingElements : " + result.getMissingPermissionElements();

                    nonChangeablePackagePoolElements = "NonChangeablePackagePoolElements : " + result.getNonChangeablePackagePoolElements();

                    fails = "\nFails:" + referencedElements + lockedFailedElements + deleteFailedElements + missingElements + nonChangeablePackagePoolElements;

                    text = "Fehler beim Löschen der Seite : " + pageName + fails;

                    log(text, RequestOperation.Kind.ERROR);

                    context.doTransition("->End");

                }

       } else {

           showInfoMessage("Die Seite : " + pageName + " wurde nicht gefunden");

       }

}

doDelete();

View solution in original post

0 Kudos
6 Replies
hoebbel
Crownpeak employee
Crownpeak employee

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Hallo Zakaria,

bei Fehlern ist es sinnvoller, diese beim TechSupport einzureichen, damit das Verhalten dort analysiert und gegebenenfalls als Bug aufgenommen werden kann.

Dem Stacktrace nach sieht es nach einem Reihenfolge-Problem aus - die Seite wird gelöscht und danach wird versucht, den Workflow auf der Seite weiterzuschalten.

Das Problem sollte verschwinden, wenn Du den Workflow zuerst durchschaltest [ context.doTransition("->End"); ] und danach die Seite löscht [ DeleteOperation.Result result = deleteOperation.perform(se); ]

Das gleiche Problem müsste aber auch bei AccessUtil.delete auftreten, sofern Du auch dort auf das Ergebnis wartest, bevor Du weiterschaltest. Kann es sein, dass <ServerActionHandle>.getResult(true) dort nicht oder erst nach dem Weiterschalten aufgerufen wurde?

Viele Grüße

Holger

zbennis
I'm new here

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Moin Holger,

danke für die schnelle Rückmledung und  die Empfehlung, ich habe es leider schon so probiert wie von Dir beschrieben, es kommt zu dem selben Fehler 😞

Also erstmal [ context.doTransition("->End"); ] und danach die Seite gelöscht [ DeleteOperation.Result result = deleteOperation.perform(se); ] Der selbe Fehler tritt auf.

Mit AccessUtil.delete, was ja Deprecated ist, funktioniet es wie gewollt, der Fehler tritt in diesem Fall nicht auf.

Hättest Du vllt. einen Link für den TechSupport? Danke im Voraus! Ich kann in diesem Fall gerne die Skripte und den Workflow zur Verfügung stellen Smiley Happy

Viele Grüße,

Zakaria.

0 Kudos
hoebbel
Crownpeak employee
Crownpeak employee

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Hallo Zakaria,

den TechSupport findest Du unter https://help.e-spirit.com/

Viele Grüße

Holger

zbennis
I'm new here

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Hallo Holger,

ich habe leider keinen Konto für den TechSupport. Wie gesagt siehe bitte oben der Code, wo der Fehler auftritt.

Der Code unten funktioniert problemlos.

***********************************************************************************************************************************************

//!Beanshell

import de.espirit.firstspirit.common.gui.*;

import de.espirit.firstspirit.ui.operations.*;

import de.espirit.firstspirit.store.operations.DeleteOperation;

import de.espirit.firstspirit.access.store.BasicInfo;

import de.espirit.firstspirit.agency.OperationAgent;

import de.espirit.firstspirit.access.AdminService;

showInfoMessage(message) {

    JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE, null);

}

log(String text, RequestOperation.Kind kind) {

    requestOperation = context.requireSpecialist(OperationAgent.TYPE).getOperation(RequestOperation.TYPE);

    requestOperation.setKind(kind);

    requestOperation.addOk();

    requestOperation.perform(text);

}

doDelete() {

         se = context.getElement();

        parent = se.getParent();

    try {

              se.setLock(false, false);

              handle = de.espirit.firstspirit.access.AccessUtil.delete(se, true);

              handle.getResult();

              handle.checkAndThrow();

            

              Set notDeleted = new HashSet();

              progress = handle.getProgress(true);

              notDeleted.addAll(progress.getDeleteFailedElements());

              notDeleted.addAll(progress.getMissingPermissionElements());

              notDeleted.addAll(progress.getLockFailedElements());

              notDeleted.addAll(progress.getReferencedElements());

              if (!notDeleted.isEmpty()) {

                          text = "Folgende Elemente konnten nicht gelöscht werden: " + notDeleted;

                          log(text,RequestOperation.Kind.INFO);

              }

    

              if (parent != null) {

                          parent.refresh();

                          context.getGuiHost().gotoTreeNode(parent);

              }

    

              if (!se.isDeleted()) {

                          se.setLock(true, false);

              }

              showInfoMessage("Die Seite : " + se.getName() + " wurde erfolgreich gelöscht");

              context.doTransition("->End");

    

    } catch (Exception ex) {

              text = "Fehler beim Löschen der Seite "+se.getName()+": \n" + ex;

              log(text,RequestOperation.Kind.ERROR);

    }

}

doDelete();

****************************************************************************************************************************************************

Könntest du es bitte an dem Techsupport weiterleiten? Vielen Dank!

Viele Grüße,

Zakaria.

0 Kudos
zbennis
I'm new here

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

Hallo Holger,

ich habe Deinen Kommentar erst gerade gesehen, vielen Dank Smiley Happy

Viele Grüße,

Zakaria.

0 Kudos
zbennis
I'm new here

Re: java.lang.IllegalStateException: after deleting an element with the DeleteOpration.perform

Jump to solution

doDelete() {

        se = context.getElement();

        parent = se.getParent();

        if (se != null) {

                pageName = se.getName();

                se.setLock(false);

                OperationAgent operationAgent = context.requireSpecialist(OperationAgent.TYPE);

                DeleteOperation deleteOperation = operationAgent.getOperation(DeleteOperation.TYPE);

                DeleteOperation.Result result = deleteOperation.perform(se);

                if (result.isSuccessful()) {

                    if (parent != null) {

                          parent.refresh();

                          context.getGuiHost().gotoTreeNode(parent);

                    }

                    showInfoMessage("Die Seite : " + pageName + " wurde erfolgreich gelöscht");

                    context.doTransition("->End");

                } else {

                    deleteFailedElements = "\nDeleteFailed : " + result.getDeleteFailedElements();

                    lockedFailedElements = "\nLockedFailedElements : " + result.getLockFailedElements();

                    referencedElements = "\nReferencedElements : " + result.getReferencedElements();

                    missingElements = "\nMissingElements : " + result.getMissingPermissionElements();

                    nonChangeablePackagePoolElements = "NonChangeablePackagePoolElements : " + result.getNonChangeablePackagePoolElements();

                    fails = "\nFails:" + referencedElements + lockedFailedElements + deleteFailedElements + missingElements + nonChangeablePackagePoolElements;

                    text = "Fehler beim Löschen der Seite : " + pageName + fails;

                    log(text, RequestOperation.Kind.ERROR);

                    context.doTransition("->End");

                }

       } else {

           showInfoMessage("Die Seite : " + pageName + " wurde nicht gefunden");

       }

}

doDelete();

0 Kudos