| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2309,24 +2309,34 @@ static public byte[] loadBytesRaw(File file) throws IOException { | |||
| 2309 | 2309 | /** | |
| 2310 | 2310 | * Read from a file with a bunch of attribute/value pairs | |
| 2311 | 2311 | * that are separated by = and ignore comments with #. | |
| 2312 | + * Changed in 3.0a6 to return null (rather than empty hash) if no file, | ||
| 2313 | + * and changed return type to Map instead of HashMap. | ||
| 2312 | 2314 | */ | |
| 2313 | - static public HashMap<String,String> readSettings(File inputFile) { | ||
| 2314 | - HashMap<String,String> outgoing = new HashMap<String,String>(); | ||
| 2315 | - if (inputFile.exists()) { | ||
| 2316 | - String lines[] = PApplet.loadStrings(inputFile); | ||
| 2317 | - readSettings(inputFile.toString(), lines, outgoing); | ||
| 2315 | + static public Map<String, String> readSettings(File inputFile) { | ||
| 2316 | + if (!inputFile.exists()) { | ||
| 2317 | + System.err.println(inputFile + " does not exist."); | ||
| 2318 | + return null; | ||
| 2318 | 2319 | } | |
| 2319 | - return outgoing; | ||
| 2320 | + String lines[] = PApplet.loadStrings(inputFile); | ||
| 2321 | + if (lines == null) { | ||
| 2322 | + System.err.println("Could not read " + inputFile); | ||
| 2323 | + return null; | ||
| 2324 | + } | ||
| 2325 | + return readSettings(inputFile.toString(), lines); | ||
| 2320 | 2326 | } | |
| 2321 | 2327 | ||
| 2322 | 2328 | ||
| 2323 | 2329 | /** | |
| 2324 | 2330 | * Parse a String array that contains attribute/value pairs separated | |
| 2325 | 2331 | * by = (the equals sign). The # (hash) symbol is used to denote comments. | |
| 2326 | 2332 | * Comments can be anywhere on a line. Blank lines are ignored. | |
| 2333 | + * In 3.0a6, no longer taking a blank HahMap as param; no cases in the main | ||
| 2334 | + * PDE code of adding to a (Hash)Map. Also returning the Map instead of void. | ||
| 2335 | + * Both changes modify the method signature, but this was only used by the | ||
| 2336 | + * contrib classes. | ||
| 2327 | 2337 | */ | |
| 2328 | - static public void readSettings(String filename, String[] lines, | ||
| 2329 | - HashMap<String, String> settings) { | ||
| 2338 | + static public Map<String, String> readSettings(String filename, String[] lines) { | ||
| 2339 | + Map<String, String> settings = new HashMap<>(); | ||
| 2330 | 2340 | for (String line : lines) { | |
| 2331 | 2341 | // Remove comments | |
| 2332 | 2342 | int commentMarker = line.indexOf('#'); | |
@@ -2350,6 +2360,7 @@ static public void readSettings(String filename, String[] lines, | |||
| 2350 | 2360 | } | |
| 2351 | 2361 | } | |
| 2352 | 2362 | } | |
| 2363 | + return settings; | ||
| 2353 | 2364 | } | |
| 2354 | 2365 | ||
| 2355 | 2366 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,7 +113,7 @@ private Library(File folder, String groupName) { | |||
| 113 | 113 | referenceFile = new File(folder, "reference/index.html"); | |
| 114 | 114 | ||
| 115 | 115 | File exportSettings = new File(libraryFolder, "export.txt"); | |
| 116 | - HashMap<String,String> exportTable = Base.readSettings(exportSettings); | ||
| 116 | + Map<String,String> exportTable = Base.readSettings(exportSettings); | ||
| 117 | 117 | ||
| 118 | 118 | exportList = new HashMap<String, String[]>(); | |
| 119 | 119 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,8 +22,8 @@ | |||
| 22 | 22 | package processing.app.contrib; | |
| 23 | 23 | ||
| 24 | 24 | import java.io.*; | |
| 25 | - import java.util.HashMap; | ||
| 26 | 25 | import java.util.List; | |
| 26 | + import java.util.Map; | ||
| 27 | 27 | ||
| 28 | 28 | import processing.app.Base; | |
| 29 | 29 | import processing.app.Language; | |
@@ -38,7 +38,7 @@ class AvailableContribution extends Contribution { | |||
| 38 | 38 | protected final String link; // Direct link to download the file | |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | - public AvailableContribution(ContributionType type, HashMap<String, String> params) { | ||
| 41 | + public AvailableContribution(ContributionType type, Map<String, String> params) { | ||
| 42 | 42 | this.type = type; | |
| 43 | 43 | this.link = params.get("download"); | |
| 44 | 44 | ||
@@ -231,7 +231,7 @@ public ContributionType getType() { | |||
| 231 | 231 | */ | |
| 232 | 232 | public boolean writePropertiesFile(File propFile) { | |
| 233 | 233 | try { | |
| 234 | - HashMap<String, String> properties = Base.readSettings(propFile); | ||
| 234 | + Map<String, String> properties = Base.readSettings(propFile); | ||
| 235 | 235 | ||
| 236 | 236 | String name = properties.get("name"); | |
| 237 | 237 | if (name == null || name.isEmpty()) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -218,7 +218,7 @@ protected Set<String> getCategories(ContributionFilter filter) { | |||
| 218 | 218 | ||
| 219 | 219 | ||
| 220 | 220 | protected List<Contribution> getFilteredLibraryList(String category, List<String> filters) { | |
| 221 | - ArrayList<Contribution> filteredList = | ||
| 221 | + ArrayList<Contribution> filteredList = | ||
| 222 | 222 | new ArrayList<Contribution>(allContributions); | |
| 223 | 223 | ||
| 224 | 224 | Iterator<Contribution> it = filteredList.iterator(); | |
@@ -310,9 +310,9 @@ private boolean hasProperty(Contribution contrib, String property) { | |||
| 310 | 310 | ||
| 311 | 311 | ||
| 312 | 312 | protected List<Contribution> getCompatibleContributionList(List<Contribution> filteredLibraries, boolean filter) { | |
| 313 | - ArrayList<Contribution> filteredList = | ||
| 313 | + ArrayList<Contribution> filteredList = | ||
| 314 | 314 | new ArrayList<Contribution>(filteredLibraries); | |
| 315 | - | ||
| 315 | + | ||
| 316 | 316 | if (!filter) | |
| 317 | 317 | return filteredList; | |
| 318 | 318 | ||
@@ -417,7 +417,7 @@ boolean hasUpdates() { | |||
| 417 | 417 | } | |
| 418 | 418 | return false; | |
| 419 | 419 | } | |
| 420 | - | ||
| 420 | + | ||
| 421 | 421 | boolean hasUpdates(Base base) { | |
| 422 | 422 | for (ModeContribution m : base.getModeContribs()) | |
| 423 | 423 | if (hasUpdates(m)) | |
@@ -459,7 +459,7 @@ else if (latestVersion.toLowerCase().startsWith("v")) // For ketai library | |||
| 459 | 459 | else | |
| 460 | 460 | return null; | |
| 461 | 461 | } | |
| 462 | - | ||
| 462 | + | ||
| 463 | 463 | ||
| 464 | 464 | ||
| 465 | 465 | boolean hasDownloadedLatestList() { | |
@@ -479,7 +479,7 @@ boolean hasListDownloadFailed() { | |||
| 479 | 479 | // return s.toLowerCase().replaceAll("^\\p{Lower}", ""); | |
| 480 | 480 | // } | |
| 481 | 481 | ||
| 482 | - | ||
| 482 | + | ||
| 483 | 483 | // /** | |
| 484 | 484 | // * @return the proper, valid name of this category to be displayed in the UI | |
| 485 | 485 | // * (e.g. "Typography / Geometry"). "Unknown" if the category null. | |
@@ -508,40 +508,31 @@ ArrayList<AvailableContribution> parseContribList(File file) { | |||
| 508 | 508 | ||
| 509 | 509 | int start = 0; | |
| 510 | 510 | while (start < lines.length) { | |
| 511 | - // // Only consider 'invalid' lines. These lines contain the type of | ||
| 512 | - // // software: library, tool, mode | ||
| 513 | - // if (!lines[start].contains("=")) { | ||
| 514 | 511 | String type = lines[start]; | |
| 515 | 512 | ContributionType contribType = ContributionType.fromName(type); | |
| 516 | 513 | if (contribType == null) { | |
| 517 | 514 | System.err.println("Error in contribution listing file on line " + (start+1)); | |
| 518 | 515 | // Scan forward for the next blank line | |
| 519 | 516 | int end = ++start; | |
| 520 | - while (end < lines.length && !lines[end].equals("")) { | ||
| 517 | + while (end < lines.length && lines[end].trim().length() != 0) { | ||
| 521 | 518 | end++; | |
| 522 | 519 | } | |
| 523 | 520 | start = end + 1; | |
| 524 | - continue; | ||
| 525 | - } | ||
| 526 | 521 | ||
| 527 | - // Scan forward for the next blank line | ||
| 528 | - int end = ++start; | ||
| 529 | - while (end < lines.length && !lines[end].equals("")) { | ||
| 530 | - end++; | ||
| 531 | - } | ||
| 522 | + } else { | ||
| 523 | + // Scan forward for the next blank line | ||
| 524 | + int end = ++start; | ||
| 525 | + while (end < lines.length && lines[end].trim().length() != 0) { | ||
| 526 | + end++; | ||
| 527 | + } | ||
| 532 | 528 | ||
| 533 | - int length = end - start; | ||
| 534 | - String[] contribLines = new String[length]; | ||
| 535 | - System.arraycopy(lines, start, contribLines, 0, length); | ||
| 529 | + String[] contribLines = PApplet.subset(lines, start, end-start); | ||
| 536 | 530 | ||
| 537 | - HashMap<String,String> contribParams = new HashMap<String,String>(); | ||
| 538 | - Base.readSettings(file.getName(), contribLines, contribParams); | ||
| 531 | + Map<String, String> contribParams = Base.readSettings(file.getName(), contribLines); | ||
| 539 | 532 | ||
| 540 | - outgoing.add(new AvailableContribution(contribType, contribParams)); | ||
| 541 | - start = end + 1; | ||
| 542 | - // } else { | ||
| 543 | - // start++; | ||
| 544 | - // } | ||
| 533 | + outgoing.add(new AvailableContribution(contribType, contribParams)); | ||
| 534 | + start = end + 1; | ||
| 535 | + } | ||
| 545 | 536 | } | |
| 546 | 537 | } | |
| 547 | 538 | return outgoing; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -497,8 +497,8 @@ else if (type.equalsIgnoreCase("libraries")) //putting this here, just in case | |||
| 497 | 497 | propFileName = "libraries.properties"; | |
| 498 | 498 | ||
| 499 | 499 | for (File folder : markedForUpdate) { | |
| 500 | - HashMap<String, String> properties = Base | ||
| 501 | - .readSettings(new File(folder, propFileName)); | ||
| 500 | + Map<String, String> properties = | ||
| 501 | + Base.readSettings(new File(folder, propFileName)); | ||
| 502 | 502 | updateContribsNames.add(properties.get("name")); | |
| 503 | 503 | Base.removeDir(folder); | |
| 504 | 504 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -46,7 +46,7 @@ public abstract class LocalContribution extends Contribution { | |||
| 46 | 46 | protected String id; // 1 (unique id for this library) | |
| 47 | 47 | protected int latestVersion; // 103 | |
| 48 | 48 | protected File folder; | |
| 49 | - protected HashMap<String, String> properties; | ||
| 49 | + protected Map<String, String> properties; | ||
| 50 | 50 | protected ClassLoader loader; | |
| 51 | 51 | protected List<String> specifiedImports; // mylib,mylib.util; | |
| 52 | 52 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ _ static mode (no setup() / draw()) broken | |||
| 21 | 21 | _ https://github.com/processing/processing/issues/3130 | |
| 22 | 22 | _ Sketch window dimensions off in Java2D | |
| 23 | 23 | _ https://github.com/processing/processing/issues/3129 | |
| 24 | + _ fix? https://github.com/processing/processing/pull/3162 | ||
| 24 | 25 | ||
| 25 | 26 | earlier | |
| 26 | 27 | X size(640,360 , P3D) doesn't work properly | |
@@ -209,7 +210,17 @@ _ https://github.com/processing/processing/issues/2030 | |||
| 209 | 210 | _ NPE when using image() created with createGraphics(PGraphicsRetina2D) | |
| 210 | 211 | _ https://github.com/processing/processing/issues/2510 | |
| 211 | 212 | ||
| 213 | + | ||
| 212 | 214 | decisions/misc | |
| 215 | + _ async requests | ||
| 216 | + _ Request r = createRequest("http://p5.org/feed/13134.jpg"); | ||
| 217 | + _ Request r = createRequest("http://p5.org/feed/13134.jpg", "callbackName"); | ||
| 218 | + _ Request r = createRequest("http://p5.org/feed/13134, "callbackName", "jpg"); | ||
| 219 | + _ implement callbacks for images and other loadXxxx() functions | ||
| 220 | + _ remove requestImage() and friends | ||
| 221 | + _ callback for requestImage() | ||
| 222 | + _ https://github.com/processing/processing/issues/680 | ||
| 223 | + _ remove/update requestImage example | ||
| 213 | 224 | _ use enums for constants | |
| 214 | 225 | _ https://github.com/processing/processing/issues/2778 | |
| 215 | 226 | _ make join() work with Iterable? | |
@@ -312,6 +323,7 @@ _ add Double and Long versions of the classes? | |||
| 312 | 323 | ||
| 313 | 324 | ||
| 314 | 325 | ||
| 326 | + | ||
| 315 | 327 | //////////////////////////////////////////////////////////////////// | |
| 316 | 328 | //////////////////////////////////////////////////////////////////// | |
| 317 | 329 | //////////////////////////////////////////////////////////////////// | |
@@ -864,12 +876,3 @@ _ put a Hash<Something> class in there | |||
| 864 | 876 | _ will this work to sort by the values? | |
| 865 | 877 | _ there was another concern as well.. | |
| 866 | 878 | _ save() should probably come out of image, ja? | |
| 867 | - _ async requests | ||
| 868 | - _ Request r = createRequest("http://p5.org/feed/13134.jpg"); | ||
| 869 | - _ Request r = createRequest("http://p5.org/feed/13134.jpg", "callbackName"); | ||
| 870 | - _ Request r = createRequest("http://p5.org/feed/13134, "callbackName", "jpg"); | ||
| 871 | - _ implement callbacks for images and other loadXxxx() functions | ||
| 872 | - _ remove requestImage() and friends | ||
| 873 | - _ callback for requestImage() | ||
| 874 | - _ http://code.google.com/p/processing/issues/detail?id=641 | ||
| 875 | - _ remove/update requestImage example | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,6 +54,8 @@ X https://github.com/processing/processing/pull/3061 | |||
| 54 | 54 | X contributions.txt now gets deleted and recreated instead of overwritten | |
| 55 | 55 | X https://github.com/processing/processing/pull/3073 | |
| 56 | 56 | X https://github.com/processing/processing/issues/2994 | |
| 57 | + X Contrib Manager does not stop parsing contribs.txt if an error exists | ||
| 58 | + X https://github.com/processing/processing/pull/3132 | ||
| 57 | 59 | ||
| 58 | 60 | manindra | |
| 59 | 61 | X Fix for "Probably a ++ should go here" messages | |
| Back | FazBrowse Home | New Git URL |
0 commit comments