Skip to content

Commit

Permalink
Fixed Bug when creating a new store
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoeppke committed Nov 28, 2016
1 parent 11da520 commit 38c0ce8
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ public boolean updateStore(@NotNull StoreViewData store) {
LOG.error(String.format("Exception while updating store: %s\n%s", e.getMessage(), e.getStackTrace()));
return false;
}


if (!checkStoresAvailable()) {
// Error occured while retrieving the stores
return false;
}

stores.put(store.getID(), store);
return true;
}
Expand Down Expand Up @@ -235,6 +240,11 @@ public boolean createStore(long enterpriseID, String name, String location) {
return false;
}

if (!checkStoresAvailable()) {
// Error occured while retrieving the stores
return false;
}

for (StoreWithEnterpriseTO recStoreTO : storeTOs) {
if (storeTO.getLocation().equals(location)) {
StoreViewData recStore = new StoreViewData(recStoreTO.getId(), recStoreTO.getEnterpriseTO(), location, name);
Expand All @@ -245,4 +255,15 @@ public boolean createStore(long enterpriseID, String name, String location) {

return true;
}

private boolean checkStoresAvailable() {
if (stores == null) {
try {
updateStoreInformation();
} catch (NotInDatabaseException_Exception e) {
return false;
}
}
return true;
}
}

0 comments on commit 38c0ce8

Please sign in to comment.