Ronakpatel005 / android-vcard

Automatically exported from code.google.com/p/android-vcard
Apache License 2.0
0 stars 0 forks source link

VCardComposer having problems with Note and Title #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
contact.notes.add("my note");
composer.createVCard(contact, VCardComposer.VERSION_VCARD30_INT);

What is the expected output?
...
NOTE:my note
...
What do you see instead?
...
NOTE:
...

What version of the product are you using? On what operating system?
android-vcard 1.3, Android 2.3.4

Suggested Fix:
Fix is in VCardComposer on line 167 in foldingString. the else that returns 
null is not needed, right? Just remove it. Other fix in code would be to add a 
note or title and as well add a \n at the end of the note. My foldingString now 
looks like:

    private String foldingString(String str, int version) {
        if (str.endsWith("\r\n")) {
            str = str.substring(0, str.length() - 2);
        } else if (str.endsWith("\n")) {
            str = str.substring(0, str.length() - 1);
        }

        str = str.replaceAll("\r\n", "\n");
        if (version == VERSION_VCARD21_INT) {
            return str.replaceAll("\n", "\r\n ");
        } else if (version == VERSION_VCARD30_INT) {
            return str.replaceAll("\n", "\n ");
        } else {
            return null;
        }
    }

now notes are working fine. and from how i saw, that function is only used in 
title note and photo, where that change should not cause a problem. right?

Original issue reported on code.google.com by patrickb...@gmail.com on 26 May 2011 at 12:47

GoogleCodeExporter commented 9 years ago
I just looked at the android source code.. looks like they did quite some 
refactoring in that area. From looking at it it looks like the bug is not in 
there anymore. Is it possible to merge that or too much work?

Original comment by patrickb...@gmail.com on 26 May 2011 at 12:56

GoogleCodeExporter commented 9 years ago
Hello Patrick, thanks for your reports. I added some general information onto 
the homepage, please read: http://code.google.com/p/android-vcard/

Basically, I don't think it makes much sense in bugfixing this code when Google 
developers already probably fixed most of those issues. But I also don't have 
time to extract this library again from Android 2.0 (or whatever the latest 
release is). It is not an easy task, they rewrote most of the relevant code and 
it's not really modularly written (politely said). I started that task in the 
'android2-merge' mercurial branch, but I didn't finish it. Now I don't need it 
anymore, so I lack motivation.

If you feel like working on it, you're very welcome. If you feel like rather 
fixing the current code instead, you're also welcome, I'll give you the commit 
rights.

Original comment by kamil.paral on 27 May 2011 at 6:45

GoogleCodeExporter commented 9 years ago
Did Patrick ever commit the fix?  I ended up patching foldingString() locally 
as well and can commit a fix/test case.

Original comment by jarno.jr...@gmail.com on 17 Aug 2011 at 7:24

GoogleCodeExporter commented 9 years ago
Hello Jarno. No, Patrick haven't responded since then. Comment #2 also applies 
to you. If you want to help, I'll give you the commit rights, you're very 
welcome.

Original comment by kamil.paral on 18 Aug 2011 at 7:52

GoogleCodeExporter commented 9 years ago
Sure, please do.

As I indicated in Issue 10 I'm aware that the project's no longer actively 
maintained but I might as well push my own changes upstream.  Maybe they'll end 
up being useful to someone, who knows.

Original comment by jarno.jr...@gmail.com on 18 Aug 2011 at 11:54

GoogleCodeExporter commented 9 years ago
By upstream you mean this project, right? Because Android upstream is much far 
ahead. As I mentioned before, the best approach would be to extract the new 
code from Android 2.0/3.0/whatever. But it's not an easy task to do.

You're set as project committer. Feel free to fix bugs. Let me know when a new 
release should be done. Enjoy and thanks.

Original comment by kamil.paral on 18 Aug 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Yes, I mean this project, not Android. :)

Thanks for the commit access.  This has been fixed in f49aff6b8fee.

Original comment by jarno.jr...@gmail.com on 18 Aug 2011 at 1:57

GoogleCodeExporter commented 9 years ago
Hi Kamil,

It seems I won't be applying any more patches at least in the immediate future. 
 How much trouble would it be for you to wrap up a bugfix release..?

Original comment by jarno.jr...@gmail.com on 25 Sep 2011 at 4:44

GoogleCodeExporter commented 9 years ago
Thanks for letting me know. I'll publish a new release today.

Original comment by kamil.paral on 25 Sep 2011 at 5:43