-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Enable Error Prone check: DefaultCharset #12313
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| import java.io.UncheckedIOException; | ||
|
|
||
| import static io.trino.plugin.ml.type.ClassifierType.BIGINT_CLASSIFIER; | ||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||
| import static java.util.Objects.requireNonNull; | ||
|
|
||
| public class SvmClassifier | ||
|
|
@@ -50,7 +51,8 @@ public static SvmClassifier deserialize(byte[] modelData) | |
| { | ||
| // TODO do something with the hyperparameters | ||
| try { | ||
| svm_model model = svm.svm_load_model(new BufferedReader(new InputStreamReader(new ByteArrayInputStream(modelData)))); | ||
| // UTF-8 should work, though the only thing we can say about the charset is that it's guaranteed to be 8-bits | ||
| svm_model model = svm.svm_load_model(new BufferedReader(new InputStreamReader(new ByteArrayInputStream(modelData), UTF_8))); | ||
|
||
| return new SvmClassifier(model); | ||
| } | ||
| catch (IOException e) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.