Project

Profile

Help

Revision f655323a

Added by Michael Kay about 7 years ago

Fix bug 2210 - concurrent schema import

View differences:

latest9.6/hej/net/sf/saxon/query/XQueryParser.java
1261 1261
        // Do the importing
1262 1262

  
1263 1263
        Configuration config = env.getConfiguration();
1264
        if (!config.isSchemaAvailable(sImport.namespaceURI)) {
1265
            if (!sImport.locationURIs.isEmpty()) {
1266
                try {
1267
                    PipelineConfiguration pipe = config.makePipelineConfiguration();
1268
                    config.readMultipleSchemas(pipe, env.getBaseURI(), sImport.locationURIs, sImport.namespaceURI);
1269
                    namespacesToBeSealed.add(sImport.namespaceURI);
1270
                } catch (SchemaException err) {
1271
                    grumble("Error in schema " + sImport.namespaceURI + ": " + err.getMessage(), "XQST0059");
1264
        synchronized (config) {
1265
            if (!config.isSchemaAvailable(sImport.namespaceURI)) {
1266
                if (!sImport.locationURIs.isEmpty()) {
1267
                    try {
1268
                        PipelineConfiguration pipe = config.makePipelineConfiguration();
1269
                        config.readMultipleSchemas(pipe, env.getBaseURI(), sImport.locationURIs, sImport.namespaceURI);
1270
                        namespacesToBeSealed.add(sImport.namespaceURI);
1271
                    } catch (SchemaException err) {
1272
                        grumble("Error in schema " + sImport.namespaceURI + ": " + err.getMessage(), "XQST0059");
1273
                    }
1274
                } else if (sImport.namespaceURI.equals(NamespaceConstant.XML) ||
1275
                        sImport.namespaceURI.equals(NamespaceConstant.FN) ||
1276
                        sImport.namespaceURI.equals(NamespaceConstant.SCHEMA_INSTANCE)) {
1277
                    config.addSchemaForBuiltInNamespace(sImport.namespaceURI);
1278
                } else {
1279
                    grumble("Unable to locate requested schema " + sImport.namespaceURI, "XQST0059");
1272 1280
                }
1273
            } else if (sImport.namespaceURI.equals(NamespaceConstant.XML) ||
1274
                    sImport.namespaceURI.equals(NamespaceConstant.FN) ||
1275
                    sImport.namespaceURI.equals(NamespaceConstant.SCHEMA_INSTANCE)) {
1276
                config.addSchemaForBuiltInNamespace(sImport.namespaceURI);
1277
            } else {
1278
                grumble("Unable to locate requested schema " + sImport.namespaceURI, "XQST0059");
1279 1281
            }
1282
            ((QueryModule) env).addImportedSchema(sImport.namespaceURI, env.getBaseURI(), sImport.locationURIs);
1280 1283
        }
1281
        ((QueryModule) env).addImportedSchema(sImport.namespaceURI, env.getBaseURI(), sImport.locationURIs);
1282 1284
    }
1283 1285

  
1284 1286
    /**
latest9.6/hej/net/sf/saxon/style/StylesheetPackage.java
522 522
            ComponentDeclaration decl = topLevel.get(i);
523 523
            decl.getSourceElement().index(decl, this);
524 524
        }
525
        // Now seal all the schemas that have been imported to guarantee consistency with instance documents
526
        Configuration config = getConfiguration();
527
        for (String ns : schemaIndex) {
528
            config.sealNamespace(ns);
529
        }
525
//        // Now seal all the schemas that have been imported to guarantee consistency with instance documents
526
//        Configuration config = getConfiguration();
527
//        for (String ns : schemaIndex) {
528
//            config.sealNamespace(ns);
529
//        }
530 530
    }
531 531

  
532 532
    /**

Also available in: Unified diff