Question
Part II: Fix security issues in a simple Java application that uses command line arguments. 1. Download the source file from this week. Found as
Part II: Fix security issues in a simple Java application that uses command line arguments. 1. Download the source file from this week. Found as an attachment in the homework folder.
2. Create a new Java application in Netbeans and either copy and paste the code or import the existing source file. Note you may need to make package adjustments if you created a different package
Here are text versions of the code and emailaddresses for your reference:
package sdev425;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/** * * @author jim */ 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()); }
}
}
}
EmailAddresses.txt
j..n@umuc.edu &..d@umuc.edu &..n@umuc.edu &..a@umuc.edu
j..r@umuc.edu
j..e@umuc.edu &..a@umuc.edu &..a@umuc.edu &..d@umuc.edu
e..d@umuc.edu
WHAT I NEED:
Fixes any security issues you find in the provided code. (20 points) Describes the rules that were being broken. (10 points) Provides recommendations you applied and specifically how you fixed the code. (10 points) Demonstrates, using multiple possible error or invalid input, the code now works properly. (20 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started