[pkg-java] r16994 - in trunk/libiscwt-java/debian: . patches

Shuxiong Ye yesx-guest at alioth.debian.org
Fri Jul 5 13:15:30 UTC 2013


Author: yesx-guest
Date: 2013-07-05 13:15:29 +0000 (Fri, 05 Jul 2013)
New Revision: 16994

Added:
   trunk/libiscwt-java/debian/patches/java6andjava7-compat.patch
Modified:
   trunk/libiscwt-java/debian/changelog
   trunk/libiscwt-java/debian/patches/series
Log:
  * Team upload.

  [ ShuxiongYe ]
  * Compatible with both openjdk-7 and openjdk-7
    - debian/patch/java6andjava7-compat.patch



Modified: trunk/libiscwt-java/debian/changelog
===================================================================
--- trunk/libiscwt-java/debian/changelog	2013-07-05 10:40:34 UTC (rev 16993)
+++ trunk/libiscwt-java/debian/changelog	2013-07-05 13:15:29 UTC (rev 16994)
@@ -12,8 +12,12 @@
     - d/patches/java7-compat.patch: Update usage of FontManager for
       Java 7.
 
- -- Miguel Landaeta <miguel at miguel.cc>  Tue, 02 Jul 2013 22:10:27 -0300
+  [ ShuxiongYe ]
+  * Compatible with both openjdk-7 and openjdk-7
+    - debian/patch/java6andjava7-compat.patch
 
+ -- ShuxiongYe <yeshuxiong at gmail.com>  Fri, 05 Jul 2013 18:59:40 +0800
+
 libiscwt-java (5.3.20100629-2) unstable; urgency=low
 
   [ Miguel Landaeta ]

Added: trunk/libiscwt-java/debian/patches/java6andjava7-compat.patch
===================================================================
--- trunk/libiscwt-java/debian/patches/java6andjava7-compat.patch	                        (rev 0)
+++ trunk/libiscwt-java/debian/patches/java6andjava7-compat.patch	2013-07-05 13:15:29 UTC (rev 16994)
@@ -0,0 +1,88 @@
+Index: libiscwt-java-5.3.20100629/src/de/intarsys/cwt/font/FontEnvironment.java
+===================================================================
+--- libiscwt-java-5.3.20100629.orig/src/de/intarsys/cwt/font/FontEnvironment.java	2013-07-03 03:10:21.395832976 +0800
++++ libiscwt-java-5.3.20100629/src/de/intarsys/cwt/font/FontEnvironment.java	2013-07-05 19:05:07.295469597 +0800
+@@ -40,7 +40,6 @@
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
+ 
+-import sun.font.FontManager;
+ import de.intarsys.cwt.freetype.Face;
+ import de.intarsys.cwt.freetype.Freetype;
+ import de.intarsys.cwt.freetype.Library;
+@@ -92,6 +91,56 @@
+ 		return fontFiles.toArray(new File[fontFiles.size()]);
+ 	}
+ 
++	
++	// sun.font.FontManager openjdk6
++	// sun.font.SunFontManager openjdk7
++	static boolean mIsOpenJDK6;
++	static Class<?> mClass;
++	static java.lang.reflect.Method mMethod;
++	static Object mContext;
++	static {
++		try {
++			mClass=Class.forName("sun.font.SunFontManager");
++			mIsOpenJDK6=false;
++		} catch (ClassNotFoundException e) {
++			mIsOpenJDK6=true;
++			try {
++				mClass=Class.forName("sun.font.FontManager");
++			} catch (ClassNotFoundException e1) {
++				// should never go here
++				e1.printStackTrace();
++			}
++		}
++		if (mIsOpenJDK6){
++			//definition = FontManager.getFontPath(true);
++			try {
++				mMethod=mClass.getMethod("getFontPath", boolean.class);
++				mContext=null;
++			} catch (SecurityException e) {
++				e.printStackTrace();
++			} catch (NoSuchMethodException e) {
++				e.printStackTrace();
++			}
++		} else {
++			// definition = sun.font.SunFontManager.getInstance().getPlatformFontPath(true); 
++			try {
++				mMethod=mClass.getMethod("getInstance");
++				mContext=mMethod.invoke(null);
++				mMethod=mClass.getMethod("getPlatformFontPath", boolean.class);
++			} catch (NoSuchMethodException e) {
++				e.printStackTrace();
++			} catch (SecurityException e) {
++				e.printStackTrace();
++			} catch (IllegalAccessException e) {
++				e.printStackTrace();
++			} catch (IllegalArgumentException e) {
++				e.printStackTrace();
++			} catch (java.lang.reflect.InvocationTargetException e) {
++				e.printStackTrace();
++			}
++		}
++	}
++
+ 	/**
+ 	 * This method determines the system's font directories.
+ 	 * 
+@@ -102,7 +151,17 @@
+ 		String definition = null;
+ 		// force FontManager initialization
+ 		Font.decode("dummy").getFamily(); //$NON-NLS-1$
+-		definition = sun.font.SunFontManager.getInstance().getPlatformFontPath(true);
++		try {
++			definition=(String)mMethod.invoke(mContext, true);
++		} catch (IllegalArgumentException e) {
++			e.printStackTrace();
++		} catch (IllegalAccessException e) {
++			e.printStackTrace();
++		} catch (java.lang.reflect.InvocationTargetException e) {
++			e.printStackTrace();
++		} catch (java.lang.ClassCastException e){
++			e.printStackTrace();
++		}
+ 		if (definition == null) {
+ 			return new File[0];
+ 		}

Modified: trunk/libiscwt-java/debian/patches/series
===================================================================
--- trunk/libiscwt-java/debian/patches/series	2013-07-05 10:40:34 UTC (rev 16993)
+++ trunk/libiscwt-java/debian/patches/series	2013-07-05 13:15:29 UTC (rev 16994)
@@ -1 +1,2 @@
 java7-compat.patch
+java6andjava7-compat.patch




More information about the pkg-java-commits mailing list