|  | @@ -7,6 +7,7 @@ import java.io.*;
 | 
											
												
													
														|  |  import java.nio.channels.FileChannel;
 |  |  import java.nio.channels.FileChannel;
 | 
											
												
													
														|  |  import java.nio.file.*;
 |  |  import java.nio.file.*;
 | 
											
												
													
														|  |  import java.text.DecimalFormat;
 |  |  import java.text.DecimalFormat;
 | 
											
												
													
														|  | 
 |  | +import java.util.Objects;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @Component
 |  |  @Component
 | 
											
												
													
														|  |  public class FileManager {
 |  |  public class FileManager {
 | 
											
										
											
												
													
														|  | @@ -35,7 +36,8 @@ public class FileManager {
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          } catch (IOException e) {}finally {
 |  |          } catch (IOException e) {}finally {
 | 
											
												
													
														|  |              try {
 |  |              try {
 | 
											
												
													
														|  | -                stream.close();
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (Objects.nonNull(stream))
 | 
											
												
													
														|  | 
 |  | +                    stream.close();
 | 
											
												
													
														|  |              } catch (IOException e) {}
 |  |              } catch (IOException e) {}
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          if ( size > 0  ) {
 |  |          if ( size > 0  ) {
 | 
											
										
											
												
													
														|  | @@ -78,8 +80,10 @@ public class FileManager {
 | 
											
												
													
														|  |                              file.delete();
 |  |                              file.delete();
 | 
											
												
													
														|  |                          } catch (IOException e) {}finally {
 |  |                          } catch (IOException e) {}finally {
 | 
											
												
													
														|  |                              try {
 |  |                              try {
 | 
											
												
													
														|  | -                                sourceChannel.close();
 |  | 
 | 
											
												
													
														|  | -                                destChannel.close();
 |  | 
 | 
											
												
													
														|  | 
 |  | +                                if (Objects.nonNull(sourceChannel))
 | 
											
												
													
														|  | 
 |  | +                                    sourceChannel.close();
 | 
											
												
													
														|  | 
 |  | +                                if (Objects.nonNull(destChannel))
 | 
											
												
													
														|  | 
 |  | +                                    destChannel.close();
 | 
											
												
													
														|  |                              } catch (IOException e) {}
 |  |                              } catch (IOException e) {}
 | 
											
												
													
														|  |                          }
 |  |                          }
 | 
											
												
													
														|  |                      } else {
 |  |                      } else {
 | 
											
										
											
												
													
														|  | @@ -191,8 +195,10 @@ public class FileManager {
 | 
											
												
													
														|  |              ret = false;
 |  |              ret = false;
 | 
											
												
													
														|  |          } finally {
 |  |          } finally {
 | 
											
												
													
														|  |              try {
 |  |              try {
 | 
											
												
													
														|  | -                fileOutputStream.close();
 |  | 
 | 
											
												
													
														|  | -                document.close();
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (Objects.nonNull(fileOutputStream))
 | 
											
												
													
														|  | 
 |  | +                    fileOutputStream.close();
 | 
											
												
													
														|  | 
 |  | +                if (Objects.nonNull(document))
 | 
											
												
													
														|  | 
 |  | +                    document.close();
 | 
											
												
													
														|  |              } catch (IOException e) {}
 |  |              } catch (IOException e) {}
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return ret;
 |  |          return ret;
 | 
											
										
											
												
													
														|  | @@ -273,6 +279,7 @@ public class FileManager {
 | 
											
												
													
														|  |              return  false;
 |  |              return  false;
 | 
											
												
													
														|  |          } finally {
 |  |          } finally {
 | 
											
												
													
														|  |              try {
 |  |              try {
 | 
											
												
													
														|  | 
 |  | +                if (Objects.nonNull(fileOutputStream))
 | 
											
												
													
														|  |                  fileOutputStream.close();
 |  |                  fileOutputStream.close();
 | 
											
												
													
														|  |              }catch (IOException e){}
 |  |              }catch (IOException e){}
 | 
											
												
													
														|  |          }
 |  |          }
 |