0

I am getting an exception like below-

System.VisualforceException: class sun.font.CompositeFont cannot be cast to class sun.font.PhysicalFont (sun.font.CompositeFont and sun.font.PhysicalFont are in module java.desktop of loader 'bootstrap')

My Visualforce line is

<tr><td colspan="4" style="font-family: 'Roboto', sans-serif;  text-align: center; font-size:30px; color:#231f20; font-weight:700;  margin:0px; background: ##FFFF00;">&nbsp;<Strike><apex:outputPanel >{!JobSale}</apex:outputPanel></Strike>&nbsp;&nbsp;&nbsp;<b><span style="background: yellow;font-size:35px;">{!DiscountedAmount}</span></b></td>

And Apex lines are-

upchargediscounttotaljobsales=opp[0].PRODQuoteupchargeDiscountTotalJobSale__c;  //-----------This is the Discount + Upcharge Amount
    //TotalJobSale = opp.get(0).Total_Job_Sale__c;
    upchargeValue = String.valueOf(opp[0].PRODQuoteUpchargeValue__c);
    upchargeValue = upchargeValue.replace(',', '');  //-----------------------This is the Upcharge Amount
    JobDecimal = opp[0].ProdQuoteBaseplusUpcharge__c;
    JobDecimal = JobDecimal.replace(',','');
    TotalJobSale = Decimal.valueOf(JobDecimal);  //---------------------------This is the Total Amount + Upcharge(If Any)
    Discount = opp.get(0).PRODQuoteDiscountValue__c;
    Discount = Discount.replace(',', '');       //----------------------------This is the Discount Amount

    System.debug('Raw value of Upcharge: '+upchargeValue);
    System.debug('Raw value of Discount: '+Discount);
    system.debug('Decimal value of Discount: ' +decimal.valueOf(Discount));
    system.debug('Incoming Total Job Sale: '+TotalJobSale);

    //*** When Discount = 0 && Upcharge = 0 ***/
    if((Discount == '' || Discount == null || Discount =='0.0' || Discount =='0') && (upchargeValue == '' || upchargeValue == null || upchargeValue =='0.0' || upchargeValue =='0'))
    {
        system.debug('In If');
        JobSale = '';
        DiscountedAmount = 'Only $'+opp[0].PRODQuoteupchargeDiscountTotalJobSale__c;
    }

    //*** When Discount != 0 && Upcharge = 0 ***/
    else if((Discount != '' || Discount != null || Discount !='0.0' || Discount !='0') && (upchargeValue == '' || upchargeValue == null || upchargeValue =='0.0' || upchargeValue =='0'))
    {
        if(decimal.valueOf(Discount) < TotalJobSale)
        {
            system.debug('In Else-If1');
            DiscountedAmount = 'Only $'+opp[0].PRODQuoteupchargeDiscountTotalJobSale__c;
            system.debug('Discounted Amount: '+DiscountedAmount);

            JobSale = '$'+(TotalJobSale.format().contains('.')?TotalJobSale.format():(TotalJobSale.format()+'.00'));
            system.debug('Total Job Sale: ' +JobSale);
        }
        else if(decimal.valueOf(Discount) == TotalJobSale)
        {
            system.debug('In Else-If2');
            DiscountedAmount = '';
            JobSale = '';
        }
    }
    //*** When Discount == 0 && Upcharge != 0 ***/
    else if((Discount == '' || Discount == null || Discount =='0.0' || Discount =='0') && (upchargeValue != '' || upchargeValue != null || upchargeValue !='0.0' || upchargeValue !='0'))
    {
        DiscountedAmount = 'Only $'+opp[0].PRODQuoteupchargeDiscountTotalJobSale__c;
        JobSale = '';
    }

    //*** When Discount != 0 && Upcharge != 0 ***/
    else if((Discount != '' || Discount != null || Discount !='0.0' || Discount !='0') && (upchargeValue != '' || upchargeValue != null || upchargeValue !='0.0' || upchargeValue !='0'))
    {
        DiscountedAmount = 'Only $'+opp[0].PRODQuoteupchargeDiscountTotalJobSale__c;
        JobSale = '$'+(TotalJobSale.format().contains('.')?TotalJobSale.format():(TotalJobSale.format()+'.00'));
    }

I didn't get any error on Developer console. But when I am running my application, I got the above exception. Please help me.

1

Have you tried changing the font in the in-line CSS ?

"style="font-family: 'Roboto', sans-serif;"

Or recompiling the Apex class since that may be a java bug. https://bugs.openjdk.java.net/browse/JDK-8144703

  • Hi Boris, thanks for your reply. I removed "style="font-family: 'Roboto', sans-serif;" from CSS. But unfortunately still facing the same error. – Sam Jul 25 '19 at 6:50
  • I have seen a similar issue, and I see that removing the CSS was not the solution, so, did it the recompile all classes worked? – Jeferson Chaves Aug 13 '19 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.