JDK-4370469 : REGRESSION: NPE in selectBestTextFlavor() on win32
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-09-12
  • Updated: 2000-10-03
  • Resolved: 2000-10-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Description
Description: ###@###.###

The following test reproduces the problem:
--------------------------------------------------------
import java.awt.datatransfer.DataFlavor;

public class NPETest {

    public static void main(String[] args) {
        DataFlavor flavor1 = new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream", "Flavor 1"); 
        DataFlavor flavor2 = new DataFlavor("text/plain; class=java.io.InputStream", "Flavor 2"); 
        DataFlavor[] flavors = new DataFlavor[] { flavor1, flavor2 };
        DataFlavor best = DataFlavor.selectBestTextFlavor(flavors);
        System.out.println("best=" + best);
    }
}
--------------------------------------------------------

The test case throws the following exception:
--------------------------------------------------------
Z:\bug\newbug>K:\das\merlin\build\win32\bin\java NPETest
Exception in thread "main" java.lang.NullPointerException
        at java.awt.datatransfer.DataFlavor.selectBestTextFlavor(DataFlavor.java:615)
        at NPETest.main(NPETest.java:9)
--------------------------------------------------------

This regression is introduced with the fix for 4275210.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

EVALUATION The problem is that on Win32 ISO8859_1 was returned as default charset. This value is already alias name and so CharacterEncoding.aliasName(...) for this value returns null. The fix is as follows: if CharacterEncoding.aliasName(...) returns null for some value, we should assume that the value is already alias name and use it as such. ###@###.### 2000-09-18
18-09-2000