syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1332761 - in /incubator/syncope/trunk: console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java
Date Tue, 01 May 2012 17:31:45 GMT
Author: rene
Date: Tue May  1 17:31:45 2012
New Revision: 1332761

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

Modified:
    incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java

Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java?rev=1332761&r1=1332760&r2=1332761&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
(original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
Tue May  1 17:31:45 2012
@@ -66,8 +66,12 @@ public class SchemaModalPage extends Abs
     @Override
     public void setSchemaModalPage(final PageReference callerPageRef, final ModalWindow window,
             AbstractBaseBean schemaTO, final boolean createFlag) {
-
-        final SchemaTO schema = schemaTO == null ? new SchemaTO() : (SchemaTO) schemaTO;
+        final SchemaTO schema;
+        if (schemaTO != null && schemaTO instanceof SchemaTO) {
+            schema = (SchemaTO) schemaTO;
+        } else {
+            schema = new SchemaTO();
+        }
 
         final Form schemaForm = new Form("form");
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java?rev=1332761&r1=1332760&r2=1332761&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SchemaMappingUtil.java
Tue May  1 17:31:45 2012
@@ -252,6 +252,9 @@ public class SchemaMappingUtil {
         if (mapping != null) {
             switch (mapping.getIntMappingType()) {
                 case Username:
+                    if (!(attributable instanceof SyncopeUser)) {
+                        throw new ClassCastException("mappingtype is Username, but attributable
is not SyncopeUser: " + attributable.getClass().getName());
+                    }
                     value.add(((SyncopeUser) attributable).getUsername());
                     break;
                 case Password:



Mime
View raw message