mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge pull request #20 from Alfresco/fix/Sonar-Close-Open-Streams
Use java 7 try with resource for closing the streams properly
This commit is contained in:
@@ -38,13 +38,11 @@ public class CMISUtils
|
||||
public static <T> T copy(T source)
|
||||
{
|
||||
T target = null;
|
||||
try
|
||||
try ( CopyOutputStream cos = new CopyOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(cos) )
|
||||
{
|
||||
CopyOutputStream cos = new CopyOutputStream();
|
||||
ObjectOutputStream out = new ObjectOutputStream(cos);
|
||||
out.writeObject(source);
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
ObjectInputStream in = new ObjectInputStream(cos.getInputStream());
|
||||
target = (T) in.readObject();
|
||||
|
Reference in New Issue
Block a user