fix: remaining references to obsolete sun.misc.Base64Encoder

This commit is contained in:
Tobi Schäfer 2020-04-10 20:24:33 +02:00
parent 523d806b56
commit a5bc33db70
3 changed files with 9 additions and 9 deletions

View file

@ -536,8 +536,8 @@ String.prototype.count = function(str) {
* @memberof {String} * @memberof {String}
*/ */
String.prototype.enbase64 = function() { String.prototype.enbase64 = function() {
var bytes = new java.lang.String(this) . getBytes(); var bytes = java.lang.String(this).getBytes('utf-8');
return new Packages.sun.misc.BASE64Encoder().encode(bytes); return String(java.lang.String(Packages.org.apache.commons.codec.binary.Base64.encodeBase64(bytes), 'utf-8'));
}; };
@ -547,8 +547,8 @@ String.prototype.enbase64 = function() {
* @memberof {String} * @memberof {String}
*/ */
String.prototype.debase64 = function() { String.prototype.debase64 = function() {
var bytes = new Packages.sun.misc.BASE64Decoder().decodeBuffer(this); var bytes = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(this);
return String(new java.lang.String(bytes)); return String(java.lang.String(bytes, 'utf-8'));
}; };

View file

@ -159,8 +159,8 @@ helma.Http = function() {
* @param {String} password The password * @param {String} password The password
*/ */
this.setCredentials = function(username, password) { this.setCredentials = function(username, password) {
var str = new java.lang.String(username + ":" + password); var str = username + ":" + password;
credentials = (new Packages.sun.misc.BASE64Encoder()).encode(str.getBytes()); credentials = str.enbase64();
return; return;
} }

View file

@ -123,8 +123,8 @@ jala.XmlRpcRequest = function(url, methodName) {
* @param {String} password The password * @param {String} password The password
*/ */
this.setCredentials = function(username, password) { this.setCredentials = function(username, password) {
var str = new java.lang.String(username + ":" + password); var str = username + ":" + password;
credentials = (new Packages.sun.misc.BASE64Encoder()).encode(str.getBytes()); credentials = str.enbase64();
return; return;
}; };