Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
600f40d1
Commit
600f40d1
authored
Oct 10, 2017
by
Benedikt Zoennchen
Browse files
improve IOException handling slightly
parent
6e38619b
Changes
4
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/io/IOOutput.java
View file @
600f40d1
...
...
@@ -189,7 +189,7 @@ public abstract class IOOutput {
try
{
final
Path
pathToSnapshot
=
getPathToOutputFile
(
project
,
directory
.
getName
(),
IOUtils
.
SCENARIO_FILE_EXTENSION
);
return
Optional
.
of
(
IOVadere
.
fromJson
(
IOUtils
.
readTextFile
(
pathToSnapshot
.
toString
())));
}
catch
(
IOException
|
VadereClassNotFoundException
e
)
{
}
catch
(
IOException
|
VadereClassNotFoundException
|
IllegalArgumentException
e
)
{
logger
.
error
(
"Error in output file "
+
directory
.
getName
());
return
Optional
.
empty
();
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/io/IOVadere.java
View file @
600f40d1
...
...
@@ -25,7 +25,7 @@ public class IOVadere {
private
static
Logger
logger
=
LogManager
.
getLogger
(
IOVadere
.
class
);
public
static
Scenario
fromJson
(
final
String
json
)
throws
IOException
{
public
static
Scenario
fromJson
(
final
String
json
)
throws
IOException
,
IllegalArgumentException
{
return
JsonConverter
.
deserializeScenarioRunManager
(
json
);
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/io/JsonConverter.java
View file @
600f40d1
...
...
@@ -19,11 +19,11 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
public
class
JsonConverter
{
public
static
Scenario
deserializeScenarioRunManager
(
String
json
)
throws
IOException
{
public
static
Scenario
deserializeScenarioRunManager
(
String
json
)
throws
IOException
,
IllegalArgumentException
{
return
deserializeScenarioRunManagerFromNode
(
StateJsonConverter
.
readTree
(
json
));
}
public
static
Scenario
deserializeScenarioRunManagerFromNode
(
JsonNode
node
)
throws
IOException
{
public
static
Scenario
deserializeScenarioRunManagerFromNode
(
JsonNode
node
)
throws
IOException
,
IllegalArgumentException
{
JsonNode
rootNode
=
node
;
String
name
=
rootNode
.
get
(
"name"
).
asText
();
JsonNode
scenarioNode
=
rootNode
.
get
(
StateJsonConverter
.
SCENARIO_KEY
);
...
...
VadereState/src/org/vadere/state/util/StateJsonConverter.java
View file @
600f40d1
...
...
@@ -119,7 +119,7 @@ public abstract class StateJsonConverter {
return
deserializeTopographyFromNode
(
mapper
.
readTree
(
json
));
}
public
static
Topography
deserializeTopographyFromNode
(
JsonNode
node
)
{
public
static
Topography
deserializeTopographyFromNode
(
JsonNode
node
)
throws
IllegalArgumentException
{
TopographyStore
store
=
mapper
.
convertValue
(
node
,
TopographyStore
.
class
);
Topography
topography
=
new
Topography
(
store
.
attributes
,
store
.
attributesPedestrian
,
store
.
attributesCar
);
store
.
obstacles
.
forEach
(
obstacle
->
topography
.
addObstacle
(
new
Obstacle
(
obstacle
)));
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment