public static JSONObject getUser(String screen_name, boolean forceReload) throws TwitterException, IOException { if (!forceReload) { JsonFactory mapcapsule = DAO.user_dump.get("screen_name",screen_name); if (mapcapsule == null) mapcapsule = DAO.user_dump.get("id_str", screen_name); if (mapcapsule != null) { JSONObject json = mapcapsule.getJSON(); if (json.length() > 0) { // check if the entry is maybe outdated, i.e. if it is empty or too old try { Date d = DAO.user_dump.parseDate(json); if (d.getTime() + DateParser.DAY_MILLIS > System.currentTimeMillis()) return json; } catch (ParseException e) { return json; } } } } TwitterFactory tf = getUserTwitterFactory(screen_name); if (tf == null) tf = getAppTwitterFactory(); if (tf == null) return new JSONObject(); Twitter twitter = tf.getInstance(); User user = twitter.showUser(screen_name); RateLimitStatus rateLimitStatus = user.getRateLimitStatus(); getUserResetTime = System.currentTimeMillis() + rateLimitStatus.getSecondsUntilReset() * 1000; getUserRemaining = rateLimitStatus.getRemaining(); JSONObject json = user2json(user); enrichLocation(json); DAO.user_dump.putUnique(json); return json; }