Changeset 10618 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-07-23T23:54:27+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r10615 r10618 8 8 import java.net.MalformedURLException; 9 9 import java.net.URL; 10 import java.nio.ByteBuffer;11 import java.nio.CharBuffer;12 import java.nio.charset.CharacterCodingException;13 10 import java.nio.charset.StandardCharsets; 11 import java.util.Base64; 14 12 import java.util.Objects; 15 13 import java.util.concurrent.FutureTask; … … 24 22 import org.openstreetmap.josm.io.auth.CredentialsAgentResponse; 25 23 import org.openstreetmap.josm.io.auth.CredentialsManager; 26 import org.openstreetmap.josm.tools.Base64;27 24 import org.openstreetmap.josm.tools.HttpClient; 28 25 import org.openstreetmap.josm.tools.Utils; … … 80 77 String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword()); 81 78 token = username + ':' + password; 82 try { 83 ByteBuffer bytes = StandardCharsets.UTF_8.newEncoder().encode(CharBuffer.wrap(token)); 84 con.setHeader("Authorization", "Basic "+Base64.encode(bytes)); 85 } catch (CharacterCodingException e) { 86 throw new OsmTransferException(e); 87 } 79 con.setHeader("Authorization", "Basic "+Base64.getEncoder().encodeToString(token.getBytes(StandardCharsets.UTF_8))); 88 80 } 89 81 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportSender.java
r10616 r10618 10 10 import java.net.URL; 11 11 import java.net.URLEncoder; 12 import java.nio.ByteBuffer;13 import java.nio.CharBuffer;14 import java.nio.charset.Charset;15 12 import java.nio.charset.StandardCharsets; 13 import java.util.Base64; 16 14 17 15 import javax.swing.JOptionPane; … … 27 25 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 28 26 import org.openstreetmap.josm.gui.widgets.UrlLabel; 29 import org.openstreetmap.josm.tools.Base64;30 27 import org.openstreetmap.josm.tools.GBC; 31 28 import org.openstreetmap.josm.tools.HttpClient; … … 84 81 try { 85 82 String text = Utils.strip(statusText); 86 ByteBuffer buffer = Charset.forName("UTF-8").encode(CharBuffer.wrap(text)); 87 String pdata = Base64.encode(buffer, false); 83 String pdata = Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8)); 88 84 String postQuery = "pdata=" + URLEncoder.encode(pdata, "UTF-8"); 89 85 HttpClient client = HttpClient.create(new URL(getJOSMTicketURL()), "POST")
Note:
See TracChangeset
for help on using the changeset viewer.