зеркало из https://github.com/mozilla/pjs.git
Bugzila bug : 314098 Changed Double to Double.doubleValue() in constructing java.Security.Provider(). sr=wtc
This commit is contained in:
Родитель
b67840b4e9
Коммит
54fc46b257
|
@ -35,6 +35,8 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
package org.mozilla.jss;
|
package org.mozilla.jss;
|
||||||
|
|
||||||
|
import java.math.*;
|
||||||
|
|
||||||
public final class JSSProvider extends java.security.Provider {
|
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 int JSS_MAJOR_VERSION = 4;
|
||||||
private static String JSS_MINOR_VERSION = "1";
|
private static int JSS_MINOR_VERSION = 1;
|
||||||
private static String JSS_PATCH_VERSION = "1";
|
private static int JSS_PATCH_VERSION = 1;
|
||||||
private static Double JSS_VERSION = new Double(JSS_MAJOR_VERSION +
|
private static double JSS_VERSION = round((double)(JSS_MAJOR_VERSION +
|
||||||
"."+JSS_MINOR_VERSION);
|
(double)JSS_MINOR_VERSION/10),2);
|
||||||
|
|
||||||
public JSSProvider() {
|
public JSSProvider() {
|
||||||
super("Mozilla-JSS", JSS_VERSION,
|
super("Mozilla-JSS", JSS_VERSION,
|
||||||
|
@ -225,9 +227,23 @@ public final class JSSProvider extends java.security.Provider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Mozilla-JSS version " +
|
String mozillaProviderVersion = new Double(JSS_VERSION).toString();
|
||||||
JSS_MAJOR_VERSION + "." +
|
if ( JSS_PATCH_VERSION != 0 ) {
|
||||||
JSS_MINOR_VERSION + "." +
|
mozillaProviderVersion = mozillaProviderVersion + "." +
|
||||||
JSS_PATCH_VERSION;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче