Application Crashes After Upgrading

Is there a new minimum version of GSON for the Java version of Words?

I upgraded to Java 19.9 (from 19.3) and and am now getting an exception out of GSON:

java.lang.NoSuchFieldException: ASCII

It appears to occur in fromJSON applied to the following class:

com.aspose.words.internal.zz5F$zzZ

I also use GSON and currently have it pinned to 2.8.4.

Do I need to upgrade my version of GSON?

This may be an unresolved name clash between a new class in the Java library and a class name in my code. Any chance you can tell me (privately if need be) the name of the class zz5F$zzZ maps to?

Whatever change is causing this, it occured in 19.6. 19.5 works fine in my application.

It appears the issue was related to removing or renaming a field “ASCII” in classes related to Field or List. I was able to work around the change by marking the fields in my class which depended on those classes as transient (they aren’t involved in deserialization anyway).

@neallester

It would be great if you please share the complete detail of your issue along with steps to reproduce your issue at our end. We will then provide you more information about your query.

Here is a reproducer:


import com.google.gson.Gson;

@Test
public void deserializationTest() throws Exception {
	Gson gson = new Gson();
	MyClass m = gson.fromJson("{\"myInteger\":1}", MyClass.class);
	assertEquals(1, m.myInteger);
}

class MyClass {

	int myInteger;
	com.aspose.words.Field myField;
	com.aspose.words.List myList;
	
}

throws:
java.lang.AssertionError: AssertionError (GSON 2.8.5): java.lang.NoSuchFieldException: ASCII

I was able to resolve the issue in my context by marking the aspose fields as transient. That is:

@Test
public void deserializationTest() throws Exception {
	Gson gson = new Gson();
	MyClass m = gson.fromJson("{\"myInteger\":1}", MyClass.class);
	assertEquals(1, m.myInteger);
}

class MyClass {

	int myInteger;
	transient com.aspose.words.Field myField;
	transient com.aspose.words.List myList;

}

works as expected (no exception).

@neallester

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2189. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-2189) have been fixed in this Aspose.Words for .NET 19.10 update and this Aspose.Words for Java 19.10 update.