2011-11-22 113 views
0

我抓我的頭,爲什麼我的try語句內的一些代碼沒有被執行。下面是有問題的元兇代碼。奇怪的Java錯誤我似乎無法解決

try { 
    Long idSociety = UtilAction.<Long>getSessionAttribute(session, idSocietyAttrName); 
    ContactAddressForm caf = (ContactAddressForm) form; 
    java.lang.System.out.println("invoiceAddresss: " + caf.getInvoiceAddress()); //This doesn't show in Console 
    Address address = new Address(caf.getStreet(), caf.getPostalCode(), caf.getCity(), caf.getBoitePostale()); 
    ContactAddress ca = new ContactAddress(); 

    ca.setInvoiceAddress(caf.getInvoiceAddress()); //Not set despite the Debugger showing the correct value for caf. 
    ca.setAddress(address); //But this is set 0_o? 
    synchronized (session) { 
     SocietyPeer.storeAddress(idSociety, ca); 
    } 
    addAddressesInSession(session, idSociety); 
    form.reset(mapping, request); 
} 

ContactAddress類

package fr.model.society; 

import fr.model.component.Address; 

public class ContactAddress { 

    private Long idContactAddress; 

    private Address address; 
    private Boolean invoiceAddress = false; 

    private Society society; 

    public Long getIdContactAddress() { 
     return idContactAddress; 
    } 

    public void setIdContactAddress(Long id) { 
     this.idContactAddress = id; 
    } 

    public Address getAddress() { 
     return address; 
    } 

    public void setAddress(Address address) { 
     this.address = address; 
    } 

    public void setInvoiceAddress(Boolean invoiceAddress) { 
     this.invoiceAddress = invoiceAddress; 
    } 

    public Boolean getInvoiceAddress() { 
     return invoiceAddress; 
    } 

    /** 
    * **************** METHODES MAPPING ***************** 
    */ 
    public Society getSociety() { 
     return society; 
    } 

    public void setSociety(Society society) { 
     this.society = society; 
    } 

    public String toString() { 
     return getAddress().toString(); 
    } 

    public boolean equals(Object o) { 
     if (!(o instanceof ContactAddress)) { 
      return false; 
     } 
     ContactAddress ca = (ContactAddress) o; 
     return address.equals(ca.getAddress()) && (getSociety().equals(ca.getSociety())); 
    } 

    public int hashCode() { 
     return ((getIdContactAddress() == null) ? 0 : getIdContactAddress().hashCode()) 
       ^address.hashCode() 
       ^((getSociety() == null) ? 0 : getSociety().hashCode()); 
    } 
} 

編輯: 基本上我嘗試設置invoiceAddress布爾變量併爲所有意圖和目的,我不能在此刻。沒有任何內容在控制檯中打印出來,java.lang.System.out.println(「invoiceAddresss:」+ caf.getInvoiceAddress());我也試過把它傳遞給一個臨時布爾變量,並且該變量在調試器中根本沒有找到。

+1

請添加一些關於您希望發生的事情和實際發生的情況的附加信息。 –

+0

看@評論直到 –

+0

你的捕獲在哪裏?是否有可能發生事件? – Thom

回答

0

我在Netbeans中加載了這個項目,這個問題似乎與eclipse和Tomcat服務器有關。儘管重新構建,但不能更新Warfile。

相關問題