From 684df8a6f5e8bebaccf86ae9167800a8942077b4 Mon Sep 17 00:00:00 2001 From: XingY Date: Thu, 13 Nov 2025 15:43:50 -0800 Subject: [PATCH 1/2] Handle surrogate pair characters substring --- flow/src/org/labkey/flow/ScriptParser.java | 273 +++++++++--------- .../labkey/api/protein/ProteinManager.java | 3 +- .../org/labkey/api/protein/ProteinPlus.java | 3 +- .../api/protein/fasta/FastaDbLoader.java | 3 +- .../labkey/api/protein/fasta/IdPattern.java | 3 +- .../labkey/api/protein/uniprot/uniprot.java | 8 +- 6 files changed, 149 insertions(+), 144 deletions(-) diff --git a/flow/src/org/labkey/flow/ScriptParser.java b/flow/src/org/labkey/flow/ScriptParser.java index 74f1507de7..83fda0bece 100644 --- a/flow/src/org/labkey/flow/ScriptParser.java +++ b/flow/src/org/labkey/flow/ScriptParser.java @@ -1,136 +1,137 @@ -/* - * Copyright (c) 2007-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.flow; - -import org.apache.commons.lang3.StringUtils; -import org.apache.xmlbeans.XmlError; -import org.apache.xmlbeans.XmlException; -import org.apache.xmlbeans.XmlOptions; -import org.fhcrc.cpas.flow.script.xml.ScriptDef; -import org.fhcrc.cpas.flow.script.xml.ScriptDocument; -import org.xml.sax.SAXParseException; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -public class ScriptParser -{ - List _errors; - ScriptDef _script; - - public ScriptParser() - { - } - - static public class Error - { - String _message; - int _line; - int _column; - - public Error(String message) - { - this(message, 0, 0); - } - - public Error(String message, int line, int column) - { - _message = message; - _line = line; - _column = column; - } - - public Error(SAXParseException spe) - { - this(spe.getLocalizedMessage(), spe.getLineNumber(), spe.getColumnNumber()); - } - - public String getMessage() - { - return _message; - } - - public int getLine() - { - return _line; - } - - public int getColumn() - { - return _column; - } - } - - public void parse(String script) - { - try - { - XmlOptions options = new XmlOptions(); - List errors = new ArrayList<>(); - options.setDocumentType(ScriptDocument.type); - script = StringUtils.replace(script, "