Problem in class moving to next method

thank you to all those who helped me with dealing with time in my Movie class. My other problem is I can't return the charges (val) once a movie is hired. I need my Movie class to output the following when applied to the TestMovie class.
Movie MOV456 is hired to PC00034
Movie MOV456 cannot be hired to PC10101
Movie MOV456 is returned by PC00034
Total Charges = 16.5
Movie MOV456 cannot be hired to PC98456
Movie MOV456 is hired to PC99999
Movie: MOV456
Description: The Fellowship of the ring
Classification: PG
Status: H
Rate per day: 5.5
Hirer=PC99999
Date/time of hire: 2007/3/19 - 18:30
Here is my Movie class:
//CPT12 - Assignment2
//Written by Suzanne Howarth, 88886, Tutor - Clemens Meyr
//This is the class of an object orientated programme to manage the hiring of movies
import java.util.*;
import java.text.*;
//Defined instance variables set to private
public class Movie {
//Defined constuctor for the Movie class
    public Movie(String movieID, String description, String classification, float dailyRate) {
        ID = movieID;
        this.description = description;
        this.classification = classification;
        status = 'A';
        this.dailyRate = dailyRate;       
         private String ID;
         private String description;
         private String classification;
         private float dailyRate;
         private char status;
         private String hirer;
         private String s;
         private GregorianCalendar dob;
         private GregorianCalendar d;
         private GregorianCalendar dC;
         private double val;
         private long daysHired;
         private long age;
         private boolean valid;
//Defined accessors for the Movie class
    public String getID() {
        return ID;
    public String getDescription() {
        return description;
    public String getClassification() {
        return classification;
    public float getDailyRate() {
        return dailyRate;
    public char getStatus() {
        return status;
    public boolean hire(String hirerID, GregorianCalendar hirerDOB, GregorianCalendar dateTime) {
        hirer = hirerID;
        dob = hirerDOB;
        d = dateTime;
        boolean valid = false;
    if (status == 'A') {
            if (classification.equals("PG")) {
         valid = true;
        else {
         if (age<18) {
            valid = true;
    if (valid) {
     status = 'H';
    return valid;
    public String getHirer() {
        return hirer;
    public GregorianCalendar getDob() {
        return dob;
    public GregorianCalendar getD() {   
        return d;        
    public String getS() {
        Date date = d.getTime();
        DateFormat df = DateFormat.getDateTimeInstance();
        s = df.format(date);
        return s;
    public long getAge() {
        age = (d.getTimeInMillis() - dob.getTimeInMillis())/(365*24*60*60*1000);
        return age;
    public double hireComplete(GregorianCalendar date_time2) {
        dC = date_time2;
        if ((status == 'H') && (val > 0.0))
            return val;
        else
            return val = -1.0;
    public long getDaysHired() {
        daysHired = (dC.getTimeInMillis() - d.getTimeInMillis())/(24*60*60*1000);
        return daysHired;
    public GregorianCalendar getDC() {
        return dC;
    public double getVal() {
        val = daysHired * dailyRate;       
        return val;
    public void print() {  
        System.out.println("Movie ID - " + ID);
        System.out.println("Movie - " + description);
        System.out.println("Classification - " + classification);
        System.out.println("Status - " + status);
        System.out.println("Daily Rate - " + dailyRate);
        System.out.println("Hirer ID - " + hirer);
        System.out.println("Date and Time of hire - " + s);
}and here is the MovieTest class:
import java.util.GregorianCalendar;
public class TestMovie
   public static void main(String args[])
      Movie mov = new Movie("MOV456", "The Fellowship of the ring", "PG", 5.50f);     
      String hirer1ID = "PC00034";     
      // GregorianCalendar date below correspond to 15th March 2007, 1.30 pm
      GregorianCalendar d1 = new GregorianCalendar(2007,3,15,13,30);
      GregorianCalendar dob1 = new GregorianCalendar(1989,01,22,15,15);
      if (mov.hire(hirer1ID, dob1, d1) == true)
         System.out.println("Movie " + mov.getID() + " is hired to " + mov.getHirer());  
      else
         System.out.println("Movie " + mov.getID() + " could not be hired to " + hirer1ID);
      // Another attempt to hire the movie (after the movie has already been hired)
      GregorianCalendar d2 = new GregorianCalendar(2007,3,15,15,30);
      GregorianCalendar dob2 = new GregorianCalendar(1989,12,20,10,12);
      String hirer2ID = "PC10101";
      if (mov.hire(hirer2ID, dob2, d2) == true)
         System.out.println("Movie " + mov.getID() + " is hired to " + mov.getHirer());  
      else
         System.out.println("Movie " + mov.getID() + " cannot be hired to " + hirer2ID);
      // Completing the hiring of the movie
      GregorianCalendar d1C = new GregorianCalendar(2007,3,18,10,30);
      double val = mov.hireComplete(d1C);
      if ( val > 0.0 )
         System.out.println("Movie " + mov.getID() + " is returned by " + mov.getHirer());  
         System.out.println("Total Charges = " + val);  
      Another attempt to hire the movie (after earlier hire is completed,
      but with hirer too young to hire a PG rated movie)
      GregorianCalendar d3 = new GregorianCalendar(2007,3,19,16,30);
      GregorianCalendar dob3 = new GregorianCalendar(1995,12,20,10,12);
      String hirer3ID = "PC98456";
      if (mov.hire(hirer3ID, dob3, d3) == true)
         System.out.println("Movie " + mov.getID() + " is hired to " + mov.getHirer());  
      else
         System.out.println("Movie " + mov.getID() + " cannot be hired to " + hirer3ID);
      // Hiring the movie with the correct age again        
      GregorianCalendar d4 = new GregorianCalendar(2007,3,19,18,30);
      GregorianCalendar dob4 = new GregorianCalendar(1985,12,20,10,12);
      String hirer4ID = "PC99999";
      if (mov.hire(hirer4ID, dob4, d4) == true)
         System.out.println("Movie " + mov.getID() + " is hired to " + mov.getHirer());  
      else
         System.out.println("Movie " + mov.getID() + " cannot be hired to " + hirer4ID);  
      // Printing the details of Movie object referred by mov  
      mov.print();          
}The problem must be with how I coded my Movie class. It just won't output that the movie has been returned and the total charges.
Any help would be very much appreciated.

Do u mean to put it like this:
//CPT12 - Assignment2
//Written by Suzanne Howarth, 88886, Tutor - Clemens Meyr
//This is the class of an object orientated programme to manage the hiring of movies
import java.util.*;
import java.text.*;
//Defined instance variables set to private
public class Movie {
//Defined constuctor for the Movie class
    public Movie(String movieID, String description, String classification, float dailyRate) {
        ID = movieID;
        this.description = description;
        this.classification = classification;
        status = 'A';
        this.dailyRate = dailyRate;       
         private String ID;
         private String description;
         private String classification;
         private float dailyRate;
         private char status;
         private String hirer;
         private String s;
         private GregorianCalendar dob;
         private GregorianCalendar d;
         private GregorianCalendar dC;
         private double val;
         private long daysHired;
         private long age;
         private boolean valid;
//Defined accessors for the Movie class
    public String getID() {
        return ID;
    public String getDescription() {
        return description;
    public String getClassification() {
        return classification;
    public float getDailyRate() {
        return dailyRate;
    public char getStatus() {
        return status;
    public boolean hire(String hirerID, GregorianCalendar hirerDOB, GregorianCalendar dateTime) {
        hirer = hirerID;
        dob = hirerDOB;
        d = dateTime;
        boolean valid = false;
    if (status == 'A') {
            if (classification.equals("PG")) {
         valid = true;
        else {
         if (age<18) {
            valid = true;
    if (valid) {
     status = 'H';
    return valid;
    public String getHirer() {
        return hirer;
    public GregorianCalendar getDob() {
        return dob;
    public GregorianCalendar getD() {   
        return d;        
    public String getS() {
        SimpleDateFormat formatter = new SimpleDateFormat("d");
        GregorianCalendar d = new GregorianCalendar();
        s = formatter.format(d.getTime());
        return s;
    public long getAge() {
        age = (d.getTimeInMillis() - dob.getTimeInMillis())/(365*24*60*60*1000);
        return age;
    public double hireComplete(GregorianCalendar date_time2) {
        dC = date_time2;
        if ((status == 'H') && (val > 0.0)) {
            val = daysHired * dailyRate;
            return val;
        else
            return val = -1.0;
    public long getDaysHired() {
        daysHired = (dC.getTimeInMillis() - d.getTimeInMillis())/(24*60*60*1000);
        return daysHired;
    public GregorianCalendar getDC() {
        return dC;
    public double getVal() {            
        return val;
    public void print() {  
        System.out.println("Movie ID - " + ID);
        System.out.println("Movie - " + description);
        System.out.println("Classification - " + classification);
        System.out.println("Status - " + status);
        System.out.println("Daily Rate - " + dailyRate);
        System.out.println("Hirer ID - " + hirer);
        System.out.println("Date and Time of hire - " + s);
}I must be wrong because I am still not getting the desired output.

Similar Messages

  • Scanner next method... wtf?

    Code:import java.io.*;
    import java.util.*;
    public class Test
         public static void main(String[] args)
              File file = new File("prob.in");
              Scanner scan = null;
              try{
                   scan = new Scanner(file);
              }catch(FileNotFoundException e){}
              ArrayList<Character> arr = new ArrayList<Character>();
              String[] keys = new String[10];
              keys[0] = "0";
              keys[1] = "@.?1";
              keys[2] = "ABC2";
              keys[3] = "DEF3";
              keys[4] = "GHI4";
              keys[5] = "JKL5";
              keys[6] = "MNO6";
              keys[7] = "PQRS7";
              keys[8] = "TUV8";
              keys[9] = "WXYZ9";
              String strtest = scan.next();
              System.out.print(strtest);
    }Make prob.in whatever you want, it doesn't matter, I just want to get a string from the first line of it. But when I try to run it I get a NullPointerException on line 25. Why is this?

    Ya, but even if it doesn't do anything there, I'll
    eventually get a NullPointerException down the line.What do you mean? Why do you think that? What does that have to do with anything?
    I figured out my problem. I just recently started
    using eclipse instead of JCreator, and I forgot to
    put the file in the project folder. But I was
    wondering, how can you get the whole line without it
    stopping on the spaces. For example, my prob file
    says 4433 555 555 666* 9666 777 555 3* 222 9992
    #555 8888777 *. When I use the next() method,
    it only returns "4433". Is there a way for it to get
    the whole line with the spaces, or am I going to have
    to make some loop?Have you looked through Scanner's methods to see if one of them might help you?
    Even if you find such a method though, how will it help? Are you going to process the whole line as a single piece? Or are you going to have to loop over its pieces anyway?

  • Using a string or char as a class when calling a method

    Is there a way to take the string.charAt(int) method and use it as a stand in for a class that is one character long? (Examples below, as I'm sure that question makes no sense out of context.)
    Something like (note the last line):
    import java.util.Scanner;
    public class DRV
         public static void main(String[] args)
              Scanner inpt = new Scanner(System.in);
              String stringy;
              A a = new A();
              System.out.println("Enter 'a': ");
              stringy = inpt.next();
              [stringy.charAt(0)].lineOne();
    }Or will I just have to use a lot of if statements:
    import java.util.Scanner;
    public class DRV
         public static void main(String[] args)
              Scanner inpt = new Scanner(System.in);
              String stringy;
              A a = new A();
              System.out.println("Enter 'a': ");
              stringy = inpt.next();
              if (stringy.charAt(0) == 'a')
                   a.lineOne();
                   System.out.println();
    }I doubt this is possible, but it would be totally awesome if there was something like [stringy.charAt(0)].classmethod();. This would allow me to just use a couple for loops instead of a cluster of if's.
    Thanks for any help.
    Edited by: 797223 on Sep 28, 2010 11:21 PM

    What Kayaman said.
    Another suggestion, slightly more elaborate, is to use class.forName() and reflection to create an instance of the correct class:
    stringy = inpt.next();
    Class clazz = Class.forName(makeClassCase(stringy));
    Object o = clazz.newInstance();
    SomeInterface i = (SomeInterface)o;
    i.lineOne();This assumes that you write a method private String makeClassCase(String s) that returns the correctly cased class name (e.g. transforms 'a' to 'A') and adds the appropriate package name if applicable, and that you define method lineOne() in an interface SomeInterface and in all classes that implement it (assuming I have correctly understood that all your classes do expose the same lineOne() method).
    You'll have to make special provisions for error cases (e.g. the user types a class name that doesn't exist, or that doesn't implement the common interface).

  • Force Derived Class to Implement Static Method C#

    So the situation is like, I have few classes, all of which have a standard CRUD methods but static. I want to create a base class which will be inherited so that it can force to implement this CRUD methods. But the problem is, the CRUD methods are static. So
    I'm unable to create virtual methods with static (for obvious reasons). Is there anyway I can implement this without compromising on static.
    Also, the signature of these CRUD methods are similar.
    E.g. ClassA will have CRUD methods with these type of Signatures
    public static List<ClassA> Get()
    public static ClassA Get(int ID)
    public static bool Insert(ClassA objA)
    public static bool Update(int ID)
    public static bool Delete(int ID)
    ClassB will have CRUD signatures like
    public static List<ClassB> Get()
    public static ClassB Get(int ID)
    public static bool Insert(ClassB objB)
    public static bool Update(int ID)
    public static bool Delete(int ID)
    So I want to create a base class with exact similar signature, so that inherited derived methods will implement their own version.
    For E.g. BaseClass will have CRUD methods like
    public virtual static List<BaseClass> Get()
    public virtual static BaseClassGet(int ID)
    public virtual static bool Insert(BaseClass objBase)
    public virtual static bool Update(int ID)
    public virtual static bool Delete(int ID)
    But the problem is I can't use virtual and static due to it's ovbious logic which will fail and have no meaning.
    So is there any way out?
    Also, I have few common variables (constants) which I want to declare in that base class so that I don't need to declare them on each derived class. That's why i can't go with interface also.
    Anything that can be done with Abstract class?

    Hi,
    With static methods, this is absolutely useless.
    Instead, you could use the "Singleton" pattern which restrict a class to have only one instance at a time.
    To implement a class which has the singleton pattern principle, you make a sealed class with a private constructor, and the main instance which is to be accessed is a readonly static member.
    For example :
    sealed class Singleton
    //Some methods
    void Method1() { }
    int Method2() { return 5; }
    //The private constructor
    private Singleton() { }
    //And, most importantly, the only instance to be accessed
    private static readonly _instance = new Singleton();
    //The corresponding property for public access
    public static Instance { get { return _instance; } }
    And then you can access it this way :
    Singleton.Instance.Method1();
    Now, to have a "mold" for this, you could make an interface with the methods you want, and then implement it in a singleton class :
    interface ICRUD<BaseClass>
    List<BaseClass> GetList();
    BaseClass Get(int ID);
    bool Insert(BaseClass objB);
    bool Update(int ID);
    bool Delete(int ID);
    And then an example of singleton class :
    sealed class CRUDClassA : ICRUD<ClassA>
    public List<ClassA> GetList()
    //Make your own impl.
    throw new NotImplementedException();
    public ClassA Get(int ID)
    //Make your own impl.
    throw new NotImplementedException();
    public bool Insert(ClassA objA)
    //Make your own impl.
    throw new NotImplementedException();
    public bool Update(int ID)
    //Make your own impl.
    throw new NotImplementedException();
    public bool Delete(int ID)
    //Make your own impl.
    throw new NotImplementedException();
    private CRUDClassA() { }
    private static readonly _instance = new CRUDClassA();
    public static Instance { get { return _instance; } }
    That should solve your problem, I think...
    Philippe

  • Problem - different classes in a custom list

    Hi,
    Im making a school project and must use this List-class, written by some of our teachers.
    The problem is, the nodes in the list are type of Objects, and i must store multiple types of classes in the list.
    Storing works fine, but when i want to do something with a specific item in the list, i cannot use it's methods since its now type Object. So everytime I want to use it, i have to cast the Object back to the class it was originally, and there are like 20 of them so thats hell of a lot if-clauses to check which type must i cast it to, and thats in every place that does something with the list.
    Am I being extremely dumb here? Whats the proper way to do this?

    ju551 wrote:
    All the objects are kind of creatures that are inherited from the same abstract class.
    Hmm did i get this right now... So if i make that ancestor class into an interface, I can just cast them everytime to that class and when i call its (abstract) methods it will invoke the real methods in the subclasses?Ah, you don't need an interface in that case. You can just cast all instances to the base class and call the methods that are available there. The methods in the subclasses will be called if they are overridden.
    Kaj

  • The class of the deferred-methods return type "{0}" can not be found.

    I am developing a multilingual portal application.
    I have the method that changes the locale based on user's choice in the bean and the method is being referred to as below.
    <af:selectOneChoice label="Select Language" autoSubmit="true"
    value="#{localeBean.locale}"
    valueChangeListener="localeBean.changeLocale">
    <af:selectItem label="English" value="en" id="si1"/>
    <af:selectItem label="French" value="fr" id="si2"/>
    <af:selectItem label="Dutch" value="nl" id="si3"/>
    </af:selectOneChoice>
    when i try to run the application, i am getting compile time errors as below,
    The class of the deferred-methods return type "{0}" can not be found.
    No property editor found for the bean "javax.el.MethodExpression".
    After going through the discussion forums i learned that the compilation errors can be resolved by setting the <jsp:directive.page deferredSyntaxAllowedAsLiteral="false> at the starting of the page.
    Even after that i am getting the compilation error.
    Any solutions, suggestions or possible approaches would be helpful as i am new to Webcenter Portal development.
    Thanks,

    The error you get points to a problem on the page (somewhere). Switch to source mode and check the right margin if you see orange or red marks. These are pointing to problems (not all are show stoppers, but they give you hints that something is not according to the standard for jsf, jsff, jsp or jspx pages.
    Have you checked that the bean is correctly defined and that it's reachable?
    Start a fresh page and isolate the problem, e.g. build a selectOneChoiuce on the new page (don't copy it as you might copy the error too) and make it work on the new page. Once you have it running you can compare the solution to your not running page.
    Timo

  • Javac probleme: bad class file error

    I'm new to java
    I have two classes myPoint.jav and TestPoint.java, when I compile them, I error:
    in the command line I type:
    C:\otman\java>javac -g geometry\src\myPoint.java TestPoint.java
    TestPoint.java:8: cannot access myPoint
    bad class file: c:\otman\java\geometry\src\myPoint.class
    class file contains wrong class: geometry.src.myPoint
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    myPoint p = new myPoint();
    ^
    1 error
    Can some one help me Thanks
    //Here is the class c:\otman\java\TestPoint.java
    import geometry.src.*;
         Testing my class Point
    public class TestPoint {
    public static void main(String[] args) {
              myPoint p = new myPoint();
              System.out.println("thank you very much");
              System.exit(0);
    // And here is the class c:\otman\java\geometry\src\myPoint.java
    package geometry.src;
         class myPoint members and methods of a 3D point
    public class myPoint {
         private double m_x,m_y,m_z;          // the coordinates
         public double getx() {return m_x;}
         public double gety() {return m_y;}
         public double getz() {return m_z;}
         public void setx(double x) {m_x=x;}
         public void sety(double y) {m_y=y;}
         public void setz(double z) {m_z=z;}
         public void translate(double dx,double dy, double dz) {
              m_x += dx;m_y += dy;m_z += dz;
         // Constructor ------------------------------------------------------------
         myPoint(double x,double y,double z) {
              m_x=x;m_y=y;m_z=z;
         myPoint() {
              m_x=0;m_y=0;m_z=0;
         myPoint(myPoint p) {
              m_x=p.getx();m_y=p.gety();m_z=p.getz();
    // ---------------------------------------------------------------------------------

    Thank you for the reply but still have problem.
    I created a directory classes and the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.java
    When I compile using the line command:
    C:\otman\java>javac -g -d classes geometry\src\myPoint.java TestPoint.java
    I get the error:
    TestPoint.java:8: cannot find symbol
    symbol : constructor myPoint()
    location: class geometry.src.myPoint
    myPoint p = new myPoint();
    ^
    1 error
    Now the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.class
    geometry\
    src\
    myPoint.java
    I think that myPoint was compiled without problem but TestPoint was not compiled and it gives 1 error.
    Can you help me? Thanks.<!--Session data-->

  • Problems with classes referencing each other...

    I've got a problem....i have a program with two classes, and each class needs access to methods stored in the other class.
    I've tried to create a reference (Classname name=new Classname();), but upon execution, i get a Exception in thread "main" java.lang.StackOverflowError, and a long list of locations, all pointing to the references i created at the top of each class.
    What's wrong, and how do I fix this?

    You have infinite recursion. A method or constructor is calling itself, or is calling another method or constructor that eventually ends up calling the first one.
    If you can't find it, post code. Use [code] and [/code] tags, which you can get with the code button, to make the code readable.

  • Control the loop of resultset.next( ); (method)

    Hai, guys
    I am using the ODBC database connection to (Excel Sheet) and i wanna get the records from it. My code is scucess but there is a problem in resultset.next() method.
    The thing is it retrieving all the data including the none data fields (null null), so finally it became a never ending loop.
    pls help me to get the data rang's records
    Statement stmnt = connexl.createStatement();
    String query = "SELECT * FROM [IJTS$]";
    stmnt.execute(query);
    ResultSet rsxl = stmnt.getResultSet();
    while(rsxl.next()) {
    String excelname = rsxl.getString(1);
    String excelcate = rsxl.getString(2);
    System.out.print(rsxl.getString(1));
    System.out.println(" "+rsxl.getString(2));
    }

    if null implies it has reached the last row, maybe you could check for null and break from the loop
    for example:
    while (rsxl.next()) {
      String excelname = rsxl.getString(1);
      String excelcate = rsxl.getString(2);
      if (excelname == null && excelcate == null) {
        break;
      } else {
        System.out.println(excelname + " " + excelcate);
    }

  • My macbook Pro 13" 2013 has a mouse problem, its not moving naturally, and keeps on moving around like its dancing. Please help solve this!!

    My macbook Pro 13" 2013 has a mouse problem, its not moving naturally, and keeps on moving around like its dancing. Please help solve this!!

    Go step by step and test.
    1. Restart
    2. Shut down the computer.
        Clean the trackpad with moist not wet microfiber cloth.
        System Preferences > Point & Click
        Try turning off three finger dragging and then turning it on after  testing.
    3. Is there any Bluetooth device nearby with failing batteries? If so, replace the batteries.
      4. Reset PRAM:   http://support.apple.com/kb/PH14222
    5. Reset SMC.     http://support.apple.com/kb/HT3964
        Choose the method for:
        "Resetting SMC on portables with a battery you should not remove on your own".
    6. Close all windows and quit all applications.
        Click the Spotlight -the magnifying glass icon- in the menu bar. Enter Disk utility in the box.
        Select Disk Utility from the drop down. When the Disk utility window opens up,
        select  Macintosh HD, then First Aid.
        Click Repair Disk Permissions button.
        Ignore the  time remaining estimate.
        Last 1 minute may take longer.

  • When I plug my iPhone in to my computer, iTunes doesn't recognize it as a device.  I have deleted and re-downloaded iTunes twice which seems to fix the problem temporarily but then the next time, the device is not recognized.

    when I plug my iPhone in to my computer, iTunes doesn't recognize it as a device.  I have deleted and re-downloaded iTunes twice which seems to fix the problem temporarily but then the next time I plug my phone in, the device is not recognized.

    What happens if you go to iTunes > File > Devices, do you get the option to Sync iPhone?
    You could try a reinstall of iTunes. OS X Yosemite: Reinstall apps that came with your Mac

  • Facing problem in creating socket in a method from an already deployed application exe while same method is working from another exe from same environment from same location.

    Dll Created In: - MFC VC
    6.0
    Application Exe Developed In:
    - VC 6.0, C# and VB.net (Applications which are using dll)
    OS: - Windows XP sp2 32bit
    / Windows Server 2008 64 bit
    Problem: - Facing problem in creating socket
    in a method from an already deployed application exe while same method is working from another exe from same environment from same location.
    Description: - We have product component which
    has an exe component and from exe we invoke a method, which is defining in dll, and that dll is developed in MFC VC6.0. In the dll we have a method which downloads images from another system after making socket connection. But every time we are getting Error
    code 7, it is not giving desire result while same method is working from another exe from same environment from same location. And also me dll is deployed on many systems and giving proper output from same application.
    Already Attempt: - Because error is coming on
    client side so what we did, we created a driver in C# which invokes same method from same environment(on client machine) using same dll and we are astonished because it worked fine there.
    Kindly Suggest: -
    We are not able to figure out root cause because nothing is coming in windows event logs but what I did, for finding the problem line, I wrote logs on each line and found the exact line in application exe which is not working,
    actually  it is not executing Create () method,
    I will give snippet of the code for understanding the problem because we are not finding any kind solution for it.
    Kindly assist us in understanding and fixing this problem.
    Code Snippet: -
    Int Initialize (LPTSTR SiteAddress, short PortId)
    try
    CClientTSSocket *m_pJtsSockto;
    m_pJtsSockto = new CClientTSSocket;
    LONG lErr = m_pJtsSockto->ConnectTS(csIPAddress,PortId);
    ErrorLog (0, 0, "--------ConnectTS has been called ------------","" );
    catch(...)
    DWORD errorCode = GetLastError();
    CString errorMessage ;
    errorMessage.Format("%lu",errorCode);
    ErrorLog (0, 0, "Image System", (LPTSTR)(LPCTSTR)errorMessage);
    return  IS_ERR_WINDOWS;
    Note: -
    CClientTSSocket extends CAsyncSocket
     IS_ERR_WINDOWS is a macro error code which value I found 7.
    LONG ConnectTS(CString strIP, UINT n_Port)
    ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");
    if(!Create())
    ErrorLog(0,0,"ConnectTS is calling [Create not called successfully] ","");
     n_Err = GetLastError();
     ErrorLog(n_Err,0,"ConnectTS is calling1111111111111111Erorrrrrrrrrrrrr","");
    return NET_INIT;
    ErrorLog(0,0,"ConnectTS is calling2222222222222222222","");
    if(!AsyncSelect(0))
    n_Err = GetLastError();
    return NET_INIT;
    if(!Connect(strIP,n_Port))
    n_Err = GetLastError();
    ErrorLog(n_Err,0,"ConnectTS","");
    return SERVER_NOT_CONNECTED;
    Code description: -
    From
    int GETImage_MT() method we call Initialize() method and pass client machine IP and Port and there we call
    ConnectTS() method, In this method we Create() method and finally it returns the error code as mention in macro 7.
    Logs after running the program: -
    --------ConnectTS has been called ------------
    ConnectTS is calling Create [is going to call]
    Image System 
    0
    Note: - According to logs, problem is coming in Create method().
    Here 0 is errorMessage received in catch block. And from catch block it returns macro value 7. And when we run same method individually from same machine, same environment through same dll
    from different exe, it is working fine and we are facing any kind of problem. While same problem application was working properly earlier but now continuously it showing problem.
     Kindly assist us to resolve the issue.

    Pointer variable was already initialized; I have mention in code; kindly assist us.
    Dll Created In: - MFC VC 6.0
    Application Exe Developed In: - VC 6.0, C# and VB.net (Applications which are using dll)
    OS: - Windows XP sp2 32bit / Windows Server 2008 64 bit
    Problem: - Facing problem in creating socket
    in a method from an already deployed application exe while same method is working from another exe from same environment from same location.
    Description: - We have product component
    which has an exe component and from exe we invoke a method, which is defining in dll, and that dll is developed in MFC VC6.0. In the dll we have a method which downloads images from another system after making socket connection. But every time we are getting
    Error code 7, it is not giving desire result while same method is working from another exe from same environment from same location. And also me dll is deployed on many systems and giving proper output from same application.
    Already Attempt: - Because error is coming
    on client side so what we did, we created a driver in C# which invokes same method from same environment (on client machine) using same dll and we are astonished because it worked fine there.
    Kindly Suggest:
    - We are not able to figure out root cause because nothing is coming in windows event logs but what I did, for finding the problem line, I wrote logs on each line and found the exact line in application exe which is not
    working, actually it is not executing Create () method, I will give snippet of the code for understanding
    the problem because we are not finding any kind solution for it. Kindly assist us in understanding and fixing this problem.
    Code Snippet: -
    Int Initialize (LPTSTR SiteAddress, short PortId)
    try
    CClientTSSocket *m_pJtsSockto;
    m_pJtsSockto = new CClientTSSocket;
    LONG lErr = m_pJtsSockto->ConnectTS(csIPAddress,PortId);
    ErrorLog (0, 0, "--------ConnectTS has been called ------------","" );
    catch(...)
                       DWORD errorCode = GetLastError();
                       CString errorMessage ;
                       errorMessage.Format("%lu",errorCode);
                       ErrorLog (0, 0, "Image System", (LPTSTR)(LPCTSTR)errorMessage);
                       return  IS_ERR_WINDOWS;
    Note: - CClientTSSocket extends CAsyncSocket
     IS_ERR_WINDOWS is a macro error code which value I found 7.
    LONG ConnectTS(CString strIP, UINT n_Port)
              ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");
              if(!Create())
                       ErrorLog(0,0,"ConnectTS is calling [Create not called successfully] ","");
              n_Err = GetLastError();
              ErrorLog(n_Err,0,"ConnectTS is calling1111111111111111Erorrrrrrrrrrrrr","");
                      return NET_INIT;
              ErrorLog(0,0,"ConnectTS is calling2222222222222222222","");
              if(!AsyncSelect(0))
                       n_Err = GetLastError();
                       return NET_INIT;
              if(!Connect(strIP,n_Port))
                       n_Err = GetLastError();
                       ErrorLog(n_Err,0,"ConnectTS","");
                       return SERVER_NOT_CONNECTED;
    Code description: - From int GETImage_MT() method
    we call Initialize() method and pass client machine IP and Port and there we call ConnectTS() method, In
    this method we Create() method and finally it returns the error code as mention in macro 7.
    Logs after running the program: -
    --------ConnectTS has been called ------------
    ConnectTS is calling Create [is going to call]
    Image System  0
    Note: - According to logs, problem is coming in Create method(). Here
    0 is errorMessage received in catch block. And from catch block it returns macro value 7. And when we run same method individually from same machine, same environment through same dll from different exe, it is working fine and we are facing any kind of problem.
    While same problem application was working properly earlier but now continuously it showing problem.
     Kindly assist us to resolve the issue.

  • How to restrict the last record and not moving to next reocrd

    1) how to restrict the last record and not moving to next reocrd.
    2) Also for the F6 key(for new record).

    When you are on the last record, next-record will create a new one, so that my question is do you want to forbid new record creation.
    Francois

  • Problem in App Module Impl client method

    Hope someone has an answer for this. I have a data action calling a client interface service method in the app module impl class. I am passing http request data wrapped in a Map to this method from the action class.
    In this method I am calling another method in a bean. Strangely, the code in app module method gets executed twice, acting like a recursive call! I debugged it and noticed that my action class calls the method only once, but the call in the method to bean method is executed twice. I want to capture a database error for inserting a new row in my bean method the first time by throwing a jbo exception in app module method, but throw new exception is ignored and message gets lost due to 2nd excecution of the code.
    Any ideas or help is much appreciated.
    TIA,
    S

    User, please always tell us your jdev version.
    What do you mean by 'verbatim EO'?
    If you want to use the framework you should use it and not look for some hacks to archive your work. The docs help you to create or update data using the framework. If you don't want to use the framework, you don't have to, but then your post is for an other forum.
    Timo

  • How to determine the Class of a static methods class?

    hi,
    is there a way to get the code below to output
    foo() called on One.class
    foo() called on Two.classthanks,
    asjf
    public class Two extends One {
       public static void main(String [] arg) {
          One.foo(); // should say "foo() called on One.class"
          Two.foo(); // should say "foo() called on Two.class"
    class One {
       public static final void foo() {
          System.out.println("foo() called on "/*+something.getClass()*/);
    }

    - One.class won't resolve to Two.class when the static
    method is called via the class TwoThat's because static methods are not polymorphic. They cannot be overridden. For example try this:
    public class Two extends One {
       public static void main(String [] arg) {
          One.foo(); // should say "foo() called on One.class"
          Two.foo(); // should say "foo() called on Two.class"
          One one = new Two();
          one.foo();
          ((Two) one).foo();
       public static void foo() {
          System.out.println("foo() called on Two");
    class One {
       public static void foo() {
          System.out.println("foo() called on One");
    }

Maybe you are looking for