caiorss / clip.jar

Utility to paste images from clipboard to Emacs org-mode or any markdown.
10 stars 2 forks source link

MultiResolutionCachedImage cannot be cast to java.awt.image.BufferedImage [osx] #1

Open dzfranklin opened 7 years ago

dzfranklin commented 7 years ago
> sbt
>> version
[info] 1.1.1
> sw_vers
ProductName:     Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G1004

Image below copied to clipboard image

> make test1
java -jar ./target/scala-2.11/Clip-assembly-1.1.1.jar --name clipboard
Exception in thread "main" java.lang.ClassCastException: sun.awt.image.MultiResolutionCachedImage cannot be cast to java.awt.image.BufferedImage
    at Clip$$anonfun$getImage$2.apply(Clip.scala:32)
    at Clip$$anonfun$getImage$2.apply(Clip.scala:32)
    at scala.Option.map(Option.scala:145)
    at Clip$.getImage(Clip.scala:32)
    at Clip$.saveClipboardImage(Clip.scala:37)
    at Clip$.main(Clip.scala:80)
    at Clip.main(Clip.scala)
make: *** [test1] Error 1
> make test2
java -jar ./target/scala-2.11/Clip-assembly-1.1.1.jar --uuid .
Exception in thread "main" java.lang.ClassCastException: sun.awt.image.MultiResolutionCachedImage cannot be cast to java.awt.image.BufferedImage
    at Clip$$anonfun$getImage$2.apply(Clip.scala:32)
    at Clip$$anonfun$getImage$2.apply(Clip.scala:32)
    at scala.Option.map(Option.scala:145)
    at Clip$.getImage(Clip.scala:32)
    at Clip$.saveClipboardImage(Clip.scala:37)
    at Clip$.saveClipboardImageUUID(Clip.scala:52)
    at Clip$.main(Clip.scala:79)
    at Clip.main(Clip.scala)
make: *** [test2] Error 1
caiorss commented 7 years ago

I don't have a OSX so didn't have any way to test the app on this operating system. In Windows and Linux it worked seamless. Thanks for the bug report. To solve this bug I will need additional help from someone who has some MacOSX.

Could you tell the Java version you are using and the Scala version and if you are using the Oracle's Java, Apple's Java or OpenJdk Java, I mean the java vendor ?

Here is my data:

Java Version:

$ java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Detailed Java Info:

$ java -XshowSettings:properties -version
Property settings:
    awt.toolkit = sun.awt.X11.XToolkit
    file.encoding = UTF-8
    file.encoding.pkg = sun.io
    file.separator = /
    java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
    java.awt.printerjob = sun.print.PSPrinterJob
    java.class.path = .
    java.class.version = 52.0
    java.endorsed.dirs = /home/arch/opt/jdk1.8.0_74/jre/lib/endorsed
    java.ext.dirs = /home/arch/opt/jdk1.8.0_74/jre/lib/ext
        /usr/java/packages/lib/ext
    java.home = /home/arch/opt/jdk1.8.0_74/jre
    java.io.tmpdir = /tmp
    java.library.path = /usr/java/packages/lib/amd64
        /usr/lib64
        /lib64
        /lib
        /usr/lib
    java.runtime.name = Java(TM) SE Runtime Environment
    java.runtime.version = 1.8.0_74-b02
    java.specification.name = Java Platform API Specification
    java.specification.vendor = Oracle Corporation
    java.specification.version = 1.8
    java.vendor = Oracle Corporation
    java.vendor.url = http://java.oracle.com/
    java.vendor.url.bug = http://bugreport.sun.com/bugreport/
    java.version = 1.8.0_74
    java.vm.info = mixed mode
    java.vm.name = Java HotSpot(TM) 64-Bit Server VM
    java.vm.specification.name = Java Virtual Machine Specification
    java.vm.specification.vendor = Oracle Corporation
    java.vm.specification.version = 1.8
    java.vm.vendor = Oracle Corporation
    java.vm.version = 25.74-b02
    line.separator = \n 
    os.arch = amd64
    os.name = Linux
    os.version = 4.4.39-1-MANJARO
    path.separator = :
    sun.arch.data.model = 64
    sun.boot.class.path = /home/arch/opt/jdk1.8.0_74/jre/lib/resources.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/rt.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/sunrsasign.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/jsse.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/jce.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/charsets.jar
        /home/arch/opt/jdk1.8.0_74/jre/lib/jfr.jar
        /home/arch/opt/jdk1.8.0_74/jre/classes
    sun.boot.library.path = /home/arch/opt/jdk1.8.0_74/jre/lib/amd64
    sun.cpu.endian = little
    sun.cpu.isalist = 
    sun.io.unicode.encoding = UnicodeLittle
    sun.java.launcher = SUN_STANDARD
    sun.jnu.encoding = UTF-8
    sun.management.compiler = HotSpot 64-Bit Tiered Compilers
    sun.os.patch.level = unknown
    user.country = US
    user.dir = /run/media/arch/transfer/projects/clipboard.scala
    user.home = /home/arch
    user.language = en
    user.name = arch
    user.timezone = 

java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Sbt version:

$ sbt
> version
[info] 1.1.1
> 

Scala Version:

$ /home/arch/opt/scala-2.11.8/bin/scala 
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74).
Type in expressions for evaluation. Or try :help.

OS Info:

$ uname -a
Linux arch-pc 4.4.39-1-MANJARO #1 SMP PREEMPT Thu Dec 15 21:29:27 UTC 2016 x86_64 GNU/Linux
jmcmichael commented 5 years ago

I tried the Oracle JDK and OpenJDK and both threw the same error noted by the original poster.