-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor(studio): improve date parsing error handling #2384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1abc31e
fix: import IOException
6mmLIU 820558a
fix-bugs
6mmLIU 2a425ad
style: apply Spring JavaFormat (core) & validate studio-server on JDK17
6mmLIU d243903
Merge branch 'alibaba:main' into main
6mmLIU f654f85
Merge branch 'main' into main
yuluo-yx e9a3ca3
Update comments to English in TextDocumentParser
6mmLIU 76fc264
Update comments to English in test cases
6mmLIU fe0f414
style(core): apply spring-javaformat to TextDocumentParser(+tests)
6mmLIU 5ed3c5d
Merge branch 'alibaba:main' into main
6mmLIU 58abd36
Merge branch 'alibaba:main' into main
6mmLIU 8585e83
Merge branch 'alibaba:main' into main
6mmLIU 6ec4bfb
refactor: improve date parsing error handling
6mmLIU a5372cf
create-high-quality-pr-without-downstream-impact-j4t8zh
6mmLIU be50dc1
test(studio): add Apache-2.0 license header & apply spring-javaformat
6mmLIU f81711e
Remove gitleaks binary and ignore it
6mmLIU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...rver-core/src/test/java/com/alibaba/cloud/ai/studio/core/utils/common/DateUtilsTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2025 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.alibaba.cloud.ai.studio.core.utils.common; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.Locale; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link DateUtils}. | ||
*/ | ||
class DateUtilsTests { | ||
|
||
@Test | ||
void parseDateStringReturnsDateWhenFormatMatches() throws Exception { | ||
String time = "Wed Sep 11 12:00:00 GMT 2024"; | ||
Date expected = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH).parse(time); | ||
assertThat(DateUtils.parseDateString(time)).isEqualTo(expected); | ||
} | ||
|
||
@Test | ||
void parseDateStringReturnsNullOnParseFailure() { | ||
assertThat(DateUtils.parseDateString("invalid-date")).isNull(); | ||
} | ||
|
||
} |
Submodule gitleaks
added at
a82bc5
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.