问题遇到的现象和发生背景
_请问下这个问题怎么解决java.lang.IllegalArgumentException: param topNode is null.
at cn.com.lundong.feishu.core.contact.vo.DeptTreeVo.appendTopNode(DeptTreeVo.java:70)
at cn.com.lundong.feishu.core.contact.service.helper.FeishuDeptHelper.buildDeptTree(FeishuDeptHelper.java:168)
at cn.com.lundong.feishu.core.contact.service.helper.FeishuDeptHelper.buildDeptHierarchy(FeishuDeptHelper.java:84)
at cn.com.lundong.feishu.core.contact.service.impl.DeptHierarchyServiceImpl.buildDeptAndSubHierarchyById(DeptHierarchyServiceImpl.java:144)
at cn.com.lundong.feishu.core.contact.service.impl.DeptHierarchyServiceImpl$$FastClassBySpringCGLIB$$c285120.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at cn.com.lundong.feishu.core.contact.service.impl.DeptHierarchyServiceImpl$$EnhancerBySpringCGLIB$$207d5be4.buildDeptAndSubHierarchyById(<generated>)
at cn.com.lundong.feishu.core.facade.impl.FeishuDeptSyncFacadeImpl.syncPlatformDept(FeishuDeptSyncFacadeImpl.java:411)
at sun.reflect.GeneratedMethodAccessor1017.invoke(Unknown Source)
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:343)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
at com.sun.proxy.$Proxy163.syncPlatformDept(Unknown Source)
at cn.com.lundong.feishu.core.app.open.callback.handler.event.ContactChangeEventHandler.handle(ContactChangeEventHandler.java:91)
at cn.com.lundong.feishu.core.app.open.callback.handler.event.ContactChangeEventHandler.handle(ContactChangeEventHandler.java:30)
at cn.com.lundong.feishu.core.app.open.callback.MessageEventDispatcher.handle(MessageEventDispatcher.java:40)
at cn.com.lundong.feishu.core.app.open.callback.MessageEventDispatcher.handle(MessageEventDispatcher.java:18)
at cn.com.lundong.feishu.core.app.open.callback.CallbackMessageQueueHandler.handleQueue(CallbackMessageQueueHandler.java:30)
at cn.com.lundong.feishu.core.app.open.callback.CallbackMessageQueueHandler.handleQueue(CallbackMessageQueueHandler.java:13)
at cn.com.lundong.base.mq.RedisSimpleQueueConsumer$QueueRun.lambda$run$1(RedisSimpleQueueConsumer.java:214)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
代码如下:
public Collection<DeptTreeNodeVo> collectSubDept(Long parentId, boolean includeParentDept, boolean includeAllSubDept) {
if (parentId == null) {
throw new IllegalArgumentException("param parentId is null.");
}
if (parentId == 0) {
// 根部门,直接返回整个部门树节点列表
return treeNodes;
}
List<DeptTreeNodeVo> depts = new LinkedList<>();
```java
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/974208853746110.png "#left")