Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » No report for failing ProjectsImportTask.
No report for failing ProjectsImportTask. [message #1424615] Tue, 16 September 2014 07:21 Go to next message
Arthur Daussy is currently offline Arthur DaussyFriend
Messages: 11
Registered: September 2014
Junior Member
Hi Oomph team,

I was wondering if there is a way to catch an event or a log for a failing ProjectImportTask. Let's say that the setup file contains a ProjectImportTask with a SourceLocator pointing to an incorrect location. When perfoming the task Oomph runs it but do not fail and does not log any error. There is a multistatus object but it seems not to be filled neither displayed by the context. My main goal here would be to find a way to detect that the setup action has failed. My context is the same described in the post https://www.eclipse.org/forums/index.php/mv/msg/782061/1413835/#msg_1413835).

Also if by any chance you could answer to the second question of the post https://www.eclipse.org/forums/index.php/t/805030/ that could be really nice.

Anyway thanks for your work and help,

Regards,

Arthur
Re: No report for failing ProjectsImportTask. [message #1424651 is a reply to message #1424615] Tue, 16 September 2014 08:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31037
Registered: July 2009
Senior Member
Arthur,

Comments below.

On 16/09/2014 9:21 AM, Arthur Daussy wrote:
> Hi Oomph team,
>
> I was wondering if there is a way to catch an event or a log for a
> failing ProjectImportTask. Let's say that the setup file contains a
> ProjectImportTask with a SourceLocator pointing to an incorrect
> location. When perfoming the task Oomph runs it but do not fail and
> does not log any error. There is a multistatus object but it seems not
> to be filled neither displayed by the context.
Eike is on vacation, but it looks to me like the intent of that design
must be to do something with that status object...

When you say it seems not to be filled, you looked with the debugger and
saw that no children were added to the status? Certainly nothing is
done with the status and I would expect some logic to check that the
status is okay or not and to throw a CoreException if it's not okay.
> My main goal here would be to find a way to detect that the setup
> action has failed. My context is the same described in the post
> https://www.eclipse.org/forums/index.php/mv/msg/782061/1413835/#msg_1413835).
Please open a bugzilla and I'll try to reproduce it.
>
> Also if by any chance you could answer to the second question of the
> post https://www.eclipse.org/forums/index.php/t/805030/ that could be
> really nice.
That thread looks complete. What question is left outstanding?
>
> Anyway thanks for your work and help,
>
> Regards,
>
> Arthur
>
Re: No report for failing ProjectsImportTask. [message #1424806 is a reply to message #1424651] Tue, 16 September 2014 12:52 Go to previous messageGo to next message
Arthur Daussy is currently offline Arthur DaussyFriend
Messages: 11
Registered: September 2014
Junior Member
Hi Ed,
First thanks for your answer.




Quote:
> I was wondering if there is a way to catch an event or a log for a
> failing ProjectImportTask. Let's say that the setup file contains a
> ProjectImportTask with a SourceLocator pointing to an incorrect
> location. When perfoming the task Oomph runs it but do not fail and
> does not log any error. There is a multistatus object but it seems not
> to be filled neither displayed by the context.
Eike is on vacation, but it looks to me like the intent of that design
must be to do something with that status object...


Yes I agree that the status object should be used somewhere to check if something went wrong but I could not find where etiher.


Quote:
When you say it seems not to be filled, you looked with the debugger and
saw that no children were added to the status?


Yes I have debugged the application and I think the problem is in:
org.eclipse.oomph.resources.impl.SourceLocatorImpl.getRootContainer(SourceLocator)
 public static BackendContainer getRootContainer(SourceLocator sourceLocator)
  {
    String rootFolder = sourceLocator.getRootFolder();

    BackendResource rootResource = BackendResource.get(rootFolder);
    if (rootResource instanceof BackendContainer)
    {
      return (BackendContainer)rootResource;
    }

    return null;
  }


In my case BackendResource.get(rootFolder) does not return a BackendContainer so this method returns null. This implies that nothing is done in:
org.eclipse.oomph.resources.impl.SourceLocatorImpl.handleProjects(SourceLocator, EList<ProjectFactory>, ProjectHandler, MultiStatus, IProgressMonitor).

 public static void handleProjects(final SourceLocator sourceLocator, final EList<ProjectFactory> defaultProjectFactories,
      final ProjectHandler projectHandler, final MultiStatus status, final IProgressMonitor monitor)
  {
    final BackendContainer rootContainer = SourceLocatorImpl.getRootContainer(sourceLocator);
    if (rootContainer != null)
    {
      rootContainer.accept(new BackendResource.Visitor.Default()
      {
        private final Set<String> excludedPaths = new HashSet<String>(sourceLocator.getExcludedPaths());

        @Override
        public boolean visitContainer(BackendContainer container, IProgressMonitor monitor) throws BackendException
        {
          ResourcesPlugin.checkCancelation(monitor);

          String path = container.getSystemRelativePath();
          if (excludedPaths.contains(path))
          {
            return false;
          }

          IProject project = loadProject(sourceLocator, defaultProjectFactories, rootContainer, container, monitor);
          if (ResourcesUtil.matchesPredicates(project, sourceLocator.getPredicates()))
          {
            try
            {
              projectHandler.handleProject(project, container);
            }
            catch (Exception ex)
            {
              SourceLocatorImpl.addStatus(status, ResourcesPlugin.INSTANCE, project.getName(), ex);
            }

            if (!sourceLocator.isLocateNestedProjects())
            {
              return false;
            }
          }

          return true;
        }
      }, monitor);
    }
  }


Maybe the case where rootContainer == null should be handle and log into the status.
Here the related bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=444250.

Quote:
That thread looks complete. What question is left outstanding?


I would like to have your thoughts on this part (this is my mistake I should have opened a second discussion):
Quote:

> I have another question wich is not directly related to this problem but linked to the ProjectImportTask implementation. I was wondering why do you use a property file to keep track of the imported projects (.plugins/org.eclipse.oomph.setup.projects/import-history.properties)? In my use case, each time I open a eclipse I have to clear all the projects of the workspace. Then I only import the project defined in the Oomph model. However with the current implementation the "isNeeded" method returns false because the property file seems corrupted (it has a key for my project but no value. So it returns "" instead of null). Each time I clear my workspace I need to clear this property file too. It feels a bit like a hack so I was wondering if there is a ClearWorkspace task that I have missed.
I think Ed wants to comment on this issue because he's implemented the import history...


Thanks again for your help,

Regards,

Arthur
Re: No report for failing ProjectsImportTask. [message #1424959 is a reply to message #1424806] Tue, 16 September 2014 17:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31037
Registered: July 2009
Senior Member
Arthur,

Comments below.

On 16/09/2014 2:52 PM, Arthur Daussy wrote:
> I would like to have your thoughts on this part (this is my mistake I
> should have opened a second discussion):
> Quote:
>> > I have another question wich is not directly related to this
>> problem but linked to the ProjectImportTask implementation. I was
>> wondering why do you use a property file to keep track of the
>> imported projects
>> (.plugins/org.eclipse.oomph.setup.projects/import-history.properties)?
We need some way of determining whether the task needs to be performed,
otherwise it would perform on each startup...
>> In my use case, each time I open a eclipse I have to clear all the
>> projects of the workspace.
Why?
>> Then I only import the project defined in the Oomph model.
I'm not sure I follow...
>> However with the current implementation the "isNeeded" method returns
>> false because the property file seems corrupted (it has a key for my
>> project but no value. So it returns "" instead of null).
If the task successfully completes (and that's likely the problem it
looks successful but wasn't really), it records the projects that were
actually imported and as long as those are present, it doesn't perform
again. It also computes digest of the source locator, so if that
changes, it will perform again. So of course if you "successfully
import" no projects then there are no projects to test and nothing is
done on startup. For manual trigger it will always be performed.
>> Each time I clear my workspace I need to clear this property file
>> too. It feels a bit like a hack so I was wondering if there is a
>> ClearWorkspace task that I have missed.
The
org.eclipse.oomph.setup.projects.impl.ProjectsImportTaskImpl.setProjects(SourceLocator,
IProject[]) method should save the value for the property; it should be
a list of the projects successfully imported...
>> I think Ed wants to comment on this issue because he's implemented
>> the import history...
I was traveling so missed that; sorry.
Previous Topic:Is there a way to create multiple targlet containers?
Next Topic:Git clone task how-to
Goto Forum:
  


Current Time: Tue Apr 07 05:12:42 GMT 2020

Powered by FUDForum. Page generated in 0.01396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top