3737import processing .app .debug .MessageConsumer ;
3838import processing .app .debug .MessageSiphon ;
3939import processing .app .helpers .ProcessUtils ;
40- import processing .app .helpers .StringUtils ;
4140
4241import java .io .File ;
43- import java .util .Arrays ;
4442import java .util .Collection ;
4543import java .util .List ;
4644import java .util .concurrent .TimeUnit ;
4745
46+ import org .apache .commons .lang3 .StringUtils ;
47+
4848import static processing .app .I18n .tr ;
4949
5050public abstract class Uploader implements MessageConsumer {
5151
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 ;
5454
5555 static {
56- STRINGS_TO_SUPPRESS = Arrays . asList ( "Connecting to programmer:" ,
56+ STRINGS_TO_SUPPRESS = new String [] { "Connecting to programmer:" ,
5757 "Found programmer: Id = \" CATERIN\" ; type = S" ,
5858 "Software Version = 1.0; No Hardware Version given." ,
5959 "Programmer supports auto addr increment." ,
6060 "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" } ;
6262
63- AVRDUDE_PROBLEMS = Arrays . asList ( "Programmer is not responding" ,
63+ AVRDUDE_PROBLEMS = new String [] { "Programmer is not responding" ,
6464 "programmer is not responding" ,
6565 "protocol error" , "avrdude: ser_open(): can't open device" ,
6666 "avrdude: ser_drain(): read error" ,
6767 "avrdude: ser_send(): write error" ,
68- "avrdude: error: buffered memory access not supported." ) ;
68+ "avrdude: error: buffered memory access not supported." } ;
6969 }
7070
7171 protected final boolean verbose ;
@@ -155,7 +155,7 @@ public String getFailureMessage() {
155155 @ Override
156156 public void message (String s ) {
157157 // 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 )) {
159159 s = "" ;
160160 }
161161
@@ -175,7 +175,7 @@ public void message(String s) {
175175 error = tr ("Device is not responding, check the right serial port is selected or RESET the board right before exporting" );
176176 return ;
177177 }
178- if (StringUtils .stringContainsOneOf (s , AVRDUDE_PROBLEMS )) {
178+ if (StringUtils .containsAny (s , AVRDUDE_PROBLEMS )) {
179179 error = tr ("Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions." );
180180 return ;
181181 }
0 commit comments