bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug swing/28773] New: "/ by Zero" in BasicTabbedPaneUI.padTabRun()


From: freebeans at xqb dot biglobe dot ne dot jp
Subject: [Bug swing/28773] New: "/ by Zero" in BasicTabbedPaneUI.padTabRun()
Date: 18 Aug 2006 12:37:48 -0000

Sometimes BasicTabbedPaneUI.padTabRun() throws ArithmeticException("Divide by
zero")
At line 966:
---
          int spaceAllocated = spaceRemaining / numTabs;
---
numTabs is zero.

It is caused by "normalizeTabRuns()" method. line 859:
---
              while (Math.abs(diffLater) < Math.abs(diffNow)
                  && spaceInNext + currRun.width < max)
                {
                  tabRuns[i]--; // <--!!!
                  spaceInNext += currRun.width;
                  spaceInCurr -= currRun.width;
                  currRun = rects[lastTabInRun(tabCount, i)];
                  diffNow = spaceInCurr - spaceInNext;
                  diffLater = (spaceInCurr - currRun.width)
                  - (spaceInNext + currRun.width);
                }
---
This method decrement "tabRuns[]" element. However, there is a possibility
being set for an illegal value according to the size of the tab. 

For example:

Before normalizeTabRuns() called:
---
tabRuns[0]:0
tabRuns[1]:2
tabRuns[2]:3
tabRuns[3]:8
---
If the second one element is decremented, tabRuns is as follows. 
---
tabRuns[0]:0
tabRuns[1]:2
tabRuns[2]:2 <-- !!!
tabRuns[3]:8


-- 
           Summary: "/ by Zero" in BasicTabbedPaneUI.padTabRun()
           Product: classpath
           Version: 0.92
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: swing
        AssignedTo: roman at kennke dot org
        ReportedBy: freebeans at xqb dot biglobe dot ne dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28773





reply via email to

[Prev in Thread] Current Thread [Next in Thread]