Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
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
Container registry
Model registry
Operate
Environments
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
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
63c18b36
Commit
63c18b36
authored
5 years ago
by
ivarnm
Browse files
Options
Downloads
Patches
Plain Diff
#89
Remove noSuchElementException
parent
66cd4cdf
No related branches found
No related tags found
2 merge requests
!90
Dev
,
!88
Resolve "Remove noSuchElementException"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/core/src/com/gameware/game/QueryIntermediate.java
+2
-12
2 additions, 12 deletions
frontend/core/src/com/gameware/game/QueryIntermediate.java
with
2 additions
and
12 deletions
frontend/core/src/com/gameware/game/QueryIntermediate.java
+
2
−
12
View file @
63c18b36
...
...
@@ -116,12 +116,6 @@ public class QueryIntermediate {
}
}
private
static
void
checkIteratorNotEmpty
(
JsonValue
.
JsonIterator
iterator
)
throws
NoSuchElementException
{
if
(!
iterator
.
hasNext
())
{
throw
new
NoSuchElementException
(
"Response empty"
);
}
}
// ---------------- Games methods ----------------
public
static
Game
getGameById
(
String
gameId
)
throws
IOException
,
NoSuchElementException
{
String
route
=
"games/gamename/"
+
gameId
;
...
...
@@ -139,7 +133,6 @@ public class QueryIntermediate {
checkStatusCode
(
response
);
JsonValue
base
=
jsonReader
.
parse
(
response
[
1
]);
JsonValue
.
JsonIterator
iterator
=
base
.
iterator
();
checkIteratorNotEmpty
(
iterator
);
while
(
iterator
.
hasNext
())
{
Game
game
=
json
.
fromJson
(
Game
.
class
,
iterator
.
next
().
toString
());
games
.
add
(
game
);
...
...
@@ -155,7 +148,6 @@ public class QueryIntermediate {
checkStatusCode
(
response
);
JsonValue
base
=
jsonReader
.
parse
(
response
[
1
]);
JsonValue
.
JsonIterator
iterator
=
base
.
iterator
();
checkIteratorNotEmpty
(
iterator
);
while
(
iterator
.
hasNext
())
{
Tournament
tournament
=
json
.
fromJson
(
Tournament
.
class
,
iterator
.
next
().
toString
());
tournaments
.
add
(
tournament
);
...
...
@@ -202,14 +194,13 @@ public class QueryIntermediate {
return
createdTournament
;
}
public
static
List
<
Point
>
getTournamentPoints
(
String
tournamentId
)
throws
IOException
,
NoSuchElementException
{
public
static
List
<
Point
>
getTournamentPoints
(
String
tournamentId
)
throws
IOException
{
String
route
=
"rounds/all/"
+
tournamentId
;
List
<
Point
>
points
=
new
ArrayList
<>();
String
[]
response
=
sendGetRequest
(
route
);
checkStatusCode
(
response
);
JsonValue
base
=
jsonReader
.
parse
(
response
[
1
]);
JsonValue
.
JsonIterator
iterator
=
base
.
iterator
();
checkIteratorNotEmpty
(
iterator
);
while
(
iterator
.
hasNext
())
{
Point
point
=
json
.
fromJson
(
Point
.
class
,
iterator
.
next
().
toString
());
points
.
add
(
point
);
...
...
@@ -227,14 +218,13 @@ public class QueryIntermediate {
}
// ---------------- Highscore methods ----------------
public
static
List
<
Highscore
>
getHighscoresForGame
(
String
gameId
)
throws
IOException
,
NoSuchElementException
{
public
static
List
<
Highscore
>
getHighscoresForGame
(
String
gameId
)
throws
IOException
{
String
route
=
"highscores/gamescores/"
+
gameId
;
List
<
Highscore
>
highscores
=
new
ArrayList
<>();
String
[]
response
=
sendGetRequest
(
route
);
checkStatusCode
(
response
);
JsonValue
base
=
jsonReader
.
parse
(
response
[
1
]);
JsonValue
.
JsonIterator
iterator
=
base
.
iterator
();
checkIteratorNotEmpty
(
iterator
);
while
(
iterator
.
hasNext
())
{
Highscore
highscore
=
json
.
fromJson
(
Highscore
.
class
,
iterator
.
next
().
toString
());
highscores
.
add
(
highscore
);
...
...
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