Skip to content

LUT-28078: Fixed SONAR issue with Field accessibility (Reflection) #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

atos-mohamed-b
Copy link
Contributor

This update satisfies SONAR's report about rule S3011.

@atos-mohamed-b
Copy link
Contributor Author

What would be the context for setting every boolean / Boolean's values to false here ?

for ( Field field : bean.getClass( ).getDeclaredFields( ) )
{
   try
   {
       // for all boolean field, init to false
       if ( Boolean.class.isAssignableFrom( field.getType( ) ) || boolean.class.isAssignableFrom( field.getType( ) ) )
       {
           field.setAccessible( true );
           field.set( bean, false );
        }
     }
     catch( Exception e )
     {
        String error = "La valeur du champ " + field.getName( ) + " de la classe " + bean.getClass( ).getName( ) + " n'a pas pu être récupéré ";
        AppLogService.error( error, e );
        throw new AppException( error, e );
     }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant