Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While Running .fdepl files with commonapi-core-generator getting an error #45

Open
swatitupat123 opened this issue Jan 29, 2024 · 1 comment

Comments

@swatitupat123
Copy link

While running .fdepl files with commonapi getting an error message as the one which is mentioned below -

  • Failed to generate code for C:\f-file_structure\crossif13\idl\instances\MGU\de.infotainment.navigation.mapcontrol.fdepl due to null

raise CommonApiGenError("call of '%s' failed: code %s" % (call, ret_code))

main__.CommonApiGenError: call of 'C:\TAF\eclipse_workspace\CommonAPI_3.2\commonapi_core_generator-3.2.12\commonapi-core-generator-windows-x86_64 -sk -d src-gen\core C:\f-file_structure\crossif13\idl\instances\MGU\de.infotainment.navigation.mapcontrol.fdepl' failed: code 1

@dprogm
Copy link

dprogm commented Feb 17, 2024

@swatitupat123 Can you tell me whether you are using enumeration inheritance (enumeration X extends Y {}) in your Franca IDL? I am experiencing the same issue and boiled it down to this inheritance relationship.

The problem is that when trying to access the currents enumeration width by calling getSomeIpEnumWidth(_obj) on an enumeration that has a base type this leads to a null pointer. Therefore the subsequent comparison with the base width is going to fail. The following snippet silently ignores this null pointer, but this means we wouldn't have any width in case of an inheritance relation.

diff --git a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
index 03e4e50..9361f28 100644
--- a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
+++ b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend
@@ -336,7 +336,11 @@ class FrancaSomeIPDeploymentAccessorHelper {
                     if (itsBaseAccessor !== null)
                         enumBaseWidth = itsBaseAccessor.getSomeIpEnumWidthHelper(_obj.base)
                 }
-                return (enumBaseWidth !== null && enumBaseWidth > enumWidth ? enumBaseWidth : enumWidth)
+
+                if(enumBaseWidth !== null && enumWidth !== null && enumBaseWidth > enumWidth) {
+                    enumWidth = enumBaseWidth;
+                }
+                return enumWidth;
             }
 
             if (_obj instanceof FTypeDef) {
@@ -362,7 +366,10 @@ class FrancaSomeIPDeploymentAccessorHelper {
                     if (itsBaseAccessor !== null)
                         enumBaseBitWidth = itsBaseAccessor.getSomeIpEnumBitWidthHelper(_obj.base)
                 }
-                return (enumBaseBitWidth !== null && enumBaseBitWidth > enumBitWidth ? enumBaseBitWidth : enumBitWidth)
+                if(enumBaseBitWidth !== null && enumBitWidth !== null && enumBaseBitWidth > enumBitWidth) {
+                    enumBitWidth = enumBaseBitWidth;
+                }
+                return enumBitWidth;
             }
 
             if (_obj instanceof FTypeDef) {
@@ -1046,7 +1053,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
                 return itsBaseAccessor.hasDeployment(_enum.base)
         }
 
-        return false 
+        return false
     }
 
     def dispatch boolean hasDeployment(PropertyAccessor _accessor, FStructType _struct) {
@@ -1217,7 +1224,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
             itsByteBufferMaxLength = _accessor.getSomeIpByteBufferMaxLength(_element)
         }
         if (itsSpecificByteBufferMaxLength !== null
-            && itsSpecificByteBufferMaxLength != itsByteBufferMaxLength 
+            && itsSpecificByteBufferMaxLength != itsByteBufferMaxLength
             && itsSpecificByteBufferMaxLength != SOMEIP_DEFAULT_MAX_LENGTH) {
             return true
         }
@@ -1250,7 +1257,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
             itsStringLengthWidth = itsBaseAccessor.getSomeIpStringLengthWidth(_element)
         }
         if (itsSpecificStringLengthWidth !== null
-            && itsSpecificStringLengthWidth != itsStringLengthWidth 
+            && itsSpecificStringLengthWidth != itsStringLengthWidth
             && itsSpecificStringLengthWidth != SOMEIP_DEFAULT_LENGTH_WIDTH) {
             return true
         }
@@ -1383,7 +1390,7 @@ class FrancaSomeIPDeploymentAccessorHelper {
 
         return false
     }
-    
+
     def boolean hasNonArrayDeployment(PropertyAccessor _accessor,
                                       FTypedElement _attribute) {
         if (_attribute.type.derived !== null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants