You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2015/04/10 15:21:32 UTC
svn commit: r1672646 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
Author: schor
Date: Fri Apr 10 13:21:32 2015
New Revision: 1672646
URL: http://svn.apache.org/r1672646
Log:
no Jira, fix up prettyprint of general feature structures to work in the presence of exceptions in getting values, so at least something gets produced
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java?rev=1672646&r1=1672645&r2=1672646&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java Fri Apr 10 13:21:32 2015
@@ -436,7 +436,12 @@ public abstract class FeatureStructureIm
}
LowLevelCAS llcas = this.getCASImpl().getLowLevelCAS();
LowLevelTypeSystem llts = llcas.ll_getTypeSystem();
- final int typeCode = llcas.ll_getFSRefType(ref, true);
+ final int typeCode;
+ try {
+ typeCode = llcas.ll_getFSRefType(ref, true);
+ } catch (LowLevelException e) {
+ return; // can't find ref, may be invalid or null
+ }
int[] feats = llts.ll_getAppropriateFeatures(typeCode);
for (int i = 0; i < feats.length; i++) {
if (llcas.ll_isRefType(llts.ll_getRangeType(feats[i]))) {
@@ -590,7 +595,7 @@ public abstract class FeatureStructureIm
List<Feature> feats = getType().getFeatures();
Feature feat;
Type approp;
- FeatureStructureImpl val;
+ FeatureStructureImpl val = null;
String stringVal;
for (int i = 0; i < feats.size(); i++) {
StringUtils.printSpaces(indent, buf);
@@ -610,8 +615,15 @@ public abstract class FeatureStructureIm
}
buf.append(stringVal + "\n");
} else if (!approp.isPrimitive()) {
- val = (FeatureStructureImpl) getFeatureValue(feat);
- if (val == null) {
+ Exception e = null;
+ try {
+ val = (FeatureStructureImpl) getFeatureValue(feat);
+ } catch (Exception ee) {
+ e = ee;
+ }
+ if (e != null) {
+ buf.append("<exception").append(e.getMessage()).append('>');
+ } else if (val == null) {
buf.append("<null>\n");
} else {
if (!approp.getName().equals("uima.cas.Sofa")) {