diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java index b5118fa1e..224db27c2 100644 --- a/arduino-core/src/cc/arduino/Compiler.java +++ b/arduino-core/src/cc/arduino/Compiler.java @@ -555,18 +555,18 @@ public class Compiler implements MessageConsumer { //msg = _("\nThe 'Keyboard' class is only supported on the Arduino Leonardo.\n\n"); } - RunnerException exception = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1); + RunnerException ex = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1); - if (exception != null) { - String fileName = exception.getCodeFile().getPrettyName(); - int lineNum = exception.getCodeLine() + 1; + if (ex != null) { + String fileName = ex.getCodeFile().getPrettyName(); + int lineNum = ex.getCodeLine() + 1; s = fileName + ":" + lineNum + ": error: " + error + msg; } - if (exception != null) { - if (this.exception == null || this.exception.getMessage().equals(exception.getMessage())) { - this.exception = exception; - this.exception.hideStackTrace(); + if (ex != null) { + if (exception == null || exception.getMessage().equals(ex.getMessage())) { + exception = ex; + exception.hideStackTrace(); } } } diff --git a/arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java b/arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java index 7508bad1f..ead276f47 100644 --- a/arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java +++ b/arduino-core/src/cc/arduino/contributions/GPGDetachedSignatureVerifier.java @@ -85,17 +85,17 @@ public class GPGDetachedSignatureVerifier extends SignatureVerifier { } } - private PGPPublicKey readPublicKey(File file, String keyId) throws IOException, PGPException { + private PGPPublicKey readPublicKey(File file, String id) throws IOException, PGPException { InputStream keyIn = null; try { keyIn = new BufferedInputStream(new FileInputStream(file)); - return readPublicKey(keyIn, keyId); + return readPublicKey(keyIn, id); } finally { IOUtils.closeQuietly(keyIn); } } - private PGPPublicKey readPublicKey(InputStream input, String keyId) throws IOException, PGPException { + private PGPPublicKey readPublicKey(InputStream input, String id) throws IOException, PGPException { PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), new BcKeyFingerprintCalculator()); Iterator keyRingIter = pgpPub.getKeyRings(); @@ -106,7 +106,7 @@ public class GPGDetachedSignatureVerifier extends SignatureVerifier { while (keyIter.hasNext()) { PGPPublicKey key = keyIter.next(); - if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(keyId)) { + if (Long.toHexString(key.getKeyID()).toUpperCase().endsWith(id)) { return key; } } diff --git a/arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java b/arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java index 3be2c6297..a09eb2a46 100644 --- a/arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java @@ -81,10 +81,10 @@ public class LibrariesIndexer { // TODO: resolve libraries inner references } - private void parseIndex(File indexFile) throws IOException { + private void parseIndex(File file) throws IOException { InputStream indexIn = null; try { - indexIn = new FileInputStream(indexFile); + indexIn = new FileInputStream(file); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new MrBeanModule()); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java b/arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java index a53ad28a4..48b07e1d8 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributedPlatform.java @@ -110,15 +110,15 @@ public abstract class ContributedPlatform extends DownloadableContribution { ContributedPlatform obj1 = (ContributedPlatform) obj; - ContributedPackage parentPackage = getParentPackage(); - ContributedPackage parentPackage1 = obj1.getParentPackage(); - if (parentPackage == null) { - if (parentPackage1 != null) + ContributedPackage parent = getParentPackage(); + ContributedPackage parent1 = obj1.getParentPackage(); + if (parent == null) { + if (parent1 != null) return false; } else { - if (parentPackage1 == null) + if (parent1 == null) return false; - if (!parentPackage.getName().equals(parentPackage1.getName())) + if (!parent.getName().equals(parent1.getName())) return false; } if (!getArchitecture().equals(obj1.getArchitecture())) { diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java index bfb8fad74..6cbfd2fd3 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java @@ -124,12 +124,12 @@ public class ContributionsIndexer { tool.setPackage(pack); } - for (ContributedPlatform platform : pack.getPlatforms()) { + for (ContributedPlatform plat : pack.getPlatforms()) { // Set a reference to parent packages - platform.setParentPackage(pack); + plat.setParentPackage(pack); // Resolve tools dependencies (works also as a check for file integrity) - platform.resolveToolsDependencies(packagesWithTools); + plat.resolveToolsDependencies(packagesWithTools); } } @@ -166,9 +166,9 @@ public class ContributionsIndexer { platforms = new LinkedList<>(); } for (ContributedPlatform contributedPlatform : platforms) { - ContributedPlatform platform = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion()); - if (platform != null) { - targetPackage.getPlatforms().remove(platform); + ContributedPlatform plat = targetPackage.findPlatform(contributedPlatform.getArchitecture(), contributedPlatform.getVersion()); + if (plat != null) { + targetPackage.getPlatforms().remove(plat); } targetPackage.getPlatforms().add(contributedPlatform); } @@ -253,9 +253,9 @@ public class ContributionsIndexer { for (File platformFolder : hardwareFolder.listFiles(ONLY_DIRS)) { File platformTxt = new File(platformFolder, "platform.txt"); String version = new PreferencesMap(platformTxt).get("version"); - ContributedPlatform platform = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version); - if (platform != null) { - platform.setReadOnly(true); + ContributedPlatform p = syncHardwareWithFilesystem(pack, platformFolder, platformFolder.getName(), version); + if (p != null) { + p.setReadOnly(true); } } } @@ -321,13 +321,13 @@ public class ContributionsIndexer { } private ContributedPlatform syncHardwareWithFilesystem(ContributedPackage pack, File installationFolder, String architecture, String version) { - ContributedPlatform platform = pack.findPlatform(architecture, version); - if (platform != null) { - platform.setInstalled(true); - platform.setReadOnly(false); - platform.setInstalledFolder(installationFolder); + ContributedPlatform p = pack.findPlatform(architecture, version); + if (p != null) { + p.setInstalled(true); + p.setReadOnly(false); + p.setInstalledFolder(installationFolder); } - return platform; + return p; } @Override @@ -348,9 +348,9 @@ public class ContributionsIndexer { List platforms = aPackage.getPlatforms().stream().filter(new InstalledPredicate()).collect(Collectors.toList()); Collections.sort(platforms, new DownloadableContributionBuiltInAtTheBottomComparator()); - for (ContributedPlatform platform : platforms) { - String arch = platform.getArchitecture(); - File folder = platform.getInstalledFolder(); + for (ContributedPlatform p : platforms) { + String arch = p.getArchitecture(); + File folder = p.getInstalledFolder(); try { TargetPlatform targetPlatform = new ContributedTargetPlatform(arch, folder, targetPackage); @@ -377,14 +377,14 @@ public class ContributionsIndexer { public boolean isContributedToolUsed(ContributedPlatform platformToIgnore, ContributedTool tool) { for (ContributedPackage pack : index.getPackages()) { - for (ContributedPlatform platform : pack.getPlatforms()) { - if (platformToIgnore.equals(platform)) { + for (ContributedPlatform p : pack.getPlatforms()) { + if (platformToIgnore.equals(p)) { continue; } - if (!platform.isInstalled() || platform.isReadOnly()) { + if (!p.isInstalled() || p.isReadOnly()) { continue; } - for (ContributedTool requiredTool : platform.getResolvedTools()) { + for (ContributedTool requiredTool : p.getResolvedTools()) { if (requiredTool.equals(tool)) return true; } @@ -406,8 +406,8 @@ public class ContributionsIndexer { if (platformsWithName.size() > 1) { platformsWithName = platformsWithName.stream().filter(new BuiltInPredicate().negate()).collect(Collectors.toList()); } - for (ContributedPlatform platform : platformsWithName) { - tools.addAll(platform.getResolvedTools()); + for (ContributedPlatform p : platformsWithName) { + tools.addAll(p.getResolvedTools()); } }); } diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index d95681595..fd372596c 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -156,9 +156,9 @@ public class BaseNoGui { List requiredTools = new ArrayList<>(); // Add all tools dependencies specified in package index - ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform()); - if (platform != null) - requiredTools.addAll(platform.getResolvedTools()); + ContributedPlatform p = indexer.getContributedPlaform(getTargetPlatform()); + if (p != null) + requiredTools.addAll(p.getResolvedTools()); // Add all tools dependencies from the (possibily) referenced core String core = prefs.get("build.core"); @@ -586,8 +586,8 @@ public class BaseNoGui { } String arch = subFolder.getName(); try { - TargetPlatform platform = new LegacyTargetPlatform(arch, subFolder, targetPackage); - targetPackage.getPlatforms().put(arch, platform); + TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage); + targetPackage.getPlatforms().put(arch, p); } catch (TargetPlatformException e) { System.err.println(e.getMessage()); } @@ -668,8 +668,8 @@ public class BaseNoGui { populateImportToLibraryTable(); } - static protected void loadContributedHardware(ContributionsIndexer indexer) { - for (TargetPackage pack : indexer.createTargetPackages()) { + static protected void loadContributedHardware(ContributionsIndexer idx) { + for (TargetPackage pack : idx.createTargetPackages()) { packages.put(pack.getId(), pack); } } diff --git a/arduino-core/src/processing/app/debug/LegacyTargetPlatform.java b/arduino-core/src/processing/app/debug/LegacyTargetPlatform.java index 65e4d4fdc..c00378c48 100644 --- a/arduino-core/src/processing/app/debug/LegacyTargetPlatform.java +++ b/arduino-core/src/processing/app/debug/LegacyTargetPlatform.java @@ -96,8 +96,8 @@ public class LegacyTargetPlatform implements TargetPlatform { // Create boards Set boardIds = boardsPreferences.keySet(); for (String boardId : boardIds) { - PreferencesMap preferences = boardsPreferences.get(boardId); - TargetBoard board = new LegacyTargetBoard(boardId, preferences, this); + PreferencesMap prefs = boardsPreferences.get(boardId); + TargetBoard board = new LegacyTargetBoard(boardId, prefs, this); boards.put(boardId, board); // Pick the first board as default