What Is A NullpointerException And How To Fix It? (Complete Guide)

preview_player
Показать описание
So what is a nullpointerexception, what causes it, how to prevent it and what the security implications of null pointer exceptions are in your code.

Let’s talk about Null Pointer Exceptions!!

#IT #Development #SoftwareDevelopment #JavaProgramming #JavaTutorial #AppplicationSecurity #AppSec #appsecurity #informationsecurity #infosec

Chapters

00:00 Introduction
00:44 What is a NullPointerException
02:19 Creating object variables in Java
03:00 Causing a NullPointerException
06:37 How to fix/prevent a NullPointerException
06:48 Application security discussion

If you’ve been a developer for any amount of time, you’ve had to deal with NullPointerExceptions in your code. Whether you’re a complete newbie or you have decades of experience, at some point, you’ll end up with null pointers exceptions and the nasty stack traces that result. It’s simply part of the process of developing code.

Of course, finding null pointer exceptions during development instead of once your code reaches production is the goal.

Let’s spend a few minutes and talk about:

1. What a null pointer exception is
2. What can cause it
3. How we can detect or better yet, prevent it
4. And what are the implications of null pointer exceptions for application security

So what is a NullPointerExcepption?

In the Java programming language, the literal, reserved word null indicates that an object variable currently refers to no object.

In Java, an object variable contains a reference to an object that is stored elsewhere. When elsewhere is nowhere, that’s what null is.

All Java objects exist on the heap. When an object contains another object variable it contains a pointer to another object on the heap.

Should your code reference an uninitialized object, rather than giving you back some random piece of memory like C or C++ language will, the Java runtime will generate a runtime exception, the null pointer exception.

This give you the opportunity to do something resourceful in your code like respond to that event and to keep going to get to a recoverable state.

Although it may not seem like it, getting a null pointer exception in your code is good thing since you can take appropriate action, like logging the event, clearing the condition and trying again, or complaining to your user about their bad data.
Рекомендации по теме
Комментарии
Автор

What other Java videos would you like to see? Questions about application security? Leave a comment.

beginsecure