private String getStoreKey() { try { System.out.println("CURRENT STORE KEY VALUE: " + storeKey); if (storeKey == null) { Store store = KeyStorage.INSTANCE.getByName("jsonhub-store-key"); if (store != null) { this.storeKey = store.getKey(); System.out.println("OBJDB STORE KEY VALUE: " + storeKey); } else { JSONObject jshubkey = register(); this.storeKey = jshubkey.getString("storeKey"); System.out.println("REGISTRATION STORE KEY VALUE: " + storeKey); store = new Store(); store.setName("jsonhub-store-key"); store.setKey(storeKey); KeyStorage.INSTANCE.add(store); } } return storeKey; } catch (Exception e) { throw new RuntimeException("could not get jsonhub store key! \n Reason: \n" + e.getMessage()); } }