Changeset 10733 in josm
- Timestamp:
- 2016-08-04T23:55:20+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r10634 r10733 1400 1400 final String lang = LanguageInfo.getLanguageCodeXML(); 1401 1401 cachedFile = new CachedFile(url); 1402 try ( finalBufferedReader reader = cachedFile.getContentReader()) {1402 try (BufferedReader reader = cachedFile.getContentReader()) { 1403 1403 1404 1404 String line; -
trunk/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java
r10644 r10733 39 39 private OverpassTurboQueryWizard() { 40 40 41 try ( finalCachedFile file = new CachedFile("resource://data/overpass-wizard.js");42 finalReader reader = file.getContentReader()) {41 try (CachedFile file = new CachedFile("resource://data/overpass-wizard.js"); 42 Reader reader = file.getContentReader()) { 43 43 engine.eval("var console = {error: " + Main.class.getCanonicalName() + ".warn};"); 44 44 engine.eval("var global = {};"); -
trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
r10641 r10733 73 73 assertThat(response.getHeaderFields().get("Content-Type"), is(Collections.singletonList("application/json"))); 74 74 assertThat(response.getHeaderFields().get("Content-TYPE"), is(Collections.singletonList("application/json"))); 75 try ( finalInputStream in = response.getContent();76 finalJsonReader json = JsonProvider.provider().createReader(in)) {75 try (InputStream in = response.getContent(); 76 JsonReader json = JsonProvider.provider().createReader(in)) { 77 77 final JsonObject root = json.readObject(); 78 78 assertThat(root.getJsonObject("args").getString("foo"), is("bar")); … … 83 83 @Test 84 84 public void testUserAgent() throws IOException { 85 try ( finalInputStream in = HttpClient.create(new URL("https://httpbin.org/user-agent")).connect(progress).getContent();86 finalJsonReader json = JsonProvider.provider().createReader(in)) {85 try (InputStream in = HttpClient.create(new URL("https://httpbin.org/user-agent")).connect(progress).getContent(); 86 JsonReader json = JsonProvider.provider().createReader(in)) { 87 87 assertThat(json.readObject().getString("user-agent"), is(Version.getInstance().getFullAgentString())); 88 88 } … … 107 107 .connect(progress); 108 108 assertThat(response.getResponseCode(), is(200)); 109 try ( finalInputStream in = response.getContent();110 finalJsonReader json = JsonProvider.provider().createReader(in)) {109 try (InputStream in = response.getContent(); 110 JsonReader json = JsonProvider.provider().createReader(in)) { 111 111 assertThat(json.readObject().getString("data"), is(text)); 112 112 } … … 121 121 .connect(progress); 122 122 assertThat(response.getResponseCode(), is(200)); 123 try ( finalInputStream in = response.getContent();124 finalJsonReader json = JsonProvider.provider().createReader(in)) {123 try (InputStream in = response.getContent(); 124 JsonReader json = JsonProvider.provider().createReader(in)) { 125 125 assertThat(json.readObject().getString("data"), is("")); 126 126 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeDataTest.java
r9994 r10733 20 20 data.setChangesetId(314159); 21 21 final Object readData; 22 try ( finalByteArrayOutputStream bytes = new ByteArrayOutputStream();23 finalObjectOutputStream out = new ObjectOutputStream(bytes)) {22 try (ByteArrayOutputStream bytes = new ByteArrayOutputStream(); 23 ObjectOutputStream out = new ObjectOutputStream(bytes)) { 24 24 out.writeObject(data); 25 try ( finalObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) {25 try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) { 26 26 readData = in.readObject(); 27 27 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java
r9994 r10733 20 20 data.setChangesetId(314159); 21 21 final Object readData; 22 try ( finalByteArrayOutputStream bytes = new ByteArrayOutputStream();23 finalObjectOutputStream out = new ObjectOutputStream(bytes)) {22 try (ByteArrayOutputStream bytes = new ByteArrayOutputStream(); 23 ObjectOutputStream out = new ObjectOutputStream(bytes)) { 24 24 out.writeObject(data); 25 try ( finalObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) {25 try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) { 26 26 readData = in.readObject(); 27 27 } -
trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
r9958 r10733 32 32 public static GpxData parseGpxData(String filename) throws IOException, SAXException { 33 33 final GpxData result; 34 try ( finalFileInputStream in = new FileInputStream(new File(filename))) {35 finalGpxReader reader = new GpxReader(in);34 try (FileInputStream in = new FileInputStream(new File(filename))) { 35 GpxReader reader = new GpxReader(in); 36 36 assertTrue(reader.parse(false)); 37 37 result = reader.getGpxData();
Note:
See TracChangeset
for help on using the changeset viewer.