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 83994
Collapse All | Expand All

(-)java/api/src/org/netbeans/api/java/queries/SourceLevelQuery.java (+8 lines)
Lines 19-25 Link Here
19
package org.netbeans.api.java.queries;
19
package org.netbeans.api.java.queries;
20
20
21
import java.util.Iterator;
21
import java.util.Iterator;
22
import java.util.regex.Pattern;
22
import org.netbeans.spi.java.queries.SourceLevelQueryImplementation;
23
import org.netbeans.spi.java.queries.SourceLevelQueryImplementation;
24
import org.openide.ErrorManager;
23
import org.openide.filesystems.FileObject;
25
import org.openide.filesystems.FileObject;
24
import org.openide.util.Lookup;
26
import org.openide.util.Lookup;
25
27
Lines 31-36 Link Here
31
 */
33
 */
32
public class SourceLevelQuery {
34
public class SourceLevelQuery {
33
    
35
    
36
    private static final Pattern SOURCE_LEVEL = Pattern.compile("\\d+\\.\\d+");
37
34
    private static final Lookup.Result/*<SourceLevelQueryImplementation>*/ implementations =
38
    private static final Lookup.Result/*<SourceLevelQueryImplementation>*/ implementations =
35
        Lookup.getDefault().lookup(new Lookup.Template(SourceLevelQueryImplementation.class));
39
        Lookup.getDefault().lookup(new Lookup.Template(SourceLevelQueryImplementation.class));
36
40
Lines 51-56 Link Here
51
            SourceLevelQueryImplementation sqi = (SourceLevelQueryImplementation)it.next();
55
            SourceLevelQueryImplementation sqi = (SourceLevelQueryImplementation)it.next();
52
            String s = sqi.getSourceLevel(javaFile);
56
            String s = sqi.getSourceLevel(javaFile);
53
            if (s != null) {
57
            if (s != null) {
58
                if (!SOURCE_LEVEL.matcher(s).matches()) {
59
                    ErrorManager.getDefault().getInstance(SourceLevelQuery.class.getName()).log(ErrorManager.WARNING, "#83994: Ignoring bogus source level " + s + " for " + javaFile + " from " + sqi);
60
                    continue;
61
                }
54
                return s;
62
                return s;
55
            }
63
            }
56
        }
64
        }

Return to bug 83994