fix the security issues for the provided code below

Fixes any security issues you find in the provided code.

Describes the rules that were being broken.

Provides recommendations you applied and specifically how you fixed the code.

Demonstrates, using multiple possible error or invalid input, the code now works properly.

Here is the code:

import java.io.BufferedReader;

import java.io.FileReader;

import java.io.IOException;

public class SDEV425_1 {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// Read the filename from the command line argument

String filename = args[0];

BufferedReader inputStream = null;

String fileLine;

try {

inputStream = new BufferedReader(new FileReader(filename));

System.out.println(“Email Addresses:”);

// Read one Line using BufferedReader

while ((fileLine = inputStream.readLine()) != null) {

System.out.println(fileLine);

}

} catch (IOException io) {

System.out.println(“File IO exception” + io.getMessage());

} finally {

// Need another catch for closing

// the streams

try {

if (inputStream != null) {

inputStream.close();

}

} catch (IOException io) {

System.out.println(“Issue closing the Files” + io.getMessage());

}

}

}

}

 
Do you need a similar assignment done for you from scratch? Order now!
Use Discount Code "Newclient" for a 15% Discount!