All of lore.kernel.org
 help / color / mirror / Atom feed
* [eclipse-poky][PATCH] Fix NullPointerException
@ 2012-09-04  8:20 David Nyström
  2012-09-04 17:21 ` Zhang, Jessica
  0 siblings, 1 reply; 4+ messages in thread
From: David Nyström @ 2012-09-04  8:20 UTC (permalink / raw)
  To: yocto; +Cc: Björn Arnelid

From: Björn Arnelid <bjorn.arnelid@enea.com>

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.

Author:    Björn Arnelid <bjorn.arnelid@enea.com>
Signed-off-by: David Nyström <david.nystrom@enea.com>
---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 6be90be..749fac7 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -100,7 +100,17 @@ public class YoctoSDKUtils {
 			File sysroot_dir = new File(sysroot_dir_str);
 			if (!sysroot_dir.exists())
 				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-			String toolchain_host_arch = findHostArch(sysroot_dir);
+			
+			String toolchain_host_arch = null;
+			
+			try 
+			{
+				toolchain_host_arch = findHostArch(sysroot_dir);
+			}
+			catch(NullPointerException e) 
+			{
+				return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+			}
 			
 			if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
 				if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
@@ -576,7 +586,7 @@ public class YoctoSDKUtils {
 	static private String findHostArch(File sysroot_dir) {
 		FilenameFilter nativeFilter = new FilenameFilter() {
 			public boolean accept(File dir, String name) {
-				if (name.endsWith("-pokysdk-linux")) {
+				if (name.endsWith("sdk-linux")) {
 					return true;
 				} else {
 					return false;
@@ -590,11 +600,11 @@ public class YoctoSDKUtils {
 		for (File file : files) {
 			if (file.isDirectory()) {
 				String path = file.getName();
-				arch = path.substring(0, path.indexOf("-pokysdk-linux"));
+				String[] subPath = path.split("-");
+				arch = subPath[0];
 			} else 
 				continue;
         }
 		return arch;
 	}
-}
-
+}
\ No newline at end of file
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [eclipse-poky][PATCH] Fix NullPointerException
  2012-09-04  8:20 [eclipse-poky][PATCH] Fix NullPointerException David Nyström
@ 2012-09-04 17:21 ` Zhang, Jessica
  2012-09-04 20:22   ` David Nyström
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Jessica @ 2012-09-04 17:21 UTC (permalink / raw)
  To: David Nystr?m, yocto; +Cc: Bj?rn Arnelid

Hi Björn,

Thanks for the patch, there's no issue as to the coding and implementation of the patch.  Just need to clarify what's the usage scenario or how did you generate your toolchain that's different from the naming convention of the sysroot directory names that's generated by poky build?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of David Nystr?m
Sent: Tuesday, September 04, 2012 1:21 AM
To: yocto@yoctoproject.org
Cc: Björn Arnelid
Subject: [yocto] [eclipse-poky][PATCH] Fix NullPointerException

From: Björn Arnelid <bjorn.arnelid@enea.com>

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.

Author:    Björn Arnelid <bjorn.arnelid@enea.com>
Signed-off-by: David Nyström <david.nystrom@enea.com>
---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 6be90be..749fac7 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -100,7 +100,17 @@ public class YoctoSDKUtils {
                        File sysroot_dir = new File(sysroot_dir_str);
                        if (!sysroot_dir.exists())
                                return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-                       String toolchain_host_arch = findHostArch(sysroot_dir);
+
+                       String toolchain_host_arch = null;
+
+                       try
+                       {
+                               toolchain_host_arch = findHostArch(sysroot_dir);
+                       }
+                       catch(NullPointerException e)
+                       {
+                               return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+                       }

                        if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
                                if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
@@ -576,7 +586,7 @@ public class YoctoSDKUtils {
        static private String findHostArch(File sysroot_dir) {
                FilenameFilter nativeFilter = new FilenameFilter() {
                        public boolean accept(File dir, String name) {
-                               if (name.endsWith("-pokysdk-linux")) {
+                               if (name.endsWith("sdk-linux")) {
                                        return true;
                                } else {
                                        return false;
@@ -590,11 +600,11 @@ public class YoctoSDKUtils {
                for (File file : files) {
                        if (file.isDirectory()) {
                                String path = file.getName();
-                               arch = path.substring(0, path.indexOf("-pokysdk-linux"));
+                               String[] subPath = path.split("-");
+                               arch = subPath[0];
                        } else
                                continue;
         }
                return arch;
        }
-}
-
+}
\ No newline at end of file
--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [eclipse-poky][PATCH] Fix NullPointerException
  2012-09-04 17:21 ` Zhang, Jessica
@ 2012-09-04 20:22   ` David Nyström
  2012-09-04 21:50     ` Zhang, Jessica
  0 siblings, 1 reply; 4+ messages in thread
From: David Nyström @ 2012-09-04 20:22 UTC (permalink / raw)
  To: yocto, jessica.zhang; +Cc: Björn Arnelid

[-- Attachment #1: Type: text/plain, Size: 4666 bytes --]

Hi,

The Nullpointer exception is thrown when trying to use a toolchain tarball
which has DISTRO set to something else than poky.
This would generate the name *${DISTRO}sdk* in the sysroot under /opt/${DISTRO}/1.2/sysroots/

Br,
David


Sent from my Android phone using TouchDown (www.nitrodesk.com)

-----Original Message-----
From: Zhang, Jessica [jessica.zhang@intel.com]
Received: Tuesday, 04 Sep 2012, 19:21
To: David Nyström [David.Nystrom@enea.com]; yocto@yoctoproject.org [yocto@yoctoproject.org]
CC: Björn Arnelid [Bjorn.Arnelid@enea.com]
Subject: RE: [yocto] [eclipse-poky][PATCH] Fix NullPointerException

Hi Björn,

Thanks for the patch, there's no issue as to the coding and implementation of the patch.  Just need to clarify what's the usage scenario or how did you generate your toolchain that's different from the naming convention of the sysroot directory names that's generated by poky build?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] On Behalf Of David Nystr?m
Sent: Tuesday, September 04, 2012 1:21 AM
To: yocto@yoctoproject.org
Cc: Björn Arnelid
Subject: [yocto] [eclipse-poky][PATCH] Fix NullPointerException

From: Björn Arnelid <bjorn.arnelid@enea.com>

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.

Author:    Björn Arnelid <bjorn.arnelid@enea.com>
Signed-off-by: David Nyström <david.nystrom@enea.com>
---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 6be90be..749fac7 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -100,7 +100,17 @@ public class YoctoSDKUtils {
                        File sysroot_dir = new File(sysroot_dir_str);
                        if (!sysroot_dir.exists())
                                return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-                       String toolchain_host_arch = findHostArch(sysroot_dir);
+
+                       String toolchain_host_arch = null;
+
+                       try
+                       {
+                               toolchain_host_arch = findHostArch(sysroot_dir);
+                       }
+                       catch(NullPointerException e)
+                       {
+                               return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+                       }

                        if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
                                if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
@@ -576,7 +586,7 @@ public class YoctoSDKUtils {
        static private String findHostArch(File sysroot_dir) {
                FilenameFilter nativeFilter = new FilenameFilter() {
                        public boolean accept(File dir, String name) {
-                               if (name.endsWith("-pokysdk-linux")) {
+                               if (name.endsWith("sdk-linux")) {
                                        return true;
                                } else {
                                        return false;
@@ -590,11 +600,11 @@ public class YoctoSDKUtils {
                for (File file : files) {
                        if (file.isDirectory()) {
                                String path = file.getName();
-                               arch = path.substring(0, path.indexOf("-pokysdk-linux"));
+                               String[] subPath = path.split("-");
+                               arch = subPath[0];
                        } else
                                continue;
         }
                return arch;
        }
-}
-
+}
\ No newline at end of file
--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

[-- Attachment #2: Type: text/html, Size: 10380 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [eclipse-poky][PATCH] Fix NullPointerException
  2012-09-04 20:22   ` David Nyström
@ 2012-09-04 21:50     ` Zhang, Jessica
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Jessica @ 2012-09-04 21:50 UTC (permalink / raw)
  To: David Nystr?m, yocto; +Cc: Bj?rn Arnelid

[-- Attachment #1: Type: text/plain, Size: 5186 bytes --]

Merged to master, thanks!



From: David Nyström [mailto:David.Nystrom@enea.com]
Sent: Tuesday, September 04, 2012 1:23 PM
To: yocto@yoctoproject.org; Zhang, Jessica
Cc: Björn Arnelid
Subject: RE: [yocto] [eclipse-poky][PATCH] Fix NullPointerException



Hi,

The Nullpointer exception is thrown when trying to use a toolchain tarball
which has DISTRO set to something else than poky.
This would generate the name *${DISTRO}sdk* in the sysroot under /opt/${DISTRO}/1.2/sysroots/

Br,
David


Sent from my Android phone using TouchDown (www.nitrodesk.com<http://www.nitrodesk.com>)

-----Original Message-----
From: Zhang, Jessica [jessica.zhang@intel.com]
Received: Tuesday, 04 Sep 2012, 19:21
To: David Nyström [David.Nystrom@enea.com]; yocto@yoctoproject.org<mailto:yocto@yoctoproject.org> [yocto@yoctoproject.org]
CC: Björn Arnelid [Bjorn.Arnelid@enea.com]
Subject: RE: [yocto] [eclipse-poky][PATCH] Fix NullPointerException

Hi Björn,

Thanks for the patch, there's no issue as to the coding and implementation of the patch.  Just need to clarify what's the usage scenario or how did you generate your toolchain that's different from the naming convention of the sysroot directory names that's generated by poky build?

Thanks,
Jessica

-----Original Message-----
From: yocto-bounces@yoctoproject.org<mailto:yocto-bounces@yoctoproject.org> [mailto:yocto-bounces@yoctoproject.org] On Behalf Of David Nystr?m
Sent: Tuesday, September 04, 2012 1:21 AM
To: yocto@yoctoproject.org<mailto:yocto@yoctoproject.org>
Cc: Björn Arnelid
Subject: [yocto] [eclipse-poky][PATCH] Fix NullPointerException

From: Björn Arnelid <bjorn.arnelid@enea.com<mailto:bjorn.arnelid@enea.com>>

[Yocto Bugzilla] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=3019

When using a Toolchain where sysroot is not named <arch>-pokysdk-linux a NullPointerException is thrown when trying to apply changes in Yocto Preferences.
It should be possible to use Toolchains with a sysroot named <arch>-<organizationName>sdk-linux with the plugin.

static private String findHostArch(File sysroot_dir) now accept folders named *sdk-linux instead of *-pokysdk-linux. checkYoctoSDK will also return SDKCheckResults.TOOLCHAIN_NO_SYSROOT if findHostArch returns null.

Author:    Björn Arnelid <bjorn.arnelid@enea.com<mailto:bjorn.arnelid@enea.com>>
Signed-off-by: David Nyström <david.nystrom@enea.com<mailto:david.nystrom@enea.com>>
---
 .../src/org/yocto/sdk/ide/YoctoSDKUtils.java       |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
index 6be90be..749fac7 100644
--- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
+++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/YoctoSDKUtils.java
@@ -100,7 +100,17 @@ public class YoctoSDKUtils {
                        File sysroot_dir = new File(sysroot_dir_str);
                        if (!sysroot_dir.exists())
                                return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
-                       String toolchain_host_arch = findHostArch(sysroot_dir);
+
+                       String toolchain_host_arch = null;
+
+                       try
+                       {
+                               toolchain_host_arch = findHostArch(sysroot_dir);
+                       }
+                       catch(NullPointerException e)
+                       {
+                               return SDKCheckResults.TOOLCHAIN_NO_SYSROOT;
+                       }

                        if (!toolchain_host_arch.equalsIgnoreCase(platform)) {
                                if (!platform.matches("i\\d86") || !toolchain_host_arch.matches("i\\d86"))
@@ -576,7 +586,7 @@ public class YoctoSDKUtils {
        static private String findHostArch(File sysroot_dir) {
                FilenameFilter nativeFilter = new FilenameFilter() {
                        public boolean accept(File dir, String name) {
-                               if (name.endsWith("-pokysdk-linux")) {
+                               if (name.endsWith("sdk-linux")) {
                                        return true;
                                } else {
                                        return false;
@@ -590,11 +600,11 @@ public class YoctoSDKUtils {
                for (File file : files) {
                        if (file.isDirectory()) {
                                String path = file.getName();
-                               arch = path.substring(0, path.indexOf("-pokysdk-linux"));
+                               String[] subPath = path.split("-");
+                               arch = subPath[0];
                        } else
                                continue;
         }
                return arch;
        }
-}
-
+}
\ No newline at end of file
--
1.7.9.5

_______________________________________________
yocto mailing list
yocto@yoctoproject.org<mailto:yocto@yoctoproject.org>
https://lists.yoctoproject.org/listinfo/yocto


[-- Attachment #2: Type: text/html, Size: 13748 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-04 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04  8:20 [eclipse-poky][PATCH] Fix NullPointerException David Nyström
2012-09-04 17:21 ` Zhang, Jessica
2012-09-04 20:22   ` David Nyström
2012-09-04 21:50     ` Zhang, Jessica

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.