File tree Expand file tree Collapse file tree
dbptk-model/src/main/java/com/databasepreservation/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323import javax .xml .xpath .XPathExpressionException ;
2424import javax .xml .xpath .XPathFactory ;
2525
26+ import com .databasepreservation .model .reporters .ValidationReporter ;
2627import org .apache .commons .lang3 .StringUtils ;
2728import org .apache .commons .text .translate .AggregateTranslator ;
2829import org .apache .commons .text .translate .CharSequenceTranslator ;
2930import org .apache .commons .text .translate .EntityArrays ;
3031import org .apache .commons .text .translate .LookupTranslator ;
3132import org .apache .commons .text .translate .UnicodeEscaper ;
3233import org .apache .commons .text .translate .UnicodeUnescaper ;
34+ import org .slf4j .Logger ;
35+ import org .slf4j .LoggerFactory ;
3336import org .w3c .dom .Document ;
3437import org .w3c .dom .Element ;
3538import org .w3c .dom .Node ;
4144 * @author Bruno Ferreira <bferreira@keep.pt>
4245 */
4346public class XMLUtils {
47+ private static final Logger LOGGER = LoggerFactory .getLogger (XMLUtils .class );
4448 /**
4549 * Translator to escape characters according to the SIARD specification
4650 */
@@ -87,8 +91,12 @@ public static String decode(String text) {
8791 if (text == null ) {
8892 return null ;
8993 }
94+ try {
95+ text = SIARD_UNESCAPE .translate (text );
96+ } catch (IllegalArgumentException e ) {
97+ LOGGER .warn ("Illegal unicode on: " + text );
98+ }
9099
91- text = SIARD_UNESCAPE .translate (text );
92100 return text ;
93101 }
94102
You can’t perform that action at this time.
0 commit comments