[Kde-pim] Review Request: avoid the use of an undefined collection

Guy Maurel guy-kde at maurel.de
Wed Oct 5 19:43:43 BST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102765/
-----------------------------------------------------------

(Updated Oct. 5, 2011, 6:43 p.m.)


Review request for KDEPIM-Libraries.


Changes
-------

I see the problem at file kdepimlibs/akonadi/specialcollectionshelperjobs.cpp at line 419:
  q->emitResult();
This trigged over 15 calls the method
  OutboxQueue::Private::localFoldersRequestResult

which says:
323?>  if ( job->error() ) {
324?     // We tried to create the outbox, but that failed. This could be because some
332?       kWarning() << "Failed to get outbox folder. Retrying in: " << timeout;

and after 8 times (OUTBOX_DISCOVERY_RETRIES)
335?       kWarning() << "Failed to get outbox folder. Giving up."; ;
336?       emit q->error( i18n( "Could not access the outbox folder (%1).", job->errorString() ) );

All this has *nothing* to do with the first call.

A look at the debugger-Window from Akonadi Console gives us:
0x8632950 * OK Akonadi Almost IMAP Server [PROTOCOL 28]
0x8632950 0 LOGIN "akonadi_maildispatcher_agent"
akonadi_maildispatcher_agent (0x8632950) 0 OK User logged in
akonadi_maildispatcher_agent (0x8632950) 1 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 1 OK List completed
akonadi_maildispatcher_agent (0x8632950) 2 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 2 OK List completed
akonadi_maildispatcher_agent (0x8632950) 3 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 3 OK List completed
akonadi_maildispatcher_agent (0x8632950) 4 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 4 OK List completed
akonadi_maildispatcher_agent (0x8632950) 5 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 5 OK List completed
akonadi_maildispatcher_agent (0x8632950) 6 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 6 OK List completed
akonadi_maildispatcher_agent (0x8632950) 7 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 7 OK List completed
akonadi_maildispatcher_agent (0x8632950) 8 LSUB 0 INF (RESOURCE akonadi_maildir_resource_0) (STATISTICS true)
akonadi_maildispatcher_agent (0x8632950) 8 OK List completed

and
AgentBase(akonadi_maildispatcher_agent): Could not access the outbox folder (Unknown error. (Failed to fetch the resource collection.)).

My proposal is a little bit "complicated" but it avoid these erroness messages.


Description
-------

Within the file
  kdepimlibs/akonadi/specialcollectionshelperjobs.cpp
at the method:
  DefaultResourceJobPrivate::collectionFetchResult( KJob *job )
I found a problem: if the job has no collection, info is given with
  collections.count()
the loop
  foreach ( const Collection &collection, collections ) {
will not be entered. The variable 
  resourceCollection
is declared but nothing is assigned to it.
I think, it is not allowed to use it, such as a few lines below
  if ( !resourceCollection.isValid() ) {

My proposal: 
Test the count, and just return if zero.


Diffs (updated)
-----

  akonadi/specialcollectionshelperjobs.cpp ebc79c3 

Diff: http://git.reviewboard.kde.org/r/102765/diff/diff


Testing
-------


Thanks,

Guy Maurel

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list