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:24:45 UTC
svn commit: r1332759 - in
/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans:
role/RAttrValue.java user/UAttrValue.java
Author: rene
Date: Tue May 1 17:24:44 2012
New Revision: 1332759
URL: http://svn.apache.org/viewvc?rev=1332759&view=rev
Log:
sonar: fix unchecked casts
Modified:
incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/RAttrValue.java
incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/UAttrValue.java
Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/RAttrValue.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/RAttrValue.java?rev=1332759&r1=1332758&r2=1332759&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/RAttrValue.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/role/RAttrValue.java Tue May 1 17:24:44 2012
@@ -33,7 +33,6 @@ public class RAttrValue extends Abstract
@Id
private Long id;
-
@ManyToOne
@NotNull
private RAttr attribute;
@@ -50,6 +49,9 @@ public class RAttrValue extends Abstract
@Override
public <T extends AbstractAttr> void setAttribute(T attribute) {
+ if (!(attribute instanceof RAttr)) {
+ throw new ClassCastException("expected type RAttr, found: " + attribute.getClass().getName());
+ }
this.attribute = (RAttr) attribute;
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/UAttrValue.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/UAttrValue.java?rev=1332759&r1=1332758&r2=1332759&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/UAttrValue.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/UAttrValue.java Tue May 1 17:24:44 2012
@@ -33,7 +33,6 @@ public class UAttrValue extends Abstract
@Id
private Long id;
-
@ManyToOne
@NotNull
private UAttr attribute;
@@ -50,6 +49,9 @@ public class UAttrValue extends Abstract
@Override
public <T extends AbstractAttr> void setAttribute(final T attribute) {
+ if (!(attribute instanceof UAttr)) {
+ throw new ClassCastException("expected type UAttr, found: " + attribute.getClass().getName());
+ }
this.attribute = (UAttr) attribute;
}
}