Breaking News
Home / Java / Java Issues / Warning – sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release

Warning – sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release

Issue

I am using Base64 Decoder from JDK 1.6.x, the program runs fine but when I compile my the application it gives the following warnings:

Compiling 35 source files to /home/infuze/service/projects/infuze/build/classes
    [javac] /home/local/service/projects/infuze/src/java/com/test/service/subscription/workflow/SubscriptionUploadWorkflow.java:11: warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release
    [javac] import sun.misc.BASE64Decoder;
    [javac]                ^
    [javac] /home/local/service/projects/infuze/src/java/com/test/service/subscription/workflow/SubscriptionUploadWorkflow.java:86: warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release
    [javac]                BASE64Decoder decoder = new BASE64Decoder();
    [javac]                ^
    [javac] /home/local/service/projects/infuze/src/java/com/test/service/subscription/workflow/SubscriptionUploadWorkflow.java:86: warning: sun.misc.BASE64Decoder is Sun proprietary API and may be removed in a future release
    [javac]                BASE64Decoder decoder = new BASE64Decoder();
    [javac]                                            ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

Solution

Basically the class BASE64Decoder that is part of sun.misc package is an internal proprietary implementation from Sun as part of the JDK. This class can be changed or removed anytime without notice that will cause your program to fail at runtime or not compile in future if a different JVM version is used. So a best practice we should avoid using internal API to be safe. Find an alternative base64 implementation and replace this at the earliest.

[pb_builder]

Check Also

Data truncation: Data too long for column – JDBC

Issue Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘columname‘ at row 1     …

Leave a Reply