Exception in loading WMF file from an applet

Last post 10-05-2010, 4:16 AM by aspose.notifier. 3 replies.
Sort Posts: Previous Next
  •  09-17-2010, 3:34 PM 259352

    Exception in loading WMF file from an applet

    Attachment: Present (inaccessible)
    I am trying to load a WMF graph from an applet. Sometime, the graph can be loaded without exception, a log of information get lost; sometime, I get an exception as shown below:

    com.aspose.metafiles.MetafilesException: Error reading Wmf record number1639
    com.aspose.metafiles.MetafilesException: Error reading WMF metafile.
            at com.aspose.metafiles.Metafile.LoadMetafile(SourceFile:78)
            at sapphire.common.mssiGraph.getScaledRotatedImage(mssiGraph.java:275)
            at sapphire.common.mssiGraph.getImage(mssiGraph.java:377)
            at sapphire.common.mssiBkArea.loadAreaGraph(mssiBkArea.java:98)
            at sapphire.common.hubVisualConfig.setCurrArea(hubVisualConfig.java:581)
            at sapphire.common.hubSiteSelPanel.actionPerformed(hubSiteSelPanel.java:153)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at javax.swing.JComponent.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: com.aspose.metafiles.MetafilesException: Error reading Wmf record number 11639
            at com.aspose.metafiles.obfuscated.aG.do(SourceFile:401)
            at com.aspose.metafiles.WmfMetafile.do(SourceFile:117)
            at com.aspose.metafiles.WmfMetafile.<init>(SourceFile:47)
            at com.aspose.metafiles.Metafile.LoadMetafile(SourceFile:76)
            ... 29 more
    Caused by: com.aspose.metafiles.MetafilesException: Unexpected end of file.
            at com.aspose.metafiles.obfuscated.aG.do(SourceFile:132)
            ... 32 more


    Here is the code I used to load the graph:
                            URL  tmpUrl = getGraphUrl();
                            if (tmpUrl == null) {
                                errMsg = new String("Error: Failed to connect to " + graphAbsPath);
                                return null;
                            }           
                            InputStream urlIn = tmpUrl.openStream();
                            graphMetaFile = (Metafile)Metafile.LoadMetafile(urlIn);
                            urlIn.close();

    More research found that loading the WMF graph from a local file works without any issue. Code is as below:
                          FileInputStream fileIn = new FileInputStream("c:/Temp/DDS_CAD_Drawing.wmf");
                          graphMetaFile = (Metafile)Metafile.LoadMetafile(fileIn);
                          fileIn.close();

    Did I anything wrong in the applet code? Does anyone know the root cause of the problem? It looks to me the location of the WMF file matters.  Please help!

    I also attached the WMF file here, which is zipped.







     
  •  10-01-2010, 3:53 AM 261483 in reply to 259352

    Re: Exception in loading WMF file from an applet

    Hello Chang,

    Sorry for replying you late.

    Your query is answered over 261482. In case you have any further query, please feel free to contact. We are sorry for the delay and inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  10-01-2010, 8:55 AM 261526 in reply to 259352

    Re: Exception in loading WMF file from an applet

    Hello Chang,

    After further investigating this issue, we have been able to reproduce this problem. For the sake of correction, the problem was logged as METAFJAVA-20445 in our issue tracking system. And I am pleased to inform you that we also have been able to resolve this issue. Please wait for sometime so that the new hotfix containing the resolution fo this problem, becomes avaialble.

    Your patience and comprehension is greatly appreciated in this regard. We apologize for the delay and inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  10-05-2010, 4:16 AM 261915 in reply to 259352

    Re: Exception in loading WMF file from an applet

    The issues you have found earlier (filed as 20445) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
View as RSS news feed in XML