37
37
import processing .app .debug .MessageConsumer ;
38
38
import processing .app .debug .MessageSiphon ;
39
39
import processing .app .helpers .ProcessUtils ;
40
- import processing .app .helpers .StringUtils ;
41
40
42
41
import java .io .File ;
43
- import java .util .Arrays ;
44
42
import java .util .Collection ;
45
43
import java .util .List ;
46
44
import java .util .concurrent .TimeUnit ;
47
45
46
+ import org .apache .commons .lang3 .StringUtils ;
47
+
48
48
import static processing .app .I18n .tr ;
49
49
50
50
public abstract class Uploader implements MessageConsumer {
51
51
52
- private static final List < String > STRINGS_TO_SUPPRESS ;
53
- private static final List < String > AVRDUDE_PROBLEMS ;
52
+ private static final String [] STRINGS_TO_SUPPRESS ;
53
+ private static final String [] AVRDUDE_PROBLEMS ;
54
54
55
55
static {
56
- STRINGS_TO_SUPPRESS = Arrays . asList ( "Connecting to programmer:" ,
56
+ STRINGS_TO_SUPPRESS = new String [] { "Connecting to programmer:" ,
57
57
"Found programmer: Id = \" CATERIN\" ; type = S" ,
58
58
"Software Version = 1.0; No Hardware Version given." ,
59
59
"Programmer supports auto addr increment." ,
60
60
"Programmer supports buffered memory access with buffersize=128 bytes." ,
61
- "Programmer supports the following devices:" , "Device code: 0x44" ) ;
61
+ "Programmer supports the following devices:" , "Device code: 0x44" } ;
62
62
63
- AVRDUDE_PROBLEMS = Arrays . asList ( "Programmer is not responding" ,
63
+ AVRDUDE_PROBLEMS = new String [] { "Programmer is not responding" ,
64
64
"programmer is not responding" ,
65
65
"protocol error" , "avrdude: ser_open(): can't open device" ,
66
66
"avrdude: ser_drain(): read error" ,
67
67
"avrdude: ser_send(): write error" ,
68
- "avrdude: error: buffered memory access not supported." ) ;
68
+ "avrdude: error: buffered memory access not supported." } ;
69
69
}
70
70
71
71
protected final boolean verbose ;
@@ -155,7 +155,7 @@ public String getFailureMessage() {
155
155
@ Override
156
156
public void message (String s ) {
157
157
// selectively suppress a bunch of avrdude output for AVR109/Caterina that should already be quelled but isn't
158
- if (!verbose && StringUtils .stringContainsOneOf (s , STRINGS_TO_SUPPRESS )) {
158
+ if (!verbose && StringUtils .containsAny (s , STRINGS_TO_SUPPRESS )) {
159
159
s = "" ;
160
160
}
161
161
@@ -175,7 +175,7 @@ public void message(String s) {
175
175
error = tr ("Device is not responding, check the right serial port is selected or RESET the board right before exporting" );
176
176
return ;
177
177
}
178
- if (StringUtils .stringContainsOneOf (s , AVRDUDE_PROBLEMS )) {
178
+ if (StringUtils .containsAny (s , AVRDUDE_PROBLEMS )) {
179
179
error = tr ("Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions." );
180
180
return ;
181
181
}
0 commit comments