Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ve-dev] [Minor patch] NPE fix in ChildRelationshipDecoderHelper.java

Hi, here's another minor patch to get VE and SWT to work better together. The problem is that no write method is set in this call, so I added a check.
Maybe we should fix the cause of the NPE instead of checking for it?

I posted another patch in the newsgroup before I realized there was a dev list.

Again, I've very little knowledge on whats going on under the hood. For example when adding a FormAttachment there seem to be some mixup on how to set it to the FormData. The correct syntax is for example "formData.left = formAttachment;" but VE creates "formData.left(formAttachment);". Where it goes wrong I've no idea, so if someone could enlighten
me I would be grateful!

Regards.

Index: codegen/org/eclipse/ve/internal/java/codegen/java/ChildRelationshipDecoderHelper.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ve/plugins/org.eclipse.ve.java.core/codegen/org/eclipse/ve/internal/java/codegen/java/ChildRelationshipDecoderHelper.java,v
retrieving revision 1.25
diff -u -r1.25 ChildRelationshipDecoderHelper.java
--- codegen/org/eclipse/ve/internal/java/codegen/java/ChildRelationshipDecoderHelper.java 16 Sep 2005 13:34:48 -0000 1.25 +++ codegen/org/eclipse/ve/internal/java/codegen/java/ChildRelationshipDecoderHelper.java 18 Apr 2009 10:07:50 -0000
@@ -555,12 +555,15 @@
    protected int getSFPriority() {
        if(fFmapper!=null){
            String methodName = null;
-            if (fFmapper.getDecorator() != null)
+ if (fFmapper.getDecorator() != null && fFmapper.getDecorator().isSetWriteMethod()) { methodName = fFmapper.getDecorator().getWriteMethod().getName();
-            if (methodName == null)
+            }
+            if (methodName == null) {
methodName = AbstractFeatureMapper.getPropertyMethod(fExpr);
-            if(methodName!=null)
+            }
+            if(methodName!=null) {
                return fFmapper.getFeaturePriority(methodName);
+            }
        }
        return super.getSFPriority();
    }


Back to the top