@@ -170,33 +170,35 @@ protected void loadDataPackage() {
170170 }
171171 }
172172
173- if (!localGamesList .isEmpty ()){
174- for (String gameName : games ){
175- if (localGamesList .containsKey (gameName )){
176- //check all checksums
177- for (File version : localGamesList .get (gameName ).listFiles ()){
178- if (versions .containsKey (gameName ) && versions .get (gameName ).equals (version .getName ())){
179- try (FileReader reader = new FileReader (version )){
180- updateDataPackage (gson .fromJson (reader , DataPackage .class ));
181- LOGGER .info ("Read datapackage for Game: " .concat (gameName ).concat (" Checksum: " ).concat (version .getName ()));
182- } catch (IOException e ){
183- LOGGER .info ("Failed to read a datapackage. Starting with a new one." );
184- }
185- }
186- }
187- }
188- }
173+ if (localGamesList .isEmpty ()){
174+ //cache doesn't exist. Create the filepath
175+ boolean success = directoryPath .mkdirs ();
176+ if (success ){
177+ LOGGER .info ("DataPackage directory didn't exist. Starting from a new one." );
178+ } else {
179+ LOGGER .severe ("Failed to make directories for datapackage cache." );
180+ }
181+ return ;
189182 }
190- } else {
191- //cache doesn't exist. Create the filepath
192- boolean success = directoryPath .mkdirs ();
193- if (success ){
194- LOGGER .info ("DataPackage directory didn't exist. Starting from a new one." );
195- } else {
196- LOGGER .severe ("Failed to make directories for datapackage cache." );
183+ for (String gameName : games ) {
184+ File dir = localGamesList .get (gameName );
185+ if (null == dir ){
186+ continue ;
187+ }
188+ //check all checksums
189+ for (File version : dir .listFiles ()){
190+ String versionStr = versions .get (gameName );
191+ if (versionStr != null && versionStr .equals (version .getName ())) {
192+ try (FileReader reader = new FileReader (version )){
193+ updateDataPackage (gson .fromJson (reader , DataPackage .class ));
194+ LOGGER .info ("Read datapackage for Game: " .concat (gameName ).concat (" Checksum: " ).concat (version .getName ()));
195+ } catch (IOException e ){
196+ LOGGER .info ("Failed to read a datapackage. Starting with a new one." );
197+ }
197198 }
198199 }
199200 }
201+ }
200202 }
201203
202204 public void saveDataPackage () {
0 commit comments