Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
VJ# problems
Messages   Related Types
This message was discovered on microsoft.public.dotnet.vjsharp.


Larry Earl
I encountered the following problems converting from a
Visual J++ 6.0 project
to Visual J# .NET:

===========================================================
====================

1. I get the error message:

Method 'clone' redefines super method with more
restrictive access

at line 5 of ExtendedInterface when attempting to
compile the following code:

-----------------------------------------------------------
--------------------
package a;

public interface BaseInterface extends Cloneable
{
public Object clone();
}

-----------------------------------------------------------
--------------------
package a.b;

import a.BaseInterface;

public interface ExtendedInterface extends BaseInterface
{
}

-----------------------------------------------------------
--------------------
package a.impl;

import a.BaseInterface;

public abstract class BaseImpl implements BaseInterface
{
String s;

public Object clone()
{
BaseImpl clone;
try
{
clone = (BaseImpl) super.clone();
}
catch (CloneNotSupportedException ex)
{
}

return clone;
}
}

-----------------------------------------------------------
--------------------
package a.b.impl;

import a.b.ExtendedInterface;
import a.impl.BaseImpl;

public class ExtendedImpl extends BaseImpl implements
ExtendedInterface
{
}

===========================================================
====================

2. I get the error message:

The blank final field 'HW' is not initialized at
declaration or in constructor

at line 11 of d.Commands when attempting to compile the
following code:

-----------------------------------------------------------
--------------------
package c;

public abstract class Command
{
    protected abstract void execute(int value);
}

-----------------------------------------------------------
--------------------
package d;

import c.Command;

public class Commands
{
public static Command getCommand(int value)
{
return new Command()
{
private final String HW = "Hello World";

public void execute(int value)
{
switch (value)
{
case 1:
System.out.println(HW);
break;

default:
System.out.println("Goodbye Cruel
World");
break;
}
}
};
}
}

===========================================================
====================

3. I get the Exception:

java.io.InvalidClassException: the class does not match
the class of the
persisted object for cl = java.util.Vector :
__SUID = -2767605614048989439, getSUID(cl) = -
8053090695849551395

at java.io.ObjectStreamClass.setClass(Class cl,
FieldInfo[] fields)
at java.io.ObjectInputStream.readObject()
at java.io.ObjectInputStream.getObjectStreamClass
(Boolean[] is_ref)
at java.io.ObjectInputStream.readObject()
at java.io.ObjectInputStream.getFieldValue(Char
typeCode)
at java.io.ObjectInputStream.defaultReadObject()
at java.io.ObjectInputStream.readObject()

when attempting to read in a file created using JAVA
serialization.

===========================================================
====================

4. When I attempt to get the schema names for a SQL Server
database using the
following code, nulls are returned:

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.Vector;
..
..
..

Vector schemaNames = new Vector();
ResultSet sset = null;
try
{
// Get a connection to the SQL Server database
using the
// JDBC-ODBC bridge.
Connection connection =
connectionSource.getJDBCConnection();
    
DatabaseMetaData metadata = connection.getMetaData
();
sset = metadata.getSchemas();
while (sset.next())
{
     schemaNames.addElement(sset.getString(1));
}
sset.close();
}

catch (SQLException se)
{
.
.
.
}

.
.
.
                    
Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Robert LaCasse
Thanks Earl - I'll have a look and post to VJ# developers. FYI, I've
reproduced the MemberwiseClone error on a recent build, good catch ...
thanks :)

-Bob

Bob LaCasse
Beta Support - Visual JSharp
microsoft.public.dotnet.vjsharp
http://msdn.microsoft.com/visualj/jsharp/beta.asp

This posting is provided “AS IS” with no warranties, and confers no rights.

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
Robert LaCasse
Hi Earl - I'm not able to reproduce the serialization error with a basic
test case using a vector. Do you have a test case for that?

Thanks,
-Bob

Bob LaCasse
Beta Support - Visual JSharp
microsoft.public.dotnet.vjsharp
http://msdn.microsoft.com/visualj/jsharp/beta.asp

This posting is provided “AS IS” with no warranties, and confers no rights.

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Larry Earl
Here's a class which replicates the problem.

Compile and execute it using Visual J++ with the command
line arguments: -w [path]\thing.ser

Then, compile and execute it using Visual J# .NET with the
command line arguments: -r [path]\thing.ser

You will see the java.io.InvalidClassException!

import java.io.*;

import java.util.Vector;

public class Thing implements Serializable
{
static final long serialVersionUID = -
7557498746120172041L;
private Vector things = new Vector();

public Thing()
{
things.addElement("Thing String");
}

public static void main(String[] args)
{
try
{
if (args.length == 2 && args[0].equals("-w"))
{
File file = new File(args[1]);
FileOutputStream fileStream = new
FileOutputStream(file);
BufferedOutputStream outStream =
new BufferedOutputStream(fileStream);
ObjectOutputStream out = new
ObjectOutputStream(outStream);
out.writeObject(new Thing());
out.close();
}
else if (args.length == 2 && args[0].equals("-
r"))
{
File file = new File(args[1]);
FileInputStream fileStream = new
FileInputStream(file);
BufferedInputStream inStream =
new BufferedInputStream(fileStream);
ObjectInputStream in = new
ObjectInputStream(inStream);
Thing thing = (Thing) in.readObject();
in.close();
}
else
System.out.println("Usage: jview Thing -
[rw] filename");
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
}
}

Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
    
Robert LaCasse
Okay, thanks,
-Bob

Bob LaCasse
Beta Support - Visual JSharp
microsoft.public.dotnet.vjsharp
http://msdn.microsoft.com/visualj/jsharp/beta.asp

This posting is provided “AS IS” with no warranties, and confers no rights.

Reply to this message...
Vote that this is a GOOD answer...
 
Open source windows
The Law Society’s guidelines on e-mail management
 
    
Robert LaCasse
Hello -

Just wanted to let you know that I found this behavior to be by design.
VJ# doesn't support deserialization of vectors serialized by other
implementations.

"Objects serialized under Visual J++ 6.0 can be deserialized in Visual J#
.NET only if the
fields of the objects are primitive types or java.lang.String. An Object
referencing any of the other classes in the JDK level 1.1.4 packages cannot
be deserialized."

Bob LaCasse
Beta Support - Visual JSharp
microsoft.public.dotnet.vjsharp
http://msdn.microsoft.com/visualj/jsharp/beta.asp

This posting is provided AS IS with no warranties, and confers no rights.

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Chris Harlow
As I recall, evan Sun Java doesnt support serialise-deserialise accross
different versions of the JDK so anyone relying of serialisation to
communicate between things that MIGHT be different in the future was bound
to shoot themselves in the foot sooner or later;-)

"Robert LaCasse" <Click here to reveal e-mail address> wrote in message
news:R$siwP4ACHA.2060@cpmsftngxa08...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Google Docs… no.
Twitter Elite
 
 
System.IO.File
System.Reflection.FieldInfo
System.Web.UI.MobileControls.Command




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734