From: Jody G. <jga...@re...> - 2007-06-27 19:35:56
|
Hi Martin I am walking through some of your code and I think I spotted a problem: > public synchronized Set/*<CoordinateOperation>*/ > createFromCoordinateReferenceSystemCodes( > final String sourceCode, final String targetCode) > throws FactoryException > { > final Set/*<CoordinateOperation>*/ operations; > final CodePair key = new CodePair(trimAuthority(sourceCode), > trimAuthority(targetCode)); > final Object cached = get(key); > if (cached instanceof CoordinateOperation) { > operations = (Set/*<CoordinateOperation>*/) cached; > } else { > operations = Collections.unmodifiableSet(getBackingStore() > > .createFromCoordinateReferenceSystemCodes(sourceCode, targetCode)); > } > put(key, operations); > return operations; > The line where we have: > if (cached instanceof CoordinateOperation) { > operations = (Set/*<CoordinateOperation>*/) cached; > } Can never succeed - it shoudl result in a class cast exception! But since we only ever put an unmodifieableSet into the cache - it has never been called .... perhaps you intended to check for an instance of Set? Cheers, Jody |