IBM Z and LinuxONE - IBM Z

IBM Z

The enterprise platform for mission-critical applications brings next-level data privacy, security, and resiliency to your hybrid multicloud.

 View Only

NULLPOINTEREXCEPTION WHEN PRINTING FLOATING FORMS

By Dionne Nerissa posted Wed October 18, 2023 05:58 AM

  

NullPointerException is a Runtime Exception that is thrown when a program attempts to use an object reference with a null value.

There is a different situation where the NullPointerException is used 

  • Invoking a method from a null object.
  • Accessing or modifying a null object’s field.
  • Taking the length of null as if it were an array.
  • Synchronize over a null object.

In RBD, the "form-floating" enables a floating label with text form fields to give the required input, which can be floating or resting. The labels are visible and aligned with the input line, which can be a textual description or heading for the Text Field.

In this blog, we will see how RBD handles Null pointer exceptions when printing floating forms.

Steps to create an exception for Null pointer when printing floating forms:

Step-1:

A. Create a general JAVA project with Form-Group

Follow the below steps to create a general JAVA project with Form-Group:

1. Navigate to File-->New-->EGL project.

2. EGL Project window will appear.

3. Enter the Project name.

4. Select the General Project option.

5. Select Java in the Target Runtime Platform.

6. click Next and then Finish.

7. Right-click the EGL source in the general project.

8. Go to New-->Other…

9. Select the show all wizard checkbox under EGL.

10. Select the Form-Group.

11. Enter the Package name and Form-Group name.

12. Click Finish.

13. Form-Group is created successfully with the floating form with Text_fields.

B. Java EGL program

Follow the below steps to create a Java EGL program:

1. Go to Project Explorer.

2. Expand the project.

3. Right-click the EGL source.

4. Go to New-->Program.

5. New EGL Program window will appear.

6. Enter the Package name and EGL source file name.

7. Click Finish.

8. Code logic is added successfully to print text form fields 10000 times with Null reference.

Step-2: Creating a Resources Association part in the build descriptor.

Enter the systemName as MYPRINT.out in the property tab, which will create a report file after generating the project.

Step-3: Generation process.

Follow the below steps to generate the program:

1. Select and right-click on the created project.

2. Go to Run As and select Java Application.

3. As the Form-Group and program are generated successfully without any issues, the response is printed on the console.

Step-4: Deployment process

Follow the below steps to deploy the project:

1. Select and right-click on the created project.

2. Go to Debug As and select Java Application.

3. The project has been deployed successfully.

Step-5: Verify MYPRINT.out file creation.

Follow the below steps to verify the report file:

1. Double-click the report created under the Java project.


The MYPRINT.out report file holding the floating Form-Group simultaneously prints 10000 times with Nullpointer reference.

                                                                                        

Dionne A Nerissa

QA - Senior Software Engineer

0 comments
14 views

Permalink