JTextComponent paste exception
Michael Hall
mik3hall at gmail.com
Fri Dec 14 19:27:08 PST 2012
On Dec 14, 2012, at 7:50 PM, Michael Hall wrote:
> On Dec 13, 2012, at 4:29 AM, Michael Hall wrote:
>
>> On Dec 12, 2012, at 8:40 PM, Roger Lewis wrote:
>>
>>> Hi Michael,
>>>
>>> Can you first try with 7u10? DataTransferer.java handles of some encoding and there were a number of bugs fixed since 7u7 that could resolve the issue being seen.
>>> For example: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7193966
>>>
>>> For convince:
>>> http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
>>
>> Roger,
>> I was just going to file the bug report.
>> The problem appears to be an incorrect path to the jdk flavormap.properties file
>>
>> Exception
>> /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/lib/flavormap.properties
>>
>
> I looked into this a bit more.
I looked into it still a bit more. Adding this…
String javaHome = System.getProperty("java.home");
System.out.println("default java.home " + javaHome + " includes jre is " + (javaHome.contains("jre")));
gets…
default java.home /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/jre includes jre is true
including the SystemFlavorMap necessary /jre
so this is fine with the default. My own code setting this to the result of the OS X command java_home is what is absent the /jre.
It works anyhow for my use, nice robustness, but doesn't work for SystemFlavorMap not quite the robustness.
Changing mine to
javaHome = rtexec(System.out,new String[] {"/usr/libexec/java_home","-v","1.7"}).trim() + "/jre";
works for my purpose, access to the compiler tool, and it works for SystemFlavorMap access to flavormap.properties for cut and paste.
So, never mind, my change would still work as well but probably isn't worth the overhead to handle what is basically an incorrectly set java.home property. if I find a subsequent bug, I can status it.
Michael Hall
trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz
HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe
AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter
> As near as I can tell the code determining the location of the flavormap.properties file is in
> java.awt.datatransfer.SystemFlavorMap in the initSystemFlavorMap() method with…
>
> String fileName =
> System.getProperty("java.home") +
> File.separator +
> "lib" +
> File.separator +
> "flavormap.properties";
>
> Another possibility for this would be something like…
>
> public class FlavorFinder {
>
> public static void main(String[] args) {
> new FlavorFinder();
> }
>
> public FlavorFinder() {
> String rtpath = getClass().getClassLoader().getResource("java/lang/Object.class").getPath();
> String filePath = rtpath.substring(5,rtpath.indexOf("lib")+4) + "flavormap.properties";
> System.out.println(filePath);
> }
>
> }
>
> getting
> java FlavorFinder
> /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/jre/lib/flavormap.properties
> correct I believe for the jdk.
> Obviously a lot more inefficient than simply pasting together the string but my understanding of this class is that this is only done once so the performance hit wouldn't be a major concern. This hit would also probably not be at startup when performance might be more of a concern but later when clipboard access would be in use.
>
> I may not be correct in my understanding here but I would think that any application run with the jdk would not correctly locate this file and then would not correctly handle cut and paste? I'd think jdk using applications like ide's might be impacted?
> My understanding might be wrong because my use is actually running from the jre with temporary OS X access to the jdk with…
>
> static {
> if (javaHome == null) {
> javaHome = rtexec(System.out,new String[] {"/usr/libexec/java_home","-v","1.7"}).trim();
> if (javaHome.equals("-")) javaHome = null;
> else {
> System.setProperty("java.home",javaHome);
> }
> }
> }
>
> I could run the app jdk embedded to see if the problem is always there for the jdk runtime but have not.
>
> I just wondered what problems there might be in determining the path based off of current runtime instead of trying to place it relative to java.home?
>
> Michael Hall
>
> trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz
>
> HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe
>
> AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter
>
More information about the macosx-port-dev
mailing list