Fixes a possible NullPointerException.

cusax-fix
Lyubomir Marinov 15 years ago
parent e4259e9b69
commit 42bfa11626

@ -544,9 +544,7 @@ void start(BundleContext bc)
this.started = true;
// retrieve a reference to the FileAccessService
ServiceReference faServiceReference = bc.getServiceReference(
FileAccessService.class.getName());
this.faService = (FileAccessService) bc.getService(faServiceReference);
this.faService = ServiceUtils.getService(bc, FileAccessService.class);
try
{

@ -439,11 +439,6 @@ private static int getMajorOSVersion()
*/
public FailSafeTransaction createFailSafeTransaction(File file)
{
if (file == null)
{
return null;
}
return new FailSafeTransactionImpl(file);
return (file == null) ? null : new FailSafeTransactionImpl(file);
}
}

@ -216,6 +216,8 @@ public synchronized Component getComponent()
componentClassName.append(JAWTRenderer.class.getName());
if (USE_MACOSX_CALAYERS && OSUtils.IS_MAC)
componentClassName.append("Swing");
else if (OSUtils.IS_ANDROID)
componentClassName.append("Android");
componentClassName.append("VideoComponent");
Class<?> componentClass;

@ -21,6 +21,9 @@ public class OSUtils
/** <tt>true</tt> if architecture is 64 bit. */
public static final boolean IS_64_BIT;
/** <tt>true</tt> if OS is Android */
public static final boolean IS_ANDROID;
/** <tt>true</tt> if OS is Linux. */
public static final boolean IS_LINUX;
@ -64,6 +67,7 @@ public class OSUtils
if (osName == null)
{
IS_ANDROID = false;
IS_LINUX = false;
IS_MAC = false;
IS_WINDOWS = false;
@ -73,7 +77,18 @@ public class OSUtils
}
else if (osName.startsWith("Linux"))
{
IS_LINUX = true;
String javaVmName = System.getProperty("java.vm.name");
if ((javaVmName != null) && javaVmName.equalsIgnoreCase("Dalvik"))
{
IS_ANDROID = true;
IS_LINUX = false;
}
else
{
IS_ANDROID = false;
IS_LINUX = true;
}
IS_MAC = false;
IS_WINDOWS = false;
IS_WINDOWS_VISTA = false;
@ -82,6 +97,7 @@ else if (osName.startsWith("Linux"))
}
else if (osName.startsWith("Mac"))
{
IS_ANDROID = false;
IS_LINUX = false;
IS_MAC = true;
IS_WINDOWS = false;
@ -91,6 +107,7 @@ else if (osName.startsWith("Mac"))
}
else if (osName.startsWith("Windows"))
{
IS_ANDROID = false;
IS_LINUX = false;
IS_MAC = false;
IS_WINDOWS = true;
@ -100,6 +117,7 @@ else if (osName.startsWith("Windows"))
}
else if (osName.startsWith("FreeBSD"))
{
IS_ANDROID = false;
IS_LINUX = false;
IS_MAC = false;
IS_WINDOWS = false;
@ -109,6 +127,7 @@ else if (osName.startsWith("FreeBSD"))
}
else
{
IS_ANDROID = false;
IS_LINUX = false;
IS_MAC = false;
IS_WINDOWS = false;

Loading…
Cancel
Save