You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Lexert19 (via GitHub)" <gi...@apache.org> on 2026/03/29 00:01:07 UTC
[PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Lexert19 opened a new pull request, #17387:
URL: https://github.com/apache/iotdb/pull/17387
## Description
This PR adds support for the X-TimeZone header in REST API V2. The header is parsed in AuthorizationFilter and the time zone is set in the session. Integration tests are added to verify correct handling of valid and invalid time zones.
Closes #17344
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error
conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition,
design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design
(or naming) decision point and compare the alternatives with the designs that you've implemented
(or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere
(e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list),
link to that discussion from this PR description and explain what have changed in your final design
compared to your original proposal or the consensus version in the end of the discussion.
If something hasn't changed since the original discussion, you can omit a detailed discussion of
those aspects of the design here, perhaps apart from brief mentioning for the sake of readability
of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
This PR has:
- [x] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [x] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, __license__, or notice information
- [x] added comments explaining the "why" and the intent of the code wherever would not be obvious
for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold
for code coverage.
- [x] added integration tests.
- [ ] been tested in a test IoTDB cluster.
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items
apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items
from the checklist above are strictly necessary, but it would be very helpful if you at least
self-review the PR. -->
<hr>
##### Key changed/added classes (or packages if there are too many classes) in this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "Lexert19 (via GitHub)" <gi...@apache.org>.
Lexert19 commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4248145302
Hi @CritasWang, thanks for the review. I have added null guards and integration tests for Table Rest API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "CritasWang (via GitHub)" <gi...@apache.org>.
CritasWang merged PR #17387:
URL: https://github.com/apache/iotdb/pull/17387
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4151601832
Add support in
https://github.com/apache/iotdb/blob/master/external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/impl/RestApiServiceImpl.java ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "Lexert19 (via GitHub)" <gi...@apache.org>.
Lexert19 commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4217516858
Hi @HTHou, i have updated the PR to address all the feedback:
-Integration Tests: Adjusted test timestamps to ensure they fall within the GROUP BY time window.
-AuthorizationFilter: Added .trim() to the Time-Zone header to avoid errors with extra spaces.
-Example: Added the missing Time-Zone header to HttpExample.java.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "Lexert19 (via GitHub)" <gi...@apache.org>.
Lexert19 commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3083182869
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/impl/GrafanaApiServiceImpl.java:
##########
@@ -91,8 +91,8 @@ public Response variables(SQL sql, SecurityContext securityContext) {
try {
RequestValidationHandler.validateSQL(sql);
- Statement statement =
- StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault());
+ ZoneId zoneId = SESSION_MANAGER.getCurrSession().getZoneId();
Review Comment:
Added null guards.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3048921237
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/AuthorizationFilter.java:
##########
@@ -147,6 +154,33 @@ private User checkLogin(
return user;
}
+ /**
+ * Resolves the Time-Zone header from the request.
+ *
+ * @param requestContext the incoming HTTP request
+ * @return the resolved ZoneId, or {@code null} if the header is invalid (the request is aborted)
+ */
+ private ZoneId resolveTimeZone(ContainerRequestContext requestContext) {
+ String timeZoneHeader = requestContext.getHeaderString("Time-Zone");
+ if (timeZoneHeader == null || timeZoneHeader.isEmpty()) {
+ return ZoneId.systemDefault();
+ }
Review Comment:
PR description mentions supporting an `X-TimeZone` header, but the implementation reads `Time-Zone` only. If clients (or the issue) expect `X-TimeZone`, requests will be ignored and the session will continue using the system default. Consider either updating the PR description and examples to match `Time-Zone`, or accepting both headers (e.g., prefer `Time-Zone` then fall back to `X-TimeZone`) for compatibility.
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/AuthorizationFilter.java:
##########
@@ -147,6 +154,33 @@ private User checkLogin(
return user;
}
+ /**
+ * Resolves the Time-Zone header from the request.
+ *
+ * @param requestContext the incoming HTTP request
+ * @return the resolved ZoneId, or {@code null} if the header is invalid (the request is aborted)
+ */
+ private ZoneId resolveTimeZone(ContainerRequestContext requestContext) {
+ String timeZoneHeader = requestContext.getHeaderString("Time-Zone");
+ if (timeZoneHeader == null || timeZoneHeader.isEmpty()) {
+ return ZoneId.systemDefault();
+ }
+ try {
+ return ZoneId.of(timeZoneHeader);
+ } catch (DateTimeException e) {
Review Comment:
`timeZoneHeader` is used as-is for parsing. If the header is present but contains only whitespace (or has leading/trailing spaces), `ZoneId.of(...)` will throw and the request will be rejected. Consider trimming the header value before validation/parsing so common client formatting issues don’t cause a 400.
##########
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java:
##########
@@ -2354,4 +2363,206 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) {
}
}
}
+
+ public void queryWithValidTimeZoneHeader(CloseableHttpClient httpClient) {
+ CloseableHttpResponse response = null;
+ try {
+ HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query");
+ httpPost.setHeader("Time-Zone", "+05:00");
+ String sql =
+ "{\"sql\":\"SELECT count(s3) FROM root.sg25 GROUP BY ([2026-03-28T00:00:00, 2026-03-29T00:00:00), 1d)\"}";
+ httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset()));
+ response = httpClient.execute(httpPost);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ String message = EntityUtils.toString(response.getEntity(), "utf-8");
+ JsonObject result = JsonParser.parseString(message).getAsJsonObject();
+ assertTrue(result.has("timestamps"));
+ assertTrue(result.getAsJsonArray("timestamps").size() > 0);
+ long expectedTimestamp =
+ ZonedDateTime.of(2026, 3, 28, 0, 0, 0, 0, ZoneId.of("+05:00")).toInstant().toEpochMilli();
+ assertEquals(expectedTimestamp, result.getAsJsonArray("timestamps").get(0).getAsLong());
Review Comment:
The GROUP BY time range here uses 2026-03-28/2026-03-29, but the test data inserted into root.sg25 earlier in this IT uses fixed timestamps 1635232143960/1635232153960 (~2021-10-26). As a result, this query will likely return an empty result set and fail the `timestamps.size() > 0` assertion. Consider changing the query time range (and expectedTimestamp) to align with the inserted data, or insert additional rows for root.sg25 within the queried range before asserting on the first window timestamp.
##########
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRestServiceIT.java:
##########
@@ -2354,4 +2363,206 @@ public void queryDateAndBlobV2(CloseableHttpClient httpClient) {
}
}
}
+
+ public void queryWithValidTimeZoneHeader(CloseableHttpClient httpClient) {
+ CloseableHttpResponse response = null;
+ try {
+ HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query");
+ httpPost.setHeader("Time-Zone", "+05:00");
+ String sql =
+ "{\"sql\":\"SELECT count(s3) FROM root.sg25 GROUP BY ([2026-03-28T00:00:00, 2026-03-29T00:00:00), 1d)\"}";
+ httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset()));
+ response = httpClient.execute(httpPost);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ String message = EntityUtils.toString(response.getEntity(), "utf-8");
+ JsonObject result = JsonParser.parseString(message).getAsJsonObject();
+ assertTrue(result.has("timestamps"));
+ assertTrue(result.getAsJsonArray("timestamps").size() > 0);
+ long expectedTimestamp =
+ ZonedDateTime.of(2026, 3, 28, 0, 0, 0, 0, ZoneId.of("+05:00")).toInstant().toEpochMilli();
+ assertEquals(expectedTimestamp, result.getAsJsonArray("timestamps").get(0).getAsLong());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ }
+
+ public void nonQueryWithValidTimeZoneHeader(CloseableHttpClient httpClient) {
+ CloseableHttpResponse response = null;
+ try {
+ HttpPost createPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/nonQuery");
+ nonQuery(
+ httpClient,
+ "{\"sql\":\"CREATE TIMESERIES root.sg_tz.d1.s1 WITH DATATYPE=INT32\"}",
+ createPost);
+
+ HttpPost insertPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/nonQuery");
+ insertPost.setHeader("Time-Zone", "+05:00");
+ nonQuery(
+ httpClient,
+ "{\"sql\":\"INSERT INTO root.sg_tz.d1(time, s1) VALUES (2026-03-28T00:00:00, 123)\"}",
+ insertPost);
+
+ HttpPost queryPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v1/query");
+ queryPost.setEntity(
+ new StringEntity("{\"sql\":\"SELECT s1 FROM root.sg_tz.d1\"}", StandardCharsets.UTF_8));
+ response = httpClient.execute(queryPost);
+ String message = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
+ JsonObject result = JsonParser.parseString(message).getAsJsonObject();
+ long expected =
+ ZonedDateTime.of(2026, 3, 28, 0, 0, 0, 0, ZoneId.of("+05:00")).toInstant().toEpochMilli();
+ assertEquals(expected, result.getAsJsonArray("timestamps").get(0).getAsLong());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ }
+
+ public void queryWithValidTimeZoneHeaderV2(CloseableHttpClient httpClient) {
+ CloseableHttpResponse response = null;
+ try {
+ HttpPost httpPost = getHttpPost("http://127.0.0.1:" + port + "/rest/v2/query");
+ httpPost.setHeader("Time-Zone", "+05:00");
+ String sql =
+ "{\"sql\":\"SELECT count(s3) FROM root.sg25 GROUP BY ([2026-03-28T00:00:00, 2026-03-29T00:00:00), 1d)\"}";
+ httpPost.setEntity(new StringEntity(sql, Charset.defaultCharset()));
+ response = httpClient.execute(httpPost);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ String message = EntityUtils.toString(response.getEntity(), "utf-8");
+ JsonObject result = JsonParser.parseString(message).getAsJsonObject();
+ assertTrue(result.has("timestamps"));
+ assertTrue(result.getAsJsonArray("timestamps").size() > 0);
+ long expectedTimestamp =
+ ZonedDateTime.of(2026, 3, 28, 0, 0, 0, 0, ZoneId.of("+05:00")).toInstant().toEpochMilli();
+ assertEquals(expectedTimestamp, result.getAsJsonArray("timestamps").get(0).getAsLong());
Review Comment:
Same issue as the v1 test: this GROUP BY time range is in 2026, but root.sg25 test data is inserted with timestamps around 2021-10-26. This will likely return no rows and break the `timestamps.size() > 0` assertion. Please align the queried time range (and expectedTimestamp) with the inserted test data, or insert data that falls into the specified 2026 range before querying.
##########
example/rest-java-example/src/main/java/org/apache/iotdb/HttpExample.java:
##########
@@ -138,4 +139,29 @@ public void query() {
}
}
}
+
+ public void queryWithTimeZone() {
+ CloseableHttpClient httpClient = SSLClient.getInstance().getHttpClient();
+ CloseableHttpResponse response = null;
+ try {
+ HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/query");
Review Comment:
`queryWithTimeZone()` doesn’t actually send the Time-Zone header (unlike the HTTPS and table examples). As written, this method behaves the same as `query()` and won’t demonstrate the feature. Add the `Time-Zone` (or intended header name) to this request so the example matches the method name and the PR’s new behavior.
```suggestion
HttpPost httpPost = getHttpPost("http://127.0.0.1:18080/rest/v1/query");
httpPost.setHeader("Time-Zone", "Asia/Shanghai");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "Lexert19 (via GitHub)" <gi...@apache.org>.
Lexert19 commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3083185222
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/impl/RestApiServiceImpl.java:
##########
@@ -287,7 +286,8 @@ private Statement createStatement(
}
clientSession.setSqlDialect(IClientSession.SqlDialect.TABLE);
- return relationSqlParser.createStatement(sql.getSql(), ZoneId.systemDefault(), clientSession);
+ return relationSqlParser.createStatement(
Review Comment:
Added integration tests for Table API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "Lexert19 (via GitHub)" <gi...@apache.org>.
Lexert19 commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4183254144
Hi @HTHou, thank you for the review! I've updated the PR:
- Renamed header to "Time-Zone"
- Added support to v1 and table v1 API
- Added examples
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4188014409
Hi @Lexert19, could you please share this new feature in the dev mail list?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3007135979
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/AuthorizationFilter.java:
##########
@@ -88,6 +89,12 @@ public void filter(ContainerRequestContext containerRequestContext) throws IOExc
if (user == null) {
return;
}
+
+ ZoneId zoneId = parseTimeZone(containerRequestContext);
+ if (zoneId == null) {
+ return;
+ }
Review Comment:
Use `ZoneId.systemDefault()` if not set the TimeZone?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4151681929
And consider add some example in https://github.com/apache/iotdb/tree/master/example/rest-java-example/src/main/java/org/apache/iotdb?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3007135979
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/AuthorizationFilter.java:
##########
@@ -88,6 +89,12 @@ public void filter(ContainerRequestContext containerRequestContext) throws IOExc
if (user == null) {
return;
}
+
+ ZoneId zoneId = parseTimeZone(containerRequestContext);
+ if (zoneId == null) {
+ return;
+ }
Review Comment:
Use `ZoneId.systemDefault()` if not set the TimeZone?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add X-TimeZone header support to REST API (#17344) [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#issuecomment-4151665557
Another question, why did you pick `X-TimeZone`? I found there is a document uses `Time-Zone`.
https://docs.github.com/en/rest/using-the-rest-api/timezones-and-the-rest-api?apiVersion=2026-03-10#using-the-time-zone-header
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add TimeZone header support to REST API (#17344) [iotdb]
Posted by "CritasWang (via GitHub)" <gi...@apache.org>.
CritasWang commented on code in PR #17387:
URL: https://github.com/apache/iotdb/pull/17387#discussion_r3071200614
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/impl/RestApiServiceImpl.java:
##########
@@ -287,7 +286,8 @@ private Statement createStatement(
}
clientSession.setSqlDialect(IClientSession.SqlDialect.TABLE);
- return relationSqlParser.createStatement(sql.getSql(), ZoneId.systemDefault(), clientSession);
+ return relationSqlParser.createStatement(
Review Comment:
The table REST API (RestApiServiceImpl in table/v1) was also updated to use session ZoneId, but there are no integration tests for the table model endpoints with the Time-Zone header.
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/impl/GrafanaApiServiceImpl.java:
##########
@@ -91,8 +91,8 @@ public Response variables(SQL sql, SecurityContext securityContext) {
try {
RequestValidationHandler.validateSQL(sql);
- Statement statement =
- StatementGenerator.createStatement(sql.getSql(), ZoneId.systemDefault());
+ ZoneId zoneId = SESSION_MANAGER.getCurrSession().getZoneId();
Review Comment:
Every service method now does:
ZoneId zoneId = SESSION_MANAGER.getCurrSession().getZoneId();
If SESSION_MANAGER.getCurrSession() returns null (e.g., on the /ping endpoint which bypasses auth, or an edge case in session lifecycle), this will throw a NullPointerException. The
old code used ZoneId.systemDefault() which was always safe.
Recommendation: Add a null guard:
IClientSession session = SESSION_MANAGER.getCurrSession();
ZoneId zoneId = (session != null) ? session.getZoneId() : ZoneId.systemDefault();
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org