Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
a1f91b0f
Commit
a1f91b0f
authored
Jul 05, 2019
by
Michael Droettboom
Browse files
Use "val X = try {" syntax
parent
697d91dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/service/glean/src/main/java/mozilla/components/service/glean/storages/TimingDistributionsStorageEngine.kt
View file @
a1f91b0f
...
...
@@ -191,9 +191,8 @@ data class TimingDistributionData(
return
null
}
val
rawHistogramType
=
jsonObject
.
tryGetString
(
"histogram_type"
)
?:
return
null
var
histogramType
:
HistogramType
try
{
histogramType
=
HistogramType
.
valueOf
(
rawHistogramType
.
capitalize
())
val
histogramType
=
try
{
HistogramType
.
valueOf
(
rawHistogramType
.
capitalize
())
}
catch
(
e
:
IllegalArgumentException
)
{
return
null
}
...
...
@@ -212,9 +211,8 @@ data class TimingDistributionData(
}
val
sum
=
jsonObject
.
tryGetLong
(
"sum"
)
?:
return
null
val
rawTimeUnit
=
jsonObject
.
tryGetString
(
"time_unit"
)
?:
return
null
var
timeUnit
:
TimeUnit
try
{
timeUnit
=
TimeUnit
.
valueOf
(
rawTimeUnit
.
capitalize
())
val
timeUnit
=
try
{
TimeUnit
.
valueOf
(
rawTimeUnit
.
capitalize
())
}
catch
(
e
:
IllegalArgumentException
)
{
return
null
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment