[ https://issues.apache.org/jira/browse/OFBIZ-8341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15945385#comment-15945385 ] Jacques Le Roux edited comment on OFBIZ-8341 at 3/28/17 3:36 PM: ----------------------------------------------------------------- After my last commits this morning, I checked if there were still swallowed exceptions, using the regexp below (note the white space ahead) {code} +\} catch \(.*\) \{\R\R +\}\R {code} and some variations, like {code} +\} catch \(.*\) \{\R +\R +\}\R +\} catch \(.*\) \{\R\R +\}\R {code} And found only 3 PatternSyntaxException which are from pre Apache era and seems OK because it's always the same pattern {code} try { String queryStringEncoded = queryString.replaceAll("&", "%26"); context.put("queryStringEncoded", queryStringEncoded); } catch (PatternSyntaxException e) { {code} and obviously a PatternSyntaxException should not occur there. So they simply miss a comment to document the fact even it it seems obvious. I put it at revision: 1789163 I note though that the repeated pattern is a smell for refactoring. I created OFBIZ-9287 for that. I also begin to have a look into the ebaystore component which is a can of worms when you look at its exception handling. But, according to my research, there are no longer swallowed exceptions. was (Author: jacques.le.roux): After my last commits this morning, I checked if there were still swallowed exceptions, using the regexp below (note the white space ahead) {code} +\} catch \(.*\) \{\R\R +\}\R {code} and some variations, like {code} +\} catch \(.*\) \{\R +\R +\}\R +\} catch \(.*\) \{\R\R +\}\R {code} And found only 3 PatternSyntaxException which are from pre Apache era and seems OK because it's always the same pattern {code} try { String queryStringEncoded = queryString.replaceAll("&", "%26"); context.put("queryStringEncoded", queryStringEncoded); } catch (PatternSyntaxException e) { {code} and obviously a PatternSyntaxException should not occur there. So they simply miss a comment to document the fact even it it seems obvious. I put it at revision: 1789163 I note though that the repeated pattern is a smell for refactoring... I also begin to have a look into the ebaystore component which is a can of worms when you look at its exception handling. But, according to my research, there are no longer swallowed exceptions. > Fix Default or Empty Catch block in Java files > ---------------------------------------------- > > Key: OFBIZ-8341 > URL: https://issues.apache.org/jira/browse/OFBIZ-8341 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS > Reporter: Harsh Vijaywargiya > Assignee: Jacques Le Roux > Fix For: Upcoming Release > > > In many Java files we have auto generated catch blocks or empty catch blocks. > To avoid such exception swallowing this should be improved to at least log the error and also return error in case of service. > As of now I found following classes with such patterns - > InventoryServices.java > FreeMarkerWorker.java > QRCodeEvents.java > QRCodeServices.java -- This message was sent by Atlassian JIRA (v6.3.15#6346) |
Free forum by Nabble | Edit this page |