Skip to content

Commit 6b9da2c

Browse files
committed
Fix for AdminMessage InApp message null pointer issue
This is a simple solution to avoid null pointer exceptions when a user wants to send an Admin initiated InApp message but doesn’t set the email subject or email template type. Currently users are not made aware why the null pointer exceptions are thrown and figuring out why is compounded by the fact that the documentation says these parameters are not required for inapp messages. Now the default for email subject is “” and the default for email type is plain. Of course these are overwritten when specified.
1 parent 5766674 commit 6b9da2c

File tree

8 files changed

+81
-2
lines changed

8 files changed

+81
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ build
1212
*.ear
1313
hs_err_pid*
1414
.idea
15+
/bin/

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>intercom-java</name>
4+
<comment>Project intercom-java created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
connection.arguments=
2+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
3+
connection.java.home=null
4+
connection.jvm.arguments=
5+
connection.project.dir=
6+
derived.resources=.gradle,build
7+
eclipse.preferences.version=1
8+
project.path=\:

intercom-java/.classpath

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/main/java">
4+
<attributes>
5+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src/test/java">
9+
<attributes>
10+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
11+
</attributes>
12+
</classpathentry>
13+
<classpathentry kind="src" path="src/test/resources">
14+
<attributes>
15+
<attribute name="FROM_GRADLE_MODEL" value="true"/>
16+
</attributes>
17+
</classpathentry>
18+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
19+
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
20+
<classpathentry kind="output" path="bin"/>
21+
</classpath>

intercom-java/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

intercom-java/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>intercom-java-intercom-java</name>
4+
<comment>Project intercom-java-intercom-java created by Buildship.</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
21+
<nature>org.eclipse.jdt.core.javanature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
connection.arguments=
2+
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
3+
connection.java.home=null
4+
connection.jvm.arguments=
5+
connection.project.dir=..
6+
derived.resources=.gradle,build
7+
eclipse.preferences.version=1
8+
project.path=\:intercom-java

intercom-java/src/main/java/io/intercom/api/AdminMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public class AdminMessage extends TypedData {
2222
private String messageType;
2323

2424
@JsonProperty("subject")
25-
private String subject;
25+
private String subject=""; // Set default to blank string so null pointer exception won't thrown if messageType = inapp and subject not set
2626

2727
@JsonProperty("body")
2828
private String body;
2929

3030
@JsonProperty("template")
31-
private String template;
31+
private String template="plain"; // Set default to plain so null pointer exception won't thrown if messageType = inapp and template not set
3232

3333
@JsonProperty("created_at")
3434
private long createdAt;

0 commit comments

Comments
 (0)