Unit 3 - Lesson 4 - Exception Handling Flashcards

1
Q

List two forms of exceptions

A
AppException - checked exception - must catch or throw an exception. Subclass of curam.util.exception.AppException)
AppRuntimeException - unchecked exception - e.g. RecordNotFound - doesn't have to catch or throw. 
Inherit from Java's Exception and RuntimeException classes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where exceptions can originate from

A

Generated code:
Database Access Layer (typically unchecked exceptions)
Remote Interface Layer (RIL)
Handcoded code:
Business Object Layer (can be pre-defined or customised exceptions)
All Facade and Process object methods throw AppException and InformationalException.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Advantages of exceptions

A

Recommended mechanism for handling errors.

Single exception try/catch can enclose many statements, each of which could raise an exception.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

describe Handling exceptions

A
  • Ignored, in which case it filters up to the RIL
  • Caught and ignored
  • Caught, information added, and re-thrown
  • Caught, a new exception created, and thrown
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

describe general RIL exception handling

A
  • Get message text from catalog (messages.jar, must rebuild the client whenever the message catalog has been changed)
    • If exception not handled, get default message.
  • Log the exception if setLoggable = true
  • Create an exception and throw to the client
  • Client looks up localised text and displays
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe message catalogs

A

Message file is an XML file stored in the components\core\message directory
Usually one per BPO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to generate message catalog

A

build msggen generates BpoValidateAccount.xml into:
BpoValidateAccount.properties file contains the message text file (1 per locale)
BPOVALidaTEACCOUNT.java containing the message catalog identifiers.
Part of the build generated.
Must build client whenever the message file changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain tags in message.xml file

A

Messages -> Message -> Locale
Messages - entire content root
Message where name is Java identifier for this message.
Locale - element has message description - after generation this text is copied to the properties file for the message.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Simple exception in Java

A

throw new AppException (serverworkshop.message.BPOVALIDATEACCOUNT.ERR_ACCOUNT_ALREADY_EXISTS)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe Message Arguments

A

Argument place holders are tokens included in the error message source text and replaced by an argument at runtime.
Form of %nc where n is argument number and c is a single character denoting the argument type.
Can be attached to an exception before it is thrown.
intended to be included in the error message displayed to the client e.arg(arg0.setupDate)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

List message argument types

A
s - string
n - numeric
d - date
t - time
z - date/time
c - code table item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Logging exceptions

A

To log to the application log file by RIL:
* Use the exception’s setLoggable method.
* e.setLoggable(true)
Luggable if its luggable flag is set, or if the luggable flag is set on any attached exceptions.
Any other exceptions attached are also logged.
Loggable exceptions are written to the application log file by the RIL.
Logging facilities are provided by curam.util.resources.Trace, wrapper for Log4j API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Where is defined application log file

A

The application log file is defined here: application.prx (curam.trace.configfile.location)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

RecordNotFoundException

A

Singleton reads, updates and removes. read, nsread, modify, nsmodify, remove, nsremove, nkremove, nkmodify

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

RecordDeletedException

A

When optimistic locking fails because the target record has been deleted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

DuplicateRecordException

A

Can be thrown by insert and update operations (entity insert, nsinsert, modify, nsmodify, nkmodify)

17
Q

MultipleRecordException

A

read, nsread, nkread return multiple records