You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Thilo Goetz <tw...@gmx.de> on 2007/11/07 16:19:40 UTC
Re: svn commit: r592777 - /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
Oh crap, I did it again. Ctrl-Shift-F is just
is hard-wired in my backbone. Sorry about that.
The essential piece is this:
> @@ -717,13 +717,39 @@
> } while (numTypes > 0 && numTypes != lastNumTypes);
> // we quit the above loop either when we've added all types or when
> // we went through the entire list without successfully finding any
> - // supertypes. In the latter case, throw an exception
> + // supertypes. In the latter case, throw an exception. Since there
> + // can be more than one such type, we look for one that does not have
> + // ancestor in the list as it is the likely cause of the issue. The
> + // implementation of this is not as efficient as it could be but avoids
> + // issues with cyclic definitions.
> + for (int i = 0; i < typeList.size(); i++) {
> + TypeDescription td_i = (TypeDescription) typeList.get(i);
> + boolean foundSuperType = false;
> + for (int j = 0; j < typeList.size(); j++) {
> + if (i == j) {
> + continue;
> + }
> + TypeDescription td_j = (TypeDescription) typeList.get(j);
> + if (td_j.getName().equals(td_i.getSupertypeName())) {
> + foundSuperType = true;
> + break;
> + }
> + }
> + if (!foundSuperType) {
> + throw new ResourceInitializationException(
> + ResourceInitializationException.UNDEFINED_SUPERTYPE, new Object[] {
> + td_i.getSupertypeName(), td_i.getName(), td_i.getSourceUrlString() });
> + }
> + }
> +
> if (numTypes > 0) {
> + // We get here in either of two cases: there was only one problematic
> + // type definition, or there was a cycle.
> TypeDescription firstFailed = (TypeDescription) typeList.getFirst();
> throw new ResourceInitializationException(