Match #1: /Test.java: line 43-52 /java/8482313-8482425-1: line 3-12 //PHP Array Output for Parsing in Java. A snippet of how to decode JSON (taken from the wiki page). < String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]"; < Object obj=JSONValue.parse(s); < JSONArray array=(JSONArray)obj; < System.out.println("======the 2nd element of array======"); < System.out.println(array.get(1)); < System.out.println(); < < JSONObject obj2=(JSONObject)array.get(1); < System.out.println("======field \"1\"=========="); < System.out.println(obj2.get("1")); --- >String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]"; >Object obj=JSONValue.parse(s); >JSONArray array=(JSONArray)obj; >System.out.println("======the 2nd element of array======"); >System.out.println(array.get(1)); >System.out.println(); > >JSONObject obj2=(JSONObject)array.get(1); >System.out.println("======field \"1\"=========="); >System.out.println(obj2.get("1")); Match #2: /PeerForeignDelegate.java: line 927-934 /java/5574204-5574272-1: line 4-8 //Add a parameter to the end of an array. Here's another way to write that code using System.arraycopy. < int[] updated = new int[existing.length+1]; < < System.arraycopy( existing, 0, updated, 0, existing.length ); < < updated[existing.length] = piece_number; < < reserved_pieces = updated; < } --- > int[] anotherArray = new int[values.length + 1]; > System.arraycopy(values, 0, anotherArray, 0, values.length); > anotherArray[values.length] = number; > values = anotherArray; >} Match #3: /PEPeerTransportProtocol.java: line 4655-4662 /java/5574204-5574272-1: line 4-8 //Add a parameter to the end of an array. Here's another way to write that code using System.arraycopy. < int[] updated = new int[existing.length+1]; < < System.arraycopy( existing, 0, updated, 0, existing.length ); < < updated[existing.length] = piece_number; < < reserved_pieces = updated; < } --- > int[] anotherArray = new int[values.length + 1]; > System.arraycopy(values, 0, anotherArray, 0, values.length); > anotherArray[values.length] = number; > values = anotherArray; >} Match #4: /TrackerPeerAuthPlugin.java: line 137-143 /java/11332280-11332351-1: line 4-7 //Receive a stack trace. Use this method to capture the stacktrace in a String. < StringWriter sw = new StringWriter(); < < PrintWriter pw = new PrintWriter( sw ); < < error.printStackTrace( pw ); < < pw.flush(); --- > StringWriter sw = new StringWriter(); > PrintWriter pw = new PrintWriter(sw); > t.printStackTrace(pw); > pw.flush(); Match #5: /LocalTrackerPlugin.java: line 173-179 /java/11332280-11332351-1: line 4-7 //Receive a stack trace. Use this method to capture the stacktrace in a String. < StringWriter sw = new StringWriter(); < < PrintWriter pw = new PrintWriter( sw ); < < error.printStackTrace( pw ); < < pw.flush(); --- > StringWriter sw = new StringWriter(); > PrintWriter pw = new PrintWriter(sw); > t.printStackTrace(pw); > pw.flush(); Match #6: /ExternalSeedPlugin.java: line 117-123 /java/11332280-11332351-1: line 4-7 //Receive a stack trace. Use this method to capture the stacktrace in a String. < StringWriter sw = new StringWriter(); < < PrintWriter pw = new PrintWriter( sw ); < < error.printStackTrace( pw ); < < pw.flush(); --- > StringWriter sw = new StringWriter(); > PrintWriter pw = new PrintWriter(sw); > t.printStackTrace(pw); > pw.flush(); Match #7: /PluginLauncherImpl.java: line 82-88 /java/11332280-11332351-1: line 4-7 //Receive a stack trace. Use this method to capture the stacktrace in a String. < StringWriter sw = new StringWriter(); < < PrintWriter pw = new PrintWriter( sw ); < < error.printStackTrace( pw ); < < pw.flush(); --- > StringWriter sw = new StringWriter(); > PrintWriter pw = new PrintWriter(sw); > t.printStackTrace(pw); > pw.flush(); Match #8: /CustomizationManagerImpl.java: line 321-324 /java/9300597-9300691-3: line 3-5 //Want both the key and value, use entrySet. < for ( Map.Entry entry: config.entrySet()){ < < String key = entry.getKey(); < Object value = entry.getValue(); --- >for (Map.Entry entry : map.entrySet()) { > String key = entry.getKey(); > Object value = entry.getValue(); Match #9: /Wizard.java: line 303-307 /java/10762415-10762559-2: line 3-6 //Dispose all children of Composite object. < Control[] controls = panel.getChildren(); < for (int i = 0; i < controls.length; i++) { < if (controls[i] != null && !controls[i].isDisposed()) < controls[i].dispose(); < } --- >Control[] children = descComp.getChildren(); > for (int i = 0 ; i < children.length; i++) { > children[i].dispose(); > } Match #10: /MyTorrentsView.java: line 537-540 /java/10762415-10762559-2: line 3-6 //Dispose all children of Composite object. < Control[] controls = cCategories.getChildren(); < for (int i = 0; i < controls.length; i++) { < controls[i].dispose(); < } --- >Control[] children = descComp.getChildren(); > for (int i = 0 ; i < children.length; i++) { > children[i].dispose(); > } Match #11: /TransferStatsView.java: line 567-570 /java/10762415-10762559-2: line 3-6 //Dispose all children of Composite object. < Control[] labels = route_comp.getChildren(); < for (int i = 0; i < labels.length; i++){ < labels[i].dispose(); < } --- >Control[] children = descComp.getChildren(); > for (int i = 0 ; i < children.length; i++) { > children[i].dispose(); > } Match #12: /Colors.java: line 104-106 /java/2615522-2615530-1: line 4-6 //Java's Color class can do the conversion. < int tR = colorTables.getRed(); < int tG = colorTables.getGreen(); < int tB = colorTables.getBlue(); --- >int red = c.getRed(); >int green = c.getGreen(); >int blue = c.getBlue();