Implicit Type Conversion In Java

In java any decimal literal is an Integer.Then why the byte b=4; does not generate a compilation error as we are trying to assign integer (larger data type) to an byte(smaller data type).If we try to do float f=4.5; then it gives the compliation error.Becasue any floating point literal is double.But why it does not hold good in case of the decimal litera?

i'm not sure but I think this has something to do with the loss of information and the precision of a floating point number. An integer of 4 can be converted to a byte of value 4 without any loss of information but with a floating point number you loose information by converting down from double to float. btw you cannot assign any integer, all ints lager than 127 will throw a compilation error

Similar Messages

  • Implicit and explicit Type conversion using Type object in heap

    Hi,
    I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.

    Hello,
    >> I am surprised how Implicit and explicit Type conversion works using Type object in heap.
    For Implicit conversions: Typical examples are conversions from smaller to larger integral types, and conversions from derived classes to base classes. For the first one, the reference would be different which means it would return a different pointer to
    a new object. For the reference type, it actually points to the same memory location, you could use the object.ReferenceEquals() to check it.
    For Explicit conversions (casts):Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. For first one, it would perform the same with implicit conversions.
    While for the conversion of conversion of a base-class instance to a derived class, actually, there's no built-in way to do this conversion.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error raised when concatenating to CLOB using implicit to_char conversion

    Hi there,
    Please consider the code below (Oracle 11.1.0.7.0):
    DECLARE
      c CLOB;
    BEGIN
      FOR i IN 1..10
      LOOP
        -- Please uncomment ONE of the lines below
        c := c ||  LPAD('x', 8000, 'z') || i; -- raises error ora-06502
        --c := c || (LPAD('x', 8000, 'z') || i);  -- works
        --c := c ||  LPAD('x', 8000, 'z') || to_char(i);  -- works
      END LOOP;
    END;Ok, maybe making use of implicit type conversion is not the best thing to do, but just out of curiosity is there any explanation for this error to happen?
    It seems that, when implicit conversion is involved without the aid of brackets, Oracle tries to convert the whole thing to varchar2 before concatenating it to the clob, raising the error.
    Thanks
    Luis

    Hi,
    Accordingly link below, I think this behavior can be explained
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/datatypes.htm#CIHGBADF
    Case 1
    c := c ||  LPAD('x', 8000, 'z') || i
    How it going
    1. Evaluate expression  res1 = LPAD('x', 8000, 'z')
    2. Next oracle must to evaluate  c||res1 where c is clob and res1 is varchar2
    3. Oracle can and choose implicit conversation res1 to clob
    4. Evaluate expression  res2 = c||to_clob(res1);  where res2 now is clob
    5. Next oracle must to evaluate  res2||i where res2 is clob and i is number
    6. Oracle can implicitly convert number only to varchar2 not to clob so he choose implicit conversation i to varchar2
    6.1 Oracle implicitly try convert res2 to varchar2 and when res2 size more then 32627 then he raise error ORA-06502Case 2
    c := c || (LPAD('x', 8000, 'z') || i)
    How it going
    1. Evaluate expression  res1 = LPAD('x', 8000, 'z')
    2. Next oracle must to evaluate  res1||i where res1 is varchar2 and i is number
    3. So he convert i to varchar2 and evaluate res2 = res1||to_char(i)
    4. Next oracle must to evaluate  c||res2 where res2 is varchar2 and c is clob
    5. So he convert res2 to clob and evaluate c||to_clob(res2)Case 3
    c := c ||  LPAD('x', 8000, 'z') || to_char(i)
    How it going
    0. Evaluate res0 = to_char(i)
    1. Evaluate expression  res1 = LPAD('x', 8000, 'z')
    2. Next oracle must to evaluate  c||res1 where c is clob and res1 is varchar2
    3. Oracle can and choose implicit conversation res1 to clob
    4. Evaluate expression  res2 = c||to_clob(res1);  where res2 now is clob
    5. Next oracle must to evaluate  res2||res0 where res2 is clob and res0 is varchar2
    6. He evaluate  to_clob(res0)||res2

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • WebDynpro call Returns an exception: Type conversion error

    Hi,
    I'm trying to start some of the standard SAP web dynpro .
    most of then work fine.
    some don't and i get the following error message.
    Root Cause
    The initial exception that caused the request to fail, was:
    +com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field TAX_PER_DIEMTAX, complex type class com.sap.xss.tra.tre.model.expenses.Ptrv_Web_General_Data_Int+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)+
    +at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValue(DynamicRFCModelClass.java:482)+
    +at com.sap.tc.webdynpro.progmodel.context.GenericModelClassCopyHelper.setAttributeValue(GenericModelClassCopyHelper.java:69)+
    +at com.sap.tc.webdynpro.progmodel.context.CopyService.copyCorresponding(CopyService.java:55)+
    +... 66 more+
    See full exception chain for details.
    could anyone give me an hint.
    jco connetion are made and testet for:
    sap_r3_humanresources
    sap_r3_finacials
    sap_r3_selfservicegenerics
    sap_r3_travel
    analog the *_MetaData
    Thank in advance
    Maximilian

    Hello
    did you solve this problem? I have the same error
    Regards

  • Need help RE: "Type Conversion"...

    Hi, need some urgen help here...
    I had done the following below:
    =====
    import java.awt.*;
    import java.applet.*;
    public class Demo extends Applet
         int ivalue = 3;
         double dvalue = 3.9;
         int a1 = dvalue;
         double a2 = ivalue*2;
         public void paint (Graphics g)
              g.drawString ("inum is " + a1, 25,50);
              g.drawString ("dnum is " + a2, 25,75);
    =====
    I wanted to convert my 'dvalue' to '3' but can't...Why?
    (error: possible loss of precision found :double required: int)
    How to retify it?
    Converting my 'ivalue' to '6.0' is ok.

    Listening to Author: angusedison, problem solved!
    Second problem, I wanted to calculate the volume of sphere...
    =====
    import java.awt.*;
    import java.applet.*;
    public class Sphere extends Applet
         double radius, II, volume;
         public void paint (Graphics g)
              radius = 12.5;
              II = 3.142;
              volume = 4 / 3 * II * radius * radius * radius;
              g.drawString ("Volume is " + volume, 25,50);
    =====
    & ans from this is "6136.71875", but using my calculator it's "8182.291667" (which is suppose to be the correct answer).
    What's the problem & how to solve it???
    Do I use Type Conversion too?

  • DataAccessException Type conversion error complex type class

    Hello,
    We meet some trouble randomly wrbtr field, we have suspected the jco cache, but after a reboot the problem still occurs.
    We currently use this field on others webdynpro applications.
    While execute the message displays :
    DataAccessException : Type conversion error, field wrbtr complex type class dop.model.Zst_Pp_liste
    We have a Z customize structure, which contains a zone "WAERS", used as reference field for wrbtr
    Anyone has an idea to look for ?

    Are you sure you have posted this question in the correct forum?  I don't see how this is Web Dynpro ABAP related. You refer to JCo cache and Java style class names.  I think perhaps you actually should have posted this question in the Web Dynpro Java forum?

  • Type conversion error, field ABSENCE_TYPE while accessing General Informati

    Hi ,
    One of the user is facing issue while he is accessing General Information link under Manager Self Service -> Team on portal. He is getting the below error message while accessing it.
    500   Internal Server Error
      SAP NetWeaver Application Server 7.00/Java AS 7.00 
    Failed to process request. Please contact your system administrator.
    [Hide]
    Error Summary
    While processing the current request, an exception occured which could not be handled by the application or the framework.
    If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
    Root Cause
    The initial exception that caused the request to fail, was:
       com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field ABSENCE_TYPE, complex type class com.sap.xss.hr.eeprofile.absencedays.model.Hrmss_Rfc_Ep_Read_Absencedays_Input
        at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)
        at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)
        at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValueAsString(DynamicRFCModelClass.java:669)
        at com.sap.xss.hr.eeprofile.absencedays.model.Hrmss_Rfc_Ep_Read_Absencedays_Input.setAbsence_Type(Hrmss_Rfc_Ep_Read_Absencedays_Input.java:192)
        at com.sap.xss.hr.eeprofile.absencedays.wdp.IPublicBAbsenceDaysComp$IHrmss_Rfc_Ep_Read_Absencedays_InputElement.setAbsence_Type(IPublicBAbsenceDaysComp.java:579)
        ... 64 more
    See full exception chain for details.
    System Environment
    Client
    Web Dynpro Client Type HTML Client
    User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; MS-RTC LM 8)
    Version null
    DOM version null
    Client Type msie6
    Client Type Profile ie6
    ActiveX enabled
    Cookies enabled
    Frames enabled
    Java Applets enabled
    JavaScript enabled
    Tables enabled
    VB Script enabled
    Server
    Web Dynpro Runtime Vendor: SAP, build ID: 7.0017.20100223114935.0000 (release=NW04S_17_REL, buildtime=2010-02-23:11:33:08[UTC], changelist=80269, host=pwdfm114), build date: Wed Apr 28 21:07:28 BST 2010
    J2EE Engine 7.00 patchlevel 112614.44
    Java VM IBM J9 VM, version:2.3, vendor: IBM Corporation
    Operating system Linux, version: 2.6.16.60-0.21-smp, architecture: amd64
    Session & Other
    Session Locale en_GB
    Time of Failure Wed Oct 06 12:13:18 BST 2010 (Java Time: 1286363598619)
    Web Dynpro Code Generation Infos
    sap.com/pb
    SapDictionaryGenerationCore 7.0017.20061002105236.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:01:31[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates 7.0017.20061002105236.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:01:37[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapGenerationFrameworkCore 7.0017.20060719095755.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:48:53[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer 7.0017.20080801093115.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:07:06[UTC], changelist=495367, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon 7.0017.20061002105432.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:49:40[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore 7.0017.20061002105432.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:49:34[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary 7.0017.20060719095619.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:58:48[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro 7.0017.20080801093120.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:03:59[UTC], changelist=495368, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCTemplates 7.0017.20080829103545.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:16:41[UTC], changelist=499141, host=pwdfm101)
    SapWebDynproGenerationCore 7.0017.20080801093115.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:07:12[UTC], changelist=495367, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates 7.0017.20080829103545.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:16:41[UTC], changelist=499141, host=pwdfm101)
    sap.com/tcwddispwda
    No information available null
    sap.com/pb_api
    SapDictionaryGenerationCore 7.0017.20061002105236.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:01:31[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates 7.0017.20061002105236.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:01:37[UTC], changelist=419377, host=PWDFM101.wdf.sap.corp)
    SapGenerationFrameworkCore 7.0017.20060719095755.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:48:53[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer 7.0017.20080801093115.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:07:06[UTC], changelist=495367, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon 7.0017.20061002105432.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:49:40[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore 7.0017.20061002105432.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:49:34[UTC], changelist=419384, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary 7.0017.20060719095619.0000 (release=645_VAL_REL, buildtime=2008-09-17:12:58:48[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro 7.0017.20080801093120.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:03:59[UTC], changelist=495368, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCTemplates 7.0017.20080829103545.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:16:41[UTC], changelist=499141, host=pwdfm101)
    SapWebDynproGenerationCore 7.0017.20080801093115.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:07:12[UTC], changelist=495367, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates 7.0017.20080829103545.0000 (release=645_VAL_REL, buildtime=2008-09-17:13:16:41[UTC], changelist=499141, host=pwdfm101)
    sap.com/tcwdcorecomp
    No information available null
    Detailed Error Information
    Detailed Exception Chain
    com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field ABSENCE_TYPE, complex type class com.sap.xss.hr.eeprofile.absencedays.model.Hrmss_Rfc_Ep_Read_Absencedays_Input
         at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)
         at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)
         at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValueAsString(DynamicRFCModelClass.java:669)
         at com.sap.xss.hr.eeprofile.absencedays.model.Hrmss_Rfc_Ep_Read_Absencedays_Input.setAbsence_Type(Hrmss_Rfc_Ep_Read_Absencedays_Input.java:192)
         at com.sap.xss.hr.eeprofile.absencedays.wdp.IPublicBAbsenceDaysComp$IHrmss_Rfc_Ep_Read_Absencedays_InputElement.setAbsence_Type(IPublicBAbsenceDaysComp.java:579)
         at com.sap.xss.hr.eeprofile.absencedays.BAbsenceDaysComp.callRFC(BAbsenceDaysComp.java:291)
         at com.sap.xss.hr.eeprofile.absencedays.BAbsenceDaysComp.readAbsenceDaysData(BAbsenceDaysComp.java:236)
         at com.sap.xss.hr.eeprofile.absencedays.wdp.InternalBAbsenceDaysComp.readAbsenceDaysData(InternalBAbsenceDaysComp.java:230)
         at com.sap.xss.hr.eeprofile.absencedays.BAbsenceDaysCompInterface.readAbsenceDaysData(BAbsenceDaysCompInterface.java:134)
         at com.sap.xss.hr.eeprofile.absencedays.wdp.InternalBAbsenceDaysCompInterface.readAbsenceDaysData(InternalBAbsenceDaysCompInterface.java:191)
         at com.sap.xss.hr.eeprofile.absencedays.wdp.InternalBAbsenceDaysCompInterface$External.readAbsenceDaysData(InternalBAbsenceDaysCompInterface.java:243)
         at com.sap.xss.hr.eeprofile.absencedays.vac.VAbsenceDaysComp.onBeforeOutput(VAbsenceDaysComp.java:259)
         at com.sap.xss.hr.eeprofile.absencedays.vac.wdp.InternalVAbsenceDaysComp.onBeforeOutput(InternalVAbsenceDaysComp.java:260)
         at com.sap.xss.hr.eeprofile.absencedays.vac.VAbsenceDaysCompInterface.onBeforeOutput(VAbsenceDaysCompInterface.java:143)
         at com.sap.xss.hr.eeprofile.absencedays.vac.wdp.InternalVAbsenceDaysCompInterface.onBeforeOutput(InternalVAbsenceDaysCompInterface.java:136)
         at com.sap.xss.hr.eeprofile.absencedays.vac.wdp.InternalVAbsenceDaysCompInterface$External.onBeforeOutput(InternalVAbsenceDaysCompInterface.java:212)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.callOnBeforeOutput(FPMComponent.java:603)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:569)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
         at com.sap.pcuigp.xssfpm.wd.FPMComponent.wdDoInit(FPMComponent.java:196)
         at com.sap.pcuigp.xssfpm.wd.wdp.InternalFPMComponent.wdDoInit(InternalFPMComponent.java:110)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:108)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:430)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:756)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:291)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:733)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:668)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
         at c
    Regards,
    Sreedhar

    Are you sure you have posted this question in the correct forum?  I don't see how this is Web Dynpro ABAP related. You refer to JCo cache and Java style class names.  I think perhaps you actually should have posted this question in the Web Dynpro Java forum?

  • Passing regexp_replace backreference to a function; type conversion problem

    I am trying to convert some text within my CLOB field to HTML links.
    The format of the (part of the link I am having problems with) is:
    <link 12>
    which I wish to convert to
    url_dest
    I am trying to pass the backreference \1 (being the number 12 in this case) in regexp_replace to a simple function I have made and when I run it I receive the error:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    I have tested the function on its own with passing a string and it works fine.
    I have passed the string from the backreference to the function and back out as the return value and it works fine.
    However, when I try to pass the string back reference (a set of digits) to use as the NUMBER ID in my where clause, it always returns this error. I have tried CASTing / TO_NUMBER in every way possible I can think of, using temporary variables etc. and still the same error.
    =====
    CREATE OR REPLACE
    FUNCTION GETLINK (linkid IN CLOB)
    RETURN VARCHAR2 AS
    linkstring VARCHAR2(4000);
    linkchar VARCHAR(4000);
    linkint NUMBER;
    BEGIN
    linkchar := TO_CHAR(linkid);
    linkint := TO_NUMBER(linkchar);
    SELECT url_dest INTO linkstring FROM TABLE WHERE ID = linkint;
    RETURN linkstring;
    END;
    =====
    Offending calling code:
    tempcontent := regexp_replace(myClobField, '<link ([[:digit:]]*)>', GETLINK('\1'));
    =====
    I have tried implicit and explicit type conversions that vary the above function; in parameters as VARCHAR2; etc.; no joy.
    Is this a bug within the database, is it by design, or is it just me making a hash of things? I really don't want to have to pull the XML into PHP then run the PHP regex functions with Oracle DB queries to do this!
    Many thanks for your assistance.
    Ingram

    Many thanks for the reply, but I'm not sure how that would work. I wish to do a global regexp_replace on all instances of '<link> ([[:digit:]]*)>' within my XML document, with the return value from the GETLINK function.
    So for instance.
    The return value of GETLINK could be in format:
    &lt;a href="\1"&gt;
    so an XML document of:
    =====
    &lt;doc&gt;
    &lt;link 12&gt;Test Link&lt;/link&gt;
    some content
    &lt;link 783&gt;A second Test Link&lt;/link&gt;
    &lt;/doc&gt;
    =====
    would return as:
    =====
    &lt;doc>
    &lt;a href="12"&gt;Test Link&lt;/link&gt;
    some content
    &lt;a href="783"&gt;A second Test Link&lt;/link&gt;
    &lt;/doc&gt;
    =====
    Obviously I would then do the other replacements to fix broken XML with the non matching end tags etc.
    TIA

  • Image type conversion

    Hi, How can i use BufferedImage class to perform image type conversion, thanks

    I fyou're talking about changing the image encoding, see the documentation for ImageIO.
    {color:#0000ff}http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html{color}
    Particularly the read and write methods.
    If you're talking about changing the BufferedImage.TYPE_xxx, construct a new BI with the same size and drawImage the previous image on it.
    If something else, clarify. And next time you ask a question, please try to be clear about your requirements.
    luck, db

  • JSP type conversion (JSP- PageBean) not working

              We are using page beans extensively, and I had expected that if you have a variable
              of type String passed in the URL (variable name is "id" for example, a unique record
              identifier), and within the page bean declaration you have a setId(int uId){...}
              that the JSP engine will automatically do the type conversion between the String
              and the int.
              I am using WLS6.0 on NT4.0SP5, and whenever I do this I get a
              java.lang.NoSuchMethodError error.
              When I change the method signature to setId(String uId){...} (and change the variable
              types etc. and do the String to int conversion myself), all works fine.
              Does WLS6.0 not support this automatic type conversion?
              Thanks in advance,
              Mils.
              

    Try removing the transient property.
    To avoid the duplicate problem, verify, before creating the component if the component is already on the tree.
    transient - A flag indicating whether this instance has
    decided to opt out of having its state
    information saved and restored. The
    default value for all standard component,
    converter, and validator classes that
    implement StateHolder must be false.
    By other words -
    � void setTransient(boolean newValue)
    � boolean isTransient()
    Set and get the transient property. When this property is set, the state is not
    saved.

  • True Type Fonts in Java

    Hi all
    I searched through the forum and found some threads with the same problem but never a solution attached so here is my question:
    I'm currently trying to use a True Type Font in Java. I installed the font under windows and it works fine in e.g. Word, but when I try to use it in Java all I can see are "rectangles". I'm not sure if the problem lies in the font itself or if it is a problem of Java. The fonts are named "Fughetta" and "Toccata" and can be found here: http://www.efn.org/~bch/aboutfonts.html. He is a code snippet I'm using to test the font:
    public void setFonts(Graphics g)
            if (f != null) {
                return;
            f = new Font("Fughetta", Font.TRUETYPE_FONT, 26);
            System.out.println(f);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            setFonts(g);
            String s1 = "1234567890��!\"�$%&/(()=?`";
            String s2 = "qwertzuiop�+asdfghjkl��#yxcvbnm,.-<";
            String s3 = "QWERTZUIOP�*ASDFGHJKL��'YXCVBNM;:_>";
            String s4 = "1��{[]\\}@�~�|";
            g.setFont(f);
            g.drawString(s1, 10, 30);
            g.drawString(s2, 10, 70);
            g.drawString(s3, 10, 110);
            g.drawString(s4, 10, 150);
        }All help is appreciated ;)
    - marc

    Hy, Thanks for your sollution, but now I can't use this kind of approach.
    I need to show a Bar Code Font inside a JTable cell, so I created my CellRenderer, in which I tried to change the font to my "Code EAN13" True Type font.
    public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column)  {
                 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                 if (column == CollectInfoTableModel.CODBAREPRODUS_INDEX ) {
                         Font barCodeFont = new Font("Arial", Font.BOLD, 36);
                         c.setFont(barCodeFont);                 
    }This doesn't work, it just prints some strange characters.
    I tried your sollution, but when I make :
    Graphics2D g2D= (Graphics)c.getGraphics();i keep getting g2D = null.
    What can I do ?
    Is there a way to obtai a valid Grapics object on which to draw the glyphVector on ?

  • The priority of different data type conversion

    Hi All,
    I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
    Then finaly, all the data object will convert to which data type?
    I don't know the priority of data conversion.
    E.g.   data a type i. data b type p. data c type f.
             a = b + c.
    or    data d type p, data e type f.
          if ( d > f ).
    Then who will convert to who's type?
    Thanks and Regards.
    Aaron

    For expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
    Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables).

  • Image size and mime type.. non-java guy needs help

    Image size, mime type.. non-java guy needs help
    Im not at all familiar with java so this is really weird for me to work out. I?ve been doing it all day (and half of yesterday).
    Im trying to write a custom clodFusion tag in java that gets the width, height, size and MIME types of a given file. I?ve been trying to get it to work on the command line first. I can get the width and height but cant get the size and the MIME type.
    Here is what I got
    /*import com.allaire.cfx.*;*/
    import java.awt.image.renderable.*;
    import javax.media.jai.*;
    import com.sun.media.jai.codec.*;
    import java.io.*;
    import java.util.*;
    public class ImageInfo {
    private RenderedOp image = null;
    private RenderedOp result = null;
    private int height = 0;
    private int width = 0;
    private String type = "";
    private String size = "";
    public void loadf(String file) throws IOException
    file = "80by80.jpg";
    FileSeekableStream fss = new FileSeekableStream(file);
    image = JAI.create("stream", fss);
    height = image.getHeight();
    width = image.getWidth();
    System.out.println(height + "\n");
    System.out.println(width);
    System.out.println(type);
    public static void main(String[] args) throws IOException {
    ImageInfo test = new ImageInfo();
    test.loadf(args[0]);
    can anyone please help me out to modify the above so I can also print the mime type and the file size to screen.
    thanks for any help

    any suggestions?

  • Mapping of PLSQL  table type  Date to java

    i am having problem in mapping plsql table type DATE in java,
    able to execute procedures which return plsql table type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows 2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.DATE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.DATE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[] O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[] st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTable(16);
    error while executing the code:
    java.sql.SQLException: Invalid PL/SQL Index Table element type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
    at oracle.jdbc.driver.OraclePreparedStatement.checkPlsqlIndexTableBindTypes(OraclePreparedSt
    atement.java:2705)
    at oracle.jdbc.driver.OracleCallableStatement.registerIndexTableOutParameter(OracleCallableS
    tatement.java:834)
    can anyone help me to solve this problem.

    i am having problem in mapping plsql table type
    DATE in java,
    able to execute procedures which return plsql table
    type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows
    2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.D
    TE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.D
    TE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[]
    O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[]
    st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTab
    e(16);
    can anyone help me to solve this problem.1. Write a wrapper procedure that converts the table of dates to either number or date and then re-convert the table back into date.
    2. Since it's an out param you could create a temp table, insert the contents of the index by array into it and return a cursor.
    3. Create a oracle type using CREATE TYPE and then use an array of the type.
    David Rolfe
    Orinda Software

Maybe you are looking for