Help with data access

Hi,
I am new to Java and stuck at a problem. Situation is like following-
package X
public abstract class A {
     A(int a) { this.a=p; }
     protected int p;
     abstract int func();
package Y
public class B extends A{
     B(int b) { super(b); }
     B() {}
     //p is accessible here
     int func() {
          D d=new D();
          d.func2();
    static void main() {
        func();
public abstract class C extends B{
public class D extends C implements interface{
     int func2() {}
}Now my problem is when I try to access p from func2(), I am getting a NullPointerException error. I am not initialising p anywhere through D()'s and B()'s no argument constructor. Is that the problem?

When you post code it doesn't help when the code doesn't actually reflect the problem.
The code you posted isn't legal java so given that it won't even compile you certainly can't get a null pointer exception from that. And where you commented the usage of 'p' you can't use it there so that doesn't help with guessing what you actual code might have looked like.
So all I can do is offer the following general advice.
Null pointer exceptions occur because a reference is null and it is de-referenced.. Thus if you do a line like the following.
xxx.p
Then 'xxx' is the only possible thing that can be null.
The stack trace of the exception will tell you the exact line that the problem occurred on.

Similar Messages

  • Is there a Java utility class to help with data management in a desktop UI?

    Is there a Java utility class to help with data management in a desktop UI?
    I am writing a UI to configure a network device that will be connected to the serial port of the computer while it is being configured. There is no web server or database for my application. The UI has a large number of fields (50+) spread across 16 tabs. I will write the UI in Java FX. It should run inside the browser when launched, and issue commands to the network device through the serial port. A UI has several input fields spread across tabs and one single Submit button. If a field is edited, and the submit button clicked, it issues a command and sends the new datum to the device, retrieves current value and any errors. so if input field has bad data, it is indicated for example, the field has a red border.
    Is there a standard design pattern or Java utility class to accomplish the frequently encountered, 'generic' parts of this scenario? lazy loading, submitting only what fields changed, displaying what fields have errors etc. (I dont want to reinvent the wheel if it is already there). Otherwise I can write such a class and share it back here if it is useful.
    someone recommended JGoodies Bindings for Swing - will this work well and in FX?

    Many thanks for the reply.
    In the servlet create an Arraylist and in th efor
    loop put the insances of the csqabean in this
    ArrayList. Exit the for loop and then add the
    ArrayList as an attribute to the session.I am making the use of Vector and did the same thing as u mentioned.I am using scriplets...
    >
    In the jsp retrieve the array list from the session
    and in a for loop step through the ArrayList
    retrieving each CourseSectionQABean and displaying.
    You can do this in a scriptlet but should also check
    out the jstl tags.I am able to remove this problem.Thanks again for the suggestion.
    AS

  • Need Help with data type conversion

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

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

  • Need Help with Dates

    I am printing a calendar and certain events will be helds on certain dates.
    One can edit the event if it has not passed the date. Events in the past can be viewed but not edited.
    When I query the database the date must be formatted dd-MMM-yy
    I am able to get today's date by doing this:
    java.util.Date today = new java.util.Date();
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    String today_str = sdf.format(today);
    My code for printing the calendar: I left out some of the table formatting in the JSP page.
    GregorianCalendar d = new GregorianCalendar();
    int today = d.get(Calendar.DAY_OF_MONTH);
    int month = d.get(Calendar.MONTH);
    d.set(Calendar.DAY_OF_MONTH,1);
    int weekday = d.get(Calendar.DAY_OF_WEEK);
    for(int i = Calendar.SUNDAY; i < weekday; i++)
    out.print("<td> </td>");
    do {
    int day = d.get(Calendar.DAY_OF_MONTH);
    out.print("<td>" + day + "</td>");
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    if(weekday == Calendar.SATURDAY)
    out.println("</tr><tr valign=top>");
    d.add(Calendar.DAY_OF_MONTH,1);
    weekday = d.get(Calendar.DAY_OF_WEEK);
    } while(d.get(Calendar.MONTH) == month);
    if(weekday != Calendar.SUNDAY)
    System.out.println();
    The part I need help on is this:
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    I'm looping through each day of the month to print the days. I have the month, day, year as integers. How can I create a date object out of that and compare it to today's date to test if it's before or after today???
    All the function in the Date class that I think would do this have been deprecated.

    Need Help with Dates
    Here is some information about dates:
    There are many edible palm fruits, and one of the most widespread and favored of these is the data (Phoenix dactylifera). Dates were cultivated in ancient land from Mesopotamia to prehistoric Egypt, possibly as early as 6000 B.C. Then--as now--dates were a staple for the natives of those dry regions. Much later, Arabs spread dates around northern Africa, and dates were introduced into California by the Spaniards in 1765, around Mission San Ignacio.
    The date prefers dry, hot climates, because date fruits are injured at temperatures of 20 degrees F, and the damp climate of the California coast was not favorable for fruit production. In the mid-1800s, the date industry developed in California's hot interior valleys and in Arizona. Now the date industry in the United States is localized mostly in the Coachella Valley, where the sandy soils permit the plants to be deeply irrigated. Today the new varieties, mostly introduced in this century, produce about 40 million pounds of dates per annum, or over 60% of the dates consumed in this country. The rest are imported mainly from Persia. According to one survey, about one million people are engaged entirely in date palm cultivation worldwide.
    Hope that helps.

  • Help with date validation on input boxes.

    I need some help with date validation on input boxes.
    What I�m trying to create is a form where a user inputs dates and then the rest of the form calculates the other dates for them.
    i.e. � A user inputs 2 dates (A & B) and then a 3rd date which is 11 weeks before date B is calculated automatically.
    Is this possible and if so how do I do it ???
    Thanks

    Hi,
    to get third date try this:
    java.util.Date bDate = ...;
    Calendar yourCalendar = new GregorianCalendar();
    yourCalendar.setTime(bDate);
    yourCalendar.roll(Calendar.WEEK_OF_YEAR, -11);
    java.util.Date cDate = yourCalendar.getTime();Regards
    Ldinka

  • Help with guided access

    I need help with guided access! My friend's ipod touch 4 used guided access. She can't turn off her ipod touch, and the home button won't work. When she uses the home button, it shows a message that says she needs to click it 3 times. How do i fix it? Please help!

    See:
    iOS: About Guided Access
    In case i forget my guided access...: Apple Support Communities
    SOS I cannot Exit Guided access: Apple Support Communities

  • Issue with Data Access Profile

    Hi Experts,
         Facing issue while using Data Access Profiles:
    I have created a data access profile ,giving access to only limited members for  a particular model.
    While logging in using a particular user id which is assigned to this data access profile I am able to see all the members for which the access is denied
    and I am also able to manipulate the transaction data. But in data access profile I have provided only read access.
    Recently,the system has been upgraded with a new support package after which we are facing the issue.
    Please help us solving the issue.
    BPC version:  10.0 NW
    SP : 15
    Best Regards,
    Remya

    Dear Ramya,
    Again do the setting for data access profile.  Sometime it will not refresh.
    Regards,
    Nanny

  • Need help with thinkvantage access connection

    Here a log file with new access connection:
    Connection status:  Disconnected
    Cause:  Driver disconnected while associating.
    Error code:  229378
    Recommended actions:
    Verify that the encryption settings (WEP/TKIP/AES) specified in this profile match those expected by the wireless network.
    Verify that the wireless adapter in your computer has not been restricted from accessing the radio channels being used by the wireless network.
    If the problem persists, contact your network administrator and provide the troubleshooting information below.
    Adapter Details
    Adapter name  11a/b/g Wireless LAN Mini PCI Express Adapter                  
    Adapter type  Wireless LAN                                                   
    Adapter speed  54.0 Mbps                                                      
    Driver/Firmware version  7.6.0.96/ N/A                                                  
    Adapter status  Enabled                                                        
    Connection Status  Disconnected                                                   
    Disable unused cards?  Yes                                                            
    TCP/IP Settings
    DHCP enabled?  Yes                                                            
    Append parent suffixes of the primary DNS suffix?  Yes                                                            
    Register connection's DNS suffix in registration?  Yes                                                            
    Register connection's DNS suffix in DNS registration?  Yes                                                            
    Enable LMHOSTS Lookup?  No                                                             
    NetBIOS setting  "Default"                                                      
    Wireless Settings
    Network name (SSID)  linksys                                                        
    Connection type  Access point                                                   
    Wireless mode  Auto                                                           
    Security encryption  None                                                           
    System Information
    System model  7732CTO                                                        
    BIOS version  7LETB7WW (2.17 )                                               
    Operating system version  Windows Vista,  Service pack 2                                 
    Access connections version  5.31                                                           
    Access Point scan list
    Network name (SSID)              Wireless mode  MAC address                   Signal strength Channel
    linksys                          802.11g        00:1C:10:54:65:B6              24%            11
    Global Settings
    Network
     Allow all users of this system to switch to any existing location profile  -> No
     Allow the wireless LAN radio to be turned off when inactive  -> No
     Allow selection of location profiles with Fn+F5 On Screen Display menu  -> Yes
     Enable autodeletion of unused profiles  -> Yes
    Notifications
     Show ThinkVantage Access Connections status icon in task tray  -> No
     Show wireless status icon in task tray  -> No
     Display the progress indicator window when a profile is being applied  -> Yes
    Preferences
     Enable sound effects  -> Yes
     Do not show balloon tips from the Access Connections system tray icon  -> Yes
     Show WiMAX page as default on Main GUI  -> No
    Automatic location profile switching list
     Include Ethernet connections in automatic switching and prompt me to save Ethernet ports  -> Yes
     When no other connections are available, connect through Wireless WAN or WiMAX  -> No
    Wireless priority list
    Selection    Priority     Location profile name                                            Connection order                 Connection details             
    No                  1     linksys                                                          Wireless LAN                     SSID: linksys                  
    Log File
    Debug Log is enabled
    It didn't happen when I use old version. Can anybody help me?

    Are you getting any error message while connecting to ds..?
    Are you able to go online on wired computer...?
    Are you able to go online on any wireless computer on your network..?
    Open the router setup page and under the wireless tab,Change the Channel width to 20MHz only and Channel to 11-2.462GHz and click on save settings...Under the Advanced Wireless Settings...Change the Beacon Interval to 75,Change the Fragmentation Threshold to 2304,Change the RTS Threshold to 2304 and Click on Save Settings... 
    Now,check.

  • Mac OS X help with share access on a windows 2003 server

    Hello everyone
    I am not too familiar with Mac OS X (Darwin) and so on and need a little help.
    We recently got a new windows 2003 standard server and I want to move my files to there so they get backed up and so on. I am able to access shares on the pc's on our network but when I try to access the server from finder i just get a box pop up saysing do you want to fix or delete the alias.
    When I try to access it via a terminal, because I am a bit more ok with the cmd line thanks to my linux capabilities, I get the following error:
    mount_smbfs: tree connect phase failed: syserr = Permission denied
    when i try:
    mount_smbfs //dan:[email protected]/General\ Files /BB-SERVER/General\ Files
    Is there anybody that has experienced this before and that can help me resolve this.
    Thank you in advance
    Kobus

    Hi Kobus Bensch,
    I'm sorry I am not able to help with your questions about sharing from your Mac to the server but wanted to suggest that you post back the exact Mac OS version you are using. Your specs below your post suggest 10.0.x which was barely a beta version of Mac OS X. This will surely help those who are seeing your topic and trying to help.
    To find the version you can simply click on the blue Apple in your top menu bar and select About This Mac.
    good luck,
    littleshoulders

  • Help with date code

    Sry about this amount of code lines.... but i realy need help...
    I must insert into a table, the date, like 10/12/2009, and the time, like 22:34:12... but, when i select the date from a datepicker, and insert the time into a text field... i got this result:
    if the date inserted was 12/12/2009 and the time 22:34:12
    result is.......................12/12/0922 34:12:00 <<<<< it´s getting just the two lasts number of the year and inserting the two firsts number of the time into the year, like year 0922 ....
    I´m using a javascript source to create a datepicker......
    and that is the procedure to insert into the table.......
    PROCEDURE set_atendimento(
    p_id_chamado_atendimento IN chamado_atendimento.id_chamado_atendimento%TYPE,
    p_id_chamado IN chamado_atendimento.id_chamado%TYPE,
    p_informacao IN chamado_atendimento.informacao%TYPE,
    p_datahora_inicio IN chamado_atendimento.datahora_inicio%TYPE,
    p_datahora_fim IN chamado_atendimento.datahora_fim%TYPE,
    p_hora_inicio IN VARCHAR2,
    p_hora_fim IN VARCHAR2
    IS
    v_inicio DATE;
    v_fim DATE;
    BEGIN
    v_inicio := TO_DATE(TO_CHAR(p_datahora_inicio || p_hora_inicio), 'DD/MM/YYYY HH24:MI:SS');
    v_fim := TO_DATE(TO_CHAR(p_datahora_fim || p_hora_fim), 'DD/MM/YYYY HH24:MI:SS');
    UPDATE
    chamado_atendimento
    SET
    informacao = UPPER(p_informacao)
    WHERE
    id_chamado_atendimento = p_id_chamado_atendimento;
    IF SQL%NOTFOUND THEN
    INSERT INTO
    chamado_atendimento
    (id_chamado_atendimento, id_chamado, id_operador, datahora_inicio, datahora_fim, informacao)
    VALUES
    (SEQ_CHAMADO_ATENDIMENTO.nextval, p_id_chamado, pkg_operador.get_id_operador, v_inicio, v_fim, UPPER(p_informacao));
    END IF;
    END;
    that is the JAVASCRIPT
    <script language="JavaScript" type="text/JavaScript">
    $(function(){
    $.datepicker.setDefaults({
    showOn: 'button',
    buttonImage: '/i/themes/fwsac/includes/jquery/images/calendario.gif',
    buttonImageOnly: true,
    closeText: 'Fechar',
    prevText: '<Anterior',
    nextText: 'Pr&oacute;ximo>',
    currentText: 'Hoje',
    monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
    monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
    dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
    dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
    dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
    dateFormat: 'dd/mm/yy',
    firstDay: 0,
    isRTL: false,
    showAnim: 'slide'
    $('#P5004_DATAHORA_INICIO , #P5004_DATAHORA_FIM').datepicker({ beforeShow: fdateRange });
    function fdateRange(input){
    return {
    minDate: (input.id == "P5004_DATAHORA_FIM" ? $("#P5004_DATAHORA_INICIO").datepicker("getDate") : null),
    maxDate: (input.id == "P5004_DATAHORA_INICIO" ? $("#P5004_DATAHORA_FIM").datepicker("getDate") : null)
    </script>
    what i must change to get the 4 numbers of the year and all numbers of the time and conca " || " with the date??
    can someone help with this, pls??

    Hello brugo,
    Try this:
    v_inicio := to_nchar((to_date(p_datahora_inicio || p_hora_inicio , 'DD/MM/YYYY HH24:MI:SS')), 'DD/MM/YYYY HH24:MI:SS');
    v_inicio := to_nchar((to_date(p_datahora_fim || p_hora_fim , 'DD/MM/YYYY HH24:MI:SS')), 'DD/MM/YYYY HH24:MI:SS');When I substitute strings: '10/12/2009' for p_datahora_inicio and '22:30:05' for p_hora_inicio, using this format string, I get: 10/12/2009 22:30:05 as a result.
    Don.
    You can reward this reply by marking it as either Helpful or Correct :)

  • Need some help with date

    Hi everyone!
    I have an application in Flex AIR and I'm having problems with dates, I could't found an example on internet until now.
    I tried this for insert (database is embeded sqlite)
    insertManager.parameters[":mydate"] = mydate.selectedDate.time; // type of this column is INTEGER (in my table) and store a number (milliseconds from 1/1/1970) ex: 1265079600000
    Then when I need read records
    mydate.selectedDate = new Date(mydateprice); //it supposed show me DD/MM/YYYY but in every case display 1/1/1970
    If I replace mydateprice for mydate.selectedDate = new Date(1265079600000); // it brings me the right date
    So I don't know what happed, and I'm not sure if it's the best idea to store a date in Flex AIR
    I'll appreciate any help, information or example to find a solution.
    Regards!
    Mara.-

    Thank you so much VIKASH!!! it works!!!
    Now I'm trying to format this value 1265079600000 in my datagrid column:
    <mx:DateFormatter id="dateFormatter" formatString="DD/MM/YYYY"/>
    <mx:DataGridColumn width="140" textAlign="left" headerText="DATE" dataField="myDateColumn" labelFunction="formatDate"  />
    public function formatDate(item:Object,column:DataGridColumn):String
    return dateFormatter.format(item.myDateColumn);
    but this column appear empty....
    Regards and thanks again!
    Mara.-

  • Help with data load model

    Hi,
    I need help with a data load model. First, i'm doing delta extraction from R/3, we load data with a InfoSource to InfoCube A and InfoCube B.
    I'm doing master data validation on the load, so if a load fails for InfoCube A, it fails for InfoCube B too (this is because i can have only 1 InfoPackage for the 2 infocubes, because of the delta update).
    So i propose a new model in wich:
    - The delta load is taked first to an ODS.
    - ODS is cleaned before the delta update.
    - Then i create 2 InfoPackages for full load from ODS to  Infocube A, and from ODS to InfoCube B.
    With this solution i can have 2 infopackages from ODS because i'm not doing a delta load from here to the cubes, and with 2 infopackages i can have independent validations for each cube so if one of them fails, the other can still be loaded sucessfully.
    The solution fails because if i load delta from R/3 to the ODS i can't clean it first. The initialization and the old updates needs to be previuslly loaded on the ODS. Then i can't do full load to the cubes and neither have 2 infopackages.
    Please help me to solve this issue.
    thanks a lot

    Hi jeremy,
    what about this simple solution:
    load data by delta from R/3 in your ODS. You can also have an ODS/cube for the historical data which is more space-saving than holding all the old data in PSA. Then you load your historical data from PSA into the historical ODS/cube.
    From your ODS with the actual data you update your requests by full from ODS into the cubes with 2 different full infopackages. But because you load by full you have to use deletion selections in the infopackages to avoid duplicate data!
    regards,
    Jürgen

  • Help With Date Manipulation

    Hi Everyone,
    I need help with oracle dates. I would like to format the following dates and keep it as a DATE datatype NOT char.
    1/10/2007 8:57:45 PM TO 1/10/2007 (only the data part of SYSDATE)
    1/10/2007 8:57:45 PM TO 1/1/2007 (first of the month)
    If I use the To_Char function, it will return a character string. The problem is that I need to retain the DATE datatype so I can join this query to tables with date fields.

    This?
    sql>
    select trunc(sysdate)
    from dual;
    TRUNC(SYSD 
    01/11/2007                                                                                                                                                                           

  • Help with data migration- Balances from legacy system for Loans Management

    Hi all,
    Can someone please help with this. I need help in how to go about migrating legacy data and balances for loans to SAP FS-CML.
    Which flow types to use, and to do the migration.
    Thanks.
    Fisayo.

    Hi Fisayo,
    good documentation you can find in the transaction KCLJ                      
    => Help => Application help.                                                                               
    You also can find some documentation in the IMG:                            
    => Loans Management                                                              
      => Tools                                                                 
        => External Data Transfer                                             
          => Transfer Categories                                             
             => Loans Master Data and Conditions                             
             => Loans Flow Data                                                                               
    You could use transaction KCLJ to upload the existing  flows. For this you need a sender file with the flows you want to  upload. This file you can create manually or by a report in the old/legacy system that writes the file in your file system.                                                                               
    The sender structure must be defined in transaction KCLL and you could use transaction KCLT to create or change a file to test the upload program.                                                                               
    You will also find some information in the online documentation.                                                                               
    Please be aware that the upload of flows must be tested very exactly. Iif you take over 'wrong' flows, this could cause serious problems in the future when you work with the contracts.   
    Best regards,
    Tomislav

  • Help with Data base

    Hi all I am new in SUN Java Studio Creater and I having problem with
    Data base can sombody help me how Can I create a data base.
    I do not what I need to do that.
    Is not come with Sun Java Studio or no.
    if not which data base you think is the best to use with SUN java Studio
    Creator.
    Thanks alot

    For a start, I guess you can explore the tutorial here:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp?cid=113303
    To create database, I guess, it's better if you use the tool provided by the database. Which database? It can work with any databases provided that you can find the JDBC driver for the database.
    JSC2 is a great product. Just give it a try!

Maybe you are looking for

  • Has anyone had issues with the headphones?

    I get no sound at all through my headphones that came with my phone? The set that came with my husbands didn't work either.

  • Reading String input?

    So the other day I thought I might go ahead and try to make a few simple programs to see if anything I have learned is soaking in. I did a few math ones, which were easy enough, but then I tried to do a password program. It was easy enough to write,

  • Notification Task needs UME role and other value

    Hi Experts, I have a BPM notification task which needs to go to two UME roles (always same) and a UME user (dynamic selection). This UME user is already stored in my context data. However, when I configure the "To" tab of the notification task, how d

  • Contract Renewal - Entire Contract - Service Contract Management - SAP Library

    To add a comment, please log in or register on the top of this page and choose Reply. Please write your comment in English. You can also go back to the SAP help page.

  • Replaceing previous iPod touch with new one...how to Sync?

    Hi, Received a new iPod Touch for Christmas to replace my 2nd Gen version that had run out of memory capacity. My question is...how do I get all of my iTunes library that's on my PC onto the new iPod touch? I want to keep my current iTunes account, j