Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with the code in Java for the following used pattern and matcher from java.util.regex to setup a pattern to find anything that

I need help with the code in Java for the following used pattern and matcher from java.util.regex to setup a pattern to find anything that doesn't match the pattern and asks the user to rename the file if it is not within the pattern. For the rule use conservation file naming conventions. Also can you find all the vulnerabilities and mitigation in the given code with test of the mitigations of the new code

attachment1.png


 

*/ 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()); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Programming questions

Question

What is systems analysis and design?

Answered: 1 week ago