0
下面的代碼用於javax.activation.DataHandler.getDataContentHandler,1.41,07/05/14。dataContentHandler成員變量被覆蓋在javax.activation.DataHandler.getDataContentHandler中?
如果在調用方法時dataContentHandler成員變量爲null,那麼它將由[1]處的'if'子句(這是我的程序中發生的)設置。
然後立即在[2]的if子句中被覆蓋。
我錯過了什麼,或者那不太可能是預期的行爲?
private synchronized DataContentHandler getDataContentHandler() {
// make sure the factory didn't change
if (factory != oldFactory) {
oldFactory = factory;
factoryDCH = null;
dataContentHandler = null;
transferFlavors = emptyFlavors;
}
if (dataContentHandler != null)
return dataContentHandler;
String simpleMT = getBaseType();
if (factoryDCH == null && factory != null)
factoryDCH = factory.createDataContentHandler(simpleMT);
if (factoryDCH != null)
dataContentHandler = factoryDCH;
if (dataContentHandler == null) { // [1]
if (dataSource != null)
dataContentHandler = getCommandMap().
createDataContentHandler(simpleMT, dataSource);
else
dataContentHandler = getCommandMap().
createDataContentHandler(simpleMT);
}
// getDataContentHandler always uses these 'wrapper' handlers
// to make sure it returns SOMETHING meaningful...
if (dataSource != null) // [2]
dataContentHandler = new DataSourceDataContentHandler(
dataContentHandler,
dataSource);
else
dataContentHandler = new ObjectDataContentHandler(
dataContentHandler,
object,
objectMimeType);
return dataContentHandler;
}
我
啊,是的,謝謝,我錯過了。 – 2015-03-05 09:47:21