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

MCP Asset Folder Creator Fails on AEM 6.5 SP3 #2162

Closed
3 tasks
shsteimer opened this issue Jan 15, 2020 · 7 comments
Closed
3 tasks

MCP Asset Folder Creator Fails on AEM 6.5 SP3 #2162

shsteimer opened this issue Jan 15, 2020 · 7 comments
Milestone

Comments

@shsteimer
Copy link
Contributor

shsteimer commented Jan 15, 2020

Required Information

  • AEM Version, including Service Packs, Cumulative Fix Packs, etc:6.5.3.0
  • ACS AEM Commons Version: 4.4.0
  • Reproducible on Latest? yes

Expected Behavior

The folders should be created successfully without an error

Actual Behavior

No folders are created, the following stack trace is produced, pointing to a no such method error when calling POI.

java.lang.RuntimeException: java.lang.NoSuchMethodError: 
org.apache.poi.ss.usermodel.Cell.setCellType(I)V at com.adobe.acs.commons.fam.impl.ActionManagerImpl.runActionAndLogErrors(ActionManagerImpl.java:175) at 
com.adobe.acs.commons.fam.impl.ActionManagerImpl.lambda$deferredWithResolver$0(ActionManagerImpl.java:159) at 
com.adobe.acs.commons.fam.impl.ActionManagerImpl$$Lambda$339/1098834023.run(Unknown Source) at com.adobe.acs.commons.fam.impl.TimedRunnable.run(TimedRunnable.java:91) at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at 
java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NoSuchMethodError: org.apache.poi.ss.usermodel.Cell.setCellType(I)V at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator.parseAssetFolderCell(AssetFolderCreator.java:189) at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator.parseAssetFolderRow(AssetFolderCreator.java:170) at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator.lambda$parseAssetFolderDefinitions$0(AssetFolderCreator.java:151) at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator$$Lambda$342/335134771.accept(Unknown Source) at 
com.adobe.acs.commons.fam.impl.ActionManagerImpl.withResolver(ActionManagerImpl.java:200) at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator.parseAssetFolderDefinitions(AssetFolderCreator.java:142) at 
com.adobe.acs.commons.mcp.impl.processes.AssetFolderCreator$$Lambda$315/1643962007.accept(Unknown Source) at
com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl.lambda$runStep$14(ProcessInstanceImpl.java:236) at 
 com.adobe.acs.commons.mcp.impl.ProcessInstanceImpl$$Lambda$338/1654569062.accept(Unknown Source) at
  com.adobe.acs.commons.fam.impl.ActionManagerImpl.withResolver(ActionManagerImpl.java:200) at 

Steps to Reproduce

Run the mcp asset folder creator tool with any compatible excel sheet.

Links

Links to related assets, e.g. content packages containing test components

In the only java doc I can find online for the relevant POI class, http://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Cell.html#setCellType-org.apache.poi.ss.usermodel.CellType-, it says that method is deprecated and will be removed in 5.0. Strangely, the POI bundle used by AEM appears to export 3.0.0, so I'm not 100% sure what is going on there, but the issue is readily reproducible under SP3. My guess is that the service pack updated the POI bundle for some reason, thus causing the no such method error.

@badvision
Copy link
Contributor

The awkward thing about this bug is that the CellType enum doesn't exist until version 3.15 so we can't switch our code reliably over to that and expect things to compile or even bind correctly in older versions of AEM that use v3.0 and not a newer 3.x version of the library. Our choices are then limited to 1) Code that uses reflection to bypass version compatibility limitations (which is ugly but can work in theory) or 2) Remove that line of code which will revert the bug it fixed in the first place via #1791

@badvision
Copy link
Contributor

@davidjgonzalez, @justinedelson thoughts on this one?

@davidjgonzalez
Copy link
Contributor

perhaps this might be a work around?

http://apache-poi.1045710.n5.nabble.com/How-to-set-Cell-Format-to-Text-tp3275568p3275966.html

It's not obvious to me how setCellValue(..) is a reasonable replacement, since IIRC, getting the value (which youd have to do to reset it) was what's breaking before .. and if you can get it as a String, there would be no point to resetting it anyhow.

@badvision
Copy link
Contributor

That is rather strange but I've seen stranger. If we have unit test coverage of #1791 can we try this to see if it doesn't result in a regression?

@slreynol
Copy link

@badvision
Copy link
Contributor

I have a solution in place -- I just get the type as an object and then convert to an internal version of the enumeration they introduced in POI 4. That way it works the same with new and old versions. Fortunately there were no other significant impacts in the version changes of POI that we could find.

@badvision
Copy link
Contributor

The problem with using other methods to coerce the value type is that you are relying on undocumented side effects and that's more fragile overall.

@badvision badvision added this to the 4.4.2 milestone Feb 29, 2020
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

4 participants