This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 210236
Collapse All | Expand All

(-)parsing.api/src/org/netbeans/modules/parsing/api/ParserManager.java (-3 / +17 lines)
Lines 388-398 Link Here
388
            p = ref.get();
388
            p = ref.get();
389
        }
389
        }
390
        if (p == null) {
390
        if (p == null) {
391
            final Lookup lookup = MimeLookup.getLookup (mimeType);
391
            Lookup lookup = MimeLookup.getLookup (mimeType);
392
            final ParserFactory parserFactory = lookup.lookup (ParserFactory.class);
392
            ParserFactory parserFactory = lookup.lookup (ParserFactory.class);
393
            if (parserFactory == null) {
393
            int numberOfAttempts = 0;
394
            while (parserFactory == null) {
395
                // We live in a nice dynamic system, correct?
396
                // Let's try again and keep our fingers crossed!
397
                // http://netbeans.org/bugzilla/show_bug.cgi?id=210236
398
                if (numberOfAttempts++ > 5) {
399
                    // Enough is enough!
394
                throw new IllegalArgumentException("No parser for mime type: " + mimeType);
400
                throw new IllegalArgumentException("No parser for mime type: " + mimeType);
395
            }
401
            }
402
                try {
403
                    Thread.sleep(3000);
404
                } catch (InterruptedException ex) {
405
                    // Who cares?
406
                }
407
                lookup = MimeLookup.getLookup (mimeType);
408
                parserFactory = lookup.lookup (ParserFactory.class);
409
            }
396
            p = parserFactory.createParser(Collections.<Snapshot>emptyList());
410
            p = parserFactory.createParser(Collections.<Snapshot>emptyList());
397
            cachedParsers.put(mimeType, new TimedWeakReference<Parser>(p));
411
            cachedParsers.put(mimeType, new TimedWeakReference<Parser>(p));
398
        }
412
        }

Return to bug 210236