javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java Wed Sep 15 12:05:25 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java Wed Oct 13 14:23:59 2010 +0300
@@ -35,7 +35,6 @@
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.internal.extension.ImageUtil;
/**
* Installation step PrepareSplashScreen prepares splash
@@ -107,21 +106,15 @@
for (int i = 0; i < tokens.length; i++)
{
tokens[i] = tokens[i].trim();
- imageSizes[i] = getImageSize(tokens[i], ball.iJarFilename);
- if (imageSizes[i] == null)
+ currentImage = loadImage(tokens[i], ball.iJarFilename);
+ if (currentImage == null)
{
- // Couldn't get image size, try to get it by loading
- // the image.
- currentImage = loadImage(tokens[i], ball.iJarFilename);
- if (currentImage == null)
- {
- // Image loading failed, proceed to the next image.
- imageSizes[i] = new Point(0, 0);
- continue;
- }
- imageSizes[i] = new Point(
- currentImage[0].width, currentImage[0].height);
+ // Image loading failed, proceed to the next image.
+ imageSizes[i] = new Point(0, 0);
+ continue;
}
+ imageSizes[i] = new Point(
+ currentImage[0].width, currentImage[0].height);
}
// Choose the images which best fill the portrait and
// landscape screens.
@@ -244,74 +237,6 @@
}
/**
- * Gets image size for specified image from given jar file.
- *
- * @param aResource image file name
- * @param aJar jar file name
- * @return image size, or null if getting image size fails
- */
- private static Point getImageSize(String aResource, String aJar)
- {
- Point result = null;
- JarFile jarFile = null;
- InputStream is = null;
- try
- {
- // Open jar file and input stream.
- jarFile = new JarFile(aJar);
- is = jarFile.getInputStream(
- new JarEntry(FileUtils.trimJarEntry(aResource)));
- if (is != null)
- {
- result = ImageUtil.getImageSize(is);
- if (result != null)
- {
- Log.log("Image size for " + aResource + " from " +
- aJar + ": " + result);
- }
- }
- else
- {
- Log.logWarning("Image " + aResource + " not found from " + aJar);
- }
- }
- catch (Throwable t)
- {
- Log.logWarning("Loading image " + aResource + " from " +
- aJar + " failed", t);
- }
- finally
- {
- // Close streams and jar file.
- if (is != null)
- {
- try
- {
- is.close();
- is = null;
- }
- catch (IOException ioe)
- {
- Log.logWarning("Closing InputStream failed", ioe);
- }
- }
- if (jarFile != null)
- {
- try
- {
- jarFile.close();
- jarFile = null;
- }
- catch (IOException ioe)
- {
- Log.logWarning("Closing " + aJar + " failed", ioe);
- }
- }
- }
- return result;
- }
-
- /**
* Loads image from specified resource from given jar file.
*
* @param aResource resource file name
@@ -327,8 +252,8 @@
{
// Open jar file and input stream.
jarFile = new JarFile(aJar);
- is = jarFile.getInputStream(
- new JarEntry(FileUtils.trimJarEntry(aResource)));
+ is = jarFile.getInputStream
+ (new JarEntry(FileUtils.trimJarEntry(aResource)));
if (is != null)
{
result = (new ImageLoader()).load(is);
@@ -394,8 +319,8 @@
{
// Open jar file and input and output streams.
jarFile = new JarFile(aJar);
- is = jarFile.getInputStream(
- new JarEntry(FileUtils.trimJarEntry(aResource)));
+ is = jarFile.getInputStream
+ (new JarEntry(FileUtils.trimJarEntry(aResource)));
os = FileUtils.getOutputStream(imageFilename);
// Copy the image data from InputStream to OutputStream.
byte[] buf = new byte[16384];