src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
changeset 51661 a4c50d83af82
parent 47216 71c04702a3d5
child 58297 01f7ba3a4905
--- a/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Sep 06 10:49:17 2018 -0700
+++ b/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Sep 06 12:10:59 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,10 +189,12 @@
                    $replType$ replacement)
     {
         this.charset = cs;
-        if (average$ItypesPerOtype$ <= 0.0f)
+        // Use !(a > 0.0f) rather than (a <= 0.0f) to exclude NaN values
+        if (!(average$ItypesPerOtype$ > 0.0f))
             throw new IllegalArgumentException("Non-positive "
                                                + "average$ItypesPerOtype$");
-        if (max$ItypesPerOtype$ <= 0.0f)
+        // Use !(a > 0.0f) rather than (a <= 0.0f) to exclude NaN values
+        if (!(max$ItypesPerOtype$ > 0.0f))
             throw new IllegalArgumentException("Non-positive "
                                                + "max$ItypesPerOtype$");
         if (average$ItypesPerOtype$ > max$ItypesPerOtype$)