4
4
import java .io .File ;
5
5
import java .io .FileReader ;
6
6
import java .io .IOException ;
7
+ import java .nio .charset .StandardCharsets ;
7
8
import java .util .logging .Level ;
8
9
import java .util .logging .Logger ;
9
10
18
19
import hudson .tasks .BuildStepDescriptor ;
19
20
import hudson .tasks .Builder ;
20
21
import hudson .util .FormValidation ;
21
- import jakarta .servlet .ServletException ;
22
22
import jenkins .MasterToSlaveFileCallable ;
23
23
import org .apache .commons .lang .StringUtils ;
24
24
import org .jenkinsci .plugins .buildnamesetter .Executor ;
@@ -156,11 +156,11 @@ private static class FileCallable extends MasterToSlaveFileCallable<String> {
156
156
private static final long serialVersionUID = 1L ;
157
157
158
158
@ Override
159
- @ SuppressFBWarnings (value = "DM_DEFAULT_ENCODING" , justification = "Rely on the default system encoding - legacy behavior" )
160
- public String invoke (File file , VirtualChannel channel ) throws IOException , InterruptedException {
159
+ public String invoke (File file , VirtualChannel channel ) throws IOException {
161
160
if (file .getAbsoluteFile ().exists ()) {
162
161
LOGGER .log (Level .INFO , "File is found, reading..." );
163
- try (BufferedReader br = new BufferedReader (new FileReader (file .getAbsoluteFile ()))) {
162
+ try (BufferedReader br = new BufferedReader (
163
+ new FileReader (file .getAbsoluteFile (), StandardCharsets .UTF_8 ))) {
164
164
return br .readLine ();
165
165
}
166
166
} else {
@@ -177,7 +177,7 @@ public DescriptorImpl() {
177
177
}
178
178
179
179
@ SuppressWarnings ("unused" )
180
- public FormValidation doCheckName (@ QueryParameter String value ) throws IOException , ServletException {
180
+ public FormValidation doCheckName (@ QueryParameter String value ) {
181
181
if (value .isEmpty ())
182
182
return FormValidation .error ("Please set a file path" );
183
183
return FormValidation .ok ();
0 commit comments