You need to sign in to do that
Don't have an account?
Edmondo Porcu 2
NullPointerException in Apply Domain Layer Principles
I am trying to pass the "Apply Domain Layer Principles" assignment in Developer Advanced but I get stucked to the following issues:
Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.fflib_SObjectDomain.triggerHandler: line 345, column 1 Class.fflib_SObjectDomain.triggerHandler: line 321, column 1 Trigger.AccountsTrigger: line 5, column 1: []
The error occurs in line 345 of Class.fflib_SObjectDomain.triggerHandler (the second one in the snippet)
Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountsTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Class.fflib_SObjectDomain.triggerHandler: line 345, column 1 Class.fflib_SObjectDomain.triggerHandler: line 321, column 1 Trigger.AccountsTrigger: line 5, column 1: []
The error occurs in line 345 of Class.fflib_SObjectDomain.triggerHandler (the second one in the snippet)
Type constructableClass = domainClassName.endsWith('Constructor') ? Type.forName(domainClassName) : Type.forName(domainClassName+'.Constructor'); IConstructable domainConstructor = (IConstructable) constructableClass.newInstance()So it seems that Apex Commons can't retrieve by reflection the instance of the domain class (which is called Accounts). Has this something to do with the version of the API I am running?
public class Constructor implements fflib_SObjectDomain.IConstructable {
public fflib_SObjectDomain construct(List<SObject> sObjectList) {
return new Accounts(sObjectList);
}
}