1 5 6 package com.hp.hpl.jena.rdf.arp; 7 8 9 16 public class ARPOptions implements ARPErrorNumbers { 17 private static int defaultErrorMode[] = new int[400]; 18 private boolean embedding = false; 19 20 ARPOptions copy() { 21 ARPOptions rslt = new ARPOptions(); 22 rslt.errorMode = (int[])errorMode.clone() ; 23 rslt.embedding = embedding; 24 return rslt; 25 } 26 static { 27 for (int i = 0; i < defaultErrorMode.length; i++) 28 defaultErrorMode[i] = i / 100; 29 } 30 private int errorMode[] = (int[]) defaultErrorMode.clone(); 31 32 int getErrorMode()[] { 33 return errorMode; 34 } 35 55 public int setErrorMode(int errno, int mode) { 56 int old = errorMode[errno]; 57 switch (mode) { 58 case EM_WARNING : 59 case EM_IGNORE : 60 if (errno >= 100 * EM_ERROR && errno != ERR_NOT_WHITESPACE) 61 break; 62 case EM_ERROR : 63 case EM_FATAL : 64 switch (errno) { 65 default : 68 errorMode[errno] = mode; 69 } 70 } 71 return old; 72 } 73 74 77 public void setDefaultErrorMode() { 78 errorMode = (int[]) defaultErrorMode.clone(); 79 } 80 81 84 public void setLaxErrorMode() { 85 setDefaultErrorMode(); 86 for (int i = 100; i < 200; i++) 87 setErrorMode(i, EM_IGNORE); 88 setErrorMode(WARN_MINOR_INTERNAL_ERROR, EM_WARNING); 89 } 90 91 93 public void setStrictErrorMode() { 94 setStrictErrorMode(EM_IGNORE); 95 } 96 97 105 public void setStrictErrorMode(int nonErrorMode) { 106 setDefaultErrorMode(); 107 for (int i = 1; i < 100; i++) 108 setErrorMode(i, nonErrorMode); 109 int warning = EM_WARNING; 110 int error = EM_ERROR; 111 switch (nonErrorMode) { 112 case EM_ERROR : 113 warning = EM_ERROR; 114 break; 115 case EM_FATAL : 116 warning = error = EM_FATAL; 117 break; 118 } 119 for (int i = 100; i < 200; i++) 120 setErrorMode(i, error); 121 setErrorMode(WARN_MINOR_INTERNAL_ERROR, warning); 124 setErrorMode(WARN_MINOR_INTERNAL_ERROR, warning); 125 setErrorMode(WARN_DEPRECATED_XMLLANG, warning); 126 setErrorMode(WARN_STRING_NOT_NORMAL_FORM_C, warning); 127 setErrorMode(WARN_UNKNOWN_PARSETYPE, warning); 129 setErrorMode(WARN_PROCESSING_INSTRUCTION_IN_RDF, nonErrorMode); 131 setErrorMode(WARN_RDF_NN_AS_TYPE, nonErrorMode); 133 setErrorMode(WARN_UNKNOWN_RDF_ELEMENT, warning); 134 setErrorMode(WARN_UNKNOWN_RDF_ATTRIBUTE, warning); 135 setErrorMode(WARN_UNQUALIFIED_RDF_ATTRIBUTE, warning); 136 setErrorMode(WARN_UNKNOWN_XML_ATTRIBUTE, nonErrorMode); 137 setErrorMode(WARN_SAX_WARNING, warning); 140 setErrorMode(IGN_DAML_COLLECTION, error); 141 } 142 143 153 public boolean setEmbedding(boolean embed) { 154 boolean old = embedding; 155 embedding = embed; 156 return old; 157 } 158 boolean getEmbedding() { 159 return embedding; 160 } 161 162 } 163 164 165 191 192 | Popular Tags |