// Path: src/main/java/com/asana/Json.java
// public class Json {
//     private static Gson instance;
// 
//     /**
//      * Implements ISO 3339 date/time deserialization since SimpleDateFormat in Java 6 does not support the "X" format specifier
//      */
//     private static class ISO3339DateDeserializer implements JsonDeserializer<DateTime> {
//         @Override
//         public DateTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
//             DateTime result = null;
//             try {
//                 String date = jsonElement.getAsString();
//                 result = DateTime.parseRfc3339(date);
//             } catch (NumberFormatException e)  {
//                 System.err.println("Couldn't parse date: " + jsonElement.getAsString());
//             }
//             return result;
//         }
//     }
// 
//     /**
//      * @return Singleton instance of the Gson parser that handle Asana's date format (ISO 3339)
//      */
//     static public Gson getInstance() {
//         if (instance == null) {
//             instance = new GsonBuilder()
//                     .registerTypeAdapter(DateTime.class, new ISO3339DateDeserializer())
//                     .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
//                     .create();
//         }
//         return instance;
//     }
// }
// 
// Path: src/main/java/com/asana/models/ResultBodyCollection.java
// public class ResultBodyCollection<T> {
//     public class NextPage {
//         public String offset;
//         public String path;
//         public String uri;
//     }
// 
//     public List<T> data;
// 
//     public String sync;
//     @SerializedName("next_page")
//     public NextPage nextPage;
//     @SerializedName("has_more")
//     public Boolean hasMore;
// }


import com.asana.Json;
import com.asana.models.ResultBodyCollection;
import com.google.api.client.http.HttpResponseException;
package com.asana.errors;


public class InvalidTokenError extends AsanaError {
    final public static String MESSAGE = "Sync token invalid or too old";
    final public static int STATUS = 412;

    public String sync;

    public InvalidTokenError(HttpResponseException exception) {
        super(MESSAGE, STATUS, exception);

        try {
// Path: src/main/java/com/asana/Json.java
// public class Json {
//     private static Gson instance;
// 
//     /**
//      * Implements ISO 3339 date/time deserialization since SimpleDateFormat in Java 6 does not support the "X" format specifier
//      */
//     private static class ISO3339DateDeserializer implements JsonDeserializer<DateTime> {
//         @Override
//         public DateTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
//             DateTime result = null;
//             try {
//                 String date = jsonElement.getAsString();
//                 result = DateTime.parseRfc3339(date);
//             } catch (NumberFormatException e)  {
//                 System.err.println("Couldn't parse date: " + jsonElement.getAsString());
//             }
//             return result;
//         }
//     }
// 
//     /**
//      * @return Singleton instance of the Gson parser that handle Asana's date format (ISO 3339)
//      */
//     static public Gson getInstance() {
//         if (instance == null) {
//             instance = new GsonBuilder()
//                     .registerTypeAdapter(DateTime.class, new ISO3339DateDeserializer())
//                     .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
//                     .create();
//         }
//         return instance;
//     }
// }
// 
// Path: src/main/java/com/asana/models/ResultBodyCollection.java
// public class ResultBodyCollection<T> {
//     public class NextPage {
//         public String offset;
//         public String path;
//         public String uri;
//     }
// 
//     public List<T> data;
// 
//     public String sync;
//     @SerializedName("next_page")
//     public NextPage nextPage;
//     @SerializedName("has_more")
//     public Boolean hasMore;
// }


// Path: src/main/java/com/asana/errors/InvalidTokenError.java
import com.asana.Json;
import com.asana.models.ResultBodyCollection;
import com.google.api.client.http.HttpResponseException;

package com.asana.errors;


public class InvalidTokenError extends AsanaError {
    final public static String MESSAGE = "Sync token invalid or too old";
    final public static int STATUS = 412;

    public String sync;

    public InvalidTokenError(HttpResponseException exception) {
        super(MESSAGE, STATUS, exception);

        try {
            ResultBodyCollection body = Json.getInstance().fromJson(exception.getContent(), ResultBodyCollection.class);