2012-02-14 110 views
0

OK我是一個初學者,我必須解決這個Java表達式語言代碼,在我的系統(Windchill的)工作,但看起來像我缺少的東西語法:Java表達式語言錯誤「;」預計

LWCNormalizedObject lwc = new LWCNormalizedObject(cr, null, null, null); 
    lwc.load(wt.change2.WTChangeRequest2.theCategory); 
    Object bUnit = lwc.get(wt.change2.WTChangeRequest2.theCategory); 
    If ((bUnit.toString()).equals("PRODUCT_IMPROVEMENT")) { 
     wt.team.Team team = (wt.team.Team) ((wt.workflow.engine.WfProcess) self.getObject()).getTeamId().getObject(); 
     java.util.Enumeration principals = team.getPrincipalTarget(wt.project.Role.toRole("Product Manager")); 
     while(principals.hasMoreElements()) 
     { 
      wt.org.WTPrincipal wtprincipal = ((wt.org.WTPrincipalReference)principals.nextElement()).getPrincipal(); 
      System.out.println("principal = " + wtprincipal.getPrincipalDisplayIdentifier()); 
      wt.team.TeamHelper.service.addRolePrincipalMap(wt.project.Role.toRole("Change Admin II "),wtprincipal, team); 
     } 
    } 

我具有誤差在該行4:

If ((bUnit.toString()).equals("PRODUCT_IMPROVEMENT")) { 

任何幫助將高度讚賞= d

+0

不是'if'而不是'If'嗎? – CoolBeans 2012-02-14 18:08:21

+0

大寫'if'。 – Mob 2012-02-14 18:08:44

+0

如果(「PRODUCT_IMPROVEMENT」.equals(bUnit.toString())){}避免空指針異常,它總是更好做 – 2012-02-14 18:20:14

回答

5

If應該小寫。

if ((bUnit.toString()).equals("PRODUCT_IMPROVEMENT")) {

+0

這是正確的......羞恥的哈哈 – 2012-02-14 18:14:26