incubator-s4-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "qiu zhan bo (JIRA)" <j...@apache.org>
Subject [jira] [Created] (S4-50) SchemaContainer will throw NPE In some conditions.
Date Mon, 28 May 2012 01:26:22 GMT
qiu zhan bo created S4-50:
-----------------------------

             Summary: SchemaContainer will throw NPE In some conditions.
                 Key: S4-50
                 URL: https://issues.apache.org/jira/browse/S4-50
             Project: Apache S4
          Issue Type: Bug
    Affects Versions: 0.4, 0.3
            Reporter: qiu zhan bo
            Priority: Minor
             Fix For: 0.4, 0.3


in SchemaContainer's source code line 27.clazz.getClassLoader() will be null.
I modified as follows:
	public Schema getSchema(Class<?> clazz) {
		ClassLoader classLoader = clazz.getClassLoader();
		String schemaKey = "";
		if (clazz.getClassLoader() == null) {
			schemaKey = "bootStrap" + ":" + clazz.getName();
		} else {
			schemaKey = classLoader.toString() + ":" + clazz.getName();
		}

        Schema schema = schemaMap.get(schemaKey);
        if (schema == null) {
            schema = new Schema(clazz);
            schemaMap.put(schemaKey, schema);
        }

        return schema;
    }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message