Skip to content

Commit ccc5558

Browse files
committed
HTMLDOCS-161 more Sonar compliancy
HTMLDOCS-161 more Sonar compliancy HTMLDOCS-161 more Sonar compliancy HTMLDOCS-161 more Sonar compliancy HTMLDOCS-161 more Sonar compliancy
1 parent 5ccea10 commit ccc5558

18 files changed

+94
-91
lines changed

src/java/fr/paris/lutece/plugins/blog/business/Blog.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class Blog extends ReferenceItem implements Serializable, IExtendableReso
110110
private List<Tag> _tag = new ArrayList<>( );
111111

112112
private List<BlogPublication> _blogPubilcation = new ArrayList<>( );
113-
113+
114114
/**
115115
* Returns the Id
116116
*
@@ -187,7 +187,7 @@ public void setContentLabel( String strContentLabel )
187187
*/
188188
public Timestamp getCreationDate( )
189189
{
190-
return ( Timestamp ) _dateCreationDate.clone( );
190+
return (Timestamp) _dateCreationDate.clone( );
191191
}
192192

193193
/**
@@ -198,7 +198,7 @@ public Timestamp getCreationDate( )
198198
*/
199199
public void setCreationDate( Timestamp dateCreationDate )
200200
{
201-
_dateCreationDate = ( Timestamp ) dateCreationDate.clone( );
201+
_dateCreationDate = (Timestamp) dateCreationDate.clone( );
202202
}
203203

204204
/**
@@ -344,7 +344,7 @@ public void setDescription( String strDescription )
344344
*/
345345
public List<DocContent> getDocContent( )
346346
{
347-
return ( List<DocContent> )( ( ArrayList<DocContent> )_docContent ).clone( );
347+
return (List<DocContent>) ( (ArrayList<DocContent>) _docContent ).clone( );
348348
}
349349

350350
/**
@@ -355,7 +355,7 @@ public List<DocContent> getDocContent( )
355355
*/
356356
public void setDocContent( List<DocContent> docContent )
357357
{
358-
_docContent = ( List<DocContent> )( ( ArrayList<DocContent> )docContent ).clone( );
358+
_docContent = (List<DocContent>) ( (ArrayList<DocContent>) docContent ).clone( );
359359
}
360360

361361
/**
@@ -451,7 +451,7 @@ public void setLocked( boolean locked )
451451
*/
452452
public List<Tag> getTag( )
453453
{
454-
return ( List<Tag> )( ( ArrayList<Tag> )_tag ).clone( );
454+
return (List<Tag>) ( (ArrayList<Tag>) _tag ).clone( );
455455
}
456456

457457
/**
@@ -462,7 +462,7 @@ public List<Tag> getTag( )
462462
*/
463463
public void setTag( List<Tag> tag )
464464
{
465-
_tag = ( List<Tag> )( ( ArrayList<Tag> )tag ).clone( );
465+
_tag = (List<Tag>) ( (ArrayList<Tag>) tag ).clone( );
466466
}
467467

468468
/**
@@ -499,7 +499,7 @@ public void deleteTag( Tag tag )
499499
*/
500500
public List<BlogPublication> getBlogPubilcation( )
501501
{
502-
return _blogPubilcation;
502+
return (List<BlogPublication>) ( (ArrayList<BlogPublication>) _blogPubilcation ).clone( );
503503
}
504504

505505
/**
@@ -510,7 +510,7 @@ public List<BlogPublication> getBlogPubilcation( )
510510
*/
511511
public void setBlogPubilcation( List<BlogPublication> blogPublication )
512512
{
513-
_blogPubilcation = blogPublication;
513+
_blogPubilcation = (List<BlogPublication>) ( (ArrayList<BlogPublication>) blogPublication ).clone( );
514514
}
515515

516516
/**
@@ -612,18 +612,17 @@ public String getResourceTypeCode( )
612612

613613
return PROPERTY_RESOURCE_TYPE;
614614
}
615-
616-
615+
617616
/**
618617
* Return the user informations
619618
*
620619
* @return AdminUser
621620
*/
622-
public AdminUser getUserInfos( )
621+
public AdminUser getUserInfos( )
623622
{
624623
return AdminUserHome.findUserByLogin( _strUser );
625624
}
626-
625+
627626
/**
628627
* Return the user creator informations
629628
*
@@ -633,6 +632,5 @@ public AdminUser getUserCreatorInfos( )
633632
{
634633
return AdminUserHome.findUserByLogin( _strUserCreator );
635634
}
636-
635+
637636
}
638-

src/java/fr/paris/lutece/plugins/blog/business/BlogDAO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public List<Blog> selectBlogsVersionsList( int nId, Plugin plugin )
465465
}
466466
return blogVersionsList;
467467
}
468-
468+
469469
/**
470470
* {@inheritDoc }
471471
*/
@@ -480,7 +480,7 @@ public List<String> selectAllUsersEditedBlog( int nId, Plugin plugin )
480480

481481
while ( daoUtil.next( ) )
482482
{
483-
blogUsersVersionsList.add( daoUtil.getString( 1 ) );
483+
blogUsersVersionsList.add( daoUtil.getString( 1 ) );
484484
}
485485
}
486486
return blogUsersVersionsList;

src/java/fr/paris/lutece/plugins/blog/business/BlogFilter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class BlogFilter
5656
*/
5757
public Integer [ ] getTagsId( )
5858
{
59-
return _arrayTagsId;
59+
return _arrayTagsId.clone( );
6060
}
6161

6262
/**
@@ -65,7 +65,7 @@ public class BlogFilter
6565
*/
6666
public void setTagsId( Integer [ ] arrayTagsId )
6767
{
68-
_arrayTagsId = arrayTagsId;
68+
_arrayTagsId = arrayTagsId.clone( );
6969
}
7070

7171
/**
@@ -93,7 +93,7 @@ public boolean containsIdsCriteria( )
9393
*/
9494
public Integer [ ] getIds( )
9595
{
96-
return _arrayId;
96+
return _arrayId.clone( );
9797
}
9898

9999
/**
@@ -102,7 +102,7 @@ public boolean containsIdsCriteria( )
102102
*/
103103
public void setIds( Integer [ ] arrayId )
104104
{
105-
_arrayId = arrayId;
105+
_arrayId = arrayId.clone( );
106106
}
107107

108108
/**

src/java/fr/paris/lutece/plugins/blog/business/BlogHome.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public static List<Blog> getBlogsVersionsList( int nId )
187187
{
188188
return _dao.selectBlogsVersionsList( nId, _plugin );
189189
}
190-
190+
191191
/**
192192
* Load the data of all users edited the Blog objects and returns them as a list
193193
*

src/java/fr/paris/lutece/plugins/blog/business/BlogSearchFilter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void setKeywords( String strKeywords )
9898
*/
9999
public String [ ] getTag( )
100100
{
101-
return _strTag;
101+
return _strTag.clone( );
102102
}
103103

104104
/**
@@ -109,7 +109,7 @@ public void setKeywords( String strKeywords )
109109
*/
110110
public void setTag( String [ ] strTag )
111111
{
112-
this._strTag = strTag;
112+
this._strTag = strTag.clone( );
113113
}
114114

115115
/**
@@ -132,7 +132,7 @@ public String getUser( )
132132
{
133133
return _strUser;
134134
}
135-
135+
136136
/**
137137
* Sets the User Edited blog
138138
*
@@ -141,7 +141,7 @@ public String getUser( )
141141
*/
142142
public void setUserEditedBlogVersion( String userEditedBlogVersion )
143143
{
144-
_strUserEditedBlogVersion = userEditedBlogVersion;
144+
_strUserEditedBlogVersion = userEditedBlogVersion;
145145
}
146146

147147
/**
@@ -179,7 +179,7 @@ public void setIsUnpulished( boolean isUnpulished )
179179
*/
180180
public Date getUpdateDateAfter( )
181181
{
182-
return _dateUpdateDateAfter;
182+
return (Date) _dateUpdateDateAfter.clone( );
183183
}
184184

185185
/**
@@ -190,7 +190,7 @@ public Date getUpdateDateAfter( )
190190
*/
191191
public void setUpdateDateAfter( Date dateUpdateDateAfter )
192192
{
193-
_dateUpdateDateAfter = dateUpdateDateAfter;
193+
_dateUpdateDateAfter = (Date) dateUpdateDateAfter.clone( );
194194
}
195195

196196
/**
@@ -200,7 +200,7 @@ public void setUpdateDateAfter( Date dateUpdateDateAfter )
200200
*/
201201
public Date getUpdateDateBefor( )
202202
{
203-
return _dateUpdateDateBefor;
203+
return (Date) _dateUpdateDateBefor.clone( );
204204
}
205205

206206
/**
@@ -211,7 +211,7 @@ public Date getUpdateDateBefor( )
211211
*/
212212
public void setUpdateDateBefor( Date dateUpdateDateBefor )
213213
{
214-
_dateUpdateDateBefor = dateUpdateDateBefor;
214+
_dateUpdateDateBefor = (Date) dateUpdateDateBefor.clone( );
215215
}
216216

217217
}

src/java/fr/paris/lutece/plugins/blog/business/DocContent.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
package fr.paris.lutece.plugins.blog.business;
3535

3636
import java.io.Serializable;
37+
import java.util.ArrayList;
3738
import java.util.List;
3839

3940
/**
@@ -46,7 +47,7 @@ public class DocContent implements Serializable
4647
*
4748
*/
4849
private static final long serialVersionUID = 1L;
49-
50+
5051
private int _nIdDocContent;
5152
private String _strTextValue;
5253
private byte [ ] _bytes;
@@ -105,7 +106,7 @@ public String getTextValue( )
105106
*/
106107
public void setBinaryValue( byte [ ] bytes )
107108
{
108-
_bytes = bytes;
109+
_bytes = bytes.clone( );
109110
}
110111

111112
/**
@@ -115,7 +116,7 @@ public void setBinaryValue( byte [ ] bytes )
115116
*/
116117
public byte [ ] getBinaryValue( )
117118
{
118-
return _bytes;
119+
return _bytes.clone( );
119120
}
120121

121122
/**
@@ -167,7 +168,7 @@ public ContentType getContentType( )
167168
*/
168169
public List<Blog> getBlogs( )
169170
{
170-
return _blogs;
171+
return (List<Blog>) ( (ArrayList<Blog>) _blogs ).clone( );
171172
}
172173

173174
/**
@@ -178,7 +179,7 @@ public List<Blog> getBlogs( )
178179
*/
179180
public void setBlogs( List<Blog> blogs )
180181
{
181-
this._blogs = blogs;
182+
this._blogs = (List<Blog>) ( (ArrayList<Blog>) blogs ).clone( );
182183
}
183184

184185
/**
@@ -194,7 +195,8 @@ public int getPriority( )
194195
/**
195196
* Sets the priority
196197
*
197-
* @param nPriority the priority to set
198+
* @param nPriority
199+
* the priority to set
198200
*/
199201
public void setPriority( int nPriority )
200202
{

src/java/fr/paris/lutece/plugins/blog/business/DocContentDAO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void insertDocContentInBlog( int nIdBlog, int nIdDocument, int nPriority,
125125
@Override
126126
public List<DocContent> loadDocContentByIdHtemldoc( int idBlog, Plugin plugin )
127127
{
128-
List<DocContent> listDoc = new ArrayList<DocContent>( );
128+
List<DocContent> listDoc = new ArrayList<>( );
129129
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_CONTENT, plugin ) )
130130
{
131131
daoUtil.setInt( 1, idBlog );
@@ -273,7 +273,7 @@ public ContentType loadContentType( int idType, Plugin plugin )
273273
@Override
274274
public List<ContentType> loadListContentType( Plugin plugin )
275275
{
276-
List<ContentType> listcontentType = new ArrayList<ContentType>( );
276+
List<ContentType> listcontentType = new ArrayList<>( );
277277
try ( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_CONTENT_TYPE, plugin ) )
278278
{
279279

src/java/fr/paris/lutece/plugins/blog/business/DocContentHome.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public static void create( DocContent docContent )
7474
* the document id
7575
* @param nPriority
7676
* the priority
77-
*
77+
*
7878
*/
7979
public static void insertInBlog( int nIdBlog, int nIdDocument, int nPriority )
8080
{
81-
_dao.insertDocContentInBlog( nIdBlog, nIdDocument, nPriority, _plugin );
81+
_dao.insertDocContentInBlog( nIdBlog, nIdDocument, nPriority, _plugin );
8282
}
8383

8484
/**

src/java/fr/paris/lutece/plugins/blog/business/IBlogDAO.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public interface IBlogDAO
157157
* @return The list which contains the data of all the blog objects
158158
*/
159159
List<Blog> selectBlogsVersionsList( int nId, Plugin plugin );
160-
160+
161161
/**
162162
* Load the data of all the users edited the blog and returns them as a list
163163
*
@@ -167,7 +167,6 @@ public interface IBlogDAO
167167
*/
168168
List<String> selectAllUsersEditedBlog( int nId, Plugin plugin );
169169

170-
171170
/**
172171
* Load the id of all the Blog objects and returns them as a list
173172
*

src/java/fr/paris/lutece/plugins/blog/business/portlet/BlogListPortlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public int getPageTemplateDocument( )
192192
*/
193193
public List<BlogPublication> getArrayBlogs( )
194194
{
195-
return _arrayBlogs;
195+
return (List<BlogPublication>) ( (ArrayList<BlogPublication>) _arrayBlogs ).clone( );
196196
}
197197

198198
/**
@@ -201,7 +201,7 @@ public List<BlogPublication> getArrayBlogs( )
201201
*/
202202
public void setArrayBlogs( List<BlogPublication> arrayBlogs )
203203
{
204-
_arrayBlogs = arrayBlogs;
204+
_arrayBlogs = (List<BlogPublication>) ( (ArrayList<BlogPublication>) arrayBlogs ).clone( );
205205
}
206206

207207
/**

0 commit comments

Comments
 (0)