Skip to content

Commit c102995

Browse files
committed
Merge remote-tracking branch 'arduino/master' into HEAD
2 parents b945df9 + a396f2a commit c102995

File tree

18 files changed

+201
-103
lines changed

18 files changed

+201
-103
lines changed

Diff for: app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java

-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@
3333
import cc.arduino.contributions.filters.InstalledPredicate;
3434
import cc.arduino.contributions.packages.ContributedPackage;
3535
import cc.arduino.contributions.packages.ContributedPlatform;
36-
import cc.arduino.view.Event;
3736
import processing.app.Base;
3837
import processing.app.BaseNoGui;
3938
import processing.app.I18n;
4039
import processing.app.PreferencesData;
4140

4241
import javax.swing.*;
43-
import java.awt.event.ActionEvent;
4442
import java.util.Collection;
4543
import java.util.List;
4644
import java.util.stream.Collectors;

Diff for: app/src/cc/arduino/view/preferences/Preferences.java

+6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@
4848
public class Preferences extends javax.swing.JDialog {
4949

5050
private final Language[] languages;
51+
52+
// Languages that are not translated at least to 65% are
53+
// kept in the "missingLanguages" array until they have enough
54+
// translated strings.
55+
@SuppressWarnings("unused")
5156
private final Language[] missingLanguages;
57+
5258
private final WarningItem[] warningItems;
5359
private final Base base;
5460

Diff for: app/src/processing/app/AbstractMonitor.java

-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
@SuppressWarnings("serial")
1414
public abstract class AbstractMonitor extends JFrame implements ActionListener {
1515

16-
private boolean monitorEnabled;
1716
private boolean closed;
1817

1918
private StringBuffer updateBuffer;
@@ -78,15 +77,13 @@ public void actionPerformed(ActionEvent event) {
7877
updateTimer = new Timer(33, this); // redraw serial monitor at 30 Hz
7978
updateTimer.start();
8079

81-
monitorEnabled = true;
8280
closed = false;
8381
}
8482

8583
protected abstract void onCreateWindow(Container mainPane);
8684

8785
public void enableWindow(boolean enable) {
8886
onEnableWindow(enable);
89-
monitorEnabled = enable;
9087
}
9188

9289
protected abstract void onEnableWindow(boolean enable);

Diff for: app/src/processing/app/Base.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ public void handleNew() throws Exception {
748748
try {
749749
File file = createNewUntitled();
750750
if (file != null) {
751-
Editor editor = handleOpen(file, true);
751+
handleOpen(file, true);
752752
}
753753

754754
} catch (IOException e) {

Diff for: app/src/processing/app/EditorLineStatus.java

-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424

2525
import java.awt.*;
2626
import java.awt.geom.Rectangle2D;
27-
import java.util.Map;
28-
2927
import javax.swing.JComponent;
3028

3129
import processing.app.helpers.OSUtils;
3230
import processing.app.helpers.PreferencesMap;
33-
import processing.app.syntax.SketchTextArea;
3431

3532

3633
/**

Diff for: app/src/processing/app/Preferences.java

-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@
2121

2222
package processing.app;
2323

24-
import processing.app.helpers.PreferencesHelper;
2524
import processing.app.helpers.PreferencesMap;
2625

27-
import java.awt.*;
28-
import java.io.File;
29-
3026

3127
/**
3228
* Storage class for user preferences and environment settings.

Diff for: app/test/processing/app/AutoformatProducesOneUndoActionTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import processing.app.helpers.SketchTextAreaFixture;
3535

3636
import static org.junit.Assert.assertEquals;
37-
import static org.junit.Assert.assertNotEquals;
3837

3938
public class AutoformatProducesOneUndoActionTest extends AbstractGUITest {
4039

Diff for: app/test/processing/app/macosx/SystemProfilerParserTest.java

+44-39
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,55 @@
3333
import processing.app.TestHelper;
3434

3535
import static org.junit.Assert.assertEquals;
36+
import static processing.app.macosx.SystemProfilerParser.extractVIDAndPID;
37+
38+
import java.io.IOException;
39+
import java.io.InputStream;
3640

3741
public class SystemProfilerParserTest {
3842

3943
@Test
4044
public void shouldCorrectlyParse() throws Exception {
41-
String output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output.txt"));
42-
43-
assertEquals("0X2341_0X0044", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodemfa121"));
44-
assertEquals("0X2341_0X0044", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodemfa121"));
45-
46-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output2.txt"));
47-
48-
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodemfd131"));
49-
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodemfd131"));
50-
51-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output3.txt"));
52-
53-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodemfd121"));
54-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodemfd121"));
55-
56-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output4.txt"));
57-
58-
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem411"));
59-
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem411"));
60-
61-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output5.txt"));
62-
63-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem621"));
64-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem621"));
65-
66-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output6.txt"));
67-
68-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem1421"));
69-
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem1421"));
70-
71-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output7.txt"));
72-
73-
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem24131"));
74-
assertEquals("0X2341_0X8036", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem24131"));
75-
assertEquals("0X0403_0X6015", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbserial-DN0031EV"));
76-
assertEquals("0X0403_0X6015", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbserial-DN0031EV"));
77-
78-
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output8.txt"));
45+
String output = getFileContent("system_profiler_output.txt");
46+
assertEquals("0X2341_0X0044", extractVIDAndPID(output, "/dev/cu.usbmodemfa121"));
47+
assertEquals("0X2341_0X0044", extractVIDAndPID(output, "/dev/tty.usbmodemfa121"));
48+
49+
output = getFileContent("system_profiler_output2.txt");
50+
assertEquals("0X2341_0X8036", extractVIDAndPID(output, "/dev/cu.usbmodemfd131"));
51+
assertEquals("0X2341_0X8036", extractVIDAndPID(output, "/dev/tty.usbmodemfd131"));
52+
53+
output = getFileContent("system_profiler_output3.txt");
54+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/cu.usbmodemfd121"));
55+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/tty.usbmodemfd121"));
56+
57+
output = getFileContent("system_profiler_output4.txt");
58+
assertEquals("0X2341_0X0041", extractVIDAndPID(output, "/dev/cu.usbmodem411"));
59+
assertEquals("0X2341_0X0041", extractVIDAndPID(output, "/dev/tty.usbmodem411"));
60+
61+
output = getFileContent("system_profiler_output5.txt");
62+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/cu.usbmodem621"));
63+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/tty.usbmodem621"));
64+
65+
output = getFileContent("system_profiler_output6.txt");
66+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/cu.usbmodem1421"));
67+
assertEquals("0X2341_0X8041", extractVIDAndPID(output, "/dev/tty.usbmodem1421"));
68+
69+
output = getFileContent("system_profiler_output7.txt");
70+
assertEquals("0X2341_0X8036", extractVIDAndPID(output, "/dev/cu.usbmodem24131"));
71+
assertEquals("0X2341_0X8036", extractVIDAndPID(output, "/dev/tty.usbmodem24131"));
72+
assertEquals("0X0403_0X6015", extractVIDAndPID(output, "/dev/cu.usbserial-DN0031EV"));
73+
assertEquals("0X0403_0X6015", extractVIDAndPID(output, "/dev/tty.usbserial-DN0031EV"));
74+
75+
output = getFileContent("system_profiler_output8.txt");
76+
assertEquals("0X03EB_0X2157", extractVIDAndPID(output, "/dev/tty.usbmodemfd132"));
77+
78+
// OSX El Capitan
79+
output = getFileContent("system_profiler_output9.txt");
80+
assertEquals("0X2341_0X8036", extractVIDAndPID(output, "/dev/tty.usbmodemFA121"));
81+
}
7982

80-
assertEquals("0X03EB_0X2157", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodemfd132"));
83+
private String getFileContent(String filename) throws IOException {
84+
InputStream resource = SystemProfilerParserTest.class.getResourceAsStream(filename);
85+
return TestHelper.inputStreamToString(resource);
8186
}
8287
}
+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
USB:
2+
3+
USB 2.0 Bus:
4+
5+
Host Controller Driver: AppleUSBEHCIPCI
6+
PCI Device ID: 0x1c2d
7+
PCI Revision ID: 0x0005
8+
PCI Vendor ID: 0x8086
9+
10+
Hub:
11+
12+
Product ID: 0x2513
13+
Vendor ID: 0x0424 (SMSC)
14+
Version: b.b3
15+
Speed: Up to 480 Mb/sec
16+
Location ID: 0xfa100000 / 1
17+
Current Available (mA): 1000
18+
Current Required (mA): 2
19+
Extra Operating Current (mA): 0
20+
Built-In: Yes
21+
22+
Arduino Leonardo:
23+
24+
Product ID: 0x8036
25+
Vendor ID: 0x2341
26+
Version: 1.00
27+
Speed: Up to 12 Mb/sec
28+
Manufacturer: Arduino LLC
29+
Location ID: 0xfa120000 / 3
30+
Current Available (mA): 1000
31+
Current Required (mA): 500
32+
Extra Operating Current (mA): 0
33+
34+
BRCM20702 Hub:
35+
36+
Product ID: 0x4500
37+
Vendor ID: 0x0a5c (Broadcom Corp.)
38+
Version: 1.00
39+
Speed: Up to 12 Mb/sec
40+
Manufacturer: Apple Inc.
41+
Location ID: 0xfa110000 / 4
42+
Current Available (mA): 1000
43+
Current Required (mA): 94
44+
Extra Operating Current (mA): 0
45+
Built-In: Yes
46+
47+
Bluetooth USB Host Controller:
48+
49+
Product ID: 0x8281
50+
Vendor ID: 0x05ac (Apple Inc.)
51+
Version: 1.51
52+
Speed: Up to 12 Mb/sec
53+
Manufacturer: Apple Inc.
54+
Location ID: 0xfa113000 / 2
55+
Current Available (mA): 1000
56+
Current Required (mA): 0
57+
Extra Operating Current (mA): 0
58+
Built-In: Yes
59+
60+
USB 2.0 Bus:
61+
62+
Host Controller Driver: AppleUSBEHCIPCI
63+
PCI Device ID: 0x1c26
64+
PCI Revision ID: 0x0005
65+
PCI Vendor ID: 0x8086
66+
67+
Hub:
68+
69+
Product ID: 0x2513
70+
Vendor ID: 0x0424 (SMSC)
71+
Version: b.b3
72+
Speed: Up to 480 Mb/sec
73+
Location ID: 0xfd100000 / 1
74+
Current Available (mA): 1000
75+
Current Required (mA): 2
76+
Extra Operating Current (mA): 0
77+
Built-In: Yes
78+
79+
USB Keyboard:
80+
81+
Product ID: 0x2000
82+
Vendor ID: 0x040b (Weltrend Semiconductor)
83+
Version: 2.05
84+
Speed: Up to 1.5 Mb/sec
85+
Manufacturer: Generic
86+
Location ID: 0xfd130000 / 4
87+
Current Available (mA): 1000
88+
Current Required (mA): 100
89+
Extra Operating Current (mA): 0
90+
91+
USB OPTICAL MOUSE:
92+
93+
Product ID: 0x2510
94+
Vendor ID: 0x093a (Pixart Imaging, Inc.)
95+
Version: 1.00
96+
Speed: Up to 1.5 Mb/sec
97+
Manufacturer: PIXART
98+
Location ID: 0xfd120000 / 3
99+
Current Available (mA): 1000
100+
Current Required (mA): 100
101+
Extra Operating Current (mA): 0
102+
103+
IR Receiver:
104+
105+
Product ID: 0x8242
106+
Vendor ID: 0x05ac (Apple Inc.)
107+
Version: 0.16
108+
Speed: Up to 1.5 Mb/sec
109+
Manufacturer: Apple Computer, Inc.
110+
Location ID: 0xfd110000 / 2
111+
Current Available (mA): 1000
112+
Current Required (mA): 100
113+
Extra Operating Current (mA): 0
114+
Built-In: Yes
115+
116+
117+

Diff for: app/test/processing/app/syntax/PdeKeywordsTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import org.fife.ui.rsyntaxtextarea.TokenTypes;
3333
import org.junit.Test;
3434
import processing.app.AbstractWithPreferencesTest;
35-
import processing.app.BaseNoGui;
36-
3735
import static org.junit.Assert.assertEquals;
3836
import static org.junit.Assert.assertNull;
3937

Diff for: arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ private PGPPublicKey readPublicKey(File file, String keyId) throws IOException,
9797
private PGPPublicKey readPublicKey(InputStream input, String keyId) throws IOException, PGPException {
9898
PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), new BcKeyFingerprintCalculator());
9999

100-
Iterator keyRingIter = pgpPub.getKeyRings();
100+
Iterator<PGPPublicKeyRing> keyRingIter = pgpPub.getKeyRings();
101101
while (keyRingIter.hasNext()) {
102-
PGPPublicKeyRing keyRing = (PGPPublicKeyRing) keyRingIter.next();
102+
PGPPublicKeyRing keyRing = keyRingIter.next();
103103

104-
Iterator keyIter = keyRing.getPublicKeys();
104+
Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
105105
while (keyIter.hasNext()) {
106-
PGPPublicKey key = (PGPPublicKey) keyIter.next();
106+
PGPPublicKey key = keyIter.next();
107107

108108
if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(keyId)) {
109109
return key;

Diff for: arduino-core/src/cc/arduino/contributions/SignatureVerificationFailedException.java

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import static processing.app.I18n.tr;
3535

36+
@SuppressWarnings("serial")
3637
public class SignatureVerificationFailedException extends Exception {
3738

3839
public SignatureVerificationFailedException(String filename) {

Diff for: arduino-core/src/cc/arduino/utils/ArchiveExtractor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
164164
while (stripPath > 0) {
165165
slash = name.indexOf("/", slash);
166166
if (slash == -1) {
167-
throw new IOException("Invalid archive: it must contains a single root folder");
167+
throw new IOException("Invalid archive: it must contain a single root folder");
168168
}
169169
slash++;
170170
stripPath--;
@@ -174,7 +174,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
174174

175175
// Strip the common path prefix when requested
176176
if (!name.startsWith(pathPrefix)) {
177-
throw new IOException("Invalid archive: it must contains a single root folder while file " + name + " is outside " + pathPrefix);
177+
throw new IOException("Invalid archive: it must contain a single root folder while file " + name + " is outside " + pathPrefix);
178178
}
179179
name = name.substring(pathPrefix.length());
180180
if (name.isEmpty()) {
@@ -185,7 +185,7 @@ public void extract(File archiveFile, File destFolder, int stripPath, boolean ov
185185
File outputLinkedFile = null;
186186
if (isLink) {
187187
if (!linkName.startsWith(pathPrefix)) {
188-
throw new IOException("Invalid archive: it must contains a single root folder while file " + linkName + " is outside " + pathPrefix);
188+
throw new IOException("Invalid archive: it must contain a single root folder while file " + linkName + " is outside " + pathPrefix);
189189
}
190190
linkName = linkName.substring(pathPrefix.length());
191191
outputLinkedFile = new File(destFolder, linkName);

0 commit comments

Comments
 (0)