java question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: java question

  1. #1
    Join Date
    May 2006
    Posts
    1

    java question

    I've been working on this program for quite awhile. It's basically an adapter with multiple classes, senders, receivers, main manager, etc where I have to connect messages to a new system back to a legacy system.

    One method I'm confused and stuck on is a method that creates a Command Message. here is a synopsis of the code,

    /**
    * It will have source and destination addresses filled out along with
    * path to X File in message payload.
    * method will also trigger generation of X file on local file system
    * so file can be sent to remote sites.
    */


    protected Message packMessage(String anDestAddress)
    {
    Message aMsg = null;
    XFileSender anXFileSender = new XFileSender();

    try
    {
    converttoAddress(anDestAddress);

    }
    catch(Exception e)
    {
    Log.Data(Class.Info("Error stuff..." + e.getMessage());
    }


    }

    private Address convertToAddress(String aStringAddress)
    {
    try
    {

    theLegacySystem.setAddress((LegacySystem.abc.Address)aStringAddress);
    this.anAddress = theLegacySystem.getAddress();
    }
    catch(error exception stuff)
    {

    }

    return this.aAddress;
    }

    I'm confused on how to finish the one method and in converting from a String to an LegacySystem Address when I compile it comes back as
    "Cannot cast class.java.lang.String to class LegacySystem.abc.Address.

    I'm a little confused on how to convert from string into the Address as well as getting the source and destination addresses filled out.

    ANy help would be appreciated.

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    until LegacySystem.abc.Address extends string, you cannt cast it to string.
    you will have to write the method convertToAddress that converts a string to an legacy-address in more detail. i have no idea what a legacy-adress is for and how it should be represented as a string. but you will have to parse it.

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2006, 04:16 PM
  2. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 07:46 AM
  3. Java error handling question
    By Tim in forum Java
    Replies: 0
    Last Post: 02-22-2002, 04:45 PM
  4. Replies: 0
    Last Post: 02-01-2002, 12:08 AM
  5. New to Java question
    By Ed in forum Java
    Replies: 3
    Last Post: 06-07-2000, 10:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center