Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setUnmarshalListener on Binder #1822

Open
plutext opened this issue Oct 15, 2024 · 0 comments
Open

Enable setUnmarshalListener on Binder #1822

plutext opened this issue Oct 15, 2024 · 0 comments

Comments

@plutext
Copy link

plutext commented Oct 15, 2024

Previously this was likely to work via reflection:

	public void setListener(Binder binder, Listener listener) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
		
		org.glassfish.jaxb.runtime.v2.runtime.BinderImpl binderImpl = (org.glassfish.jaxb.runtime.v2.runtime.BinderImpl )binder;
		
		Method method = binderImpl.getClass().getDeclaredMethod("getUnmarshaller");
		method.setAccessible(true);
		Unmarshaller u  = (Unmarshaller)method.invoke(binderImpl);	
		u.setListener(listener);
	}

Nowadays, the likely outcome is:

java.lang.reflect.InaccessibleObjectException: Unable to make private org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallerImpl org.glassfish.jaxb.runtime.v2.runtime.BinderImpl.getUnmarshaller() accessible: module org.glassfish.jaxb.runtime does not "opens org.glassfish.jaxb.runtime.v2.runtime" to module org.docx4j.JAXB_ReferenceImpl
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:200)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:194)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant