ERROR IN THE GETTER METHOD

Hi,
I was getting error while trying to get an attribute from a context node.
the following error shows up:
CX_CRM_CIC_PARAMETER_ERROR - Entry parameter of method LCL_SELECTION_PARAM->GET_PROPERTY contains value ACCOUNT_ID, which is not allowed .
this is not in the case of a single field but for all the attributes in a structure.
lv_value_node->get_property( iv_attr_name = 'ACCOUNT_ID' ).
here the field names are very much the same as in the structure, cross checked the same.
instead, when i try to get the properties of the entire structure at a single time, its working fine.
lr_res TYPE REF TO IF_BOL_BO_PROPERTY_ACCESS.
lr_res = lr_cuco->typed_context->node1->collection_wrapper->get_first( ).
lr_res->get_properties( IMPORTING es_attributes = ls_fields ).
here lv_value_node and lr_res are at two diff places. have given a reference for understanding.
if any one of you have faced similar issue and have an ans or could guess some solution, it vud b of grt help.

Hello Srikanth,
The problem is with the semantics of the code you are writing.
Refer to the following code to get Account ID from the value node:
data: lv_account type string.
    lv_account = lv_value_node->get_property_as_string( iv_attr_name = 'ACCOUNT_ID'  ).
or
data: lv_account type bu_partner.
  CALL METHOD lr_value_node->get_property_as_value
    EXPORTING
      iv_attr_name = 'ACCOUNT_ID'                            "#EC NOTEXT
    IMPORTING
      ev_result    = lv_account.
I hope this helps.
Thanks
Vishal

Similar Messages

  • An error with the getter method of my tag handler.

    An error occurred at line: 5 in the jsp file: /tagSupportDeom.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Apache Group\Tomcat 4.1\work\Standalone\localhost\taglib\tagSupportDeom_jsp.java:62: cannot resolve symbol
    symbol : class TagSupportDemo
    location: class org.apache.jsp.tagSupportDeom_jsp
    TagSupportDemo jspxth_tsd_TagSupportDemo_0 = (TagSupportDemo) jspxtagPool_tsd_TagSupportDemo_name_firstValue.get(TagSupportDemo.class);
    ^
    my source :
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    public class TagSupportDemo extends TagSupport {
    private String name;
    private String firstValue;
    public void setName(String name) {
    this.name = name;
    public void setFirstValue(String firstValue) {
    this.firstValue = firstValue;
    public String getName() {
    return name;
    public String getFirstValue() {
    return firstValue;
    public int doStartTag() {
    pageContext.setAttribute("secondValue","value form PageContext.setAttribute()");
    setValue("thridValue","value from TagSupport.setValue()");
    return SKIP_BODY;
    the java file can compile. but when running in jsp, it catch errors.
    why?

    Where is PA ? I just know La because LA Lakers (I
    hate this team and i like Kings and Rockets because of
    YAO MING, haha )Opposite side of the country. PA stands for Pennsylvania, on the East coast. LA (Los Angeles) is in California on the West coast. Philadelphia's basketball team is the 76ers, but they don't play the Lakers,
    Kings, or Rockets very often.
    As for my other info, I'm sorry, I don't give that out to people. Just a personal policy.

  • I can't over give my variable to the return in the get Method!

    Hello Java Cracks
    At the moment I am working with JDOM. I am able to get access to the XML File with JDOM, but when I want to send, the value of a variable, which I get from the XML File it is not possible. When I try to send the variable to the get Method (getDtdVersion), the value I over give is always �null�. Please help me, and say what the problem is?
    I also post you the second class, where I want to use the variable I over give.
    Here is my code:
    Class 1, I take the String from this class. See the arrow
    package FahrplanXML;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import org.jdom.Attribute;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.SAXBuilder;
    import org.xml.sax.InputSource;
    public class FileAuswahl {
    private File filenames;
    private String scheduledtdversion;
    public void ablauf() throws JDOMException, IOException {
    FileAuswaehlen();
    saxwer();
    grundoberflaeche xmloberflaeche = new grundoberflaeche();
    xmloberflaeche.grundoberflaechen();
    public void FileAuswaehlen() {
    JFileChooser datei = new JFileChooser();
    datei.setFileFilter(new FileFilter()
    @Override public boolean accept (File f)
    return f.isDirectory() ||
    f.getName().toLowerCase().endsWith(".xml");
    @Override public String getDescription()
    return "XML-Files";
    int state = datei.showOpenDialog(null);
    if (state == JFileChooser.APPROVE_OPTION )
    filenames = datei.getSelectedFile();
    System.out.println (filenames);
    if (filenames != null)
    try {
    System.out.print(filenames);
    saxwer();
    } catch (JDOMException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    else
    System.out.println("Kein File ausgew�hlt");
    else
    System.out.println("Auswahl abgebrochen");
    System.exit(0);
    //Ausgew�hlter Dateiname an saxwer �bergeben
    public File getNames() {
    System.out.println (filenames);
    return this.filenames;
    public void saxwer() throws JDOMException, IOException {
    //FileAuswahl filename = new FileAuswahl();
    File files = getNames();
    System.out.println (files);
    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(files);
    Element schedulemessage = doc.getRootElement();
    //Root Element auslesen
    String sch_msg_dtdversion = schedulemessage.getAttributeValue ("DtdVersion"); // <---
    scheduledtdversion = sch_msg_dtdversion;
    new grundoberflaeche().grundoberflaechen();
    public String getDtdVersion() {
    System.out.println (scheduledtdversion);
    return this.scheduledtdversion;
    Now, you will see the class in which I pass the String. See also arrow...
    package FahrplanXML;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.text.Caret;
    import org.jdom.Attribute;
    import org.jdom.JDOMException;
    public class grundoberflaeche {
    // Layout f�r Laender vorbereiten
    static void addComponent (Container cont,
    GridBagLayout diversemoegl,
    Component laenderdetails,
    int x, int y,
    int width, int height,
    double weightx, double weighty )
    GridBagConstraints grundoberflaechen = new GridBagConstraints();
    grundoberflaechen.fill = GridBagConstraints.BOTH;
    grundoberflaechen.gridx = x; grundoberflaechen.gridy = y;
    grundoberflaechen.gridwidth = width; grundoberflaechen.gridheight = height;
    grundoberflaechen.weightx = weightx; grundoberflaechen.weighty = weighty;
    diversemoegl.setConstraints(laenderdetails, grundoberflaechen);
    cont.add(laenderdetails);
    //Ausw�hlen des XML Files
    public void XMLAuswaehlen() {
    JFrame xmlauswahl = new JFrame("Fahrplan ausw�hlen");
    xmlauswahl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container laenderdetails = xmlauswahl.getContentPane();
    GridBagLayout diversemoegl = new GridBagLayout();
    laenderdetails.setLayout(diversemoegl);
    JButton dateiauswahl = new JButton ("Datei ausw�hlen");
    addComponent(laenderdetails,diversemoegl,dateiauswahl,1,1,1,1,1,1);
    ActionListener ersterdateiauswaehler = new ActionListener()
    public void actionPerformed( ActionEvent e)
    try {
    new FileAuswahl().ablauf();
    } catch (JDOMException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    } catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    dateiauswahl.addActionListener(ersterdateiauswaehler);
    xmlauswahl.setSize(150,70);
    xmlauswahl.setVisible(true);
    //Layout machen
    public void grundoberflaechen() {
    JFrame fahrplan = new JFrame("Fahrplanauswahldetails");
    fahrplan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container laenderdetails = fahrplan.getContentPane();
    GridBagLayout diversemoegl = new GridBagLayout();
    laenderdetails.setLayout(diversemoegl);
    //Klassenobjekt aufbauen
    FileAuswahl fileauswahl = new FileAuswahl();
    // Labelsbauen und einbauen in den Fahrpl�nen
    String dtdversion = fileauswahl.getDtdVersion(); // <---
    System.out.println(dtdversion);
    JTextField DtdVersion = new JTextField(1);
    DtdVersion.setText(dtdversion);
    JTextField fahrplanzeit = new JTextField(1);
    fahrplanzeit.setText("123");
    JTextField fahrplanzeita = new JTextField(1);
    fahrplanzeita.setText("piips");
    //JButton oesterreich = new JButton("�sterreich");
    //JButton italien = new JButton("Italien");
    //JButton frankreich = new JButton("Frankreich");
    //JButton spanien = new JButton("Spanien");
    addComponent(laenderdetails,diversemoegl,new JLabel("Fahrplandetails"),0,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,DtdVersion,1,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,fahrplanzeit,2,0,1,1,0,0);
    addComponent(laenderdetails,diversemoegl,fahrplanzeita,3,0,1,1,0,0);
    // Action Listener f�r Dateiauswahl
    // Action Listener f�r das Speichern der Datei
    //addComponent(laenderdetails,diversemoegl,frankreich,2,1,1,1,0,0);
    //addComponent(laenderdetails,diversemoegl,spanien,3,1,1,1,0,0);
    fahrplan.setSize(600,750);
    fahrplan.setVisible(true);
    Thank you very much for your help....
    Your Java Learner

    I suspect you are setting the scheduledtdversion member in one instance of your FileAuswahl class, but are creating yet another instance of that class and printing the member of that instance, which is null. I notice you are creating a new FileAuswahl instance each time something happens, rather than reusing the same instance.
    FileAuswahl fileauswahl = new FileAuswahl();Ok, new object here. Not the same one that you previously set the scheduledtdversion member in
    String dtdversion = fileauswahl.getDtdVersion();It's null of course, for the reason above.

  • [svn:fx-trunk] 10891: Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants

    Revision: 10891
    Author:   [email protected]
    Date:     2009-10-06 09:46:47 -0700 (Tue, 06 Oct 2009)
    Log Message:
    Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants
    QE notes: None.
    Doc notes: None
    Bugs: SDK-22676
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22676
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java

    Have you tried using com.adobe.air.crypto.EncryptionKeyGenerator instead?

  • Form and the get method

    I am using a simple form with one dropdown menu and one
    submit button.
    The form uses the get mothod to send the menu id to another
    page.
    The form must also get another value and send it along with
    the selected menu value.
    The missing value will come from the "prod_id" from my
    recordset, but I do not want to show that value to the user, of
    course, so I do not know how to incorporate it into the form.
    My second page relies on $_GET['prod_id'] and
    $_GET['menu_value']
    The menu_value is in the url, but not the prod_id, as
    explained.
    Thanks for any advice.

    On Fri, 20 Feb 2009 19:19:28 +0000 (UTC), "bregent"
    <[email protected]> wrote:
    > That's what I was going to suggest, with the caveat that
    if this is sensitive
    >information you are trying to hide, it will be visible in
    source view. The fact
    >that you did not want it in the querystring leads my to
    believe this may be the
    >case.
    That's true.
    Gary

  • I can't give my variable to the get method

    Hello togheter
    At the moment I work with JDOM. It is possible to get access to an XML File with JDOM, but I want to pass the String I get, to another Method in a different class. My problem is, that my getMethod doesn't get the variable. The variable is always "null". What is the problem, please help me.
    I will also give you my code:
    Here is the code for class 1, I take the String from this class. See the arrow
    package FahrplanXML;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.FileFilter;
    import org.jdom.Attribute;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.SAXBuilder;
    import org.xml.sax.InputSource;
    public class FileAuswahl {
       private File filenames;
       private String scheduledtdversion;
       public void ablauf() throws JDOMException, IOException {
          FileAuswaehlen();
          saxwer();
          grundoberflaeche xmloberflaeche = new grundoberflaeche();
          xmloberflaeche.grundoberflaechen();
       public void FileAuswaehlen() {
       JFileChooser datei = new JFileChooser();
       datei.setFileFilter(new FileFilter()
                @Override public boolean accept (File f)
                   return f.isDirectory() ||
                   f.getName().toLowerCase().endsWith(".xml");
                @Override public String getDescription()
                   return "XML-Files";
       int state = datei.showOpenDialog(null);
       if (state == JFileChooser.APPROVE_OPTION )
          filenames = datei.getSelectedFile();
          System.out.println (filenames);
          if (filenames != null)
                   try {
                      System.out.print(filenames);
                      saxwer();
                   } catch (JDOMException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                   } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
          else
             System.out.println("Kein File ausgew�hlt");
       else
       System.out.println("Auswahl abgebrochen");
       System.exit(0);
       //Ausgew�hlter Dateiname an saxwer �bergeben
       public File getNames() {
          System.out.println (filenames);
          return this.filenames;
       public void saxwer() throws JDOMException, IOException {
          //FileAuswahl filename = new FileAuswahl();
          File files = getNames();
          System.out.println (files);
             SAXBuilder builder = new SAXBuilder();
             Document doc = builder.build(files);
             Element schedulemessage = doc.getRootElement();
             //Root Element auslesen
             String sch_msg_dtdversion = schedulemessage.getAttributeValue ("DtdVersion");  // <---
             scheduledtdversion = sch_msg_dtdversion;
             new grundoberflaeche().grundoberflaechen();
             public String getDtdVersion() {
                System.out.println (scheduledtdversion);
                return this.scheduledtdversion;
       } Now, you will see the class in which I pass the String. See also arrow...
    package FahrplanXML;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.text.Caret;
    import org.jdom.Attribute;
    import org.jdom.JDOMException;
    public class grundoberflaeche {
    //      Layout f�r Laender vorbereiten
          static void addComponent (Container cont,
                GridBagLayout diversemoegl,
                Component laenderdetails,
                int x, int y,
                int width, int height,
                double weightx, double weighty )
                GridBagConstraints grundoberflaechen = new GridBagConstraints();
                grundoberflaechen.fill = GridBagConstraints.BOTH;
                grundoberflaechen.gridx = x; grundoberflaechen.gridy = y;
                grundoberflaechen.gridwidth = width; grundoberflaechen.gridheight = height;
                grundoberflaechen.weightx = weightx; grundoberflaechen.weighty = weighty;
                diversemoegl.setConstraints(laenderdetails, grundoberflaechen);
                cont.add(laenderdetails);
          //Ausw�hlen des XML Files
          public void XMLAuswaehlen() {
             JFrame xmlauswahl = new JFrame("Fahrplan ausw�hlen");
             xmlauswahl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             Container laenderdetails = xmlauswahl.getContentPane();
             GridBagLayout diversemoegl = new GridBagLayout();
             laenderdetails.setLayout(diversemoegl);
             JButton dateiauswahl = new JButton ("Datei ausw�hlen");
             addComponent(laenderdetails,diversemoegl,dateiauswahl,1,1,1,1,1,1);
             ActionListener ersterdateiauswaehler = new ActionListener()
                public void actionPerformed( ActionEvent e)
                      try {
                         new FileAuswahl().ablauf();
                      } catch (JDOMException e1) {
                         // TODO Auto-generated catch block
                         e1.printStackTrace();
                      } catch (IOException e1) {
                         // TODO Auto-generated catch block
                         e1.printStackTrace();
             dateiauswahl.addActionListener(ersterdateiauswaehler);
             xmlauswahl.setSize(150,70);
             xmlauswahl.setVisible(true);
          //Layout machen
          public void grundoberflaechen() {
             JFrame fahrplan = new JFrame("Fahrplanauswahldetails");
             fahrplan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             Container laenderdetails = fahrplan.getContentPane();
             GridBagLayout diversemoegl = new GridBagLayout();
             laenderdetails.setLayout(diversemoegl);
             //Klassenobjekt aufbauen
             FileAuswahl fileauswahl = new FileAuswahl();
             // Labelsbauen und einbauen in den Fahrpl�nen
             String dtdversion = fileauswahl.getDtdVersion();   // <---
             System.out.println(dtdversion);
             JTextField DtdVersion = new JTextField(1);
             DtdVersion.setText(dtdversion);
             JTextField fahrplanzeit = new JTextField(1);
             fahrplanzeit.setText("123");
             JTextField fahrplanzeita = new JTextField(1);
             fahrplanzeita.setText("piips");
             //JButton oesterreich = new JButton("�sterreich");
             //JButton italien = new JButton("Italien");
             //JButton frankreich = new JButton("Frankreich");
             //JButton spanien = new JButton("Spanien");
             addComponent(laenderdetails,diversemoegl,new JLabel("Fahrplandetails"),0,0,1,1,0,0);
             addComponent(laenderdetails,diversemoegl,DtdVersion,1,0,1,1,0,0);
             addComponent(laenderdetails,diversemoegl,fahrplanzeit,2,0,1,1,0,0);
             addComponent(laenderdetails,diversemoegl,fahrplanzeita,3,0,1,1,0,0);
             //         Action Listener f�r Dateiauswahl
             //         Action Listener f�r das Speichern der Datei
             //addComponent(laenderdetails,diversemoegl,frankreich,2,1,1,1,0,0);
             //addComponent(laenderdetails,diversemoegl,spanien,3,1,1,1,0,0);
             fahrplan.setSize(600,750);
             fahrplan.setVisible(true);
    }Thank you very much for your help....
    Your Java Learner

    Reposted here, rather than bumping up this topic:
    http://forum.java.sun.com/thread.jspa?threadID=736492

  • Recordsert not working using the GET method

    I'm trying to create a recordset that will retrieve a record from MSSQL.
    My recordset is like this:
    <%
    Dim rsAssets__MMColParam2
    rsAssets__MMColParam2 = "1"
    If (Request.QueryString("type") <> "") Then
      rsAssets__MMColParam2 = Request.QueryString("type")
    End If
    %>
    <%
    Dim rsAssets__MMColParam
    rsAssets__MMColParam = "1"
    If (Request.QueryString("number") <> "") Then
      rsAssets__MMColParam = Request.QueryString("number")
    End If
    %>
    <%
    Dim rsAssets
    Dim rsAssets_cmd
    Dim rsAssets_numRows
    Set rsAssets_cmd = Server.CreateObject ("ADODB.Command")
    rsAssets_cmd.ActiveConnection = MM_ezcaldatasource_STRING
    rsAssets_cmd.CommandText = "SELECT * FROM dbo.assets WHERE ? = ?"
    rsAssets_cmd.Prepared = true
    rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param1", 200, 1, 255, rsAssets__MMColParam2) ' adVarChar
    rsAssets_cmd.Parameters.Append rsAssets_cmd.CreateParameter("param2", 200, 1, 255, rsAssets__MMColParam) ' adVarChar
    Set rsAssets = rsAssets_cmd.Execute
    rsAssets_numRows = 0
    %>
    Thi s gives me a Server 500 error...if I just I only use 1 parameter, it works fine. Basically, MMColParam2 is a column in the database (either Asset or Serial) which comes from a field on my form.

    try this
    Dim rsAssets
    Dim  rsAssets_cmd
    Dim rsAssets_numRows
    Set rsAssets_cmd =  Server.CreateObject ("ADODB.Command")
    rsAssets_cmd.ActiveConnection =  MM_ezcaldatasource_STRING
    rsAssets_cmd.CommandText = "SELECT * FROM  dbo.assets WHERE '"&request.querystring("type")&"' = '"&request.querystring("number")&"'"
    rsAssets_cmd.Prepared = true
    im thinking it has to do with either there being a blank value passed... or.. the "content type" is wrong

  • Errors in the "Getting Started with the FPGA Module" examples

    We have LabView 8.0, the NI-5640R, and the LabView FPGA module installed on a computer with the IF-RIO board, and we are trying to compile the provided NI examples (NI-5640R documentation), but we receive errors that say "sub VI is not executable" and "you have connected terminals of two different types"  Why are the existing NI VI's not compiling properly?  We are guessing that we have some configuration error, though we aren't sure.

    The run error is broken and gives the option to list and locate errors, though these errors are found everywhere in the files that are provided in the NI-5640R.  Several wires have red x's that say that different types are attempting to be wired, and multiple blocks are highlighted that list errors that say that the blocks cannot be activated.  It seems like there is a problem with how the software and board has been installed.  The group that used the board before us had a functioning project, although they but the IF-RIO in their own computers, so they might not have put everything back together properly.  Their old VI's produce the same errors on our computer.  Do you have any suggestions on what to do? 

  • How to get the one attribute value in another attribute getter method

    Hi,
    I have a requirement to get one attribute's value in the another attribute getter or setter method.
    Help needed ASAP.
    Thanks,
    sreenivas.

    Check if both the attributes are under the same context node.
    If so directly call the getter method of the other attribute here like this:
    lv_customer_type = me->get_customer_type( attribute_path = 'STRUCT.CUSTOMER_TYPE' ).
    If it is under a different context node,check if it is available from some relation, if so
        lr_agr_rel = current->get_related_entity( iv_relation_name = 'TpmAgrre'l ).
         CALL METHOD lr_agr_rel->if_bol_bo_property_access~get_property_as_value
            EXPORTING
              iv_attr_name = 'EXTERNAL_ID'
            IMPORTING
              ev_result    = lv_cust_plan_id.
    Regards,
    Masood Imrani S.

  • Get method in the Attribute class. in JNDI

    I had connected to the AD
    // Create the initial directory context
    DirContext ctx = new InitialDirContext(env);
    Attributes attrs = ctx.getAttribute("DC=DomainDnsZones,DC=testing,DC=local");
    but I had no idea wat to get from the attrs.get method.
    as in, I don't know what kind of attributes ID are available inside my attrs
    is there any coding to get all the attribute ID so tat I can use the get method to retrieve them?

    We can get the available Attributes for a particular user.....
    using Attributes class for a Search and Context....
    You can try out the free LDAP viewer available in internet (Its a Applet)... u can find the possible Attribute Names in that... and use the below statement..
    Attributes attrs1 = ctx.getAttributes("CN=" + "user,CN=Users,DC=domain,DC=dmn,DC=com");
    String office = (String)attrs1.get("physicaldeliveryofficename").get();

  • Null pointer exception in getter method

    I am trying to have a getter method that returns a collection. The method is supposed to get a list of files from a directory and returns the collection. I am instantiating the List in the method and the converting an array into the List using asList. Then I am trying to return the list to the main method.
    When I put this code in the main method I get the result I want, but when I try to put it in the getter method and call it from main I get a NullPointerException compile error.
    I need help understanding what I am doing wrong when I move this code out of the main method and into another non static method.

    I was looking around at other posts and noticed they
    give more code than I was. I was trying to save you
    some reading but now I see I just made it harder.No problem. It can be difficult to know just how much code to post to get all the relevant stuff but not a bunch of extraneous junk.
    The problem is you have two different currentDirectory variables. The member variable (declared just inside public class FileBrowser and a method (or "local") variable declared in main. The local one in main hides or shadows (those two terms are similar in Java, and I forget the details of which is which) the member variable.
    When you set the one in main, it doesn't affect the member variable. The local one in main only exists inside of main.
    To fix this, change this line inside of main: File currentDirectory = new File(System.getProperty("user.dir")); to this: currentDirectory = new File(System.getProperty("user.dir")); By having the class name File there you're declaring a new variable. Without the class name, you're just using the existing member variable.

  • Undeclared Identifier Error for some 'PDFEdit_Layer' Methods

    Hi,
    I am getting the errors for the some Methods in PDFEdit_Layer ,
    1. Code -> PDEText pdeText = PDETextCreate();
    Error 3 error C2065: 'PDETextCreateSELPROTO' : undeclared identifier
    2. Code -> sysFont = PDFindSysFont(&pdeFontAttrs,sizeof(PDEFontAttrs), 0);
    Error 5 error C2065: 'PDFindSysFontSELPROTO' : undeclared identifier
    3. Code -> pdeFont = PDEFontCreateFromSysFont(sysFont, kPDEFontDoNotEmbed);
    Error 9 error C2065: 'PDEFontCreateFromSysFontSELPROTO' : undeclared identifier
    4. Code -> pdeColorSpace = PDEColorSpaceCreateFromName(ASAtomFromString("DeviceGray"));
    Error 11 error C2065: 'PDEColorSpaceCreateFromNameSELPROTO' : undeclared identifier
    5. Code -> PDETextAdd (pdeText, kPDETextRun, 0,(ASUns8 *)Title, strlen(Title), pdeFont, &gState,sizeof(gState), NULL, 0, &textMatrix, NULL);
    Error 15 error C2065: 'PDETextAddSELPROTO' : undeclared identifier
    Irrespective of including below header files i am the above Errors.
    #include "CoreExpT.h"
    #include "PDSExpT.h"
    #include "PEExpT.h"
    #include "PERProcs.h"
    #include "CorCalls.h"
    #include "PDCalls.h"
    #include "PERCalls.h"
    #include "PEWCalls.h"
    #include "PDSExpT.h"
    #include "PSFCalls.h"
    #include "PDSysFontExpT.h"
    I tried including the above headers then also i am getting the errors as shown above. Please let me know why is this happening, am i missing something ??
    Please someone help me, Thanks in advance.
    Regards,
    Chetan.

    This is for Plugin in Acrobat, not for Reader.
    Yes, i have set all proper defines for the project.
    #pragma 
    region [ Headers ]
    #include 
    <string>
    // Acrobat Headers.
    #ifndef 
    MAC_PLATFORM
    #include 
    "PIHeaders.h"
    #endif
    #pragma 
    endregion
    "PIHeaders.h" is having all the required header files for the Methods which i have specified.
    Yes.All this method i find under Samples\SnippetRunner project, i am able to build this project successfully.
    Please let me know what needs to be done for successfull building the solution.Thanks in advance.
    Regards,
    Chetan.

  • Why is the static method in the superclass more specific?

    Why is the static method in the superclass more specific than the static method in the subclass? After all, int is a subtype of long, but Base is not a subtype of Sub.
    class Base {
        static void m(int i){ System.out.println("Base"); }
    class Sub extends Base {
        static void m(long l){ System.out.println("Sub"); }
    class Test {
        public static void main(String[] args) {
            int i = 10;
            Sub sub = new Sub();
            sub.m(i);
    }The first example compiles without error.
    Output: Base
    class Base {
        void m(int i){ System.out.println("Base"); }
    class Sub extends Base {
        void m(long l){ System.out.println("Sub"); }
    class Test {
        public static void main(String[] args) {
            int i = 10;
            Sub sub = new Sub();
            sub.m(i);
    }In the second example, both instance methods are applicable and accessible (JLS 15.12.2.1), but neither is more specific (JLS 12.2.2), so we get a compiler error as expected.
    : reference to m is ambiguous,
    both method m(int) in Base and method m(long) in Sub match
    sub.m(i);
    ^
    1 error
    Why don�t we get a compiler error for the static methods?

    Thank you for your ideas.
    ====
    OUNOS:
    I don't get Sylvia's response. This is about static methods, what are instances are needed for??Yes, the question is about static methods. I included the example with non-static methods for a comparison. According to JLS 15.12.2, both examples should cause a compiler error.
    And why you create a Sub object to call the method, and dont just call "Sub.m(..)"Yes, it would make more sense to call Sub.m(i). Let�s change it. Now, I ask the same question. Why is there no compiler error?
    ====
    DANPERKINS:
    The error in your logic stems from calling static methods on instances, as ounos pointed out. Solution: don't. You won't see any more ambiguities.A static member of a class may also be accessed via a reference to an object of that class. It is not an error. (The value of the reference can even be null.)
    Originally I was looking only at the case with non-static methods. Therefore, I used sub.m(i). Once I understood that case, I added the static modifiers. When posting my question, I wish I had also changed sub.m to Sub.m. Either way, according to JLS 15.12.2, a compiler error should occur due to ambiguous method invocation.
    ====
    SILVIAE:
    The question was not about finding an alternative approach that doesn't throw up an ambiguity. The question related to why, in the particular situations described, the ambiguity arises in only one of them.
    Yes.
    Proposing an alternative approach doesn't address the question.
    Yes.
    ====
    If anyone is really interested, here is some background to the question. Some people studying for a Sun Java certificate were investigating some subtleties of method invocations:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=24&t=019182
    I remember seeing the non-static case discussed in this forum once before in a more practical context. jschell probably knows the link.

  • Urgent , Post or Get method?

    hello all;
    when i deploy a servelt on growser with the GET method , the servlet is working all right, but when i use POST method (to change database) , i have error , please tell me how and when i use Post method?

    GET and POST are two different ways of passing data from a browser to a server. With the GET method, the browser constructs a Query String (?var1=val&var2=val...) which is passed to the server as part of the URL. With the POST method, the data from the browser is passed via standard input to the server. You determine which method is used when you build the HTML form:
    <FORM ACTION="/path/action_servlet" METHOD="POST">
    OR
    <FORM ACTION="/path/action_servlet" METHOD="GET">
    <INPUT TYPE="TEXT" NAME="var1">
    <INPUT TYPE="TEXT" NAME="var2">
    <INPUT TYPE="SUBMIT">
    </FORM>
    In the case of servlets, either the doGet() or doPost() method will be executed depending on how the data is passed from the browser.
    In general, use the GET method for debugging or if you want the client to be able to bookmark the entire URL (with parameters). If you have an application where you are "changing the database", you probably want to use the POST method.
    -- Brian
    null

  • Cant make get method work

    package nim;
    import java.util.Random;
    public class Row {
        private static final int MAX = 21; //max number of stars in row
        private int howmany;
        /** Creates a new instance of Row with 1 to MAX stars*/
        public Row() {
            howmany = 1 + (new Random().nextInt(MAX));
        /**Creates a new instance of Row with n stars
         * @param n number of stars in the row
         *        if n is greater than MAX, n is set to MAX
         *        if n is less than n is set to 1
        public Row (int n) {
            if (n <=0 ) howmany = 1;
            else if (n > MAX) howmany = MAX;
            else howmany = n;
                System.out.println(howmany);
        /**Getter
         * @return number of stars currently in the row
        public int getHowmany() {
            return howmany;
        /**Setter
         * @param howmany number of stars in row
        public void setHowmany(int n) {
           if (n <0 ) howmany = 0;
            else if (n > MAX) howmany = MAX;
            else howmany = n;
    }i have this and im trying to just use the get method but i cant figure out for the life of me how to make this work, the code i came up with is
    package nim;
    public class testtt
    public static void main (String[]args)
         Row a = new Row(5);
         System.out.println(a.getHowmany);
    }and i keep getting the error testtt.java:11: cannot find symbol
    symbol  : variable getHowmany
    location: class nim.Row
         System.out.println(a.getHowmany);does anyone know how to make this work? im getting ready to pull my hair out

    you have missed the brackets of the function call
         System.out.println(a.getHowmany);
         System.out.println(a.getHowmany());

Maybe you are looking for