Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] [DSF] LaunchUtils.getGDBPath

There's a lot of code like written like that in the early days. At the
very least, if we're going to catch a CoreException, we should log it.
Utility methods like this should probably not catch it and have it
bubble up higher in the stack so that better recovery can be made.
Assuming the default probably isn't the right recovery anyway.

On Tue, Jun 29, 2010 at 8:23 AM, Vladimir Prus
<vladimir@xxxxxxxxxxxxxxxx> wrote:
>
> Hi,
> looking at LaunchUtils.getGDBPath, I see this:
>
>    public static IPath getGDBPath(ILaunchConfiguration configuration) {
>        IPath retVal = new Path(IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
>        try {
>            retVal = new Path(configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
>                                                             IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT));
>        } catch (CoreException e) {
>        }
>        return retVal;
>    }
>
> So, if an exception is thrown, this code returns default value, without any reporting to
> the log -- which seems like a pretty questionable behaviour. I'd much rather get a big
> error box then have wrong debugger used.
>
> Alternatively, if it is considered that CoreException can only be thrown here if all
> of Eclipse is burning in flames already, should a helper function 'getAttributeUnchecked'
> be added that would call 'getAttribute' method, catch CoreException and rethrow an
> unchecked exception in tha case?
>
> Thanks,
>
> --
> Vladimir Prus
> CodeSourcery
> vladimir@xxxxxxxxxxxxxxxx
> (650) 331-3385 x722
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>


Back to the top