import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
* @param device The device where the event is created.
* @param remoteCSPath The absolute path on the given device.
*/
- public void fileCreated(IDevice device, String remoteCSPath);
+ void fileCreated(IDevice device, String remoteCSPath);
}
\ No newline at end of file
*/
public interface IDevice {
/** Serial number of the first connected emulator. */
- public final static String FIRST_EMULATOR_SN = "emulator-26100"; //$NON-NLS-1$
+ String FIRST_EMULATOR_SN = "emulator-26100"; //$NON-NLS-1$
/** Device change bit mask: {@link DeviceState} change. */
- public static final int CHANGE_STATE = 0x0001;
+ int CHANGE_STATE = 0x0001;
/** Device change bit mask: {@link Client} list change. */
- public static final int CHANGE_CLIENT_LIST = 0x0002;
+ int CHANGE_CLIENT_LIST = 0x0002;
/** Device change bit mask: build info change. */
- public static final int CHANGE_BUILD_INFO = 0x0004;
+ int CHANGE_BUILD_INFO = 0x0004;
/**
* The architecture of a device.
/**
* Returns the serial number of the device.
*/
- public String getSerialNumber();
+ String getSerialNumber();
/**
* Returns the name of the device.
*/
- public String getDeviceName();
+ String getDeviceName();
- public DeviceState getState();
+ DeviceState getState();
/**
* Returns if the device is ready.
*
* @return <code>true</code> if {@link #getState()} returns {@link DeviceState#ONLINE}.
*/
- public boolean isOnline();
+ boolean isOnline();
/**
* Returns <code>true</code> if the device is an emulator.
*/
- public boolean isEmulator();
+ boolean isEmulator();
/**
* Returns {@link Arch} about device architecture.
*/
- public Arch getArch();
+ Arch getArch();
/**
* Returns if the device is offline.
*
* @return <code>true</code> if {@link #getState()} returns {@link DeviceState#OFFLINE}.
*/
- public boolean isOffline();
+ boolean isOffline();
/**
* Returns a {@link SyncService} object to push / pull files to and from the device.
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException if the connection with sdb failed.
*/
- public SyncService getSyncService()
+ SyncService getSyncService()
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* Returns a {@link FileListingService} for this device.
*/
- public FileListingService getFileListingService();
+ FileListingService getFileListingService();
/**
* Executes a shell command on the device and return SdbShellProcess
*
* @see SdbShellProcess
*/
- public SdbShellProcess executeShellCommand(String command) throws IOException;
+ SdbShellProcess executeShellCommand(String command) throws IOException;
/**
* Executes a shell command on the device, and sends the result to a <var>receiver</var>
* @see #executeShellCommand(String, IShellOutputReceiver, int)
* @see SdbPreferences#getTimeOut()
*/
- public void executeShellCommand(String command, IShellOutputReceiver receiver)
+ void executeShellCommand(String command, IShellOutputReceiver receiver)
throws TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException,
IOException;
*
* @see SdbPreferences#getTimeOut()
*/
- public void executeShellCommand(String command, IShellOutputReceiver receiver,
+ void executeShellCommand(String command, IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
throws TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException,
IOException;
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException in case of I/O error on the connection.
*/
- public void runEventLogService(LogReceiver receiver)
+ void runEventLogService(LogReceiver receiver)
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException in case of I/O error on the connection.
*/
- public void runLogService(String logname, LogReceiver receiver)
+ void runLogService(String logname, LogReceiver receiver)
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException in case of I/O error on the connection.
*/
- public void createForward(int localPort, int remotePort)
+ void createForward(int localPort, int remotePort)
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException in case of I/O error on the connection.
*/
- public void removeForward(int localPort, int remotePort)
+ void removeForward(int localPort, int remotePort)
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* @throws SdbCommandRejectedException if sdb rejects the command
* @throws IOException in case of I/O error on the connection.
*/
- public String syncPackageToDevice(String localFilePath)
+ String syncPackageToDevice(String localFilePath)
throws TimeoutException, SdbCommandRejectedException, IOException;
/**
* performing the action.
* @throws IOException if file removal failed
*/
- public void removeRemotePackage(String remoteFilePath)
+ void removeRemotePackage(String remoteFilePath)
throws TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException,
IOException;
}
* @param offset The offset at which the new data starts.
* @param length The length of the new data.
*/
- public void addOutput(byte[] data, int offset, int length);
+ void addOutput(byte[] data, int offset, int length);
/**
* Called at the end of the process execution (unless the process was
* canceled). This allows the receiver to terminate and flush whatever
* data was not yet processed.
*/
- public void flush();
+ void flush();
/**
* Cancel method to stop the execution of the remote shell command.
* @return true to cancel the execution of the command.
*/
- public boolean isCancelled();
+ boolean isCancelled();
};
* Sent when a new {@link LogEntry} has been parsed by the {@link LogReceiver}.
* @param entry the new log entry.
*/
- public void newEntry(LogEntry entry);
+ void newEntry(LogEntry entry);
/**
* Sent when new raw data is coming from the log service.
* @param offset the offset into the buffer signaling the beginning of the new data.
* @param length the length of the new data.
*/
- public void newData(byte[] data, int offset, int length);
+ void newData(byte[] data, int offset, int length);
}
/** Current {@link LogEntry} being read, before sending it to the listener. */
* Sent when the transfer starts
* @param totalWork the total amount of work.
*/
- public void start(int totalWork);
+ void start(int totalWork);
/**
* Sent when the transfer is finished or interrupted.
*/
- public void stop();
+ void stop();
/**
* Sent to query for possible cancellation.
* @return true if the transfer should be stopped.
*/
- public boolean isCanceled();
+ boolean isCanceled();
/**
* Sent when a sub task is started.
* @param name the name of the sub task.
*/
- public void startSubTask(String name);
+ void startSubTask(String name);
/**
* Sent when some progress have been made.
* @param work the amount of work done.
*/
- public void advance(int work);
+ void advance(int work);
}
/**
public interface SignatureConstants {
- public static final String AUTHOR = "author";
- public static final String DISTRIBUTOR = "distributor";
- public static final String DISTRIBUTOR_1ST = DISTRIBUTOR + "1";
- public static final String DISTRIBUTOR_2ND = DISTRIBUTOR + "2";
+ String AUTHOR = "author";
+ String DISTRIBUTOR = "distributor";
+ String DISTRIBUTOR_1ST = DISTRIBUTOR + "1";
+ String DISTRIBUTOR_2ND = DISTRIBUTOR + "2";
}
package org.tizen.common.sign.signer;
-import org.tizen.common.core.application.InstallPathConfig;
+import hashsign.HashingSigning;
+
import org.tizen.common.sign.util.SigningProfileUtil;
-import org.tizen.common.util.FileUtil;
import org.tizen.common.util.StringUtil;
-import hashsign.HashingSigning;
public class TizenSigner {
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.security.InvalidKeyException;
import java.util.ArrayList;
import java.util.List;
+import javax.crypto.BadPaddingException;
+import javax.crypto.IllegalBlockSizeException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.preference.IPreferenceStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
String tempPass = itemElement.getAttribute(ITEM_ATTR_PASS);
try {
tempPass = CipherUtil.getDecryptedString(tempPass);
- } catch (Exception e) {
+ }
+ catch ( InvalidKeyException e)
+ {
+ logger.error("Exception occurred while decrypting signing password", e);
+ }
+ catch (IllegalBlockSizeException e)
+ {
+ logger.error("Exception occurred while decrypting signing password", e);
+ }
+ catch (BadPaddingException e)
+ {
logger.error("Exception occurred while decrypting signing password", e);
}
final String pass = tempPass;
}
IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(location);
xmlFile.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (Exception e) {
+ }
+ catch ( final ParserConfigurationException e )
+ {
+ org.tizen.common.util.log.Logger.error( e.getMessage(), e );
+ }
+ catch ( final FileNotFoundException e )
+ {
+ org.tizen.common.util.log.Logger.error( e.getMessage(), e );
+ }
+ catch ( final CoreException e )
+ {
org.tizen.common.util.log.Logger.error( e.getMessage(), e );
}
}
String pass = new String(item.getPassword());
try {
pass = CipherUtil.getEncryptedString(pass);
- } catch (Exception e) {
+ }
+ catch ( final InvalidKeyException e )
+ {
+ logger.error("Exception occurred while encrypting signing password", e);
+ }
+ catch ( final IllegalBlockSizeException e )
+ {
+ logger.error("Exception occurred while encrypting signing password", e);
+ }
+ catch ( final BadPaddingException e )
+ {
logger.error("Exception occurred while encrypting signing password", e);
}
passAttr.setNodeValue(pass);
String pass = profileItemElement.getAttribute(SigningProfileUtil.ITEM_ATTR_PASS);
try {
pass = CipherUtil.getDecryptedString(pass);
- } catch (Exception e) {
+ }
+ catch (InvalidKeyException e)
+ {
+ logger.error("Exception occurred while decrypting signing password", e);
+ }
+ catch (IllegalBlockSizeException e)
+ {
+ logger.error("Exception occurred while decrypting signing password", e);
+ } catch (BadPaddingException e)
+ {
logger.error("Exception occurred while decrypting signing password", e);
}
profileItem.setPassword(pass.toCharArray());
package org.tizen.common;
import java.math.BigInteger;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
+import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
+import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
*/
@Override
public String create() {
- String appID = "";
try {
- appID = generate();
+ return generate();
} catch (Exception e) {
- logger.error( e.toString() );
+ logger.error( "Exception occurred:", e );
+ return "";
}
- return appID;
}
final char[] PSEUDO_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7',
"PRIVT",
"WIDGT"
};
- // Number of reserved AppID
- static final int RESERVED_APPID_NUMBER = 3;
-
private String convertBytesToAlphaNumeric(byte in[], int size) {
BigInteger randomBigInt = new BigInteger(in).abs();
StringBuffer out = new StringBuffer(size + 1);
return ret;
}
- private byte[] generateRandomBytes(int size) throws Exception {
+ private byte[] generateRandomBytes(int size)
+ throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
+ {
SecureRandom random = new SecureRandom();
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(128);
return cipher.doFinal(bytes);
}
- private boolean check(String appId) {
- for (int i = 0; i < RESERVED_APPID_NUMBER; ++ i) {
- if (appId.indexOf(RESERVED_APPID[i]) == 0) {
+ private boolean check( String appId ) {
+ for ( final String prefix : RESERVED_APPID )
+ {
+ if ( appId.startsWith( prefix ) )
+ {
return false;
}
}
import org.apache.log4j.spi.RepositorySelector;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.HostUtil;
import org.tizen.common.util.OSChecker;
-import org.tizen.common.util.ObjectUtil;
-import org.tizen.common.util.PluginUtil;
-import org.tizen.common.util.StringUtil;
import org.tizen.common.util.log.Logger;
import org.tizen.sdblib.CrashReportService;
import org.tizen.sdblib.ICrashReportServiceListener;
* \r
* @return default build configuration\r
*/\r
- public String getDefaultConfiguration();\r
+ String getDefaultConfiguration();\r
\r
/**\r
* Returns a native's binary name.\r
* \r
* @return a binary name\r
*/\r
- public String getBinaryName();\r
+ String getBinaryName();\r
\r
/**\r
* Create a appid.\r
* \r
* @return a new appid\r
*/\r
- public String generateAppId();\r
+ String generateAppId();\r
\r
/**\r
* Return the appid from a manifest.xml.\r
* \r
* @return a appid\r
*/\r
- public String getAppId();\r
+ String getAppId();\r
\r
/**\r
* Return a project type which is supported by Tizen.\r
* \r
* @return a project type\r
*/\r
- public TizenProjectType getTizenProjectType();\r
+ TizenProjectType getTizenProjectType();\r
}
\ No newline at end of file
break;\r
}\r
variableWriter.write( (char) ch );\r
+ break;\r
+ default:\r
+ break;\r
}\r
}\r
\r
getFile(
final String path
)
- throws IOException
{
logger.trace( "Path :{}", path );
+
+ if ( null == path )
+ {
+ return null;
+ }
final String[] fragments = getCanonicalFragments( path );
logger.debug( "in-processing directory :{}", dir );
return null;
-// throw new IOException( "Can't access " + path );
}
}
)
throws IOException
{
- File file = null;
- try {
- file = getFile( path );
- } catch ( Throwable e )
- {
- logger.warn( "Exception :{}", e );
- }
+ final File file = getFile( path );
if ( null != file )
{
file.setAttribute( name, value );
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.tizen.common.util.log.Logger;
-
-//import org.eclipse.jdt.core.IJavaProject;
-//import org.eclipse.jdt.core.JavaCore;
-//import org.eclipse.jdt.core.JavaModelException;
-//
-//import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
-//import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
-//import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
-//import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
-//import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-//import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
-//import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
/**
* Base for project property and preference pages
openWorkspacePreferences(data);
} else {
HashSet<IProject> projectsWithSpecifics= new HashSet<IProject>();
- try {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-// IProject[] projects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
- for (int i= 0; i < projects.length; i++) {
- IProject curr= projects[i];
- if (hasProjectSpecificOptions(curr.getProject())) {
- projectsWithSpecifics.add(curr);
- }
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (int i= 0; i < projects.length; i++) {
+ IProject curr= projects[i];
+ if (hasProjectSpecificOptions(curr.getProject())) {
+ projectsWithSpecifics.add(curr);
}
- } catch (Exception e) {
- Logger.log(e);
}
ProjectSelectionDialog dialog= new ProjectSelectionDialog(getShell(), projectsWithSpecifics);
if (dialog.open() == Window.OK) {
}
/* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
public IAdaptable getElement() {
*/
package org.tizen.common.ui.view.console;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.eclipse.jface.text.IDocument;
this.consoleName = newName;
Runnable runnable = new Runnable() {
public void run() {
- Class<?> cls;
- Method method;
- try {
+ Class<?> cls = null;
+ Method method = null;
+ try
+ {
cls = Class.forName("org.eclipse.ui.console.AbstractConsole");
method = cls.getDeclaredMethod("setName", String.class);
method.setAccessible(true);
method.invoke(getConsole(), consoleName);
- } catch (Exception e) {
+ }
+ catch (SecurityException e)
+ {
+ ConsolePlugin.log(e);
+ }
+ catch (IllegalArgumentException e)
+ {
+ ConsolePlugin.log(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ ConsolePlugin.log(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ ConsolePlugin.log(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ ConsolePlugin.log(e);
+ }
+ catch (InvocationTargetException e)
+ {
ConsolePlugin.log(e);
}
}
package org.tizen.common.util;
+import java.security.InvalidKeyException;
+
+import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
}
}
- private static byte[] decryptByDES(byte[] bytes) throws Exception{
+ private static byte[] decryptByDES(byte[] bytes)
+ throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
DES_CIPHER.init(Cipher.DECRYPT_MODE, SECRETE_KEY);
return DES_CIPHER.doFinal(bytes);
}
- private static byte[] encryptByDES(String s) throws Exception {
+ private static byte[] encryptByDES(String s)
+ throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
DES_CIPHER.init(Cipher.ENCRYPT_MODE, SECRETE_KEY);
return DES_CIPHER.doFinal(s.getBytes());
* @param s cipher message which will be decrypted.
* @return decrypted plain text.
* @author Ho Namkoong {@literal <ho.namkoong@samsung.com>} (S-Core)
+ * @throws BadPaddingException
+ * @throws IllegalBlockSizeException
+ * @throws InvalidKeyException
*/
- public static String getDecryptedString(String s) throws Exception {
+ public static String getDecryptedString(String s)
+ throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
return new String(decryptByDES(Base64.decode(s)));
}
* @param s plain text which will be encrypted.
* @return encrypted cipher text.
* @author Ho Namkoong {@literal <ho.namkoong@samsung.com>} (S-Core)
+ * @throws BadPaddingException
+ * @throws IllegalBlockSizeException
+ * @throws InvalidKeyException
*/
- public static String getEncryptedString(String s) throws Exception {
+ public static String getEncryptedString(String s)
+ throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
return new String(Base64.encode(encryptByDES(s)));
}
}
do {
c = contentsReader.read(chars);
if (c == -1)
+ {
break;
+ }
buffer.append(chars, 0, c);
} while (c != -1);
contentsReader.close();
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
* @param expectedResult
* @throws Exception
*/
- public void runCommand(String command, boolean rCode, String expectedResult) throws Exception;
+ void runCommand(String command, boolean rCode, String expectedResult) throws Exception;
/**
* get command's result all line array
*
* @return all result line
*/
- public String[] getResultLineStrings();
+ String[] getResultLineStrings();
}
Properties props = new Properties();
try {
props.load(inputStream);
- } catch (IOException e) {
+ } catch ( final IOException e ) {
+ logger.info( "Ignore exception" );
} finally {
tryClose( inputStream );
}
try {
props.store(outputStream, null);
} catch (IOException e) {
+ logger.info( "Ignore exception" );
return false;
} finally {
tryClose( outputStream );
}
catch ( IOException e )
{
+ logger.info( "Ignore exception" );
return false;
} finally {
tryClose( writer );
*/\r
package org.tizen.common.util.cache;\r
\r
+import static org.tizen.common.util.ArrayUtil.pickupFirst;\r
+\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
* @return Font or null on error\r
*/\r
synchronized public static Font getFont(FontData fd) {\r
- try {\r
- boolean disposed = false;\r
- OneFont toRemove = null;\r
- for (OneFont of : _existing) {\r
- if (of.matches(fd)) {\r
- if (of.getFont().isDisposed()) {\r
- disposed = true;\r
- toRemove = of;\r
- break;\r
- }\r
-\r
- return of.getFont(); \r
+ if ( null == fd )\r
+ {\r
+ return null;\r
+ }\r
+ boolean disposed = false;\r
+ OneFont toRemove = null;\r
+ for (OneFont of : _existing) {\r
+ if (of.matches(fd)) {\r
+ if (of.getFont().isDisposed()) {\r
+ disposed = true;\r
+ toRemove = of;\r
+ break;\r
}\r
- }\r
- if (disposed) {\r
- _existing.remove(toRemove);\r
- }\r
\r
- OneFont of = new OneFont(fd);\r
- _existing.add(of);\r
- return of.getFont();\r
- } catch (Exception err) {\r
- err.printStackTrace();\r
+ return of.getFont(); \r
+ }\r
+ }\r
+ if (disposed) {\r
+ _existing.remove(toRemove);\r
}\r
\r
- return null;\r
+ OneFont of = new OneFont(fd);\r
+ _existing.add(of);\r
+ return of.getFont();\r
}\r
\r
synchronized public static int getCount() {\r
* @return Font or null on error\r
*/\r
public static Font getFont(Font font) {\r
- try {\r
- if (font == null || font.isDisposed())\r
- {\r
- return null;\r
- }\r
-\r
- FontData fd = font.getFontData()[0];\r
- return getFont(fd);\r
-\r
- } catch (Exception err) {\r
- err.printStackTrace();\r
+ if (font == null || font.isDisposed())\r
+ {\r
+ return null;\r
}\r
\r
- return null;\r
+ FontData fd = pickupFirst( font.getFontData() );\r
+ return getFont(fd);\r
}\r
\r
/**\r
* @return Font or null on error\r
*/\r
synchronized public static Font getFont(String fontName, int height, int style) {\r
- try {\r
- boolean disposed = false;\r
- OneFont toRemove = null;\r
- for (OneFont of : _existing) {\r
- if (of.getName().equals(fontName) && of.getHeight() == height && of.getStyle() == style) {\r
- if (of.getFont().isDisposed()) {\r
- disposed = true;\r
- toRemove = of;\r
- break;\r
- }\r
- return of.getFont();\r
+ if ( null == fontName )\r
+ {\r
+ return null;\r
+ }\r
+ boolean disposed = false;\r
+ OneFont toRemove = null;\r
+ for (OneFont of : _existing) {\r
+ if (of.getName().equals(fontName) && of.getHeight() == height && of.getStyle() == style) {\r
+ if (of.getFont().isDisposed()) {\r
+ disposed = true;\r
+ toRemove = of;\r
+ break;\r
}\r
+ return of.getFont();\r
}\r
- if (disposed) {\r
- _existing.remove(toRemove);\r
- }\r
-\r
- OneFont of = new OneFont(fontName, height, style);\r
- _existing.add(of);\r
- return of.getFont();\r
}\r
- catch (Exception err) {\r
- err.printStackTrace();\r
+ if (disposed) {\r
+ _existing.remove(toRemove);\r
}\r
\r
- return null;\r
+ OneFont of = new OneFont(fontName, height, style);\r
+ _existing.add(of);\r
+ return of.getFont();\r
}\r
}\r
\r