Package: cronometer / 0.9.9+dfsg-4

06_java9_compatibility.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: Sets the source encoding and replaces sun.misc.BASE64Encoder to fix the build failure with Java 9
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/build.xml
+++ b/build.xml
@@ -23,7 +23,7 @@
 	                
 	<!-- Compile the java code from ${src} into ${build} -->
 	<target name="compile" description="compile the source">
-		<javac source="1.4" srcdir="${source}" destdir="${build}">
+		<javac source="1.4" srcdir="${source}" destdir="${build}" encoding="ISO-8859-1">
 			<classpath>
 				<fileset dir="${build}/lib">
 					<include name="*.jar"/>
--- a/src/ca/spaz/cron/ExportWizard.java
+++ b/src/ca/spaz/cron/ExportWizard.java
@@ -17,7 +17,7 @@
 
 import org.w3c.dom.*;
 
-import sun.misc.BASE64Encoder;
+import java.util.Base64;
 import ca.spaz.cron.datasource.Datasources;
 import ca.spaz.cron.datasource.FoodProxy;
 import ca.spaz.cron.metrics.Metric;
@@ -111,7 +111,7 @@
  
    private String encodeCredentials() {
       try {
-         return new BASE64Encoder().encode((username.getText() + '\n' + new String(password.getPassword())).getBytes("UTF-8"));
+         return Base64.getEncoder().encodeToString((username.getText() + '\n' + new String(password.getPassword())).getBytes("UTF-8"));
       } catch (UnsupportedEncodingException e) {
          e.printStackTrace();
       }