Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions client/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
<classpathentry kind="lib" path="lib/xpp3-1.1.4c.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/looks-2.3.1.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl-2.12.2.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.13.0.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.13.0.jar">
<attributes>
Expand Down Expand Up @@ -213,7 +212,6 @@
<classpathentry kind="lib" path="lib/xstream-1.4.20.jar"/>
<classpathentry kind="lib" path="lib/libphonenumber-8.12.50.jar"/>
<classpathentry kind="lib" path="lib/commons-pool2-2.3.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-1.4.01.jar"/>
<classpathentry kind="lib" path="lib/java-semver-0.10.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file removed client/lib/xercesImpl-2.12.2.jar
Binary file not shown.
Binary file removed client/lib/xml-apis-1.4.01.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions server/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,5 @@
<classpathentry kind="lib" path="lib/rhino-1.7.13.jar"/>
<classpathentry kind="lib" path="lib/commons/commons-fileupload-1.5.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.4.20.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl-2.12.2.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-1.4.01.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
78 changes: 0 additions & 78 deletions server/docs/thirdparty/THIRD-PARTY-README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,6 @@ License: LGPL (dual-license with SPL)
Use version 2.x as Xilize has a dependency on it; used only to produce
documentation.

XML-APIs (extracted from Apache Xerces-2)
http://xerces.apache.org/xerces2-j/
License: Apache v2
We include the xml-apis.jar from the Xerces binary distribution in order to allow
our code to compile on JDK 1.4, which does not include newer XML APIs, even though
these API implementations will run on version 1.4 of the JRE. The JAR is unmodified
from the Xerces release, but is renamed as xml-apis-xerces-2.9.1.jar to
make the version clear.
Included as lib/xml-apis-xerces-2.9.1.jar

=================== End of License Information ===================


Expand Down Expand Up @@ -883,74 +873,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------


The license below pertains to Apache Xerces2 Java (Build Tools) version 2.9.1,
which is included with Mirth Connect.

=================== Beginning of License ===================

/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/

=================== End of License =========================


--------------------------------------------------------------------------------


The license below pertains to Jsch version 0.2.13, which is included with Mirth
Connect.

Expand Down
Binary file removed server/lib/xercesImpl-2.12.2.jar
Binary file not shown.
Binary file removed server/lib/xml-apis-1.4.01.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
* http://www.mirthcorp.com
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: Mirth Corporation
// SPDX-FileCopyrightText: 2025 Tony Germano

package com.mirth.connect.plugins.datatypes.delimited;

Expand All @@ -16,14 +11,13 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.ContentHandler;
import org.openintegrationengine.engine.plugins.datatypes.AbstractXMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import com.mirth.connect.util.StringUtil;

public class DelimitedReader extends SAXParser {
public class DelimitedReader extends AbstractXMLReader {
private Logger logger = LogManager.getLogger(this.getClass());

private DelimitedSerializationProperties serializationProperties;
Expand All @@ -49,8 +43,10 @@ public DelimitedReader(DelimitedSerializationProperties serializationProperties)
ungottenRawText = null;
}

@Override
public void parse(InputSource input) throws SAXException, IOException {

ensureHandlerSet();

// Parsing overview
//
// The incoming stream is a single message which is a collection of one
Expand Down Expand Up @@ -85,11 +81,10 @@ public void parse(InputSource input) throws SAXException, IOException {

// Start the document
String documentHead = "delimited";
ContentHandler contentHandler = getContentHandler();
contentHandler.startDocument();

// Output <delimited>
contentHandler.startElement("", documentHead, "", null);
contentHandler.startElement("", documentHead, "", getEmptyAttributes());

// While the parser gets records from the message
ArrayList<String> record;
Expand All @@ -98,9 +93,9 @@ public void parse(InputSource input) throws SAXException, IOException {

// Output <rowN>
if (serializationProperties.isNumberedRows()) {
contentHandler.startElement("", "row" + recordNo, "", null);
contentHandler.startElement("", "row" + recordNo, "", getEmptyAttributes());
} else {
contentHandler.startElement("", "row", "", null);
contentHandler.startElement("", "row", "", getEmptyAttributes());
}

// For each column
Expand All @@ -115,10 +110,11 @@ public void parse(InputSource input) throws SAXException, IOException {
columnName = "column" + (i + 1);
}
// Output <columnN>
contentHandler.startElement("", columnName, "", null);
contentHandler.startElement("", columnName, "", getEmptyAttributes());

// Output column value
contentHandler.characters(record.get(i).toCharArray(), 0, record.get(i).length());
String val = record.get(i);
contentHandler.characters(val.toCharArray(), 0, val.length());

// Output </columnN>
contentHandler.endElement("", columnName, "");
Expand Down
47 changes: 21 additions & 26 deletions server/src/com/mirth/connect/plugins/datatypes/edi/EDIReader.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
* http://www.mirthcorp.com
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: Mirth Corporation
// SPDX-FileCopyrightText: 2025 Tony Germano

package com.mirth.connect.plugins.datatypes.edi;

Expand All @@ -15,19 +10,17 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.xerces.parsers.SAXParser;
import org.openintegrationengine.engine.plugins.datatypes.AbstractXMLReader;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

public class EDIReader extends SAXParser {
public class EDIReader extends AbstractXMLReader {
private Logger logger = LogManager.getLogger(this.getClass());

private String segmentDelimiter;

private String elementDelimiter;

private String subelementDelimiter;

public EDIReader(String segmentDelimiter, String elementDelimiter, String subelementDelimiter) {
Expand All @@ -37,7 +30,10 @@ public EDIReader(String segmentDelimiter, String elementDelimiter, String subele
return;
}

@Override
public void parse(InputSource input) throws SAXException, IOException {
ensureHandlerSet();

// Read the data from the InputSource
BufferedReader in = new BufferedReader(input.getCharacterStream());
String nextLine = "";
Expand Down Expand Up @@ -78,13 +74,13 @@ public void parse(InputSource input) throws SAXException, IOException {
documentHead = "EDIMessage";
}

AttributesImpl attributesImpl = new AttributesImpl();
AttributesImpl attributesImpl = getEmptyAttributes();
attributesImpl.addAttribute("", "segmentDelimiter", "", "", segmentDelimiter);
attributesImpl.addAttribute("", "elementDelimiter", "", "", elementDelimiter);
attributesImpl.addAttribute("", "subelementDelimiter", "", "", subelementDelimiter);
contentHandler.startElement("", documentHead, "", attributesImpl);
}
contentHandler.startElement("", segmentID, "", null);
contentHandler.startElement("", segmentID, "", getEmptyAttributes());

int fieldID = 0;
String field = "00";
Expand All @@ -101,7 +97,7 @@ public void parse(InputSource input) throws SAXException, IOException {
// The naming is SEG.<field number>
if (element.equals(elementDelimiter)) {
if (lastsegElement) {
contentHandler.startElement("", segmentID + "." + field, "", null);
contentHandler.startElement("", segmentID + "." + field, "", getEmptyAttributes());
contentHandler.endElement("", segmentID + "." + field, "");
}
fieldID++;
Expand All @@ -110,7 +106,7 @@ public void parse(InputSource input) throws SAXException, IOException {
lastsegElement = false;

if (element.indexOf(subelementDelimiter) > -1) {
contentHandler.startElement("", segmentID + "." + field, "", null);
contentHandler.startElement("", segmentID + "." + field, "", getEmptyAttributes());
// check if we have sub-elements, if so add them
StringTokenizer subelementTokenizer = new StringTokenizer(element, subelementDelimiter, true);
subelementID = 1;
Expand All @@ -120,7 +116,7 @@ public void parse(InputSource input) throws SAXException, IOException {
if (subelement.equals(subelementDelimiter)) {
String subelementName = segmentID + "." + field + "." + subelementID;
if (lastsegSubelement) {
contentHandler.startElement("", subelementName, "", null);
contentHandler.startElement("", subelementName, "", getEmptyAttributes());
contentHandler.characters("".toCharArray(), 0, 0);
contentHandler.endElement("", subelementName, "");
}
Expand All @@ -132,27 +128,27 @@ public void parse(InputSource input) throws SAXException, IOException {
lastsegSubelement = false;
// The naming is SEG.<field
// number>.<element number>
contentHandler.startElement("", subelementName, "", null);
contentHandler.startElement("", subelementName, "", getEmptyAttributes());
contentHandler.characters(subelement.toCharArray(), 0, subelement.length());
contentHandler.endElement("", subelementName, "");

}
}
String subelementName = segmentID + "." + (field) + "." + subelementID;
if (lastsegSubelement) {
contentHandler.startElement("", subelementName, "", null);
contentHandler.startElement("", subelementName, "", getEmptyAttributes());
contentHandler.characters("".toCharArray(), 0, 0);
contentHandler.endElement("", subelementName, "");
}
contentHandler.endElement("", segmentID + "." + (field), null);
contentHandler.endElement("", segmentID + "." + (field), "");
} else {
contentHandler.startElement("", segmentID + "." + field, "", null);
contentHandler.startElement("", segmentID + "." + field + ".1", "", null);
contentHandler.startElement("", segmentID + "." + field, "", getEmptyAttributes());
contentHandler.startElement("", segmentID + "." + field + ".1", "", getEmptyAttributes());

// Set the text contents to the value
contentHandler.characters(element.toCharArray(), 0, element.length());
contentHandler.endElement("", segmentID + "." + (field) + ".1", null);
contentHandler.endElement("", segmentID + "." + (field), null);
contentHandler.endElement("", segmentID + "." + (field) + ".1", "");
contentHandler.endElement("", segmentID + "." + (field), "");

}
}
Expand All @@ -162,7 +158,7 @@ public void parse(InputSource input) throws SAXException, IOException {
// Set the field id here so we don't get dupe fields like
// SE.01 and SE.01 when we have SE**~
field = fieldID < 10 ? "0" + fieldID : "" + fieldID;
contentHandler.startElement("", segmentID + "." + field, "", null);
contentHandler.startElement("", segmentID + "." + field, "", getEmptyAttributes());
contentHandler.endElement("", segmentID + "." + field, "");
}
contentHandler.endElement("", segmentID, "");
Expand All @@ -175,5 +171,4 @@ public void parse(InputSource input) throws SAXException, IOException {
contentHandler.endElement("", documentHead, "");
contentHandler.endDocument();
}

}
Loading