前端上传的图片地址获取不到,alert(shopImg)显示的是[object,file],下面的错是数组越界?大概该从哪里定位问题,之前测试service的时候,图片可以正常存入数据库。是要定位前端的问题吗
Servlet.service() for servlet [spring-dispatcher] in context with path [/o2o] threw exception [Request processing failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -1] with root cause
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1927)
at com.im.o2o.util.ImageUtil.getFileExtension(ImageUtil.java:66)
at com.im.o2o.util.ImageUtil.generateThumbnail(ImageUtil.java:38)
at com.im.o2o.service.ShopServiceImpl.addShopImg(ShopServiceImpl.java:46)
at com.im.o2o.service.ShopServiceImpl.addShop(ShopServiceImpl.java:33)
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.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程