{"record":{"id":"9fdbe2c8105c9676","repo":"paascloud/paascloud-master","slug":"mdc10021002-9fdbe2","errorCode":"MDC10021002","errorMessage":"MDC10021002","messagePattern":"MDC10021002","errorType":"error_code","errorClass":"MdcBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/OpcRpcServiceImpl.java","lineNumber":46,"sourceCode":" * The class Opc rpc service.\n *\n * @author paascloud.net @gmail.com\n */\n@Slf4j\n@Service\npublic class OpcRpcServiceImpl implements OpcRpcService {\n\t@Resource\n\tprivate OpcGaodeFeignApi opcGaodeFeignApi;\n\n\t@Override\n\tpublic String getLocationById(String addressId) {\n\t\ttry {\n\t\t\tWrapper<GaodeLocation> wrapper = opcGaodeFeignApi.getLocationByIpAddr(addressId);\n\t\t\tif (wrapper == null) {\n\t\t\t\tthrow new MdcBizException(ErrorCodeEnum.GL99990002);\n\t\t\t}\n\t\t\tif (wrapper.error()) {\n\t\t\t\tthrow new MdcBizException(ErrorCodeEnum.MDC10021002);\n\t\t\t}\n\n\t\t\tGaodeLocation result = wrapper.getResult();\n\n\t\t\tassert result != null;\n\t\t\treturn result.getProvince().contains(\"市\") ? result.getCity() : result.getProvince() + GlobalConstant.Symbol.SHORT_LINE + result.getCity();\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"getLocationById={}\", e.getMessage(), e);\n\t\t}\n\t\treturn null;\n\t}\n}\n","sourceCodeStart":28,"sourceCodeEnd":59,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/OpcRpcServiceImpl.java#L28-L59","documentation":"MDC10021002 in OpcRpcServiceImpl.getLocationById is thrown when the Wrapper returned by opcGaodeFeignApi.getLocationByIpAddr reports an error (wrapper.error() true). It indicates the remote gaode ip-location call failed at the business level even though a Wrapper was returned.","triggerScenarios":"getLocationById(addressId) called with an IP/address the remote service rejects, or the opc/gaode service returns an error envelope (invalid IP format, quota exceeded, upstream AMap error).","commonSituations":"Expired or rate-limited AMap API key; caller passes a malformed IP; opc service wrapping an upstream error into the Wrapper.","solutions":["Read the Wrapper's error message/code to find the upstream cause","Verify the IP format passed in addressId is valid","Check AMap API key validity and quotas on the opc side","Add a fallback location for failed lookups"],"exampleFix":"// before\nif (wrapper.error()) {\n    throw new MdcBizException(ErrorCodeEnum.MDC10021002);\n}\n// after\nif (wrapper.error()) {\n    logger.warn(\"gaode lookup failed: {}\", wrapper.getMessage());\n    return GlobalConstant.DEFAULT_LOCATION;\n}","handlingStrategy":"try-catch","validationCode":"if (addressId == null || !addressId.matches(\"^(\\\\d{1,3}\\\\.){3}\\\\d{1,3}$\")) { throw new IllegalArgumentException(\"invalid ip\"); }","typeGuard":"boolean ok = wrapper != null && !wrapper.error() && wrapper.getResult() != null;","tryCatchPattern":"try { ... } catch (MdcBizException e) { logger.warn(\"gaode error: {}\", e.getMessage()); return GlobalConstant.DEFAULT_LOCATION; }","preventionTips":["Validate IP format before calling","Watch AMap quotas and key expiry","Cache successful lookups to reduce upstream calls"],"tags":["feign","rpc","remote-service-error","gaode"],"backgroundTag":"upstream-api-error","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}