+ Start a Discussion
prageethprageeth 

Error In component (java.math.BigDecimal encountered)

Hi all;

I have a VF page, custom component and controller class.

In order to be easily understood I simplified those as below. You can simply copy and paste them.

Component:

<apex:component controller="MyClass">
  <apex:attribute name="content" type="Object" assignTo="{!content}" description=""/>

  {!content}
</apex:component>

Controller:

public with sharing class MyClass {
    Object content = null;

    public void setContent(Object obj) {
      this.content = obj;
    }
    
    public Object getContent() {
      return this.content;
    }
}

 VF Page:

<apex:page standardController="Opportunity">
    <c:aTest content="{!Opportunity.name}"/>
</apex:page>

 

 

These are work fine. But if I changed the content of the <c:aTest> component to a Double value as below 

<c:aTest content="{!Opportunity.amount}"/>

 

It gives me the following error.

"Unsupported type java.math.BigDecimal encountered."

 

This is the only error message I get. As I understood the data type 'Double' can't be stored in a variable of Object data type when the value is passed through a component. If so, this shouls be a bug of Salesforce.

Can anybody help me to solve this problem. Thank you.

Pradeep_NavatarPradeep_Navatar

Tryout this syntax given below :

 

           <c:testcomponent content="{!TEXT(Opportunity.amount)}"/>

 

Hope this helps.