Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Guava Throwables.propagate #223

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/main/java/com/treasuredata/client/TDApiRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.treasuredata.client;

import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
Expand Down Expand Up @@ -251,7 +250,7 @@ public static String urlEncode(String value)
return URLEncoder.encode(value, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
}
3 changes: 1 addition & 2 deletions src/main/java/com/treasuredata/client/TDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
Expand Down Expand Up @@ -1020,7 +1019,7 @@ public TDBulkLoadSessionStartResult startBulkLoadSession(String name, TDBulkLoad
payload = ObjectMappers.compactMapper().writeValueAsString(request);
}
catch (JsonProcessingException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
return doPost(buildUrl("/v3/bulk_loads", name, "jobs"),
queryParams, Optional.of(payload),
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/treasuredata/client/model/TDQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;

import java.io.StringWriter;

Expand Down Expand Up @@ -54,7 +53,7 @@ public static TDQuery fromObject(JsonNode value)
return new TDQuery(s.toString());
}
catch (java.io.IOException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/treasuredata/client/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package com.treasuredata.client;

import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.treasuredata.client.model.TDDatabase;
import com.treasuredata.client.model.TDJob;
import com.treasuredata.client.model.TDJobRequest;
Expand Down Expand Up @@ -94,7 +93,7 @@ public Integer apply(InputStream input)
unpacker.close();
}
catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
return count;
}
Expand Down
11 changes: 5 additions & 6 deletions src/test/java/com/treasuredata/client/TestTDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
Expand Down Expand Up @@ -391,7 +390,7 @@ public JSONArray apply(InputStream input)
return new JSONArray(result);
}
catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
});
Expand Down Expand Up @@ -420,7 +419,7 @@ public Object apply(InputStream input)
return null;
}
catch (IOException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
});
Expand Down Expand Up @@ -601,7 +600,7 @@ public JSONArray apply(InputStream input)
return new JSONArray(result);
}
catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
});
Expand Down Expand Up @@ -1029,7 +1028,7 @@ public String apply(InputStream input)
return result;
}
catch (IOException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
});
Expand Down Expand Up @@ -1278,7 +1277,7 @@ public Integer apply(InputStream input)
return errorRecordCount;
}
catch (IOException e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
});
Expand Down