Conversion Error setting value ''{0}'' for ''{1}''

Hi
I have to populate a drop-down list on my page with the values coming from the DB.
JSF code:
<td align="right"><div id="wait" style="visibility:hidden;">Select an existing Application</div></td>
<td align="left"><div id="wait1" style="visibility:hidden;" >
<h:selectOneMenu id="exist" value="#{processApplication.selectedOwner}" styleClass="selectOneMenu">
<f:selectItems value="#{processApplication.existingOwners}"></f:selectItems>
</h:selectOneMenu>
</div>
</td>
processApplication bean:
public List<SelectItem> getExistingOwners() {                    
//existingOwners = this.getOwners();
try{
     List < SelectItem > existingOwners = new ArrayList < SelectItem > ( ) ;
     SelectItem si_0 = new SelectItem();
     SelectItem si_1 = new SelectItem();
SelectItem si_2 = new SelectItem();
     si_0.setValue("11");
     si_0.setLabel("sri");
     si_1.setValue("21");
     si_1.setLabel("ADAMS");
     existingOwners.add(si_0);
     existingOwners.add(si_1);
     logger.info("values in the list" +existingOwners.get(1).getValue());
          }catch(Exception e){
               logger.debug(e.getCause());
               e.printStackTrace();
          return existingOwners;
     public void setExistingOwners(List<SelectItem> existingOwners) {
          try{
          this.existingOwners = existingOwners;
          }catch(Exception e){
               logger.debug("%%%%");
               logger.debug(e.getCause());
               e.printStackTrace();
public String getSelectedOwner() {
     try{
     List<SelectItem> test = this.getExistingOwners();
     selectedOwner = (String)test.get(1).getValue();
     logger.debug("selected owner from the list" +selectedOwner);
     }catch(Exception e){
     logger.debug(e.getCause());
     e.printStackTrace();
     return selectedOwner;
     public void setSelectedOwner(String selectedOwner) {
          this.selectedOwner = selectedOwner;
public List<SelectItem> getExistingOwners() should actually be a call to the DB to get the list.
But since i was getting exception I tried to hard code the list in the method itself.
But , I get this exception:
logger.info values in the list 21
[6/15/09 12:49:45:687 EDT] 0000003d ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /processApplication.jsp. Exception thrown : javax.servlet.ServletException: Conversion Error setting value ''{0}'' for ''{1}''.
     at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:658)
     at com.ibm._jsp._processApplication._jspService(_processApplication.java:149)
     at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:701)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:646)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
     at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
Earlier, I had a drop down list that was working perfectly fine.
But its values came from a Helper class and not the DB.
What is it that Iam missing or doing wrong?
Please help me.
Thanks.

Based on your example on the link that you referred to I tried to do this
fillSelectItems();
as the initialization block (I read what it means)
changed my getter method to
public List<SelectItem> getExistingOwners() { return existingOwners; }
private void fillSelectItems() {
this.existingOwners = new ArrayList<SelectItem>();
try{
     existingOwners.clear();
     List test = this.getOwners();
     SelectItem[] myitem = new SelectItem[test.size()];
     for(int i=0;i<test.size();i++) {
     Object[] arrayOne = (Object[])test.get(i);
try{
     SelectItem tmp = new SelectItem();
     tmp.setLabel(arrayOne[0].toString()+(String)arrayOne[1]);
     tmp.setValue((Integer)arrayOne[0]);
     myitem[i] = tmp;
this.existingOwners.add(myitem);
}catch(Exception e){
          logger.debug(e.getCause());
          e.printStackTrace();
     }catch(Exception e){
          logger.debug(e.getCause());
          e.printStackTrace();
Basically, I moved what I had earlier in getter method I have it now in the fillSelectItems()
Butthen, I get a NullPointerException.

Similar Messages

  • IllegalArgumentException: Conversion Error setting value ''{0}'' for ''{1}'

    Hi all i am facing one problem while using <h:selectManyMenu style="height:100;" value="#{cityf.cityLook}">
    <f:selectItems value="#{cityf.city}" />
    </h:selectManyMenu>
    so ,plz help me about this error.!!!!!!
    java.lang.IllegalArgumentException: Conversion Error setting value ''{0}'' for ''{1}''.
         com.sun.faces.util.Util.getSelectItems(Util.java:670)
         com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:509)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:486)
         com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:451)
         javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:740)
         com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:473)
         com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:470)
         com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:253)
         javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:721)
         javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:629)
         javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:566)
         com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
         org.apache.jsp.Demo_jsp._jspx_meth_h_005fpanelGrid_005f0(Demo_jsp.java:192)
         org.apache.jsp.Demo_jsp._jspx_meth_h_005fform_005f0(Demo_jsp.java:159)
         org.apache.jsp.Demo_jsp._jspx_meth_f_005fview_005f0(Demo_jsp.java:125)
         org.apache.jsp.Demo_jsp._jspService(Demo_jsp.java:90)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
         org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
         org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    city.jsp:
    <html>
    <body>
    <f:view>
    <h:form id="select">
    <h:panelGrid columns="1">
    <h:column>
    <h:outputText value="Select City : "/>
    <h:selectManyMenu style="height:100;" value="#{cityf.cityLook}">
    <f:selectItems value="#{cityf.city}" />
    </h:selectManyMenu>
    </h:column>
    </h:panelGrid>
    </h:form>
    </f:view>
    </body>
    </html>
    City Bean:
    public class City {
         private CityIDLookup[] city;
         private String[] cityLook;
    public CityIDLookup[] getCity() {
         return city;
    public void setCity(CityIDLookup[] city) {
         this.city = city;
    public String[] getCityLook() {
         return cityLook;
    public void setCityLook(String[] cityLook) {
         this.cityLook = cityLook;
    faces.config.xml:
    <managed-bean>
    <managed-bean-name>cityf</managed-bean-name>
    <managed-bean-class>com.class.City</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>

    With SelectItem I mean the javax.faces.model.SelectItem class.
    <h:selectManyMenu value="#{myBean.selectedItems}">
        <f:selectItems value="#{myBean.selectItems}" />
    <h:selectManyMenu>MyBeanprivate String[] selectedItems; // + getter + setter
    private List<SelectItem> selectItems; // + getter

  • Conversion Error setting value '33'  for 'null Converter'

    Hi,everyone,it looks my custom Converter dosen't work.
    CreditCard class:
    package com.corejsf;
    public class CreditCard {
         private String number;
         public CreditCard(){
         public CreditCard(String number){
              this.number=number;
         public String toString(){
              return this.number;
    ==============================
    PaymentBean:
    package com.corejsf;
    import java.util.Date;
    public class PaymentBean {
         private double amount;
         private Date date=new Date();
         private CreditCard card;
         public PaymentBean(){
         public double getAmount(){
              return this.amount;
         public void setAmount(double newValue){
              this.amount=newValue;
         public Date getDate(){
              return this.date;
         public void setDate(Date newValue){
              this.date=newValue;
         public CreditCard getCard(){
              return this.card;
         public void setCard(CreditCard newValue){
              this.card=newValue;
    =================================
    CreditCardConvert:
    package com.corejsf;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import javax.faces.application.FacesMessage;
    public class CreditCardConvert implements Converter{
         public Object getAsObject(FacesContext context,UIComponent component,String newValue) throws ConverterException{
              StringBuilder builderForNewValue=new StringBuilder(newValue);
              boolean foundInvalidCharacter=false;
              char invalidChar;
              int newValueLength=newValue.length();
              int i=0;
              char chFromNewValue;
              while(i<newValueLength && !foundInvalidCharacter){
                   chFromNewValue=builderForNewValue.charAt(i);
                   if(Character.isDigit(chFromNewValue) || Character.isSpaceChar(chFromNewValue)){
                        i++;
                   }else{
                        foundInvalidCharacter=true;
                        invalidChar=chFromNewValue;
                        FacesMessage message=new FacesMessage();
                        message.setDetail("detail error convert message for CreditCard with error Char:"+invalidChar);
                        message.setSummary("summary error convert message for CreditCard with error Char:"+invalidChar);
                        message.setSeverity(FacesMessage.SEVERITY_ERROR);
                        throw new ConverterException(message);
              return new CreditCard(builderForNewValue.toString());
         public String getAsString(FacesContext context,UIComponent component,Object newValue) throws ConverterException{
              return newValue.toString();
    ===============================
    faces-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
         <managed-bean>
              <managed-bean-name>payment</managed-bean-name>
              <managed-bean-class>com.corejsf.PaymentBean</managed-bean-class>
              <managed-bean-scope>session</managed-bean-scope>
         </managed-bean>
         <converter>
              <converter-id>com.corejsf.CardConvert</converter-id>
              <converter-class>com.corejsf.CreditCardConvert</converter-class>
         </converter>     
         <navigation-rule>
              <from-view-id>/index.xhtml</from-view-id>
              <navigation-case>
                   <from-outcome>result</from-outcome>
                   <to-view-id>/result.xhtml</to-view-id>
                   <redirect/>
              </navigation-case>
         </navigation-rule>
         <navigation-rule>
              <from-view-id>/result.xhtml</from-view-id>
              <navigation-case>
                   <from-outcome>index</from-outcome>
                   <to-view-id>/index.xhtml</to-view-id>
                   <redirect/>
              </navigation-case>
         </navigation-rule>
    </faces-config>
    ==================================================
    index.xhtml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
         <h:head>
              <title>index page</title>
         </h:head>
         <h:body>
              <h:form>
                   <table>
                        <tr>
                             <td>
                                  <h:inputText id="iptCard" label="card" required="true" convert="com.corejsf.CardConvert" value="#{payment.card}">
                                  </h:inputText>
                                  <h:message for="iptCard"></h:message>
                             </td>
                        </tr>
                        <tr>
                             <td>
                                  <h:inputText id="iptAmount" label="amount" required="true" value="#{payment.amount}">
                                       <f:convertNumber minFractionDigits="2"></f:convertNumber>
                                  </h:inputText>
                                  <h:message for="iptAmount"></h:message>
                             </td>
                        </tr>
                        <tr>
                             <td>
                                  <h:inputText id="iptDate" label="date" required="true" value="#{payment.date}">
                                       <f:convertDateTime pattern="MM/yyyy"></f:convertDateTime>
                                  </h:inputText>
                                  <h:message for="iptDate"></h:message>
                             </td>
                        </tr>
                        <tr>
                             <td>
                                  <h:commandButton value="sumbit" action="result"></h:commandButton>
                             </td>
                        </tr>
                   </table>
              </h:form>
         </h:body>
    </html>
    Can anyone help me,TKS!

    And besides,if I change the first inputText to:
    <td>
    <h:inputText id="iptCard" label="card" required="true" value="#{payment.card}">
         <f:convert convertId="com.corejsf.CardConvert"></f:convert>
    </h:inputText>
    <h:message for="iptCard"></h:message>
    </td>
    The app runs and result in:
    WebContent/index.xhtml @13,55 <f:convert> Tag Library supports namespace: http://java.sun.com/jsf/core, but no tag was defined for name: convert
    Is any configuration problem there?
    TKS!

  • JSF: Conversion Error setting value

    Anyone knows how to fix this? I got the following error when I tried to put 50 numbers in the dropdown list:
    javax.servlet.ServletException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
    Here is the bean
         private String[] items=null;
         public String[] getItems() {
              items = new String[50];
              for (int i=0; i <50; i++){
                   String va = String.valueOf(i);
                   items= va;
              return items;
         public void setItems(String[] it) {
              items = it;
    Here is the tag:
    <h:selectOneMenu id="test" value="1">
         f:selectItems value="#{QuestionBean.items}"/>
    </h:selectOneMenu>

    f:selectItems value attribute must be a list of SelectItem objects.
    Transform your items list and it'll work.

  • Error-No value given for one or more required parameters when using oleDBDa

    Hello,
    I have this sql statement and it works well, the Crystal Report gives good result when I put concrete values like:
    string comstring = "SELECT NOVI.GBR as gbrnov, NOVI.AB as abnov, NALOG1.DATA as datanov, Min(NALOG1.POCKM) AS MinOfPOCKM, Max(NALOG1.KRAJKM) AS MaxOfKRAJKM, (Max(NALOG1.KRAJKM)-Min(NALOG1.POCKM)) AS RAZLIKA, Count(IIf(([MAGACIN.SIFRA]='0991000'),[MAGACIN.KOL],Null)) AS Gorivo, Avg(IIf(([MAGACIN.SIFRA]='0991000'),[MAGACIN.KOL],Null)/100) AS potrosgor100km, Sum(IIf(([MAGACIN.SIFRA]='0993050' Or [MAGACIN.SIFRA]='0993051'),[MAGACIN.KOL],Null)) AS Motmaslo, Sum(IIf(([MAGACIN.SIFRA]='0992201'),[MAGACIN.KOL],Null)) AS Addblue, ([Addblue]/[Gorivo])100 AS Addbluegor, Sum(IIf(([MAGACIN.SIFRA]='0999001'),[MAGACIN.KOL],Null)) AS Antifriz, NOVI.DATAP, NOVI.DATAS, IIf(([NOVI].[KM]<=([NOVI].[KMS1][NOVI].[KMS2])),'ZA SERVIS',(IIf(([NOVI].[KM]<=([NOVI].[KMP1][NOVI].[KMP2])),'PROVERKA',''))) AS Zabeleska FROM (NALOG1 INNER JOIN NOVI ON NALOG1.GBRV = NOVI.GBR) INNER JOIN MAGACIN ON NOVI.GBR = MAGACIN.GBR where (((NOVI.GBR)>='1001' And (NOVI.GBR)<='1080') AND ( ((NOVI.AB)='AK') OR ((NOVI.AB)='AK') ) AND ((NALOG1.DATA)<=#10/31/2011# and (NALOG1.DATA)>=#10/31/2011#) ) GROUP BY NOVI.GBR, NOVI.AB, NALOG1.DATA, ([Addblue]/[Gorivo])100, NOVI.DATAP, NOVI.DATAS, IIf(([NOVI].[KM]<=([NOVI].[KMS1][NOVI].[KMS2])),'ZA SERVIS',(IIf(([NOVI].[KM]<=([NOVI].[KMP1][NOVI].[KMP2])),'PROVERKA','')))";          
    but when I use code like this :
    string comstring = "SELECT NOVI.GBR as gbrnov, NOVI.AB as abnov, NALOG1.DATA as datanov, Min(NALOG1.POCKM) AS MinOfPOCKM, Max(NALOG1.KRAJKM) AS MaxOfKRAJKM, (Max(NALOG1.KRAJKM)-Min(NALOG1.POCKM)) AS RAZLIKA, Count(IIf(([MAGACIN.SIFRA]='0991000'),[MAGACIN.KOL],Null)) AS Gorivo, Avg(IIf(([MAGACIN.SIFRA]='0991000'),[MAGACIN.KOL],Null)/100) AS potrosgor100km, Sum(IIf(([MAGACIN.SIFRA]='0993050' Or [MAGACIN.SIFRA]='0993051'),[MAGACIN.KOL],Null)) AS Motmaslo, Sum(IIf(([MAGACIN.SIFRA]='0992201'),[MAGACIN.KOL],Null)) AS Addblue, ([Addblue]/[Gorivo])100 AS Addbluegor, Sum(IIf(([MAGACIN.SIFRA]='0999001'),[MAGACIN.KOL],Null)) AS Antifriz, NOVI.DATAP, NOVI.DATAS, IIf(([NOVI].[KM]<=([NOVI].[KMS1][NOVI].[KMS2])),'ZA SERVIS',(IIf(([NOVI].[KM]<=([NOVI].[KMP1][NOVI].[KMP2])),'PROVERKA',''))) AS Zabeleska FROM (NALOG1 INNER JOIN NOVI ON NALOG1.GBRV = NOVI.GBR) INNER JOIN MAGACIN ON NOVI.GBR = MAGACIN.GBR where (((NOVI.GBR)>=? And (NOVI.GBR)<=?) AND ( ((NOVI.AB)=?) OR ((NOVI.AB)=?) ) AND ((NALOG1.DATA)<=? and (NALOG1.DATA)>=?) ) GROUP BY NOVI.GBR, NOVI.AB, NALOG1.DATA, ([Addblue]/[Gorivo])100, NOVI.DATAP, NOVI.DATAS, IIf(([NOVI].[KM]<=([NOVI].[KMS1][NOVI].[KMS2])),'ZA SERVIS',(IIf(([NOVI].[KM]<=([NOVI].[KMP1][NOVI].[KMP2])),'PROVERKA','')))";
    Edited by: Don Williams on Nov 23, 2011 7:22 AM

    and the code after that:
    command.CommandText = comstring;
                if (radioButton4.Checked == true)
                    if (textBox1.Text == "")
                        button1.Enabled = false;
                        MessageBox.Show("Внесете гаражен број", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        textBox1.Focus();
                        command.Parameters.AddWithValue("@gbr1", textBox1.Text);
                        command.Parameters.AddWithValue("@gbr2", textBox1.Text);               
                else if (radioButton5.Checked == true)
                    command.Parameters.AddWithValue("@gbr1", "1001");
                    command.Parameters.AddWithValue("@gbr2", "1080");
                    button1.Enabled = true;
                    textBox1.Text = "";
                else if (radioButton6.Checked == true)
                    command.Parameters.AddWithValue("@gbr1", "1081");
                    command.Parameters.AddWithValue("@gbr2", "1149");
                    button1.Enabled = true;
                    textBox1.Text = "";
                else if (radioButton7.Checked == true)
                    command.Parameters.AddWithValue("@gbr1", "1001");
                    command.Parameters.AddWithValue("@gbr2", "1149");
                    button1.Enabled = true;
                    textBox1.Text = "";
                else
                    MessageBox.Show("Немате избрано гаражен број или тип на автобус.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    button1.Enabled = false;
                if (checkBox1.Checked == true && checkBox2.Checked==true)
                    command.Parameters.AddWithValue("@ab1", "AK");
                    command.Parameters.AddWithValue("@ab2", "GP");
                    button1.Enabled = true;
                else if ((checkBox1.Checked == true) && (checkBox2.Checked == false))
                    command.Parameters.AddWithValue("@ab1", "AK");
                    command.Parameters.AddWithValue("@ab2", "AK");
                    button1.Enabled = true;
                else if (checkBox2.Checked == true )
                    command.Parameters.AddWithValue("@ab1", "GP");
                    command.Parameters.AddWithValue("@ab2", "GP");
                    button1.Enabled = true;
                else
                    MessageBox.Show("Немате избрано автобаза.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    command.Parameters.AddWithValue("@ab1", "AK");
                    command.Parameters.AddWithValue("@ab2", "GP");
                    button1.Enabled = false;
                command.Parameters.AddWithValue("@data1", dateTimePicker1.Value.Date);
                command.Parameters.AddWithValue("@data2", dateTimePicker2.Value.Date);
                 DataSet2 dataSet2=new DataSet2();    
                 OleDbDataAdapter oleDBDataAdapter1 = new OleDbDataAdapter();
                oleDBDataAdapter1.SelectCommand=command;
                    dataSet2.Clear();
                    oleDBDataAdapter1.Fill(dataSet2,"Tabela");
                    if (dataSet2.Tabela.Count == 0)
                        MessageBox.Show("Nema podatoci za toj period");
                    ReportDocument cryRpt = new ReportDocument();
                    cryRpt.Load(@"C:\Potrosuvacka-Pregledi\Potrosuvacka-Pregledi\CrystalReport6.rpt");
                cryRpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
                    cryRpt.SetDataSource(dataSet2);
                    crystalReportViewer1.DisplayToolbar=true;
                crystalReportViewer1.ReportSource = cryRpt;                      
                crystalReportViewer1.Refresh();
                    conn.Close();
    I get an error:
    "No value given for one or more required parameters."
    Could anybody help me please?
    Thank you in advance.
    Edited by: nelpet06 on Nov 23, 2011 9:30 AM

  • Can't build gcc-4.1.2; error: bad value (generic) for -mtune= switch

    I need this specific version of gcc, so I got the old PKDBUILD from svn, see below. However when gcc compiles I run into this compile error:
    TARGET_CPU_DEFAULT="" \
    HEADERS="auto-host.h ansidecl.h" DEFINES="USED_FOR_TARGET " \
    /bin/sh ../../gcc-4.1.2/gcc/mkconfig.sh tconfig.h
    ./xgcc -B./ -B/usr/i686-pc-linux-gnu/bin/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -L/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc/../ld -O2 -O2 -march=i686 -mtune=generic -O2 -pipe -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. -I../../gcc-4.1.2/gcc -I../../gcc-4.1.2/gcc/. -I../../gcc-4.1.2/gcc/../include -I../../gcc-4.1.2/gcc/../libcpp/include -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time -fno-omit-frame-pointer \
    -c ../../gcc-4.1.2/gcc/crtstuff.c -DCRT_BEGIN \
    -o crtbegin.o
    ../../gcc-4.1.2/gcc/crtstuff.c:1: error: bad value (generic) for -mtune= switch
    make[2]: *** [crtbegin.o] Error 1
    make[2]: Leaving directory `/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc'
    make[1]: *** [stage1_build] Error 2
    make[1]: Leaving directory `/home/chelg/tmp/abs/gcc-4.1/src/gcc-build/gcc'
    make: *** [bootstrap] Error 2
    ==> ERROR: Build Failed.
    Aborting...
    Here is the PKGBUILD I use:
    # $Id: PKGBUILD,v 1.60 2007/02/14 14:53:50 jgc Exp $
    # Maintainer: Jan de Groot <[email protected]>
    pkgname=gcc
    pkgver=4.1.2
    pkgrel=3
    pkgdesc="The GNU Compiler Collection"
    arch=(i686 x86_64)
    url="http://gcc.gnu.org"
    depends=('glibc' 'binutils>=2.17')
    options=('!libtool')
    source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-{core,g++,objc}-${pkgver}.tar.bz2
    ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/libstdc++-man-4.0.0.tar.bz2
    DW_CFA_val.patch
    gcc_pure64.patch)
    md5sums=('2af3fb599635219171c6ae1f3034888a' '75c6d5fa3415d614314caf0f509e8933'
    'abda05c0ab99059e8f9e7a625361fd87' '2be86d2117c8fa7f9ec2845cc0660ab1'
    '078680c207f7cd490044d4a53edf158d' '1ceaa49e3a1d9f984ecc2893c43f7425')
    build() {
    export MAKEFLAGS="-j1"
    cd ${startdir}/src/gcc-${pkgver}
    # Don't install libiberty
    sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
    if [ "${CARCH}" = "x86_64" ]; then
    patch -Np1 -i ../gcc_pure64.patch || return 1
    fi
    patch -Np0 -i ${startdir}/src/DW_CFA_val.patch || return 1
    # Don't run fixincludes
    sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
    mkdir ../gcc-build
    cd ../gcc-build
    ../gcc-${pkgver}/configure --prefix=/usr --enable-shared \
    --enable-languages=c,c++,objc --enable-threads=posix \
    --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib \
    --libexecdir=/usr/lib --enable-clocale=gnu
    make bootstrap || return 1
    make DESTDIR=${startdir}/pkg install || return 1
    mkdir -p ${startdir}/pkg/lib
    (cd ${startdir}/pkg/lib; ln -s ../usr/bin/cpp)
    (cd ${startdir}/pkg/usr/bin; ln -sf gcc cc; ln -sf g++ c++)
    # install the libstdc++ man pages
    mkdir -p ${startdir}/pkg/usr/man/man3
    install -m644 ${startdir}/src/man/man3/* ${startdir}/pkg/usr/man/man3/
    Last edited by Phlogiston (2009-02-27 20:08:37)

    or here you go:
    # $Id: PKGBUILD,v 1.60 2007/02/14 14:53:50 jgc Exp $
    # Maintainer: Jan de Groot <[email protected]>
    pkgname=gcc-4.1
    pkgver=4.1.2
    pkgrel=3
    pkgdesc="The GNU Compiler Collection"
    arch=(i686 x86_64)
    url="http://gcc.gnu.org"
    depends=('glibc' 'binutils>=2.17')
    options=('!libtool')
    source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-{core,g++,objc}-${pkgver}.tar.bz2
    ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/libstdc++-man-4.0.0.tar.bz2
    DW_CFA_val.patch
    gcc_pure64.patch)
    md5sums=('2af3fb599635219171c6ae1f3034888a' '75c6d5fa3415d614314caf0f509e8933'
    'abda05c0ab99059e8f9e7a625361fd87' '2be86d2117c8fa7f9ec2845cc0660ab1'
    '078680c207f7cd490044d4a53edf158d' '1ceaa49e3a1d9f984ecc2893c43f7425')
    build() {
    export MAKEFLAGS="-j1"
    cd ${startdir}/src/gcc-${pkgver}
    # Don't install libiberty
    sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
    if [ "${CARCH}" = "x86_64" ]; then
    patch -Np1 -i ../gcc_pure64.patch || return 1
    fi
    patch -Np0 -i ${startdir}/src/DW_CFA_val.patch || return 1
    # Don't run fixincludes
    sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
    mkdir ../gcc-build
    cd ../gcc-build
    ../gcc-${pkgver}/configure --prefix=/opt/gcc-4.1 --enable-shared \
    --enable-languages=c,c++,objc --enable-threads=posix \
    --enable-__cxa_atexit --disable-multilib \
    --enable-clocale=gnu
    make bootstrap || return 1
    make DESTDIR=${startdir}/pkg install || return 1
    mkdir -p ${startdir}/pkg/lib
    # (cd ${startdir}/pkg/lib; ln -s ../usr/bin/cpp)
    # (cd ${startdir}/pkg/usr/bin; ln -sf gcc cc; ln -sf g++ c++)
    # install the libstdc++ man pages
    mkdir -p ${startdir}/pkg/usr/man/man3
    install -m644 ${startdir}/src/man/man3/* ${startdir}/pkg/usr/man/man3/

  • Conversion error in Table control for Negative values

    hello all,
    Iam using table control with 6 columns and in that columns values are coming from Ztable. and out of that one column is of value which is input/output field and having negative value's also.type of that column is DEC.
    Now when i run the report dump occurs showing error message as COnversion Error.
    I think its because of negative value even the in attributes of that column i had selected With Sign checkbox.
    Now when i run the report then if in Ztable negative value is there then i want to display negative value in table control also.
    Please suggest me...
    <removed_by_moderator>
    Thanking you.
    Regards.
    Edited by: Hemant Baviskar on Sep 10, 2008 3:07 PM
    Edited by: Julius Bussche on Sep 10, 2008 1:13 PM

    Hemant
    Refer to following link:
    Table Control : Conversion error
    Thanks
    Amol Lohade

  • Currency conversion error in Update rules for 0SD_C03

    Hi All
    I have freshly installed Sales Overview cube 0SD_C03 from BI Content(3.x version) and when extracting data from datasource "2LIS_13_VDITM" there is an error "Error: Conversion foreign curr. -> local curr.: 0090000000 20080516 M -> SGD".
    Till PSA data is loading fine, there is error while loading from PSA to cube(ie. in Update Rule).
    Checked in the PSA for the errored records, all the records which have 0(zero) as amount are green and the rest of them are errored with the above message.
    When checked in the manage cube there are added records but the request is red.
    Please let me know if some one as the clue.
    Regards
    Jayant

    Hi
    You will find the transfer global settings for the source system where you are extracting the data.
    Select the source sytem, right click,go to transfer gloabal settings, (select the currencies in this)
    Then Reload the data into the cube,
    After, Reloading the data into the cube replicate the master data, and activate the mappings,and load the data.
    I think, this will work....
    Regards
    Sudheer

  • Why cannot I set value "base_directory"  for AIT?

    Hi,
    I am trying to insert MHP app into a ts and then try to recieve it on stb.
    I have a simple Xlet named HelloWorld including only one file HelloWorld.class . This xlet will display a string "Hello" on screen.
    Suppose that my xlet is stored in file system as the following:
    Test
    |----- HelloWorld.class
    |----- Folder
    |------- HelloWorld.class
    2 HelloWorlds are the same; and the whole file system will be broadcast in DSMCC OC.
    If i generate AIT including the first xlet (of Test directory) with:
    base_directory : /
    initclass: HelloWorld
    Result : GOOD, stb can run HelloWorld xlet
    If i generate AIT including the second xlet (of Folder subdirectory) with:
    base_directory: /
    initclass: Folder.HelloWorld
    or:
    base_directory: Folder
    initclass: HelloWorld
    Result: stb cannot run this Xlet.
    (I sure that the whole file system is broadcast .)
    So i think that stb just load and run xlets in root directory???
    I donnot know what causes the error ?
    How can stb load and run xlets in subdirectory?
    Thanks in advance
    Nghia.

    Sill question, but have you made sure that the path structure you are using matches the package structure for your application?
    Copying HelloWorld.class into "Folder" should not work unless the base directory is also set to "Folder". (I say this because you've indicated that the two HelloWorlds" are the same). Remember that the full name of your initial class is <package>.<className>. If this doesn't match your initclass setting then the VM will be unable to load your class.
    In general there is no particular reason why your initial class has to be at the root of the DMCC, although it is possible that the devive you are using to play out your AIT has some additional restrictions about what can be done.
    Roger

  • Selectitems conversion Error

    Hi ,
    I am using a selectitems tag :
    <h:selectOneMenu id="title">
    <f:selectItems value="#{WorkFLowBean.workFlowTitleOptions}" />
    </h:selectOneMenu>
    But i am getting the following error:
    javax.servlet.ServletException: Conversion Error setting value ''{0}'' for ''{1}''.
    Can it come from my faces-config.xml ?
    Here it is:
    <managed-bean>
    <description>
    TODO
    </description>
    <managed-bean-name>WorkFlowBean</managed-bean-name>
    <managed-bean-class>com.vivacances.boPackages.WorkFlowBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>waitRules</property-name>
    <property-class>java.lang.String</property-class>
    <value>cancel,sent</value>
    </managed-property>
    <managed-property>
    <property-name>inProgressRules</property-name>
    <property-class>java.lang.String</property-class>
    <value>cancel,sent</value>
    </managed-property>
    </managed-bean>
    Thank you all :-)

    ok i've found out what it was... i've made a mistake in the name of my bean !

  • SelectManyListbox Conversion error. Please Help

    In my application, I have a selecteManyListbox, but the selections are entirely optional.
    I have set required="false" in the component, still I see the message:
    Conversion Error setting value "" for '#{Page1.selections}'.
    The application works just fine if I select one or more options, so I do not think there is any problem in the code or the setup.
    How do I skip any conversion errors, so that I can proceed without any selections?

    Show your jsp page and source of the bean.

  • Numeric or value error: character to number conversion error

    I'm having problems inserting a value from a date picker field (DD-MON-YYYY HH MI )
    i'm submitting this value to a packaged procedure that accepts this field as VARCHAR2 .
    on the insert, i do a to_date( P_DATE, 'DD-MON-YYYY HH:MI PM' )
    and i get the numeric conversion error.
    If I change the to_date on the procedure side, I get the :could not read the end of the format mask - which I've found threads about on this site.
    I've tried using HH24 and different formats, but I get one of the two above errors on the insert.
    If I don't fill in the datepicker field at all, it works fine.
    help is appreciated !
    Bill

    Here is the trace anyway:
    *** ACTION NAME:(application 4000, page 1) 2004-09-24 12:58:44.052
    *** MODULE NAME:(HTML DB) 2004-09-24 12:58:44.052
    *** SERVICE NAME:(TOPS) 2004-09-24 12:58:44.052
    *** SESSION ID:(151.1) 2004-09-24 12:58:44.052
    *** 2004-09-24 12:58:44.052
    ksedmp: internal or fatal error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    Current SQL statement for this session:
    declare
    rc__ number;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 255;
    null;
    null;
    null;
    null;
    f(p=>:p);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    null;
    null;
    commit;
    else
    rc__ := 0;
    null;
    null;
    null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    :rc__ := rc__;
    end;
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    6A3C4A00 532 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2502 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A3C4A00 2748 package body FLOWS_010500.WWV_FLOW_UTILITIES
    6A0E63C8 991 package body FLOWS_010500.WWV_FLOW_FORMS
    6A11675C 932 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A11675C 247 package body FLOWS_010500.WWV_FLOW_DISP_PAGE_PLUGS
    6A4B54E0 8341 package body FLOWS_010500.WWV_FLOW
    6A2A99F0 102 procedure FLOWS_010500.F
    6A2B9E54 10 anonymous block
    ----- Call Stack Trace -----
    calling call entry argument values in hex
    location type point (? means dubious value)
    ksedmp+524          CALLrel  ksedst+0 1
    ksedmptracecb+15 CALLrel _ksedmp+0            C
    _ksddoa+118          CALLreg  00000000             C
    ksdpcg+143          CALLrel  ksddoa+0
    ksdpec+180          CALLrel  ksdpcg+0 1966 6D7D208 1
    __PGOSF3__ksfpec+11 CALLrel _ksdpec+0            0
    8
    _kgerev+77           CALLreg  00000000             7474210 1966
    kgerec1+18          CALLrel  kgerev+0 7474210 6DCE5EC 1966 1
    6D7D260
    peirve+465          CALLrel  kgerec1+0
    pevmCVTCN+346 CALLrel _peirve+0           
    pfrinstrCVTCN+36 CALLrel pevmCVTCN+0 6E6E604 71CE370 7160F0C
    pfrrunno_tool+51 CALL??? 00000000
    pfrrun+1834         CALLrel  pfrrun_no_tool+0 6E6E604 6A3C010A 6E6E640
    plsqlrun+1051 CALLrel _pfrrun+0            6E6E604
    peicnt+179          CALLrel  plsql_run+0 6E6E604 1 0
    kkxexe+477          CALLrel  peicnt+0
    opiexe+4896         CALLrel  kkxexe+0 6A2B9E54
    kpoal8+1705         CALLrel  opiexe+0 49 3 6D7E06C
    _opiodr+977          CALLreg  00000000             5E 14 6D7E7CC
    _ttcpip+1827         CALLreg  00000000             5E 14 6D7E7CC 0
    _opitsk+1098         CALL???  00000000            
    opiino+938          CALLrel  opitsk+0 0 0 747ABC0 6DEFB14 D8 0
    _opiodr+977          CALLreg  00000000             3C 4 6D7FBBC
    opidrv+479          CALLrel  opiodr+0 3C 4 6D7FBBC 0
    sou2o+45            CALLrel  opidrv+0 3C 4 6D7FBBC
    opimai+237          CALLrel  sou2o+0
    OracleThreadStart@  CALLrel  opimai+0
    4+899
    77E7D338 CALLreg 00000000

  • Set required status for all subtypes first error

    Hello,
    While implementing OSS note 1744002 for Application Control Workflow i had the following error.
    In fact, i added a new attribute for BOR bus2201.
    When i wanted to change the status to implemented, i got the following error 'Set required status for all subtypes first'.
    Thanks,
    Meriem.

    Hi Meriem,
    Any new attribute should be added to the newly created custom SubType of the Object type BUS2201, but not Object BUS2201 itself.
    Revert the BOR BUS2201 to its original state and add the new attribute to your z<subtype>. You will no more get the error.
    Regards,
    Kiran

  • How do I set proxy settings for a Java app behind a corporate server?

    I have the source code of a Download Manager program written in Java. It has to be run within my college network in which we use the "Corporate Client" server to access the internet. The HTTP proxy is 172.16.68.6 and Port number is 3128. How do I define these parameters in my java program so that it can download files from the internet?
    The source code for the program is:
    There are four classes:
    1. DownloadManager.java
    2. Download.java
    3. DownloadTable.java
    4. ProgressRenderer.java
    /*__DownloadManager.java__*/
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    // The Download Manager.
    public class DownloadManager extends JFrame
            implements Observer {
        // Add download text field.
        private JTextField addTextField;
        // Download table's data model.
        private DownloadsTableModel tableModel;
        // Table listing downloads.
        private JTable table;
        // These are the buttons for managing the selected download.
        private JButton pauseButton, resumeButton;
        private JButton cancelButton, clearButton;
        // Currently selected download.
        private Download selectedDownload;
        // Flag for whether or not table selection is being cleared.
        private boolean clearing;
        // Constructor for Download Manager.
        public DownloadManager() {
            // Set application title.
            setTitle("Download Manager");
            // Set window size.
            setSize(640, 480);
            // Handle window closing events.
            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    actionExit();
            // Set up file menu.
            JMenuBar menuBar = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            fileMenu.setMnemonic(KeyEvent.VK_F);
            JMenuItem fileExitMenuItem = new JMenuItem("Exit",
                    KeyEvent.VK_X);
            fileExitMenuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionExit();
            fileMenu.add(fileExitMenuItem);
            menuBar.add(fileMenu);
            setJMenuBar(menuBar);
            // Set up add panel.
            JPanel addPanel = new JPanel();
            addTextField = new JTextField(30);
            addPanel.add(addTextField);
            JButton addButton = new JButton("Add Download");
            addButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionAdd();
            addPanel.add(addButton);
            // Set up Downloads table.
            tableModel = new DownloadsTableModel();
            table = new JTable(tableModel);
            table.getSelectionModel().addListSelectionListener(new
                    ListSelectionListener() {
                public void valueChanged(ListSelectionEvent e) {
                    tableSelectionChanged();
            // Allow only one row at a time to be selected.
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            // Set up ProgressBar as renderer for progress column.
            ProgressRenderer renderer = new ProgressRenderer(0, 100);
            renderer.setStringPainted(true); // show progress text
            table.setDefaultRenderer(JProgressBar.class, renderer);
            // Set table's row height large enough to fit JProgressBar.
            table.setRowHeight(
                    (int) renderer.getPreferredSize().getHeight());
            // Set up downloads panel.
            JPanel downloadsPanel = new JPanel();
            downloadsPanel.setBorder(
                    BorderFactory.createTitledBorder("Downloads"));
            downloadsPanel.setLayout(new BorderLayout());
            downloadsPanel.add(new JScrollPane(table),
                    BorderLayout.CENTER);
            // Set up buttons panel.
            JPanel buttonsPanel = new JPanel();
            pauseButton = new JButton("Pause");
            pauseButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionPause();
            pauseButton.setEnabled(false);
            buttonsPanel.add(pauseButton);
            resumeButton = new JButton("Resume");
            resumeButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionResume();
            resumeButton.setEnabled(false);
            buttonsPanel.add(resumeButton);
            cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionCancel();
            cancelButton.setEnabled(false);
            buttonsPanel.add(cancelButton);
            clearButton = new JButton("Clear");
            clearButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    actionClear();
            clearButton.setEnabled(false);
            buttonsPanel.add(clearButton);
            // Add panels to display.
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(addPanel, BorderLayout.NORTH);
            getContentPane().add(downloadsPanel, BorderLayout.CENTER);
            getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
        // Exit this program.
        private void actionExit() {
            System.exit(0);
        // Add a new download.
        private void actionAdd() {
            URL verifiedUrl = verifyUrl(addTextField.getText());
            if (verifiedUrl != null) {
                tableModel.addDownload(new Download(verifiedUrl));
                addTextField.setText(""); // reset add text field
            } else {
                JOptionPane.showMessageDialog(this,
                        "Invalid Download URL", "Error",
                        JOptionPane.ERROR_MESSAGE);
        // Verify download URL.
        private URL verifyUrl(String url) {
            // Only allow HTTP URLs.
            if (!url.toLowerCase().startsWith("http://"))
                return null;
            // Verify format of URL.
            URL verifiedUrl = null;
            try {
                verifiedUrl = new URL(url);
            } catch (Exception e) {
                return null;
            // Make sure URL specifies a file.
            if (verifiedUrl.getFile().length() < 2)
                return null;
            return verifiedUrl;
        // Called when table row selection changes.
        private void tableSelectionChanged() {
        /* Unregister from receiving notifications
           from the last selected download. */
            if (selectedDownload != null)
                selectedDownload.deleteObserver(DownloadManager.this);
        /* If not in the middle of clearing a download,
           set the selected download and register to
           receive notifications from it. */
            if (!clearing) {
                selectedDownload =
                        tableModel.getDownload(table.getSelectedRow());
                selectedDownload.addObserver(DownloadManager.this);
                updateButtons();
        // Pause the selected download.
        private void actionPause() {
            selectedDownload.pause();
            updateButtons();
        // Resume the selected download.
        private void actionResume() {
            selectedDownload.resume();
            updateButtons();
        // Cancel the selected download.
        private void actionCancel() {
            selectedDownload.cancel();
            updateButtons();
        // Clear the selected download.
        private void actionClear() {
            clearing = true;
            tableModel.clearDownload(table.getSelectedRow());
            clearing = false;
            selectedDownload = null;
            updateButtons();
      /* Update each button's state based off of the
         currently selected download's status. */
        private void updateButtons() {
            if (selectedDownload != null) {
                int status = selectedDownload.getStatus();
                switch (status) {
                    case Download.DOWNLOADING:
                        pauseButton.setEnabled(true);
                        resumeButton.setEnabled(false);
                        cancelButton.setEnabled(true);
                        clearButton.setEnabled(false);
                        break;
                    case Download.PAUSED:
                        pauseButton.setEnabled(false);
                        resumeButton.setEnabled(true);
                        cancelButton.setEnabled(true);
                        clearButton.setEnabled(false);
                        break;
                    case Download.ERROR:
                        pauseButton.setEnabled(false);
                        resumeButton.setEnabled(true);
                        cancelButton.setEnabled(false);
                        clearButton.setEnabled(true);
                        break;
                    default: // COMPLETE or CANCELLED
                        pauseButton.setEnabled(false);
                        resumeButton.setEnabled(false);
                        cancelButton.setEnabled(false);
                        clearButton.setEnabled(true);
            } else {
                // No download is selected in table.
                pauseButton.setEnabled(false);
                resumeButton.setEnabled(false);
                cancelButton.setEnabled(false);
                clearButton.setEnabled(false);
      /* Update is called when a Download notifies its
         observers of any changes. */
        public void update(Observable o, Object arg) {
            // Update buttons if the selected download has changed.
            if (selectedDownload != null && selectedDownload.equals(o))
                updateButtons();
        // Run the Download Manager.
        public static void main(String[] args) {
            DownloadManager manager = new DownloadManager();
            manager.show();
    This example shows how to create a simple download manager in Java. It contains four classes in foru Java source files:
    Download.java: Contains Download class which downloads a file from a URL.
    DownloadManager.java: Contains the main class for download manager application.
    DownloadsTableModel.java: Contains the class which manages the download table's data.
    ProgressRenderer.java: Contains the class which is responsible to render a JProgressBar in a table cell.
    The contents of the listed files are written below.
    /*__Download.java__*/
    import java.io.*;
    import java.net.*;
    import java.util.*;
    // This class downloads a file from a URL.
    class Download extends Observable implements Runnable {
        // Max size of download buffer.
        private static final int MAX_BUFFER_SIZE = 1024;
        // These are the status names.
        public static final String STATUSES[] = {"Downloading",
        "Paused", "Complete", "Cancelled", "Error"};
        // These are the status codes.
        public static final int DOWNLOADING = 0;
        public static final int PAUSED = 1;
        public static final int COMPLETE = 2;
        public static final int CANCELLED = 3;
        public static final int ERROR = 4;
        private URL url; // download URL
        private int size; // size of download in bytes
        private int downloaded; // number of bytes downloaded
        private int status; // current status of download
        // Constructor for Download.
        public Download(URL url) {
            this.url = url;
            size = -1;
            downloaded = 0;
            status = DOWNLOADING;
            // Begin the download.
            download();
        // Get this download's URL.
        public String getUrl() {
            return url.toString();
        // Get this download's size.
        public int getSize() {
            return size;
        // Get this download's progress.
        public float getProgress() {
            return ((float) downloaded / size) * 100;
        // Get this download's status.
        public int getStatus() {
            return status;
        // Pause this download.
        public void pause() {
            status = PAUSED;
            stateChanged();
        // Resume this download.
        public void resume() {
            status = DOWNLOADING;
            stateChanged();
            download();
        // Cancel this download.
        public void cancel() {
            status = CANCELLED;
            stateChanged();
        // Mark this download as having an error.
        private void error() {
            status = ERROR;
            stateChanged();
        // Start or resume downloading.
        private void download() {
            Thread thread = new Thread(this);
            thread.start();
        // Get file name portion of URL.
        private String getFileName(URL url) {
            String fileName = url.getFile();
            return fileName.substring(fileName.lastIndexOf('/') + 1);
        // Download file.
        public void run() {
            RandomAccessFile file = null;
            InputStream stream = null;
            try {
                // Open connection to URL.
                HttpURLConnection connection =
                        (HttpURLConnection) url.openConnection();
                // Specify what portion of file to download.
                connection.setRequestProperty("Range",
                        "bytes=" + downloaded + "-");
                // Connect to server.
                connection.connect();
                // Make sure response code is in the 200 range.
                if (connection.getResponseCode() / 100 != 2) {
                    error();
                // Check for valid content length.
                int contentLength = connection.getContentLength();
                if (contentLength < 1) {
                    error();
          /* Set the size for this download if it
             hasn't been already set. */
                if (size == -1) {
                    size = contentLength;
                    stateChanged();
                // Open file and seek to the end of it.
                file = new RandomAccessFile(getFileName(url), "rw");
                file.seek(downloaded);
                stream = connection.getInputStream();
                while (status == DOWNLOADING) {
            /* Size buffer according to how much of the
               file is left to download. */
                    byte buffer[];
                    if (size - downloaded > MAX_BUFFER_SIZE) {
                        buffer = new byte[MAX_BUFFER_SIZE];
                    } else {
                        buffer = new byte[size - downloaded];
                    // Read from server into buffer.
                    int read = stream.read(buffer);
                    if (read == -1)
                        break;
                    // Write buffer to file.
                    file.write(buffer, 0, read);
                    downloaded += read;
                    stateChanged();
          /* Change status to complete if this point was
             reached because downloading has finished. */
                if (status == DOWNLOADING) {
                    status = COMPLETE;
                    stateChanged();
            } catch (Exception e) {
                error();
            } finally {
                // Close file.
                if (file != null) {
                    try {
                        file.close();
                    } catch (Exception e) {}
                // Close connection to server.
                if (stream != null) {
                    try {
                        stream.close();
                    } catch (Exception e) {}
        // Notify observers that this download's status has changed.
        private void stateChanged() {
            setChanged();
            notifyObservers();
    /*__DownloadTableModel.java__*/
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    // This class manages the download table's data.
    class DownloadsTableModel extends AbstractTableModel
            implements Observer {
        // These are the names for the table's columns.
        private static final String[] columnNames = {"URL", "Size",
        "Progress", "Status"};
        // These are the classes for each column's values.
        private static final Class[] columnClasses = {String.class,
        String.class, JProgressBar.class, String.class};
        // The table's list of downloads.
        private ArrayList downloadList = new ArrayList();
        // Add a new download to the table.
        public void addDownload(Download download) {
            // Register to be notified when the download changes.
            download.addObserver(this);
            downloadList.add(download);
            // Fire table row insertion notification to table.
            fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
        // Get a download for the specified row.
        public Download getDownload(int row) {
            return (Download) downloadList.get(row);
        // Remove a download from the list.
        public void clearDownload(int row) {
            downloadList.remove(row);
            // Fire table row deletion notification to table.
            fireTableRowsDeleted(row, row);
        // Get table's column count.
        public int getColumnCount() {
            return columnNames.length;
        // Get a column's name.
        public String getColumnName(int col) {
            return columnNames[col];
        // Get a column's class.
        public Class getColumnClass(int col) {
            return columnClasses[col];
        // Get table's row count.
        public int getRowCount() {
            return downloadList.size();
        // Get value for a specific row and column combination.
        public Object getValueAt(int row, int col) {
            Download download = (Download) downloadList.get(row);
            switch (col) {
                case 0: // URL
                    return download.getUrl();
                case 1: // Size
                    int size = download.getSize();
                    return (size == -1) ? "" : Integer.toString(size);
                case 2: // Progress
                    return new Float(download.getProgress());
                case 3: // Status
                    return Download.STATUSES[download.getStatus()];
            return "";
      /* Update is called when a Download notifies its
         observers of any changes */
        public void update(Observable o, Object arg) {
            int index = downloadList.indexOf(o);
            // Fire table row update notification to table.
            fireTableRowsUpdated(index, index);
    /*__ProgressRenderer.java__*/
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    // This class renders a JProgressBar in a table cell.
    class ProgressRenderer extends JProgressBar
            implements TableCellRenderer {
        // Constructor for ProgressRenderer.
        public ProgressRenderer(int min, int max) {
            super(min, max);
      /* Returns this JProgressBar as the renderer
         for the given table cell. */
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            // Set JProgressBar's percent complete value.
            setValue((int) ((Float) value).floatValue());
            return this;
    }

    Thank you for the quick reply! But the solution provided by you, it seems, has still not been able to address my issue. I ran the program at command prompt with your said parameters, but the download still gave an error in the App window.
    Also, is there some way of defining these parameters in the source code? I am keen in using NetBeans to run the program.
    Cheers!

  • Mobile Account Error Setting Up Leopard Client, createmobileaccount error.

    Hi all. I posted this discussion under Portable Home Directories, but that is unfortunately a subcategory of Max OS X Server v10.4 Tiger and this is strictly a Leopard issues, so I'm reposting here.
    Just following up on an earlier thread regarding mobile home accounts. Thought I'd post a new entry as the other one has been "answered".
    I've just recently upgraded a slew of clients and a server to Leopard and have been trying to enable mobile accounts on existing network home accounts. When I set this as a Preference using Workgroup Manager, nothing happens on the clients. When I try to create a mobile account directly on the client while logged in as the network user, I get a standard error (The mobile account could not be created.) every time after it asks to log out and enter the user password in order to create the mobile account.
    So, I followed the steps in this thread: http://discussions.apple.com/thread.jspa?threadID=1234051&tstart=0
    For the account "leedale" logged in using a network home directory, entered the Terminal command as follows:
    /System/Library/CoreServices/ManagedClient.app/Contents/Resources/createmobileac count -vsn leedale -h /Users/leedale
    createmobileaccount built Oct 2 2007 22:44:49
    verbose output on.
    user name = "leedale"
    home path = "/Users/leedale"
    user password = "(null)"
    prompt for password = FALSE
    encrypt new home = FALSE
    create as external account = TRUE
    home sync new account = TRUE
    sync URL = "(null)"
    MCXCCacheMCXRecordAndGraph(): existingMCXRecord record setValues:forAttribute:dsAttrTypeNative:cachedauthpolicy == -14120 (Unable to set value(s) for dsAttrTypeNative:cachedauthpolicy in record leedale.)
    MCXCCreateMobileAccount failed to create account. Error = -14120 (MCXCCacheMCXRecordAndGraph failed). Cleaning up mobile account record.
    2007-11-18 17:15:19.831 createmobileaccount551:10b ### Error:-14120 File:/SourceCache/Admin/Admin-423/DSRecord.m Line:484
    mobile account could not be created: -14120 (Unable to set value(s) for dsAttrTypeNative:cachedauthpolicy in record leedale.)
    Any suggestions?

    Hi,
    The namespace you are using for creating client proxy might not be available for consumption(i.e. it might not be published) or there is no connectivity to the source system so namespace is not available.
    Try checking connection.
    Hoping it helps..
    Regards,
    Komal
    Edited by: Komal Lakhwani on Feb 8, 2010 4:31 PM

Maybe you are looking for