title: Unexpected token 'END OF FILE' at position 0 (JSON)
body: <p>I'm trying to retreive a name from a UUID via a website, using the API Mojang provided. </p>
  
  <p>This is the code I use (I verified that it works):</p>
  
  <pre><code>@Override
  public Map&lt;UUID, String&gt; call() throws Exception {
      Map&lt;UUID, String&gt; uuidStringMap = new HashMap&lt;UUID, String&gt;();
      for (UUID uuid : uuids) {
          HttpURLConnection connection = (HttpURLConnection) new URL(
                  PROFILE_URL + uuid.toString().replace("-", ""))
                  .openConnection();
  
          JSONObject response;
  
          System.out.println("String: " + fromStream(connection.getInputStream()));
          System.out.print("Line: " + uuid.toString());
  
          String name = null;
  
          try {
              response = (JSONObject) jsonParser
                      .parse(new InputStreamReader(connection.getInputStream()));
  
              name = (String) response.get("name");
              if (name == null) {
                  continue;
              }
              String cause = (String) response.get("cause");
              String errorMessage = (String) response.get("errorMessage");
              if (cause != null &amp;&amp; cause.length() &gt; 0) {
                  throw new IllegalStateException(errorMessage);
              }
          } catch (Exception e) {
              System.out.print("Could not parse uuid '" + uuid.toString() + "' to name!");
              System.out.print("Trying Bukkit.getOfflinePlayer()");
  
              OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(uuid);
  
              if (oPlayer != null &amp;&amp; oPlayer.getFirstPlayed() != 0) {
                  name = oPlayer.getName();
  
                  System.out.print("Got player " + name);
              } else {
                  System.out.print("Could not retrieve player with Bukkit.getOfflinePlayer()");
                  e.printStackTrace();
              }
              //throw new Exception("Could not parse uuid '" + uuid.toString() + "' to name!");
          }
  
  
          uuidStringMap.put(uuid, name);
      }
      return uuidStringMap;
  }
  </code></pre>
  
  <p>Don't mind all the System.out.print lines, that's just to debug things.</p>
  
  <p>It errors with this error:</p>
  
  <pre><code>[17:35:56 WARN]: Unexpected token END OF FILE at position 0.
  [17:35:56 WARN]:        at org.json.simple.parser.JSONParser.parse(Unknown Source)
  [17:35:56 WARN]:        at org.json.simple.parser.JSONParser.parse(Unknown Source)
  [17:35:56 WARN]:        at me.armar.plugins.autorank.util.uuid.NameFetcher.call(
  NameFetcher.java:59)
  [17:35:56 WARN]:        at me.armar.plugins.autorank.util.uuid.UUIDManager$2.run
  (UUIDManager.java:222)
  [17:35:56 WARN]:        at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Now, I've run the returned json through a few JSON online parsers. They all tell me the JSON is correct. This is the JSON that is being returned:</p>
  
  <pre><code>{"id":"cb994e15a57a4157953ab29577229ebe","name":"tator0 1","properties":[{"name":"textures","value":"eyJ0aW1lc3RhbXAiOjE0MDQ4MzM3NTM0MTYsInByb2ZpbGVJZCI6ImNiOTk0ZTE1YTU3YTQxNTc5NTNhYjI5NTc3MjI5ZWJlIiwicHJvZmlsZU5hbWUiOiJ0YXRvcjAxIiwiaXNQdWJsaWMiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80Nzk5MjQ4NGJmNjUyODJhMTQzOWI0MGQ1NWU2ZTRjZGQxNGRmYzAyNGE0MzA3Y2M2YTM1M2Q4MzY1OThkZDUifX19","signature":"t93OEZ3BNa4vo47diKixJA0KWXqblUtWC9yZtTImuxfbSs0khqV02p58eeDF4Qbd4gy6VBQ0zv6N9oxRqhTKBQ1BG1FJHTfhGXFlLYlhHlXmVC5FMBnK0P//0T0PqVz7hlFgzW3YK6vaEf3tz5v5H/S+aCjZbCZ9vehDRx8vrV+SzZek0vuSHjm9ojooqwD4WQjCg1ZPZPtpYD/efj1OcTmS6xEnBEXbCTqOnK/wRbwfyKtezkJutFJ4UCrVCLos85ze79mMfBr67CtotFcQrVqRE9X5zShLatCCVlefPRo6K7TcKKzQYlTM24asaySfZYpv0ujGeHX2c6s4nKvg6vnwLnHT2RwDuJucCojAeoy9pRFq8jEtPSoiPGlA37NlLjChuLXp3cSYGhKIpgDFcXXNF+YsYOlN2XuYa2OpAt8EgDj09gd8r903a2apIVUDo4Hmln9rlI9J74KdifEZc3uUyazlP2BByID2YBcKr5mq5ye+MOKWkN8j5AaPNUKPNpFBXHkOOF/uE72VoBpsjDm0X9OfEx7xtNu+bA4jBObxnQKsD2qIvyhCtlmuN4S6G+VKtsBhiqlO7JTycAn1yij3aw3XhT763gALQNcUkjzERnyp55s8J7FlIpSvObNvndOgypPu4RpsHtkL/G16a/mxRJhljiAasiKX1WsYVig="}],"legacy":true}
  </code></pre>
  
  <p>I saw that there also was someone else with a kind of similiar issue, <a href="https://stackoverflow.com/questions/19945832/punexpected-token-end-of-file-at-position-0-p">here</a>.</p>
  
  <p><strong>Where could that unexpected token be?</strong></p>