Re: [PATCH] Support

From: Jephte CLAIN (Jephte.Clai..niv-reunion.fr)
Date: Wed Apr 15 2009 - 00:46:34 EDT

  • Next message: David Avendasora: "Re: New hotness - Frameworks in Projects, Libraries, or both?"

    Timo Hoepfner a écrit :
    > Grmpf, this breaks the ant build for me again:
    >
    > ...
    > Caused by: java.lang.NullPointerException
    > at
    > org.objectstyle.woenvironment.frameworks.ExternalFrameworkModel.getRootForFolder(Unknown
    > Source)
    > at
    > org.objectstyle.woproject.ant.FrameworkSet.getFrameworkRoot(Unknown Source)
    > at org.objectstyle.woproject.ant.FrameworkSet.getJarsPath(Unknown
    > Source)
    > at
    > org.objectstyle.woproject.ant.FrameworkSet.jarsPathForFrameworkSets(Unknown
    > Source)
    > at org.objectstyle.woproject.ant.WOCompile.execute(Unknown Source)
    > at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    > at
    > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    >
    > at
    > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    >
    > at java.lang.reflect.Method.invoke(Method.java:585)
    > at
    > org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    > ... 54 more
    >
    > Patch attached to WOL-998.
    >
    > Timo

    indeed, the current woproject code assume that a <framework> tag always
    have a root= attribute.

    there are at least 2 spots where root is not tested for null.
    for me, instead of chasing them all, I add the root="Local" attribute
    with dir="..." even though it is not used.

    I have a patch to fix the two spots, but I gave up when I saw that
    everywhere root is assumed to be not null.
    I think I/we should audit the code to clean the assumption about the
    value of root=

    below is the patch. It is not tested enough for me to assure that all
    problems will be fixed.

    Index:
    woenvironment/java/org/objectstyle/woenvironment/frameworks/ExternalFrameworkModel.java
    ===================================================================
    ---
    woenvironment/java/org/objectstyle/woenvironment/frameworks/ExternalFrameworkModel.java
         (révision 5705)
    +++
    woenvironment/java/org/objectstyle/woenvironment/frameworks/ExternalFrameworkModel.java
         (copie de travail)
    ..-91,8 +91,9 @@
          File canonicalFolder = frameworksFolder.getCanonicalFile();
          for (Root root : getRoots()) {
            if (root instanceof ExternalFolderRoot) {
    - File baseFolder = ((ExternalFolderRoot)
    root).getFrameworksFolder().getCanonicalFile();
    - if (baseFolder.equals(canonicalFolder)) {
    + File baseFolder = ((ExternalFolderRoot)
    root).getFrameworksFolder();
    + if (baseFolder != null) baseFolder = baseFolder.getCanonicalFile();
    + if (baseFolder != null && baseFolder.equals(canonicalFolder)) {
                return (ExternalFolderRoot) root;
              }
            }
    Index: woproject/java/org/objectstyle/woproject/ant/FrameworkSet.java
    ===================================================================
    --- woproject/java/org/objectstyle/woproject/ant/FrameworkSet.java
    (révision 5705)
    +++ woproject/java/org/objectstyle/woproject/ant/FrameworkSet.java
    (copie de travail)
    ..-300,7 +302,8 @@
          }

          for (IFramework framework : frameworks) {
    - if (framework.getRoot().equals(getFrameworkRoot())) {
    + Root root = framework.getRoot();
    + if (root != null && root.equals(getFrameworkRoot())) {
              for (FrameworkLibrary frameworkLibrary :
    framework.getFrameworkLibraries()) {
                File jarFile = frameworkLibrary.getLibraryFile();
                File deployedJarFile = getDeployedFile(jarFile);

    >
    >
    >
    > Am 07.04.2009 um 19:39 schrieb Jephte CLAIN:
    >
    >> Mike Schrag a écrit :
    >>>> Mike Schrag a écrit :
    >>>>>> I have a few woproject projects that have been broken by
    >>>>>> WOCompile's NewBuildPathHotness revision. Attached is a patch I'd
    >>>>>> love to see accepted into WOProject that fixes it again for me.
    >>>>> I hate looking in this code ... your patch didn't appear to do any
    >>>>> evil, so I committed it.
    >>>>
    >>>> The patch has been committed:
    >>> Can you log a WOLips Jira for this and attach the patch so this
    >>> doesn't get lost?
    >>> ms
    >>
    >> done as wol-990
    >> I'm not sure about the affected version, I choose what I think was the
    >> latest (2.0.0.4118)

    -- 
    cordialement,
    Jephté Clain
    Centre des Resources Informatiques
    Tél. 0262 93 86 31
    Fax. 0262 93 81 06
    



    This archive was generated by hypermail 2.0.0 : Wed Apr 15 2009 - 00:48:11 EDT