/**
 * @copyright
 * ====================================================================
 * Copyright (c) 2006 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 * @endcopyright
 */
package org.tigris.subversion.javahl;

/**
 * This exception is thrown whenever something goes wrong in the
 * Subversion JavaHL binding's JNI code.
 */
class NativeException extends SubversionException
{
    /**
     * Any associated error source (e.g. line number) for a wrapped
     * <code>svn_error_t</code>.
     */
    private String source;

    /**
     * Any associated APR error code for a wrapped
     * <code>svn_error_t</code>.
     */
    private int aprError;

    /**
     * This constructor is only used by the native library.
     *
     * @param message A description of the problem.
     * @param source The error's source.
     * @param aprError Any associated APR error code for a wrapped
     * <code>svn_error_t</code>.
     */
    NativeException(String message, String source, int aprError)
    {
        super(message);
        this.source = source;
        this.aprError = aprError;
    }

    /**
     * @return The error source (e.g. line number).
     */
    public String getSource()
    {
        return source;
    }

    /**
     * @return Any associated APR error code for a wrapped
     * <code>svn_error_t</code>.
     */
    public int getAprError()
    {
        return aprError;
    }
}

@@ -1979,11 +1979,647 @@
 r;%0A    %7D
+%0A%0A    /**%0A     * @return The description, with %7B@link #source%7D and %7B@link%0A     * #aprError%7D appended (if any).%0A     */%0A    public String getMessage()%0A    %7B%0A        StringBuffer msg = new StringBuffer(super.getMessage());%0A        // ### This might be better off in JNIUtil::handleSVNError().%0A        String src = getSource();%0A        if (src != null)%0A        %7B%0A            msg.append(%22svn: %22);%0A            msg.append(src);%0A            int aprErr = getAprError();%0A            if (aprErr != -1)%0A            %7B%0A                msg.append(%22: (apr_err=%22).append(aprErr).append(')');%0A            %7D%0A        %7D%0A        return msg.toString();%0A    %7D
 %0A%7D%0A

Include file name and apr_err in JNI code-generated exceptions (when available).