Bug 473

Summary: [Kitchen] java.lang.NullPointerException thrown when getting CustomerOrder from the priority queue
Product: Group 25 Reporter: Poon Ting Kwok <tingkpoon2-c>
Component: BugAssignee: yingtng4-c
Status: RESOLVED DUPLICATE    
Severity: critical    
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   

Description Poon Ting Kwok 2020-11-26 10:10:23 HKT
I used the Windows 10 OS, with eclipse editor version 2020-09. When I run the main class, the ArrayList of sorted CustomerOrder is successfully created. However, in the Kitchen class, the chef class's function cook() is invoked, and chef B is not assigned with an order, which caused the Order.CustomerOrder.getCustomer() function.

Steps to reproduce the bug:

Contents in myfile.txt:

0/crackers;beef,beef,fish;cake
5/crackers;fish;cake
3/crackers;beef,fish;cake
4/crackers;;cake
7/crackers;fish,beef,beef;cake

Run the main class, and the error is as follows:
Raw console output:

crackersbeefbeeffishcakeOrder appended
crackersfishcakeOrder appended
crackersbeeffishcakeOrder appended
crackerscakeOrder appended
crackersfishbeefbeefcakeOrder appended
chef Abby is cooking
42
chef Bobby is cooking
0
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Order.CustomerOrder.getCustomer()" because "co" is null
	at MainSystem.Output.output(Output.java:8)
	at Persons.Chef.cook(Chef.java:34)
	at Kitchen.Kitchen.process(Kitchen.java:50)
	at MainSystem.Main.kitchenProcess(Main.java:31)
	at MainSystem.Main.main(Main.java:58)
Comment 1 Poon Ting Kwok 2020-11-26 10:11:40 HKT
I have refactored the code in the kitchen class, and I have pushed my changes to a branch called Alan/Modification.
Comment 2 Poon Ting Kwok 2020-11-26 10:57:54 HKT

*** This bug has been marked as a duplicate of bug 452 ***