Repository: microsoft/gctoolkit
File: api/src/main/java/com/microsoft/gctoolkit/GCToolKit.java (Java)

Code before:
            dataSourceParsers = new ArrayList<>();
            dataSourceParsers.addAll(registeredDataSourceParsers);
        }


        if (dataSourceParsers.isEmpty()) {
            String[] parsers = {
                    "com.microsoft.gctoolkit.parser.CMSTenuredPoolParser",
                    "com.microsoft.gctoolkit.parser.GenerationalHeapParser",
                    "com.microsoft.gctoolkit.parser.JVMEventParser",
                    "com.microsoft.gctoolkit.parser.PreUnifiedG1GCParser",
                    "com.microsoft.gctoolkit.parser.ShenandoahParser",
                    "com.microsoft.gctoolkit.parser.SurvivorMemoryPoolParser",
                    "com.microsoft.gctoolkit.parser.UnifiedG1GCParser",
                    "com.microsoft.gctoolkit.parser.UnifiedGenerationalParser",
                    "com.microsoft.gctoolkit.parser.UnifiedJVMEventParser",
                    "com.microsoft.gctoolkit.parser.UnifiedSurvivorMemoryPoolParser",
                    "com.microsoft.gctoolkit.parser.ZGCParser"
            };
            try {
                dataSourceParsers = Arrays.stream(parsers)
                        .map(parserName -> {
                            try {
                                return forName(parserName, true, Thread.currentThread().getContextClassLoader());
                            } catch (ClassNotFoundException e) {
                                throw new ServiceConfigurationError("Unable to find a suitable provider to create a DataSourceParser");
                            }
                        })
                        .map(clazz -> {
                            try {
                                return (DataSourceParser) clazz.getConstructors()[0].newInstance();
                            } catch (Exception e) {
                                throw new ServiceConfigurationError("Unable to find a suitable provider to create a DataSourceParser");
                            }
                        })
                        .filter(consumer -> consumer.accepts(diary))
                        .collect(Collectors.toList());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        for (DataSourceParser dataSourceParser : dataSourceParsers) {
            dataSourceParser.diary(diary);
            dataSourceChannel.registerListener(dataSourceParser);
            dataSourceParser.publishTo(jvmEventChannel);
        }
    }

    /**
     * Perform an analysis on a GC log file. The analysis will use the Aggregations
     * that were {@link #loadAggregation(Aggregation) registered}, if appropriate for

Review comment (suggestion):
I suggest replacing the whole try-catch block starting on line 189 with this: 
```java
dataSourceParsers = Arrays.stream(parsers)
                        .map(parserName -> {
                            try {
                                Class<?> clazz = forName(parserName, true, Thread.currentThread().getContextClassLoader());
                                return Optional.of(clazz.getConstructors()[0].newInstance());
                            } catch (ClassNotFoundException 
                                     | InstantiationException 
                                     | IllegalAccessException 
                                     | InvocationTargetException e) {
                                return Optional.empty();
                            }
                        })
                        .filter(Optional::isPresent)
                        .map(optional -> (DataSourceParser) optional.get())
                        .filter(consumer -> consumer.accepts(diary))
                        .collect(Collectors.toList());
                if (dataSourceParsers.isEmpty()) {
                    throw new ServiceConfigurationError("Unable to find a suitable provider to create a DataSourceParser");
                } 
```
which would loop through the whole parsers array instead of bailing on the first exception. 

Code after:
                    .collect(Collectors.toList());
        } else{
            dataSourceParsers = new ArrayList<>();
            dataSourceParsers.addAll(registeredDataSourceParsers);
        }


        if (dataSourceParsers.isEmpty()) {
            String[] parsers = {
                    "com.microsoft.gctoolkit.parser.CMSTenuredPoolParser",
                    "com.microsoft.gctoolkit.parser.GenerationalHeapParser",
                    "com.microsoft.gctoolkit.parser.JVMEventParser",
                    "com.microsoft.gctoolkit.parser.PreUnifiedG1GCParser",
                    "com.microsoft.gctoolkit.parser.ShenandoahParser",
                    "com.microsoft.gctoolkit.parser.SurvivorMemoryPoolParser",
                    "com.microsoft.gctoolkit.parser.UnifiedG1GCParser",
                    "com.microsoft.gctoolkit.parser.UnifiedGenerationalParser",
                    "com.microsoft.gctoolkit.parser.UnifiedJVMEventParser",
                    "com.microsoft.gctoolkit.parser.UnifiedSurvivorMemoryPoolParser",
                    "com.microsoft.gctoolkit.parser.ZGCParser"
            };
            dataSourceParsers = Arrays.stream(parsers)
                    .map(parserName -> {
                        try {
                            Class<?> clazz = forName(parserName, true, Thread.currentThread().getContextClassLoader());
                            return Optional.of(clazz.getConstructors()[0].newInstance());
                        } catch (ClassNotFoundException
                                | InstantiationException
                                | IllegalAccessException
                                | InvocationTargetException e) {
                            return Optional.empty();
                        }
                    })
                    .filter(Optional::isPresent)
                    .map(optional -> (DataSourceParser) optional.get())
                    .filter(consumer -> consumer.accepts(diary))
                    .collect(Collectors.toList());
            if (dataSourceParsers.isEmpty()) {
                throw new ServiceConfigurationError("Unable to find a suitable provider to create a DataSourceParser");
            }
        }

        for (DataSourceParser dataSourceParser : dataSourceParsers) {
            dataSourceParser.diary(diary);
            dataSourceChannel.registerListener(dataSourceParser);
            dataSourceParser.publishTo(jvmEventChannel);
        }
    }

    /**
     * Perform an analysis on a GC log file. The analysis will use the Aggregations