Skip to content

Commit aff92f3

Browse files
author
David Strömner
committed
Fixed missed downgrades
1 parent 4039f5a commit aff92f3

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

benchmarks/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<properties>
3232
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3333
<jmh.version>1.23</jmh.version>
34-
<javac.target>25</javac.target>
34+
<javac.target>17</javac.target>
3535
<!-- Name of the benchmark Uber-JAR to generate. -->
3636
<uberjar.name>benchmarks</uberjar.name>
3737
<maven.javadoc.skip>true</maven.javadoc.skip>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<link>https://jakarta.ee/specifications/platform/8/apidocs/</link>
171171
<link>https://kafka.apache.org/30/javadoc/</link>
172172
</links>
173-
<source>25</source>
173+
<source>17</source>
174174
</configuration>
175175
<executions>
176176
<execution>

sql/src/test/java/io/cloudevents/sql/TCKTestSuite.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ public CloudEvent getTestInputEvent() {
6161
if (this.eventOverrides != null) {
6262
CloudEventBuilder builder = CloudEventBuilder.from(inputEvent);
6363
this.eventOverrides.forEach((k, v) -> {
64-
switch (v) {
65-
case String s -> builder.withContextAttribute(k, s);
66-
case Boolean b -> builder.withContextAttribute(k, b);
67-
case Number number -> builder.withContextAttribute(k, number.intValue());
68-
default -> throw new IllegalArgumentException("Unexpected event override attribute '" + k + "' type: " + v.getClass());
64+
if (v instanceof String) {
65+
builder.withContextAttribute(k, (String) v);
66+
} else if (v instanceof Boolean) {
67+
builder.withContextAttribute(k, (Boolean) v);
68+
} else if (v instanceof Number) {
69+
builder.withContextAttribute(k, ((Number) v).intValue());
70+
} else {
71+
throw new IllegalArgumentException("Unexpected event override attribute '" + k + "' type: " + v.getClass());
6972
}
7073
});
7174
inputEvent = builder.build();
@@ -74,14 +77,19 @@ public CloudEvent getTestInputEvent() {
7477
}
7578

7679
public EvaluationException.ErrorKind getEvaluationExceptionErrorKind() {
77-
return switch (this.error) {
78-
case CAST -> EvaluationException.ErrorKind.CAST;
79-
case MATH -> EvaluationException.ErrorKind.MATH;
80-
case MISSING_FUNCTION -> EvaluationException.ErrorKind.MISSING_FUNCTION;
81-
case MISSING_ATTRIBUTE -> EvaluationException.ErrorKind.MISSING_ATTRIBUTE;
82-
case FUNCTION_EVALUATION -> EvaluationException.ErrorKind.FUNCTION_EVALUATION;
83-
default -> null;
84-
};
80+
switch (this.error) {
81+
case CAST:
82+
return EvaluationException.ErrorKind.CAST;
83+
case MATH:
84+
return EvaluationException.ErrorKind.MATH;
85+
case MISSING_FUNCTION:
86+
return EvaluationException.ErrorKind.MISSING_FUNCTION;
87+
case MISSING_ATTRIBUTE:
88+
return EvaluationException.ErrorKind.MISSING_ATTRIBUTE;
89+
case FUNCTION_EVALUATION:
90+
return EvaluationException.ErrorKind.FUNCTION_EVALUATION;
91+
}
92+
return null;
8593
}
8694

8795
}

0 commit comments

Comments
 (0)