codemetropolis / CodeMetropolis

See your software as never before.
http://codemetropolis.github.io/CodeMetropolis/
14 stars 30 forks source link

Enhancement of Error Handling in Java-Based File Conversion Tool #347

Open SzatmariA opened 8 months ago

SzatmariA commented 8 months ago

Requirement Specification:

The assignment involves improving the error handling capabilities of a Java-based file conversion tool, converter-1.4.0.jar. The tool currently exhibits several deficiencies in handling exceptional cases, and the goal is to refactor it to provide more informative, user-friendly error messages and to handle specific error scenarios gracefully.

Key areas for enhancement include:

Non-existent Input File: When the input file (e.g., a.graph) does not exist, the tool should inform the user with a clear message like "Input file not found" and exit without creating any output files.

Invalid Graph File: If the provided graph file is invalid (e.g., fake.graph with random characters), the tool should identify the invalid format, notify the user about the specific issue, and exit without creating output files.

Handling Empty or Invalid Parameters:

For an empty projects parameter (e.g., -p projects=), the tool should warn about the missing parameter value and exit without proceeding further. For an invalid parameter (e.g., -p a=b), the tool should inform the user about the unrecognized parameter name and value, and exit. When special characters are used in regular expression parameter values (e.g., projects=^a.*=,), the tool should identify the error in parameter format and notify the user.

Output File Parameter Handling:

If the output file parameter is missing (e.g., -o without a value), the tool should alert the user about the missing value and provide correct usage information. For an invalid output file path (e.g., W:/out.xml on a non-existent drive), the tool should inform the user about the invalid file path and prevent any file creation. Usage Help Message Accuracy: The usage help message of the tool should accurately reflect the command line parameters and their valid values. Any discrepancies, like the presence of a -s parameter instead of -i, should be corrected.

Comprehensive Log File Information: In all error scenarios, the log file should contain detailed information about the error, including the type of error, the specific cause, and the stack trace to aid in debugging.