473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

conversion from java to c#

I am working with a project which converts a java based application into C#. I noticed that when I converted the java file, .net throws a SupportClass for me and since there is no List type in C#, SupportClass tries to use ListCollectionSupport instead. This is working great, except one situation, I got runtime error "Specified cast is not valid", and I am sure the following code caused this error
[Serializable
sealed public class WebOrder : System.Runtime.Serialization.ISerializabl

internal SupportClass.ListCollectionSupport orderItemsList
public EcomWeb.domain.OrderItem[] OrderItem
{
ge

return (EcomWeb.domain.OrderItem[]) orderItemsList.ToArray(ne
EcomWeb.domain.OrderItem[0])

}
public WebOrder():base(

//UPGRADE_ISSUE: Class hierarchy differences between 'java.util.ArrayList'
//'System.Collections.ArrayList' may cause compilation errors
//'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1186"
orderItemsList = new SupportClass.ListCollectionSupport(new System.Collections.ArrayList())
In my original java code, ListCollectionSupport is Java.Util.List type, OrderItem is an abstract Class, both rxItem and octItem are derived from this abstract class
I realy appreciate any reply on this issue and would like to supply anny more information if asked for
Thanks
Daniel
Nov 16 '05 #1
1 1928
daniel <dl*@chronimed.com> wrote:
I am working with a project which converts a java based application
into C#. I noticed that when I converted the java file, .net throws a
SupportClass for me and since there is no List type in C#,
SupportClass tries to use ListCollectionSupport instead. This is
working great, except one situation, I got runtime error "Specified
cast is not valid", and I am sure the following code caused this
error.
<snip>
return (EcomWeb.domain.OrderItem[]) orderItemsList.ToArray(new
EcomWeb.domain.OrderItem[0]);


<snip>

It looks like this is a bug in the converter. I believe this should
actually be:

return (EcomWeb.domain.OrderItem[]) orderItemsList.ToArray
(typeof(EcomWeb.domain.OrderItem));

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Atwood | last post by:
I am trying to use the Java Language Conversion Assistant 2.0 with Visual Studio .NET 2003 on Windows 2000 Server SP4 and .NET framework 1.1 to convert some java files to C#. I go through all the...
1
by: vadala | last post by:
The requirement is to send start data and end date from java to UI (.net) for a functionality. We are setting the time in java (1.5) before handing it over to WebService (sending to UI ) in...
9
by: =?Utf-8?B?RmxhdmVsbGUgQmFsbGVt?= | last post by:
Apparently the Java Conversion tool that used to be in Visual Studio 2005 is no longer supported in Visual Studio 2008. Anyone have any suggestions on how to convert a Java program to C# in Visual...
4
by: Ty | last post by:
Hello all, I am creating a website in VS 2008 VB.net. On one of my pages I am using the Table control to make a type of calendar a IN/OUT board. The problem I found after I wrote all the code...
2
by: mkbrady | last post by:
I have a query that includes calculated fields that generate numeric results. I have wrapped conversion functions CLng() and CDdl() around the calculated fields to ensure the data types are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.