Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] [jira] Created: (UDIG-1754) InMemoryCoverageLoader reports wrong file size and incorrectly reports out of memory problem

InMemoryCoverageLoader reports wrong file size and incorrectly reports out of memory problem
--------------------------------------------------------------------------------------------

                 Key: UDIG-1754
                 URL: http://jira.codehaus.org/browse/UDIG-1754
             Project: uDIG
          Issue Type: Bug
          Components: application
    Affects Versions: UDIG 1.2.0
         Environment: Windows
            Reporter: Rueben Schulz
            Priority: Minor


net.refractions.udig.catalog.internal.worldimage.InMemoryCoverageLoader has two minor issues:

1) it logs kb file sizes as mb. For example from the Eclipse log file

!ENTRY net.refractions.udig.catalog.rasterings 4 0 2011-01-26 11:36:47.978
!MESSAGE WARNING.  Loading image fully into memory.  It is about 61600.5 MB in size decompressed

This can be fixed by changing the following line in the size() method:

double megNum = bytesNum/1024.0/1024.0;

2) the load() method pops up a dialog if any errors are caught, asking the user to restart uDig with more memory. Unfortunately, the JAI library sometimes throws exceptions when opening photos that are not out of memory exceptions, creating confusion (since restarting uDig with more memory will not solve the problem).

One solution would be to pop up a different dialog telling the user of the error, instead of asking to restart with more memory. For example.

    public synchronized GridCoverage load( GeneralGridGeometry geom, IProgressMonitor monitor )
            throws IOException {

        if (coverage.get() == null) {
            try {

...

            } catch (OutOfMemoryError e) {
            	e.printStackTrace();
                updateMemoryLevel();
            } catch (Exception t) {
            	t.printStackTrace();
                //updateMemoryLevel();
            	errorDialog(t);
            }
        }
        return coverage.get();
    }
    
    private void errorDialog(final Exception e) {
    	Display.getDefault().asyncExec(new Runnable(){

            public void run() {

                Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
                String title = InMemoryCoverageLoader_msgTitle;
                String desc = "InMemoryCoverageLoader: Error loading image: " + e.getMessage();
                String[] buttons = {InMemoryCoverageLoader_close_button};
                MessageDialog dialog = new MessageDialog(shell, title, null, desc, QUESTION,
                        buttons, 0);
                dialog.open();
            }
        });

    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Back to the top