-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathERROR_HANDLER.java
More file actions
72 lines (68 loc) · 2.87 KB
/
ERROR_HANDLER.java
File metadata and controls
72 lines (68 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//package SYSTEM;
import java.io.IOException;
//import SYSTEM.ProcessControlBlock;
public class ERROR_HANDLER {
// ERROR_HANDLER subsystem is required to handle warnings and errors of the
// system.
// When ever an error occurs in the program,
// the respective Errorcode is set and then ERROR_HANDLER()
// subsystem is called from LOADER or CPU.
void ERROR_HANDLER1(SYSTEM system,ProcessControlBlock pcb) throws IOException {
// invalid opcode error
if (system.ERRORCODE == 1) {
pcb.errormsg = "Nature of Termination : abnormal. Invalid Opcode found in the user job in Loader format.";
} else if (system.ERRORCODE == 3) {
pcb.errormsg = "Nature of Termination : abnormal. Invalid Loader/data format. The loader/data format should be in Hexadecimal.";
}
// attempt to divide by zero error
else if (system.ERRORCODE == 4) {
pcb.errormsg = "Nature of Termination : abnormal. Divide by zero error. A number should not be divided by zero.";
}
// memory address fault error
else if (system.ERRORCODE == 6) {
pcb.errormsg = "Nature of Termination : abnormal. Memory address fault. An address should be within the lenth of the job.";
}
// Suspected Infinite Job
else if (system.ERRORCODE == 9) {
pcb.errormsg = "Nature of Termination : abnormal. Suspected Infinite job. A user job should have termination point.";
}
// Null Reference Exception
else if (system.ERRORCODE == 10) {
pcb.errormsg = "Nature of Termination : abnormal. Null Reference Exception occured as input given is null";
}
// Index out of bound Exception
else if (system.ERRORCODE == 11) {
pcb.errormsg = "Nature of Termination : abnormal. Index out of bound Exception occured as index has exceeded the length of array";
}
// Missing Data
else if (system.ERRORCODE == 12) {
pcb.errormsg = "Nature of Termination : abnormal. Missing data";
}
// OverFlow
else if (system.ERRORCODE == 13) {
pcb.errormsg = "Nature of Termination : abnormal. Program too long";
}
// Null Job
else if (system.ERRORCODE == 14) {
pcb.errormsg = "Nature of Termination : abnormal. Null Job. (Loader format is null)";
}
// Missing Program
else if (system.ERRORCODE == 15) {
pcb.errormsg = "Nature of Termination : abnormal. Missing Program";
}
// Missing **Job
else if (system.ERRORCODE == 16) {
pcb.errormsg = "Nature of Termination : abnormal. Missing **Job";
}
// invalid trace flag warning
if (system.WARNINGCODE == 1) {
pcb.errormsg = "Warning Message : Invalid or Missing Trace Flag. The Trace flag value should be 0 or 1.";
} else if (system.WARNINGCODE == 2) {
pcb.errormsg = "Warning Message : Missing **Data";
} else if (system.WARNINGCODE == 3) {
pcb.errormsg = "Warning Message : Missing **FIN";
} else if (system.WARNINGCODE == 4) {
pcb.errormsg = "Warning Message : Double **DATA";
}
}
}