You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2023/01/11 06:17:38 UTC

[GitHub] [netbeans] lkishalmi commented on a diff in pull request #5270: Catch IAE when Gradle error getLocation cannot be called.

lkishalmi commented on code in PR #5270:
URL: https://github.com/apache/netbeans/pull/5270#discussion_r1066608548


##########
extide/gradle/src/org/netbeans/modules/gradle/loaders/LegacyProjectLoader.java:
##########
@@ -380,8 +380,10 @@ private static String getLocation(Throwable locationAwareEx) {
             return (String)locationAccessor.invoke(locationAwareEx);
         } catch (ReflectiveOperationException ex) {
             LOG.log(Level.FINE,"Error getting location", ex);
-            return null;
+        } catch (IllegalArgumentException iae) {
+            LOG.log(Level.FINE,"Trying to get location from an exception, that has no location property: " + locationAwareEx.getClass().getName());
         }
+        return null;

Review Comment:
   Well, I think it's a tradeoff we need to pay when we try to cover multiple versions at once. My mind could trick me, but some exceptions had `getLocation` methods even before `LocationAwareException` was introduced.
   
   This is just some heuristic, trying to figure out what's behind a Gradle build failure. If we can get a location out of that we display it as an editor hint on the source code.
   
   Well, if the heuristic does not work we just shall let it go...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists