0

こんにちは、このコードで次のエラーが発生しています /* Class : CreateMobileChatterCntrl Description : Post Chatter on Contact. 開発者 : Harish Khatri(Appirio Offshore) 作成日 : 2012 年 6 月 2 日 */

public without sharing class CreateMobileChatterCntrl {
  public final Id ContactID{get;set;}
  public String message{get;set;}
  public boolean isSuccess{get;set;}
  public boolean throwError{get;set;}
  public String deviceType{get;set;}
  //----------------------------------------------------------------------------    
    //constructor
  //----------------------------------------------------------------------------  
  public CreateMobileChatterCntrl() {
    throwError = false;
    isSuccess = false;
    if( ApexPages.CurrentPage().getParameters().get('id') != null){
      ContactID = ApexPages.CurrentPage().getParameters().get('id');
    }
    String userAgent = ApexPages.currentPage().getHeaders().get('USER-AGENT');
    if(userAgent.contains('iPhone')) 
      deviceType = 'iPhone';
    //else if(userAgent.contains('Android')) deviceType = 'Android';  
  }
  //----------------------------------------------------------------------------    
    // Post the chatter on contact
  //----------------------------------------------------------------------------
  public Pagereference save() {

    if(message == null || message ==''){
      throwError = true;
      return null;
    }

    FeedItem feedItem = new FeedItem();
    feedItem.ParentId = ContactID;
    feedItem.Body = message;

    try {

      insert feedItem;
      isSuccess = true;

    } catch(Exception e){}
   return null;//new PageReference('/' + ContactID);
  }

  public Pagereference cancel() {
    return new PageReference('/' + ContactID);
  }
}

public final Id ContactID{get;set;} この行で、No Viable Alternative at character ' ' というエラーが表示されます。このエラーが発生する理由を教えてください。

4

1 に答える 1

8

クラス ファイル内の一重引用符の一部が無効です --- おそらく、別の場所からコードをコピーして貼り付けたためです。他の場所からコードをコピーしたときに、これが何度も発生しました。message == '' の引用符から始めて、一重引用符を削除し、再入力して、ファイルを再保存します。すべての一重引用符に対して繰り返します (または検索と置換を行います)。

于 2012-06-12T17:48:34.357 に答える