• Zlorfik
  • 0 Points
  • Member since 2013

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

Hello there


I'm at my first Apex coding project. When testing my code, I receive errors saying that an insert failed because I tried to de-reference a null-pointer. In the Debug Log I found a section that is, in my opinion, the source for this null pointer exception.


In the code below, I have a method to add my Handler with its corresponding action. The method is called from a trigger which creates a new instance of my Handler and uses it along with the action as parameters.


The handler list is not yet initiated and this is done by passing it a list of Handlers out of the actionHandlerMapping. Usually actionHandlerMapping is empty upon first run of this method and so also handlerList is empty. That's why the handlerList is added the Handler passed by the method and the actionHandlerMapping is set a key-value pair with the name of the action and the list of handlers.



*	Add handler to list of action type. Handler is an interface that my Apex class implements to handle certain
*	actions of a trigger. TriggerEvent is an Enum. actionHandlerMapping is a Map<String, Handler>

public void addOneHandler(Handler theHandler, TriggerEvent theEvent)
	List<Handler> handlerList = actionHandlerMapping.get(theEvent.name());
	if (handlerList == null)
		handlerList = new List<Handler>();
		actionHandlerMapping.put(theEvent.name(), handlerList);

Now in the "Variables" window of the Developer Console on Salesforce in the debug log, the list handlerList is always null. I have no clue why this list remains null even though I add a Handler object to it. The Handler Object itself exists as I can see on the Variables window, so I am not actually adding a null value.


Any help appreciated.

Hi Experts,

I want to use some external jar file in the apex class as we can use it
in the java classes.
Is there any method to use these external jar files to adopt there functionality
into my apex class???

Looking for experts kind attention
  • October 28, 2008
  • Like
  • 0