You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by re...@apache.org on 2012/05/01 19:23:28 UTC

svn commit: r1332758 - /incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java

Author: rene
Date: Tue May  1 17:23:28 2012
New Revision: 1332758

URL: http://svn.apache.org/viewvc?rev=1332758&view=rev
Log:
sonar: fix unchecked casts

Modified:
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java?rev=1332758&r1=1332757&r2=1332758&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/membership/MAttrValue.java Tue May  1 17:23:28 2012
@@ -33,7 +33,6 @@ public class MAttrValue extends Abstract
 
     @Id
     private Long id;
-
     @ManyToOne
     @NotNull
     private MAttr attribute;
@@ -50,6 +49,9 @@ public class MAttrValue extends Abstract
 
     @Override
     public <T extends AbstractAttr> void setAttribute(T attribute) {
+        if (!(attribute instanceof MAttr)) {
+            throw new ClassCastException("expected type MAttr, found: " + attribute.getClass().getName());
+        }
         this.attribute = (MAttr) attribute;
     }
 }