Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
projet-part2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mamadu-lamarana Bah
projet-part2
Commits
6ad1bda8
Commit
6ad1bda8
authored
1 year ago
by
Mamadu-lamarana Bah
Browse files
Options
Downloads
Patches
Plain Diff
transformation d'un switch en un if-else pour améliorer la lisibilité
parent
d363eccc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gson/extras/src/main/java/com/google/gson/typeadapters/UtcDateTypeAdapter.java
+10
-9
10 additions, 9 deletions
...java/com/google/gson/typeadapters/UtcDateTypeAdapter.java
with
10 additions
and
9 deletions
gson/extras/src/main/java/com/google/gson/typeadapters/UtcDateTypeAdapter.java
+
10
−
9
View file @
6ad1bda8
...
@@ -19,6 +19,7 @@ package com.google.gson.typeadapters;
...
@@ -19,6 +19,7 @@ package com.google.gson.typeadapters;
import
com.google.gson.JsonParseException
;
import
com.google.gson.JsonParseException
;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.TypeAdapter
;
import
com.google.gson.stream.JsonReader
;
import
com.google.gson.stream.JsonReader
;
import
com.google.gson.stream.JsonToken
;
import
com.google.gson.stream.JsonWriter
;
import
com.google.gson.stream.JsonWriter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -45,15 +46,15 @@ public final class UtcDateTypeAdapter extends TypeAdapter<Date> {
...
@@ -45,15 +46,15 @@ public final class UtcDateTypeAdapter extends TypeAdapter<Date> {
@Override
@Override
public
Date
read
(
JsonReader
in
)
throws
IOException
{
public
Date
read
(
JsonReader
in
)
throws
IOException
{
try
{
try
{
switch
(
in
.
peek
())
{
if
(
in
.
peek
()
==
JsonToken
.
NULL
)
{
case
NULL:
in
.
nextNull
();
in
.
nextN
ull
()
;
return
n
ull
;
return
null
;
}
default
:
else
{
String
date
=
in
.
nextString
();
String
date
=
in
.
nextString
();
// Instead of using iso8601Format.parse(value), we use Jackson's date parsing
// Instead of using iso8601Format.parse(value), we use Jackson's date parsing
// This is because Android doesn't support XXX because it is JDK 1.6
// This is because Android doesn't support XXX because it is JDK 1.6
return
parse
(
date
,
new
ParsePosition
(
0
));
return
parse
(
date
,
new
ParsePosition
(
0
));
}
}
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
throw
new
JsonParseException
(
e
);
throw
new
JsonParseException
(
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment