Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

java.lang.ClassCastException

Avatar

Level 2

Hi, We have below code,

 

Map<String, Object> assetMeta = resourceResolver.getResource(hit.getPath()).adaptTo(Asset.class).getMetadata();
Calendar expireDateCal = (assetMeta.get("idam:offTime") != null) ? ((XMPDateTime) assetMeta
.get("idam:offTime")).getCalendar() : null;
Calendar ontimeCal = (assetMeta.get("idam:onTime") != null) ? ((XMPDateTime) assetMeta
.get("idam:onTime")).getCalendar() : null;

But while executing we are getting  below error, 

java.lang.ClassCastException: class com.adobe.xmp.impl.XMPDateTimeImpl cannot be cast to class com.adobe.xmp.XMPDateTime (com.adobe.xmp.impl.XMPDateTimeImpl is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @4ef19625; com.adobe.xmp.XMPDateTime is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @3e5c6a97)

 

How we can resolve ClassCastException for XMPDateTime?

 

1 Reply