Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4810806

NullPointerException expected, instead HS Error: EXCEPTION_ACCESS_VIOLATION

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1_07
    • 1.4.0, 1.4.1, 1.4.2_01
    • client-libs
    • 2d
    • 07
    • x86
    • windows_2000, windows_xp
    • Verified

        java:2061)


        at GP.paintComponent(Unknown Source)


        at javax.swing.JComponent.paint(JComponent.java:808)


        at javax.swing.JComponent.paintChildren(JComponent.java:647)


        - locked <02EFB638> (a java.awt.Component$AWTTreeLock)


        at javax.swing.JComponent.paint(JComponent.java:817)


        at javax.swing.JComponent.paintChildren(JComponent.java:647)


        - locked <02EFB638> (a java.awt.Component$AWTTreeLock)


        at javax.swing.JComponent.paint(JComponent.java:817)


        at javax.swing.JLayeredPane.paint(JLayeredPane.java:552)


        at javax.swing.JComponent.paintChildren(JComponent.java:647)


        - locked <02EFB638> (a java.awt.Component$AWTTreeLock)


        at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4778)


        at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4724)


        at javax.swing.JComponent.paint(JComponent.java:798)


        at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)


        at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)


        at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)


        at java.awt.Container.paint(Container.java:1309)


        at sun.awt.RepaintArea.paint(RepaintArea.java:177)


        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)


        at java.awt.Component.dispatchEventImpl(Component.java:3658)


        at java.awt.Container.dispatchEventImpl(Container.java:1623)


        at java.awt.Window.dispatchEventImpl(Window.java:1585)


        at java.awt.Component.dispatchEvent(Component.java:3439)


        at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)


        at
        java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:1
        97)


        at
        java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150
        )


        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)


        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)


        at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

        Dynamic libraries:
        0x00400000 - 0x00406000 c:\winnt\system32\java.exe
        x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll
        77DB0000 - 0x77E0B000 C:\WINNT\system32\ADVAPI32.dll
        0x77E80000 - 0x77F31000 C:\WINNT\system32\KERNEL32.dll
        0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.dll
        0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
        0x6D330000 - 0x6D45A000 C:\Program
        Files\Java\j2re1.4.1_01\bin\client\jvm.dll
        0x77E10000 - 0x77E6F000 C:\WINNT\system32\USER32.dll
        0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
        0x77570000 - 0x775A0000 c:\winnt\system32\WINMM.dll
        0x6D1D0000 - 0x6D1D7000 C:\Program Files\Java\j2re1.4.1_01\bin\hpi.dll
        0x6D300000 - 0x6D30D000 C:\Program Files\Java\j2re1.4.1_01\bin\verify.dll
        0x6D210000 - 0x6D229000 C:\Program Files\Java\j2re1.4.1_01\bin\java.dll
        0x6D320000 - 0x6D32D000 C:\Program Files\Java\j2re1.4.1_01\bin\zip.dll
        0x6D000000 - 0x6D0FB000 C:\Program Files\Java\j2re1.4.1_01\bin\awt.dll
        0x77800000 - 0x7781E000 c:\winnt\system32\WINSPOOL.DRV
        0x76620000 - 0x76630000 C:\WINNT\system32\MPR.dll
        0x75E60000 - 0x75E7A000 c:\winnt\system32\IMM32.dll
        0x77A50000 - 0x77B45000 C:\WINNT\system32\ole32.dll
        0x6D180000 - 0x6D1D0000 C:\Program
        Files\Java\j2re1.4.1_01\bin\fontmanager.dll
        0x51000000 - 0x51044000 c:\winnt\system32\ddraw.dll
        0x728A0000 - 0x728A6000 c:\winnt\system32\DCIMAN32.dll
        0x72D90000 - 0x72E03000 c:\winnt\system32\D3DIM.DLL
        0x60000000 - 0x60045000 C:\WINNT\System32\MSCTF.dll
        0x1C050000 - 0x1C125000 C:\WINNT\System32\nView.dll
        0x70BD0000 - 0x70C35000 C:\WINNT\system32\SHLWAPI.dll
        0x782F0000 - 0x78534000 C:\WINNT\system32\SHELL32.dll
        0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.dll
        0x690A0000 - 0x690AB000 C:\WINNT\System32\PSAPI.DLL
        0x766F0000 - 0x766F7000 C:\WINNT\System32\POWRPROF.dll
        0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll
        0x759B0000 - 0x759B6000 C:\WINNT\system32\LZ32.DLL
        0x695E0000 - 0x69609000 C:\WINNT\System32\OLEPRO32.DLL
        0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.dll
        0x1CB00000 - 0x1CB0B000 C:\Program Files\Lotus\Sametime Client\ACTIVMON.dll
        0x61220000 - 0x61232000 C:\Program Files\Microsoft
        Hardware\Mouse\MSH_ZWF.dll
        0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
        0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll


        Local Time = Thu Feb 06 10:33:12 2003
        Elapsed Time = 3


        #
        # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
        # Error ID : 4F530E43505002E6
        # Please report this error at
        # http://java.sun.com/cgi-bin/bugreport.cgi

        #
        # Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)

        #


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.*;
        import javax.swing.*;

        public class P1 extends JFrame {
            public P1() {
                getContentPane().add(new T1(1200,600));
                setSize(1200,600);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


            }
            
            public static void main(String[] args) {
                (new P1()).show();


            }

           
        }




        import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        import javax.swing.event.*;

        public class T1 extends JPanel {

            public T1(int w,int h) {


            }

          
            public void paintComponent(Graphics g) {

                super.paintComponent(g);
               
                Graphics2D g2 = (Graphics2D)g;
                g2.drawPolyline(null,null,256);

            }


        }


        (Review ID: 180948)
        ======================================================================

        Name: rmT116609 Date: 02/25/2003


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile and run the test case.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        expected: exception
        actual : jvm crash

        ERROR MESSAGES/STACK TRACES THAT OCCUR :

        Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D3A68E7
        Function=[Unknown.]
        Library=C:\Programme\Java\j2re1.4.1_01\bin\client\jvm.dll

        NOTE: We are unable to locate the function name symbol for the error
              just occurred. Please refer to release documentation for possible
              reason and solutions.


        Current Java thread:
        at sun.awt.windows.Win32Renderer.doDrawPoly(Native Method)
        at sun.awt.windows.Win32Renderer.drawPolyline(Win32Renderer.java:114)
        at sun.java2d.pipe.ValidatePipe.drawPolyline(ValidatePipe.java:95)
        at sun.java2d.SunGraphics2D.drawPolyline(SunGraphics2D.java:2061)
        at PolyLineCrash.main(PolyLineCrash.java:21)

        Dynamic libraries:
        0x00400000 - 0x00406000 C:\WINDOWS\system32\java.exe
        0x77F40000 - 0x77FEE000 C:\WINDOWS\System32\ntdll.dll
        0x77E40000 - 0x77F38000 C:\WINDOWS\system32\kernel32.dll
        0x77DA0000 - 0x77E3C000 C:\WINDOWS\system32\ADVAPI32.dll
        0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll
        0x77BE0000 - 0x77C33000 C:\WINDOWS\system32\MSVCRT.dll
        0x6D330000 - 0x6D45A000 C:\Programme\Java\j2re1.4.1_01
        \bin\client\jvm.dll
        0x77D10000 - 0x77D9C000 C:\WINDOWS\system32\USER32.dll
        0x77C40000 - 0x77C80000 C:\WINDOWS\system32\GDI32.dll
        0x76AF0000 - 0x76B1D000 C:\WINDOWS\system32\WINMM.dll
        0x76330000 - 0x7634C000 C:\WINDOWS\System32\IMM32.DLL
        0x6D1D0000 - 0x6D1D7000 C:\Programme\Java\j2re1.4.1_01\bin\hpi.dll
        0x6D300000 - 0x6D30D000 C:\Programme\Java\j2re1.4.1_01\bin\verify.dll
        0x6D210000 - 0x6D229000 C:\Programme\Java\j2re1.4.1_01\bin\java.dll
        0x6D320000 - 0x6D32D000 C:\Programme\Java\j2re1.4.1_01\bin\zip.dll
        0x6D000000 - 0x6D0FB000 C:\Programme\Java\j2re1.4.1_01\bin\awt.dll
        0x72F70000 - 0x72F93000 C:\WINDOWS\system32\WINSPOOL.DRV
        0x77180000 - 0x772A1000 C:\WINDOWS\system32\ole32.dll
        0x6D180000 - 0x6D1D0000 C:\Programme\Java\j2re1.4.1_01
        \bin\fontmanager.dll
        0x736D0000 - 0x73714000 C:\WINDOWS\system32\ddraw.dll
        0x73B30000 - 0x73B36000 C:\WINDOWS\system32\DCIMAN32.dll
        0x6DE00000 - 0x6DE71000 C:\WINDOWS\system32\D3DIM.DLL
        0x0EE70000 - 0x0EE9B000 C:\WINDOWS\System32\msctfime.ime
        0x76C50000 - 0x76C72000 C:\WINDOWS\system32\imagehlp.dll
        0x6DA00000 - 0x6DA7D000 C:\WINDOWS\system32\DBGHELP.dll
        0x77BD0000 - 0x77BD7000 C:\WINDOWS\system32\VERSION.dll
        0x76BB0000 - 0x76BBB000 C:\WINDOWS\system32\PSAPI.DLL

        Local Time = Mon Feb 17 20:31:14 2003
        Elapsed Time = 0
        #
        # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
        # Error ID : 4F530E43505002E6
        # Please report this error at
        # http://java.sun.com/cgi-bin/bugreport.cgi
        #
        # Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
        #


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.applet.Applet;
        import java.awt.*;
        /**
         * Describe class <code>PolylineCrashApplet</code> here.
         *
         * @author <a href="mailto:###@###.###"></a>
         * @version 1.0
         */
        public class PolyLineCrash extends Applet {
            static int[] a,b;
            public void paint(Graphics g)
            {
        g.drawPolyline(a,b,30);
        g.drawString("Crash the browser!", 20, 90);
            }
          
          public static void main(String[] args) {
           Frame f = new Frame();
           f.show();
           Graphics g = f.getGraphics();
           g.drawPolyline(a,b,30);
        // (new PolyLineCrash()).paint(g);
          }
          
        }

        ---------- END SOURCE ----------


        (Review ID: 181414)
        ======================================================================


        Name: jk109818 Date: 01/30/2003


        FULL PRODUCT VERSION :
        java version "1.4.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
        Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

        FULL OPERATING SYSTEM VERSION :
        Microsoft Windows 2000 [Version 5.00.2195]

        ADDITIONAL OPERATING SYSTEMS : (only 2. Problem)
        Windows 2000
        Windows XP

        A DESCRIPTION OF THE PROBLEM :
        1. Problem:
        if you use
        g.drawPolyLine(x, y, 100);
        and x and y are not initialized, you get the the
        errormassage below..
        I made the mistake in line 185

        2. Problem:
        the system crashes!




        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1.Problem:
        description under "Description"

        2.Problem:
        remove line 185 compile the program, start it, enter a big
        value in the a4 textfield (i.e. 10 000 000)!

        the error also occurs when the program is implemented as
        applet.
        i uploaded it to http://www.diablo2web.de


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        1.Problem
        i expectet a nullPointerException

        2.I expected no system-crash

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        X:\PI3>java Funktion

        Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D365C59
        Function=[Unknown.]
        Library=C:\Java\j2sdk1.4.0_01\jre\bin\client\jvm.dll

        NOTE: We are unable to locate the function name symbol for the error
              just occurred. Please refer to release documentation for possible
              reason and solutions.


        Current Java thread:
                at sun.awt.windows.Win32Renderer.doDrawPoly(Native Method)
                at sun.awt.windows.Win32Renderer.drawPolyline(Win32Renderer.java:114)
                at sun.java2d.SunGraphics2D.drawPolyline(SunGraphics2D.java:2041)
                at GraphView.paintComponent(Funktion.java:185)
                at javax.swing.JComponent.paint(JComponent.java:804)
                at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4735)

                at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
                at javax.swing.JComponent._paintImmediately(JComponent.java:4632)
                at javax.swing.JComponent.paintImmediately(JComponent.java:4464)
                at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:404)

                at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(System
        EventQueueUtilities.java:117)
                at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
                at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
                at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
        read.java:191)
                at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
        ad.java:144)
                at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

                at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)

                at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

        Dynamic libraries:
        0x00400000 - 0x00406000 C:\Java\j2sdk1.4.0_01\bin\java.exe
        0x77880000 - 0x77901000 C:\WINNT\System32\ntdll.dll
        0x77DA0000 - 0x77DFD000 C:\WINNT\system32\ADVAPI32.dll
        0x77E70000 - 0x77F33000 C:\WINNT\system32\KERNEL32.DLL
        0x77D20000 - 0x77D91000 C:\WINNT\system32\RPCRT4.DLL
        0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
        0x6D330000 - 0x6D445000 C:\Java\j2sdk1.4.0_01\jre\bin\client\jvm.dll
        0x77E00000 - 0x77E5F000 C:\WINNT\system32\USER32.dll
        0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
        0x77540000 - 0x77571000 C:\WINNT\System32\WINMM.dll
        0x6D1D0000 - 0x6D1D7000 C:\Java\j2sdk1.4.0_01\jre\bin\hpi.dll
        0x6D300000 - 0x6D30D000 C:\Java\j2sdk1.4.0_01\jre\bin\verify.dll
        0x6D210000 - 0x6D228000 C:\Java\j2sdk1.4.0_01\jre\bin\java.dll
        0x6D320000 - 0x6D32D000 C:\Java\j2sdk1.4.0_01\jre\bin\zip.dll
        0x6D000000 - 0x6D0F6000 C:\Java\j2sdk1.4.0_01\jre\bin\awt.dll
        0x777F0000 - 0x7780E000 C:\WINNT\System32\WINSPOOL.DRV
        0x782F0000 - 0x78300000 C:\WINNT\system32\MPR.DLL
        0x75DF0000 - 0x75E0A000 C:\WINNT\System32\IMM32.dll
        0x77A40000 - 0x77B35000 C:\WINNT\system32\ole32.dll
        0x6D180000 - 0x6D1D0000 C:\Java\j2sdk1.4.0_01\jre\bin\fontmanager.dll
        0x51000000 - 0x51044000 C:\WINNT\System32\DDRAW.dll
        0x72810000 - 0x72816000 C:\WINNT\System32\DCIMAN32.dll
        0x69000000 - 0x6910A000 C:\WINNT\System32\ATIO2KAD.dll
        0x6E330000 - 0x6E336000 C:\WINNT\System32\INDICDLL.dll
        0x77910000 - 0x77933000 C:\WINNT\system32\imagehlp.dll
        0x72970000 - 0x7299D000 C:\WINNT\system32\DBGHELP.dll
        0x68F30000 - 0x68F3B000 C:\WINNT\System32\PSAPI.DLL

        Local Time = Tue Nov 26 15:18:01 2002
        Elapsed Time = 5
        #
        # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
        # Error ID : 4F530E43505002D5
        # Please report this error at
        # http://java.sun.com/cgi-bin/bugreport.cgi
        #
        # Java VM: Java HotSpot(TM) Client VM (1.4.0_01-b03 mixed mode)
        #
        # An error report file has been saved as hs_err_pid1044.log.
        # Please refer to the file for further information.
        #

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.util.*;
        import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        import javax.swing.event.*;

        class Model
        {
        private Vector listeners = new Vector();
        private double[] faktoren = {0.0, 0.0, 0.0, 0.0, 0.0};
        private int zoom = 1, x = 0;

        public void setX(int x)
        {
        this.x = x;
        fireModelChanged();
        }

        public int getX()
        {
        return x;
        }

        public int getZoom()
        {
        return zoom;
        }

        public void setZoom(int zoom)
        {
        this.zoom = zoom;
        fireModelChanged();
        }

        public void setFaktor(int index, double faktor)
        {
        faktoren[index] = faktor;
        fireModelChanged();
        }

        public double getFaktor(int index)
        {
        return faktoren[index];
        }

        public double[] getFaktoren()
        {
        return faktoren;
        }

        public int length()
        {
        return faktoren.length;
        }

        public void addListener(ModelListener mdl)
        {
        listeners.addElement(mdl);
        }

        public void fireModelChanged()
        {
        for (int i = 0; i < listeners.size(); i++)
        {
        ModelListener mdl = (ModelListener) listeners.elementAt
        (i);
        mdl.modelChanged(this);
        }
        }
        }

        interface ModelListener
        {
        public void modelChanged(Model mdl);
        }

        class TextFeldView extends JPanel implements ModelListener
        {
        private Model mdl;
        private int index;
        JTextField tf;

        public TextFeldView(Model mdl, int index)
        {
        this.mdl = mdl;
        this.index = index;
        mdl.addListener(this);
        JLabel jl = new JLabel("a" + index);
        tf = new JTextField("" + mdl.getFaktor(index));
        tf.addActionListener(new TextFeldController(mdl, index));
        setLayout(new BorderLayout());
        add(jl, BorderLayout.WEST);
        add(tf, BorderLayout.CENTER);

        }

        public void modelChanged(Model mdl)
        {
        tf.setText("" + mdl.getFaktor(index));
        }
        }

        class SliderView extends JPanel implements ModelListener
        {
        private Model mdl;
        private int index;
        private JSlider js = new JSlider(-10, 10);

        public SliderView(Model mdl, int index)
        {
        this.mdl = mdl;
        this.index = index;
        mdl.addListener(this);
        js.setMajorTickSpacing(2);
        js.setPaintTicks(true);
        js.setPaintLabels(true);
        JLabel jl = new JLabel("a" + index);
        add(jl, BorderLayout.WEST);
        add(js, BorderLayout.CENTER);
        js.addChangeListener(new SliderController(mdl, index));
        }

        public void modelChanged(Model mdl)
        {
        js.setValue((int) mdl.getFaktor(index));
        }
        }

        class FormulaView extends JLabel implements ModelListener
        {
        private Model mdl;
        private String text, anfang = " f(x) = ";

        public FormulaView(Model mdl)
        {
        this.mdl = mdl;
        mdl.addListener(this);
        setHorizontalAlignment(RIGHT);
        setForeground(Color.RED);
        setText(formel() + " ");
        }

        private String formel()
        {
        text = anfang;
        for (int i = mdl.length() - 1; i > 0; i--)
        if (mdl.getFaktor(i) != 0)
        text += mdl.getFaktor(i) + "x^" + i + " + ";
        if (mdl.getFaktor(0) != 0)
        text += mdl.getFaktor(0);
        else
        text = text.substring(0, text.length() - 3);
        return text;
        }

        public void modelChanged(Model mdl)
        {
        setText(formel() + " ");
        }
        }

        class GraphView extends JPanel implements ModelListener
        {
        private Model mdl;
        private double[] y, x;
        private int[] xc, yc, xt, yt;
        private double[] faktoren;

        public GraphView(Model mdl)
        {
        super();
        this.mdl = mdl;
        mdl.addListener(this);
        faktoren = new double[mdl.length()];
        }

        public void paintComponent(Graphics g)
        {
        super.paintComponent(g);
        setSize(((getHeight() > getWidth()) ? getWidth() : getHeight
        ()) / 20 * 20, ((getHeight() > getWidth()) ? getWidth() : getHeight()) / 20 *
        20);
        compute();

        //Tangente
        g.setColor(Color.RED);
        g.fillArc(mdl.getX(), getHeight() / 2 - 3, 6, 6, 0, 360);
        g.drawPolyline(xt, yt, getHeight() - 20); //THIS LINE CAUSES
        THE HotSpot Virtual Machine Error
        g.setColor(Color.BLACK);

        //Koordinatensystem
        g.drawLine(10, getHeight() / 2, getWidth() - 10, getHeight() /
        2);
        g.drawLine(getWidth() /2 , 10, getWidth() / 2, getHeight() -
        10);
        for (int i = -10; i <= 10; i++)
        {
        g.drawLine(getWidth() / 2 - 3, getWidth() / 2 + i *
        mdl.getZoom() * ((getWidth() - 20)) / 20, getWidth() / 2 + 3, getWidth() / 2 +
        i * mdl.getZoom() * ((getWidth() - 20)) / 20);
        g.drawLine(getWidth() / 2 + i * mdl.getZoom() *
        ((getWidth() - 20)) / 20, getWidth() / 2 - 3, getWidth() / 2 + i * mdl.getZoom
        () * ((getWidth() - 20)) / 20, getWidth() / 2 + 3);
        }

        //Graph
        g.drawPolyline(xc, yc, getHeight() - 20);
        }

        public void compute()
        {
        for (int i = 0; i < mdl.length(); i++)
        {
        faktoren[i] = -mdl.getFaktor(mdl.length() - 1 - i);

        }
        x = new double[getHeight() - 20];
        y = new double[getHeight() - 20];
        xc = new int[getHeight() - 20];
        yc = new int[getHeight() - 20];
        for (int i = -(getHeight() -20) /2; i < (getHeight() -20) /2;
        i++)
        {
        x[i+(getHeight() - 20) / 2] = (double) i / ((getHeight
        () - 20) / 20 * mdl.getZoom());
        }
        y = hornerschema(x, faktoren);
        for (int i = 0; i < getHeight() - 20; i++)
        {
        yc[i] = (int) (y[i] * (getHeight() - 20) / 20 *
        mdl.getZoom() + 10 + (getHeight() - 20) / 2);
        xc[i] = (int) (x[i] * (getHeight() - 20) / 20 *
        mdl.getZoom() + 10 + (getHeight() - 20) / 2);
        }
        yc[getHeight()-21] = yc[getHeight()-22];
        xc[getHeight()-21] = xc[getHeight()-22];
        }

        public double[] hornerschema(double[] x, double[] faktoren)
        {
        double[] tmp = new double[x.length];
        double[] tmp2 = new double[faktoren.length];
        for (int i = 0; i < tmp.length; i++)
        {
        tmp2[0] = 0;
        tmp2[1] = (faktoren[0] * x[i]);
        for (int j = 2; j < faktoren.length; j++)
        {
        tmp2[j] = ((faktoren[j-1] + tmp2[j-1]) * x[i]);
        }
        tmp[i] = (tmp2[tmp2.length-1] + faktoren[tmp2.length-
        1]);
        }
        return tmp;
        }

        public void modelChanged(Model mdl)
        {
        repaint();
        }
        }

        class MouseMotionController implements MouseMotionListener
        {
        private Model mdl;

        public MouseMotionController(Model mdl)
        {
        this.mdl = mdl;
        }
        public void mouseMoved(MouseEvent e)
        {
        mdl.setX(e.getX());
        }

        public void mouseDragged(MouseEvent e)
        {
        }
        }

        class TextFeldController implements ActionListener
        {
        private int index;
        private Model mdl;

        public TextFeldController(Model mdl, int index)
        {
        this.mdl = mdl;
        this.index = index;
        }

        public void actionPerformed(ActionEvent evt)
        {
        JTextField tf = (JTextField) evt.getSource();
        mdl.setFaktor(index, Double.parseDouble(tf.getText()));
        }
        }

        class SliderController implements ChangeListener
        {
        private int index;
        private Model mdl;

        public SliderController(Model mdl, int index)
        {
        this.mdl = mdl;
        this.index = index;
        }

        public void stateChanged(ChangeEvent evt)
        {
        JSlider js = (JSlider) evt.getSource();
        mdl.setFaktor(index, js.getValue());
        }
        }

        class ZoomController implements ChangeListener
        {
        private Model mdl;

        public ZoomController(Model mdl)
        {
        this.mdl = mdl;
        }

        public void stateChanged(ChangeEvent evt)
        {
        JSlider js = (JSlider) evt.getSource();
        mdl.setZoom(js.getValue());
        }
        }

        public class Funktion extends ExitFrame
        {
        private Model mdl = new Model();

        public Funktion()
        {
        super("Polynomdarstellung");

        //Slider
        Container slidercont = new Container();
        slidercont.setLayout(new GridLayout(mdl.length(),1));
        for (int i = 0; i < mdl.length(); i++)
        {
        SliderView sv = new SliderView(mdl,i);
        slidercont.add(sv);
        }
        getContentPane().add(slidercont, BorderLayout.WEST);


        //Textfelder
        Container textfeldcont = new Container();
        textfeldcont.setLayout(new GridLayout(1,mdl.length()));
        for (int i = 0; i < mdl.length(); i++)
        {
        TextFeldView tfv = new TextFeldView(mdl,i);
        textfeldcont.add(tfv);
        }
        getContentPane().add(textfeldcont, BorderLayout.SOUTH);

        //Formel
        FormulaView fv = new FormulaView(mdl);
        getContentPane().add(fv, BorderLayout.NORTH);

        //Graph anzeigen
        GraphView gv = new GraphView(mdl);
        gv.addMouseMotionListener(new MouseMotionController(mdl));
        getContentPane().add(gv, BorderLayout.CENTER);

        //Zoom
        JSlider js = new JSlider(1, 10);
        js.addChangeListener(new ZoomController(mdl));
        js.setOrientation(1);
        js.setValue(1);
        getContentPane().add(js, BorderLayout.EAST);



        setLocation(100,100);
        setSize(810,610);
        setVisible(true);
        }

        public static void main(String[] args)
        {
        new Funktion();
        }
        }

        import javax.swing.*;
        import java.awt.event.*;

        class ExitFrame extends JFrame implements WindowListener
        {
        static int zaehler = 0;

        ExitFrame()
        {
        super();
        zaehler++;
        addWindowListener(this);
        }

        ExitFrame(String s)
        {
        super(s);
        zaehler++;
        addWindowListener(this);
        }
        public void windowClosing(WindowEvent evt)
        {
        zaehler--;
        if (zaehler == 0)
        System.exit(0);
        }
        public void windowActivated(WindowEvent evt) {}
        public void windowClosed(WindowEvent evt) {}
        public void windowDeactivated(WindowEvent evt) {}
        public void windowDeiconified(WindowEvent evt) {}
        public void windowIconified(WindowEvent evt) {}
        public void windowOpened(WindowEvent evt) {}
        }
        ---------- END SOURCE ----------

        CUSTOMER WORKAROUND :
        1. Problem: don't make the mistake to forget initializing
        an array :)

        2. Problem: don't have a work around
        (Review ID: 178406)
        ======================================================================

        Name: rmT116609 Date: 02/13/2003


        DESCRIPTION OF THE PROBLEM :
        Was due to the system call
        g.drawPolyline(xp,yp,len) where 'yp' was null instead of an int[];
        goes away when yp is properly initialized.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        run the source code below


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D3A68E7
        Function=[Unknown.]
        Library=C:\Program Files\Java\j2re1.4.1_01\bin\client\jvm.dll

        NOTE: We are unable to locate the function name symbol for the error
         just occurred. Please refer to release documentation for possible
         reason and solutions.

        Current Java thread:


        at sun.awt.windows.Win32Renderer.doDrawPoly(Native Method)


        at sun.awt.windows.Win32Renderer.drawPolyline(Win32Renderer.java:114)


        at sun.java2d.SunGraphics2D.drawPolyline(SunGraphics2D.

              tdv Dmitri Trembovetski (Inactive)
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: