Skip to content

Conversation

@sftwnd
Copy link

@sftwnd sftwnd commented Feb 2, 2024

The toString() method of the MAPPrivateExtensionImpl class may result in an NPE when the oId is not empty.
For example - when logging a MAPPrivateExtension object with a filled oId

import org.restcomm.protocols.ss7.map.MAPParameterFactoryImpl;
import org.restcomm.protocols.ss7.map.api.MAPParameterFactory;
import org.restcomm.protocols.ss7.map.api.primitives.MAPPrivateExtension;

public class Main {
    public static void main(String[] args) {
        MAPParameterFactory map = new MAPParameterFactoryImpl();
        MAPPrivateExtension extension = map.createMAPPrivateExtension(new long[] {},null);
        System.out.println("1: Extension was created");
        System.out.println("1: " + extension);
        extension = map.createMAPPrivateExtension(null, new byte[] {});
        System.out.println("2: Extension was created");
        System.out.println("2: " + extension);
    }

}
1: Extension was created
1: PrivateExtension [Oid=]
2: Extension was created
Exception in thread "main" java.lang.NullPointerException: Cannot read the array length because "this.oId" is null
	at org.restcomm.protocols.ss7.map.primitives.MAPPrivateExtensionImpl.toString(MAPPrivateExtensionImpl.java:209)
	at java.base/java.lang.String.valueOf(String.java:4465)
	at Main.main(Main.java:15)

…tring method on a MAPPrivateExtensionImpl object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant