Bugzila bug : 314098 Changed Double to Double.doubleValue() in constructing java.Security.Provider(). sr=wtc

This commit is contained in:
sandeep.konchady%sun.com 2005-10-28 22:22:44 +00:00
parent 7afa3c63cd
commit b851582ca9

View File

@ -35,6 +35,8 @@
* ***** END LICENSE BLOCK ***** */
package org.mozilla.jss;
import java.math.*;
public final class JSSProvider extends java.security.Provider {
/********************************************************************/
@ -49,11 +51,11 @@ public final class JSSProvider extends java.security.Provider {
/* */
/********************************************************************/
private static String JSS_MAJOR_VERSION = "4";
private static String JSS_MINOR_VERSION = "1";
private static String JSS_PATCH_VERSION = "1";
private static Double JSS_VERSION = new Double(JSS_MAJOR_VERSION +
"."+JSS_MINOR_VERSION);
private static int JSS_MAJOR_VERSION = 4;
private static int JSS_MINOR_VERSION = 1;
private static int JSS_PATCH_VERSION = 1;
private static double JSS_VERSION = round((double)(JSS_MAJOR_VERSION +
(double)JSS_MINOR_VERSION/10),2);
public JSSProvider() {
super("Mozilla-JSS", JSS_VERSION,
@ -225,9 +227,23 @@ public final class JSSProvider extends java.security.Provider {
}
public String toString() {
return "Mozilla-JSS version " +
JSS_MAJOR_VERSION + "." +
JSS_MINOR_VERSION + "." +
JSS_PATCH_VERSION;
String mozillaProviderVersion = new Double(JSS_VERSION).toString();
if ( JSS_PATCH_VERSION != 0 ) {
mozillaProviderVersion = mozillaProviderVersion + "." +
JSS_PATCH_VERSION;
}
return "Mozilla-JSS version " + mozillaProviderVersion;
}
/**
* Convenience method to round double
* @param double value, int round value
* @return rounded double
*/
private static double round(double value, int decimalPlace) {
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(decimalPlace,BigDecimal.ROUND_UP);
return bd.doubleValue();
}
}