diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java
index d4b5da2807cb5eb7e89e531dea2a839192b1ee9b..4636b394cfe94e5000a13273dde142ab3034616c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java
@@ -322,8 +322,10 @@ public class AttachmentPE extends HibernateAbstractRegistrationHolder implements
         } else if (owner instanceof ProjectPE)
         {
             setProjectParentInternal((ProjectPE) owner);
+        } else
+        {
+            throw new IllegalStateException("Unexpected attachment holder.");
         }
-        throw new IllegalStateException("Unexpected attachment holder.");
     }
 
 }