Merge change 24097 into eclair
* changes: Fix small bugs in VCardComposer.java.
This commit is contained in:
@@ -103,7 +103,7 @@ public class VCardComposer {
|
||||
private OutputStream mOutputStream; // mWriter will close this.
|
||||
private Writer mWriter;
|
||||
|
||||
private boolean mFinishIsCalled = false;
|
||||
private boolean mOnTerminateIsCalled = false;
|
||||
|
||||
/**
|
||||
* Input stream will be closed on the detruction of this object.
|
||||
@@ -152,6 +152,7 @@ public class VCardComposer {
|
||||
}
|
||||
|
||||
public void onTerminate() {
|
||||
mOnTerminateIsCalled = true;
|
||||
if (mWriter != null) {
|
||||
try {
|
||||
// Flush and sync the data so that a user is able to pull
|
||||
@@ -177,7 +178,7 @@ public class VCardComposer {
|
||||
|
||||
@Override
|
||||
public void finalize() {
|
||||
if (!mFinishIsCalled) {
|
||||
if (!mOnTerminateIsCalled) {
|
||||
onTerminate();
|
||||
}
|
||||
}
|
||||
@@ -604,11 +605,11 @@ public class VCardComposer {
|
||||
|
||||
// FN property
|
||||
builder.append(VCARD_PROPERTY_FULL_NAME);
|
||||
builder.append(VCARD_ATTR_SEPARATOR);
|
||||
if (!VCardUtils.containsOnlyAscii(encodedFullname)) {
|
||||
builder.append(VCARD_ATTR_SEPARATOR);
|
||||
builder.append(mVCardAttributeCharset);
|
||||
builder.append(VCARD_DATA_SEPARATOR);
|
||||
}
|
||||
builder.append(VCARD_DATA_SEPARATOR);
|
||||
builder.append(encodedFullname);
|
||||
builder.append(VCARD_COL_SEPARATOR);
|
||||
} else if (!TextUtils.isEmpty(displayName)) {
|
||||
@@ -1242,6 +1243,9 @@ public class VCardComposer {
|
||||
case Email.TYPE_OTHER:
|
||||
builder.append(Constants.ATTR_TYPE_INTERNET);
|
||||
break;
|
||||
case Email.TYPE_MOBILE:
|
||||
builder.append(Constants.ATTR_TYPE_CELL);
|
||||
break;
|
||||
default:
|
||||
Log.e(LOG_TAG, "Unknown Email type: " + type);
|
||||
builder.append(Constants.ATTR_TYPE_INTERNET);
|
||||
|
||||
@@ -47,6 +47,8 @@ public class VCardParser_V30 extends VCardParser_V21 {
|
||||
|
||||
private String mPreviousLine;
|
||||
|
||||
private boolean mEmittedAgentWarning = false;
|
||||
|
||||
@Override
|
||||
protected String getVersion() {
|
||||
return Constants.VERSION_V30;
|
||||
@@ -221,7 +223,7 @@ public class VCardParser_V30 extends VCardParser_V21 {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleAgent(String propertyValue) throws VCardException {
|
||||
protected void handleAgent(String propertyValue) {
|
||||
// The way how vCard 3.0 supports "AGENT" is completely different from vCard 2.0.
|
||||
//
|
||||
// e.g.
|
||||
@@ -238,7 +240,12 @@ public class VCardParser_V30 extends VCardParser_V21 {
|
||||
// CID:JQPUBLIC.part3.960129T083020.xyzMail@host3.com
|
||||
//
|
||||
// This is not VCARD. Should we support this?
|
||||
throw new VCardException("AGENT in vCard 3.0 is not supported yet.");
|
||||
// throw new VCardException("AGENT in vCard 3.0 is not supported yet.");
|
||||
if (!mEmittedAgentWarning) {
|
||||
Log.w(LOG_TAG, "AGENT in vCard 3.0 is not supported yet. Ignore it");
|
||||
mEmittedAgentWarning = true;
|
||||
}
|
||||
// Just ignore the line for now, since we cannot know how to handle it...
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user