@@ -0,0 +1,2641 @@
+package com.ibatis.sqlmap.engine.scope;%0A%0Aimport com.github.bingoohuang.blackcat.javaagent.callback.Blackcat;%0A%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * An error context to help us create meaningful error messages%0A */%0Apublic class ErrorContext %7B%0A    private String resource;%0A    private String activity;%0A    private String objectId;%0A    private String moreInfo;%0A    private Throwable cause;%0A%0A    public String getResource() %7B%0A        return resource;%0A    %7D%0A%0A%0A    static Pattern ExcludedId = Pattern.compile(%22-(?:SelectKey%7CAutoResultMap%7CInlineParameterMap)$%22);%0A%0A    public void setResource(String resource) %7B%0A        this.resource = resource;%0A%0A        // %E8%BF%99%E9%87%8C%E4%BE%9D%E8%B5%96setObjectId%E5%9C%A8setResource%E4%B9%8B%E5%89%8D%E8%B0%83%E7%94%A8%0A        if (objectId != null && !ExcludedId.matcher(objectId).find())%0A            Blackcat.log(%22SQL.ID%22, %22ID:%7B%7D, RESOURCE:%7B%7D%22, objectId, resource);%0A    %7D%0A%0A    public String getActivity() %7B%0A        return activity;%0A    %7D%0A%0A    public void setActivity(String activity) %7B%0A        this.activity = activity;%0A    %7D%0A%0A    public String getObjectId() %7B%0A        return objectId;%0A    %7D%0A%0A    public void setObjectId(String objectId) %7B%0A        this.objectId = objectId;%0A    %7D%0A%0A    public String getMoreInfo() %7B%0A        return moreInfo;%0A    %7D%0A%0A    public void setMoreInfo(String moreInfo) %7B%0A        this.moreInfo = moreInfo;%0A    %7D%0A%0A    public Throwable getCause() %7B%0A        return cause;%0A    %7D%0A%0A    public void setCause(Throwable cause) %7B%0A        this.cause = cause;%0A    %7D%0A%0A    public String toString() %7B%0A        StringBuffer message = new StringBuffer();%0A%0A        // resource%0A        if (resource != null) %7B%0A            message.append(%22  %5Cn--- The error occurred in %22);%0A            message.append(resource);%0A            message.append(%22.%22);%0A        %7D%0A%0A        // activity%0A        if (activity != null) %7B%0A            message.append(%22  %5Cn--- The error occurred while %22);%0A            message.append(activity);%0A            message.append(%22.%22);%0A        %7D%0A%0A        // object%0A        if (objectId != null) %7B%0A            message.append(%22  %5Cn--- Check the %22);%0A            message.append(objectId);%0A            message.append(%22.%22);%0A        %7D%0A%0A        // more info%0A        if (moreInfo != null) %7B%0A            message.append(%22  %5Cn--- %22);%0A            message.append(moreInfo);%0A        %7D%0A%0A        // cause%0A        if (cause != null) %7B%0A            message.append(%22  %5Cn--- Cause: %22);%0A            message.append(cause.toString());%0A        %7D%0A%0A        return message.toString();%0A    %7D%0A%0A    /**%0A     * Clear the error context%0A     */%0A    public void reset() %7B%0A        resource = null;%0A        activity = null;%0A        objectId = null;%0A        moreInfo = null;%0A        cause = null;%0A    %7D%0A%0A%0A%7D%0A

add sql id in blackcat log