Skip to content

Commit

Permalink
Merge pull request #144 from abbasmanthirik/abbas-null-checks-new
Browse files Browse the repository at this point in the history
@W-14781712 fix: added null checks
  • Loading branch information
sahil-here committed May 24, 2024
2 parents 6092e00 + 4736222 commit 234e461
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
19 changes: 12 additions & 7 deletions docs/coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
<artifactId>formula-engine-oracle-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.salesforce.formula</groupId>
<artifactId>formula-engine-mysql-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.salesforce.formula</groupId>
<artifactId>formula-engine-sqlserver-test</artifactId>
Expand Down Expand Up @@ -99,5 +94,15 @@
</dependency>
</dependencies>
</profile>
</profiles>
</project>
<profile>
<id>mysql-test</id>
<dependencies>
<dependency>
<groupId>com.salesforce.formula</groupId>
<artifactId>formula-engine-mysql-test</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public WrongArgumentTypeException(String function, Type[] expectedInputTypes, Fo
super(createErrorMessage(function, expectedInputTypes, actual));

Token token = actual.getToken();
location = token.getColumn();
text = token.getText();
type = token.getType();
if(token != null) {
location = token.getColumn();
text = token.getText();
type = token.getType();
} else {
location = 0;
text = "";
type = 0;
}
}

private static String createErrorMessage(String function, Type[] expectedInputTypes, FormulaAST actual) {
Expand Down Expand Up @@ -63,9 +69,15 @@ public WrongArgumentTypeException(String function, Type[] expectedInputTypes, Fo
super(createErrorMessage(function, expectedInputTypes, columnType));

Token token = actual.getToken();
location = token.getColumn();
text = token.getText();
type = token.getType();
if(token != null) {
location = token.getColumn();
text = token.getText();
type = token.getType();
} else {
location = 0;
text = "";
type = 0;
}
}

private static String createErrorMessage(String function, Type[] expectedInputTypes, FormulaDataType columnType) {
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,9 @@
<module>impl</module>
<module>test-utils</module>
<module>oracle-test</module>
<module>mysql-test</module>
<!-- <module>mysql-test</module> -->
<!-- MYSQL tests having issues in handling regular expressions, so excluding these tests from maven build process-->
<!-- These tests can be executed by using the "mysql" profile e.g. `mvn -P mysql clean verify -B` -->
<module>sqlserver-test</module>
<module>sqlite-test</module>
<!-- <module>h2-test</module> -->
Expand All @@ -536,6 +538,12 @@
<module>google-test</module>
</modules>
</profile>
<profile>
<id>mysql</id>
<modules>
<module>mysql-test</module>
</modules>
</profile>
</profiles>

<reporting>
Expand Down

0 comments on commit 234e461

Please sign in to comment.