×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Error on UnZip the content

    In the following code snippet, I dont understand the reason for 'Leaving'. I could manually UnZip the Content. But on debugging the Application crashes. I tried TRAP also. But simply application crashes.

    What could be the reason for leaving and how could i resolve this?

    void CMyExamPleUi::ExtractContentL(const TDesC& aCompressedFile, const TDesC& aPath,const TDesC& aFileName)
    {

    // aCompressedFile = c:\ServerDownLoad.zip
    // aPath = C:\Data\DownLoadsFromServer\
    // aFileName = E:\Images\Sample.jpg


    RFs fileSession;
    User::LeaveIfError(fileSession.Connect());
    CZipFile* zipFile = CZipFile::NewL(fileSession, aCompressedFile);
    CleanupStack::PushL(zipFile);
    CZipFileMember* member = zipFile->CaseInsensitiveMemberL(aFileName);
    CleanupStack::PushL(member);
    RZipFileMemberReaderStream* stream;

    zipFile->GetInputStreamL(member, stream);
    // Application Exits here
    CleanupStack::PushL(stream);

    HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize());
    TPtr8 bufferPtr(buffer->Des());
    User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize()));
    TFileName aFileNameToBeExtracted;
    aFileNameToBeExtracted.Append(aPath);
    aFileNameToBeExtracted.Append(aFileName);
    RFile aFile;
    aFile.Replace(fileSession, aFileNameToBeExtracted, EFileWrite);
    CleanupClosePushL(aFile);
    aFile.Write(*buffer);
    aFile.Close();
    fileSession.Close();
    CleanupStack::PopAndDestroy(5); // buffer, stream, aFile, member, zipFile
    }

    Regards
    Deeps
    Last edited by lpradeepa; 2007-11-12 at 11:46. Reason: modify

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,672

    Re: Error on UnZip the content

    Do not panic, there is no "crash" without a reason: http://wiki.forum.nokia.com/index.ph...ded_panic_code

  3. #3
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    Its -3 KErrCancelled
    But how to resolve this?

    Thanx
    Deeps

  4. #4
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    This problem is still unresolved.. Please can anyone help me out..!

    Thanx
    Deeps

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Error on UnZip the content

    Hi,

    it's hard to say, why it leaves with KErrCoancel...

    Anyway you can at last try the example from newlc:
    http://newlc.com/Reading-ZIP-File-in-Symbian-OS.html
    I think that it should work, then you can compare it with your code.

    Or you can try to use the CEZCompressor class.
    http://wiki.forum.nokia.com/index.ph..._decompression

    BR
    STeN

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Error on UnZip the content

    Quote Originally Posted by lpradeepa View Post
    Its -3 KErrCancelled
    But how to resolve this?

    Thanx
    Deeps
    Where have you got this? Is your application really "crashing" (if so, what is the panic) or is that method leaving with KErrCancel, in which case you can trap the leave and try to recover from this error.

    As for what the leave means ... this is one of Symbian's well kept secrets
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  7. #7
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    dear stenlik ,
    i have already compared the code with newlc code and even nokia wiki also..!
    but no scope....!

    I wil post the complete code here.

  8. #8
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    Quote Originally Posted by ltomuta View Post
    Where have you got this? Is your application really "crashing" (if so, what is the panic) or is that method leaving with KErrCancel, in which case you can trap the leave and try to recover from this error.

    As for what the leave means ... this is one of Symbian's well kept secrets
    Application crashes with KERN EXEC 3

    I could not trap...

    RZipFileMemberReaderStream* stream;
    TRAPD(aError, aZipFile->GetInputStreamL(member, stream));
    if (aError == KErrNone )
    {
    CEikonEnv::Static()->InfoWinL(_L("KCompressionMethodNotSupported "), _L(""));
    }
    else
    {
    TBuf<256> aErrorName;
    aErrorName.AppendNum(aError);
    CEikonEnv::Static()->InfoWinL(aErrorName, _L(" error occured."));
    }

    this failed

  9. #9
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    void CMyAppUi::UnZipFolderL(const TDesC& aCompressedFile)
    {
    // filePathToGet = c:\\Data\\
    // aCompressedFile = c:\\Data\\Docs.zip



    RFs aFileSession;
    User::LeaveIfError(aFileSession.Connect());
    // Creating a new instance of CZipFile.
    // The first parameter of the two-phase constructor is a session of File Server.

    // The second parameter is the file name of the ZIP file.
    CZipFile* zipFile = CZipFile::NewL(aFileSession, aCompressedFile);
    CleanupStack::PushL(zipFile);


    CZipFileMemberIterator* members = zipFile->GetMembersL();
    CleanupStack::PushL(members);

    CZipFileMember* member;
    while ((member = members->NextL()) != 0)
    {
    TBuf<256> memberName;
    memberName = *(member->Name());
    ExtractContentL( aFileSession,aCompressedFile,filePathToGet,memberName );
    delete member;
    }


    CleanupStack::PopAndDestroy(); // members
    CleanupStack::PopAndDestroy(); // zipFile
    }

    void CMyAppUi::ExtractContentL(RFs& aRFs, const TDesC& aCompressedFile, const TDesC& aPath,const TDesC& aFileName)
    {
    // Create an instance of CZipFile.
    CZipFile* aZipFile = CZipFile::NewL(aRFs, aCompressedFile);
    CleanupStack::PushL(aZipFile);

    // Extract aFileName from the ZIP file.
    CZipFileMember* member = aZipFile->CaseInsensitiveMemberL(aFileName);
    CleanupStack::PushL(member);

    // Use input stream to extract the file.
    // The input stream of a file inside ZIP file is RZipFileMemberReaderStream.
    // The method used to get the input stream is CZipFile::GetInputStreamL().
    RZipFileMemberReaderStream* stream;
    TRAPD(aError, aZipFile->GetInputStreamL(member, stream));
    if (aError == KErrNone )
    {
    CEikonEnv::Static()->InfoWinL(_L("KCompressionMethodNotSupported "), _L(""));
    }
    else
    {
    TBuf<256> aErrorName;
    aErrorName.AppendNum(aError);
    CEikonEnv::Static()->InfoWinL(aErrorName, _L(" error occured."));
    }
    CleanupStack::PushL(stream);
    HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize());
    TPtr8 bufferPtr(buffer->Des());
    User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize()));
    TFileName aFileNameToBeExtracted;
    aFileNameToBeExtracted.Append(aPath);
    aFileNameToBeExtracted.Append(aFileName);
    RFile aFile;
    aFile.Replace(aRFs, aFileNameToBeExtracted, EFileStream|EFileWrite);
    CleanupClosePushL(aFile);
    aFile.Write(*buffer);
    // Finally, do not forget to release all the allocated resources.
    CleanupStack::PopAndDestroy(5); // buffer, stream, member, zipFile, file

    }


    thanx
    Deeps

  10. #10
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    77

    Re: Error on UnZip the content

    I read from SDK library "Only files compressed with Store or Deflatem compression methods are supported"

    Actually i m downloading the content through HTTP. So how wil i identify the type of compression used while Compression.

    thanx
    Deeps

  11. #11
    Registered User
    Join Date
    Mar 2003
    Location
    51°11'4.78"N -|- 2°48'27.05"E (Belgium)
    Posts
    730

    Re: Error on UnZip the content

    lpradeepa, have you find the solution, I get the same problem but I receive an "Unhandled exception in EZIP.DLL : 0xC0000005 : Access Violation" instead of the panic code - I'm on S60 2nd edition.

    if it's ok, can you share the solution ?

    Thanks in advance,
    Domi.
    ----------------------------------------------------------------------------------
    FExplorer is my baby !

    you can get the FREE version from www.gosymbian.com
    you can get the PRO version from http://store.ovi.com/content/339454

Similar Threads

  1. KERN-EXEC 3 with CEikEdwin
    By acarrion in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-17, 14:43
  2. Mobile Podcasting - will it happen?
    By mobile monte in forum News and Announcements
    Replies: 0
    Last Post: 2006-09-22, 23:45
  3. Audio Input Stream on N80
    By tkaihock in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2006-06-30, 09:15
  4. Replies: 0
    Last Post: 2003-09-02, 17:23
  5. Secure content: DRM, OTA, .mm and CoD
    By tdolby in forum Digital Rights Management & Content Downloading
    Replies: 1
    Last Post: 2002-09-23, 09:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×