V4Vern / pe

0 stars 0 forks source link

Corrupted data on testArticleScraper.txt will result in program crash #7

Open V4Vern opened 4 weeks ago

V4Vern commented 4 weeks ago

Description:

When I modified testArticleScraper.txt and deleted some of the text. There is no validation to check for corrupted data. When I launched the program, it crashed after I entered my name presumptuously because the program cannot load the articles properly due to corrupted files

Steps to Reproduce:

Edit the text file "testArticleScraper.txt" as shown

"Kristen Wiig initiated into SNL fivetimers club by Ryan Gosling Matt Damon and Lorne Michaels CNN;Alli Rosenbloom;April 07, 2024;CNN;https://edition.cnn.com/2024/04/07/entertainment/kristen-wiig-ryan-gosling-matt-damon-snl/index.html;Kristen Wiig got inducted into the coveted Saturday Night Live fivetimers club in style this weekend when she hosted the longrunning NBC sketch show for the fifth time and she had a little bit of help from some huge stars;Entertainment The Matrix has a fifth film in the works and no this is not a simulation CNN;Alli Rosenbloom;April 03, 2024;CNN;https://edition.cnn.com/2024/04/03/entertainment/matrix-fifth-movie/index.html;Red pill or blue pill anyone A fifth installment of the beloved scifi film franchise The Matrix is in the works;Entertainment Dune Part Two may be followed by a third film but Timothe Chalamet and Zendaya dont know how it all ends CNN;Unknown;March 04, 2024;CNN;https://edition.cnn.com/2024/03/04/entertainment/dune-part-two-sequel/index.html;Dune Part Two spiced up the box office with a 815 million opening weekend becoming the biggest film so far of 2024;Entertainment Angelina Jolie alleges history of Brad Pitts physical abuse prior to 2016 plane ride in new Miraval filing CNN;Alli Rosenbloom;April 05, 2024;CNN;https://edition.cnn.com/2024/04/04/entertainment/angelina-jolie-brad-pitt-abuse-history/index"

Relaunch the program and enter a random name. The program will crash

Actual Result: The program should check for corrupted data and generate new data if it detects any corrupted data.

image.png

nus-se-bot commented 3 weeks ago

Team's Response

Ah, I see what's happened here. You edited the scraper file, which isn't quite what we had in mind. Just a gentle reminder: the file's already set up correctly for our database, so manual adjustments aren't necessary. Running the scraper each time might slow things down a tad. Thanks for bringing it to our attention, though. Perhaps clearer documentation about not tinkering with the file would help prevent this.

The 'Original' Bug

[The team marked this bug as a duplicate of the following bug]

Unhandled Exception when encountering corrupt testArticleScraper.txt file

When testArticleScraper.txt is corrupt or manually edited to have incorrect format. The program should theoretically rerun the "Scraper" component of the program to reset the text file. But currently it leads to unhandled exception.

Hello from
__________________________________________________________________________________________
   _     _                           __             ______                     __
   /|   /                          /    )             /      /               /    )
---/-| -/-----__----------__-------/----/----__-------/------/__----__-------/---------__-
 /  | /    /___)| /| /  (_ `     /    /   /   )     /      /   ) /___)     /  --,   /   )
_/___|/____(___ _|/_|/__(__)_____(____/___/___/_____/______/___/_(___ _____(____/___(___/_

What is your name?
hmd
____________________________________________________________

Hello hmd
____________________________________________________________

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
       at newsonthego.storage.NewsImporter.importNewsFromText(NewsImporter.java:32)
       at newsonthego.NewsOnTheGo.main(NewsOnTheGo.java:309)

[original: nus-cs2113-AY2324S2/pe-interim#2373] [original labels: severity.Low type.FunctionalityBug]

Their Response to the 'Original' Bug

[This is the team's response to the above 'original' bug]

Ah, I see what's happened here. You edited the scraper file, which isn't quite what we had in mind. Just a gentle reminder: the file's already set up correctly for our database, so manual adjustments aren't necessary. Running the scraper each time might slow things down a tad. Thanks for bringing it to our attention, though. Perhaps clearer documentation about not tinkering with the file would help prevent this.

Items for the Tester to Verify

:question: Issue duplicate status

Team chose to mark this issue as a duplicate of another issue (as explained in the Team's response above)

Reason for disagreement: [replace this with your explanation]


## :question: Issue type Team chose [`type.DocumentationBug`] Originally [`type.FeatureFlaw`] - [x] I disagree **Reason for disagreement:** It should be a feature flaw since storage is not well handled and well tested. ![image.png](https://raw.githubusercontent.com/V4Vern/pe/main/files/2f98ae93-8dc9-401d-96f2-da46e489c6ed.png)
## :question: Issue severity Team chose [`severity.VeryLow`] Originally [`severity.Medium`] - [x] I disagree **Reason for disagreement:** Some users may occasionally experience inconvenience if the testArticleScraper.txt file is corrupted due to a system error or malware. For example, in this case the application crashed. Thus, the severity should not be very low because user cannot use the program as long as the testArticileScraper.txt is corrupted unless the user deletes it and let the application rerun but the UG did not specify as well. ![image.png](https://raw.githubusercontent.com/V4Vern/pe/main/files/03c3eaa3-cfde-4184-851a-3221954590a8.png)