This is a duplicate of a bug report originally issued to openjdk as JI-9024378, see message below. However, that report appears to have gottern lost, so I am re-submitting it here. If I try to create the mimetype 'image/svg+xml' on the clipboard, I will instead get the mangled mimetype = 'JAVA_DATAFLAVOR:image/svg+xml; class=java.io.InputStream'.
The code for generating the mimetype is SVGCopy.java, attached here.
The code for verifying the mimetype is the Windows program Clipview.exe, available at: http://www.peterbuettner.de/develop/tools/clipview/index.html Due to the fact that the mimetype has been mangled, it is not possible to paste data of this type into Inkscape : https://inkscape.org/

My java jdk is: java version "1.6.0_16"
My system is : Microsoft Windows [Version 6.1.7601]

Thank you for your consideration
Alvin Penner
Inkscape developer : https://launchpad.net/inkscape/+topcontributors

............................................................................................................

At 07:56 AM 9/12/2015, you wrote:
Dear Java Developer,

Thank you for reporting this issue.

We are evaluating this report and have assigned it a Review ID: JI-9024378. In the event this report is determined to be a defect or enhancement request, it will be referenced with a new Bug ID and will be listed on Bugs.java.com. For other related issues, please visit our Bug Database at http://bugs.java.com.

We try to process all newly posted bugs in a timely manner, but make no promises about the amount of time in which a bug might be fixed. If the issue just reported could have a major impact on your project, consider using one of the technical support offerings available at Oracle Support.

Regards,
Java Community Developer Support
import java.awt.datatransfer.*;
import java.awt.Toolkit;
import java.io.ByteArrayInputStream;

public class SVGCopy
{
    public static void main(String[] args)
    {
                System.out.println("This is an attempt to copy to the clipboard 
using mimetype 'image/svg+xml'");
        Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
        SVGTransferable strSVG = new SVGTransferable("<?xml version='1.0' 
encoding='UTF-8' standalone='no'?>\n<svg>test</svg>");
        clip.setContents(strSVG, null);
    }
}

class SVGTransferable implements Transferable
{
    private String str;
    private DataFlavor flavSVG = null;

    public SVGTransferable(String m_str)
    {
        str = m_str;
        try
        {
             flavSVG = new DataFlavor("image/svg+xml");
             System.out.println("created DataFlavor = " + flavSVG);
        }
        catch (Exception e)
            {System.out.println("error creating DataFlavor : " + e);}
    }

    public DataFlavor[] getTransferDataFlavors()
    {
        return new DataFlavor[] { flavSVG };
    }

    public boolean isDataFlavorSupported(DataFlavor flavor)
    {
        return flavor.equals(flavSVG);
    }

    public Object getTransferData(DataFlavor flavor) throws 
UnsupportedFlavorException
    {
        if (flavor.equals(flavSVG))
           return new ByteArrayInputStream(str.getBytes());
        else
            throw new UnsupportedFlavorException(flavor);
    }
}

Reply via email to