https://bz.apache.org/bugzilla/show_bug.cgi?id=61960
Bug ID: 61960
Summary: The log said "this error should NEVER happen Please
raise a bug", So...
Product: POI
Version: unspecified
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 35644
--> https://bz.apache.org/bugzilla/attachment.cgi?id=35644&action=edit
A export template in chinese
2018/01/03T17:46:39 [] [http-nio-8080-exec-7] ERROR
c.v.i.a.c.a.AssetCategoryQueryController - Rule M2.4 exception : this error
should NEVER happen! Please raise a bug at
https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that
triggers it, thanks!
org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Rule M2.4
exception : this error should NEVER happen! Please raise a bug at
https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach a file that
triggers it, thanks!
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.getContentType(ContentTypeManager.java:343)
at
org.apache.poi.openxml4j.opc.internal.ContentTypeManager.removeContentType(ContentTypeManager.java:256)
at
org.apache.poi.openxml4j.opc.OPCPackage.removePart(OPCPackage.java:958)
at
org.apache.poi.openxml4j.opc.PackagePart.getOutputStream(PackagePart.java:522)
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1687)
at
org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:464)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:211)
at
com.valuedaas.info.asset.controller.assetquery.AssetCategoryQueryController.export(AssetCategoryQueryController.java:314)
at
com.valuedaas.info.asset.controller.assetquery.AssetCategoryQueryController$$FastClassBySpringCGLIB$$80e5b13d.invoke(<generated>)
at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at
com.valuedaas.info.asset.controller.assetquery.AssetCategoryQueryController$$EnhancerBySpringCGLIB$$4dd9610d.export(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
com.valuedaas.info.asset.common.filter.UserAuthFilter.doFilter(UserAuthFilter.java:90)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:167)
at
org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
code:
// 循环查询结果
FileInputStream fis = null;
InputStream is = null;
Workbook wb = null;
MongoCursor<Document> cursor = null;
try {
is = new FileInputStream(new
File("C:\\Users\\chenhua\\git\\information-backend\\target\\政务信息资源目录-模板.xlsx"));
// is = new FileInputStream(new
File(Class.class.getClass().getResource("/").getPath() + "/政务信息资源目录-模板.xlsx")
);
wb = new XSSFWorkbook(is);
Sheet sheet = wb.getSheetAt(0); // 只处理第一个sheet
int rowNum = 2;
// 普通单元格
XSSFCellStyle normallCellStyle = (XSSFCellStyle)
wb.createCellStyle();
normallCellStyle.setAlignment(CellStyle.VERTICAL_CENTER);
// style.setWrapText(true);
normallCellStyle.setBorderBottom(CellStyle.BORDER_THIN);
normallCellStyle.setBorderLeft(CellStyle.BORDER_THIN);
normallCellStyle.setBorderRight(CellStyle.BORDER_THIN);
normallCellStyle.setBorderTop(CellStyle.BORDER_THIN);
normallCellStyle.setDataFormat(wb.createDataFormat().getFormat("#,##0"));//
这样写百分百变成货币
cursor =
deptInfoAssetMgmtService.mongoCollection().aggregate(pipeline).batchSize(200).iterator();
while (cursor.hasNext()) {
rowNum++;
Document d = cursor.next();
Row row = sheet.getRow(rowNum);
row.getCell(infoAssetSn).setCellValue(rowNum -
2);
String categoryKey =
d.getString(DeptInfoAsset.CATEGORY);
String categoryName =
categoryMap.get(categoryKey);
row.getCell(infoAssetCategoryIndex).setCellValue(categoryName);
// String subjectKey =
d.getString(DeptInfoAsset.SUBJECT);
// String subjectName = "";
// if (categoryKey.equals("1")) { //
根据一级分类不同,采用不同的 二级分类字典
// subjectName =
jichuSubCategory.getOrDefault(subjectKey, "");
// } else if (categoryKey.equals("2")) {
// subjectName =
zhutiSubCategory.getOrDefault(subjectKey, "");
// } else if (categoryKey.equals("3")) {
// subjectName =
bumenSubCategory.getOrDefault(subjectKey, "");
// }
//
row.getCell(infoAssetSubjectIndex).setCellValue(subjectName);
row.getCell(infoAssetNameIndex).setCellStyle(normallCellStyle);
row.getCell(infoAssetNameIndex).setCellValue(d.getString(DeptInfoAsset.NAME));
row.getCell(infoAssetNoIndex).setCellStyle(normallCellStyle);
row.getCell(infoAssetNoIndex).setCellValue(d.getString(DeptInfoAsset.NO));
wb.write(new FileOutputStream(new
File(exportFilePath)));
wb.close();
}
error occur at this line: wb.write(new FileOutputStream(new
File(exportFilePath)));
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]