From a57090bed33d33b6ecc689d2a577af328d069bd4 Mon Sep 17 00:00:00 2001 From: Aidan Butler Date: Thu, 24 Oct 2002 08:19:55 +0000 Subject: [PATCH] Added entity masking "e; --- .../xmerge/xmergebridge/FlatXml/cpp/FlatXml.cxx | 7 +++++-- .../xmergebridge/FlatXml/java/XFlatXml.java | 3 +++ .../xmerge/xmergebridge/XMergeBridge.java | 16 +++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/cpp/FlatXml.cxx b/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/cpp/FlatXml.cxx index 51dcde462982..d34a16e2c022 100644 --- a/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/cpp/FlatXml.cxx +++ b/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/cpp/FlatXml.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FlatXml.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aidan $ $Date: 2002-10-23 15:52:16 $ + * last change: $Author: aidan $ $Date: 2002-10-24 09:19:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,6 +189,9 @@ OUString needsMask(OUString origString){ if (origString.indexOf(rtl::OUString::createFromAscii("&"))!=-1){ origString=replace(origString,rtl::OUString::createFromAscii("&"),rtl::OUString::createFromAscii("&")); } + if (origString.indexOf(rtl::OUString::createFromAscii("\""))!=-1){ + origString=replace(origString,rtl::OUString::createFromAscii("\""),rtl::OUString::createFromAscii(""")); + } if (origString.indexOf(rtl::OUString::createFromAscii("<"))!=-1){ origString=replace(origString,rtl::OUString::createFromAscii("<"),rtl::OUString::createFromAscii("<")); } diff --git a/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/java/XFlatXml.java b/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/java/XFlatXml.java index d92ff3618207..efb8321d28ca 100755 --- a/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/java/XFlatXml.java +++ b/xmerge/java/org/openoffice/xmerge/xmergebridge/FlatXml/java/XFlatXml.java @@ -258,6 +258,9 @@ public class XFlatXml { if (origString.indexOf("&")!=-1){ origString=replace(origString,"&","&"); } + if (origString.indexOf("\"")!=-1){ + origString=replace(origString,"\"","""); + } if (origString.indexOf("<")!=-1){ origString=replace(origString,"<","<"); } diff --git a/xmerge/java/org/openoffice/xmerge/xmergebridge/XMergeBridge.java b/xmerge/java/org/openoffice/xmerge/xmergebridge/XMergeBridge.java index 8449adf2b753..59eb9e2c9e0b 100755 --- a/xmerge/java/org/openoffice/xmerge/xmergebridge/XMergeBridge.java +++ b/xmerge/java/org/openoffice/xmerge/xmergebridge/XMergeBridge.java @@ -251,9 +251,7 @@ public class XMergeBridge { XInputStream.class , xPipeObj ); xOutStream = (XOutputStream) UnoRuntime.queryInterface( XOutputStream.class , xPipeObj ); - convert (xis,xOutStream,false,udJarPath,sFileName,offMime,sdMime); - Object xSaxParserObj=xMSF.createInstance("com.sun.star.xml.sax.Parser"); XParser xParser = (XParser) UnoRuntime.queryInterface( @@ -268,7 +266,6 @@ public class XMergeBridge { } aInput.sSystemId = sFileName; aInput.aInputStream =xInStream; - xParser.setDocumentHandler ( xDocHandler ); xParser.parseStream ( aInput ); @@ -386,6 +383,9 @@ public class XMergeBridge { public String needsMask(String origString){ if (origString.indexOf("&")!=-1){ origString=replace(origString,"&","&"); + } + if (origString.indexOf("\"")!=-1){ + origString=replace(origString,"\"","""); } if (origString.indexOf("<")!=-1){ origString=replace(origString,"<","<"); @@ -405,6 +405,7 @@ public class XMergeBridge { public void endDocument() { + try{ convert (xInStream,xos,true,udJarPath,sURL,offMime,sdMime); @@ -503,7 +504,6 @@ public class XMergeBridge { XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(device); - try{ ConverterInfoReader cir = new ConverterInfoReader(jarName,false); ciEnum =cir.getConverterInfoEnumeration(); @@ -579,6 +579,10 @@ public class XMergeBridge { } ConverterInfoMgr.removeByJar(jarName); } + catch (StackOverflowError sOE){ + System.out.println("\nERROR : Stack OverFlow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n"); + + } catch (Exception e) { System.out.println("Error:"+e); throw new IOException("Xmerge Exception"); @@ -588,7 +592,6 @@ public class XMergeBridge { try { //Check to see if jar contains a plugin Impl - ConverterInfoMgr.addPlugIn(ciEnum); ConverterFactory cf = new ConverterFactory(); Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true); @@ -613,6 +616,9 @@ public class XMergeBridge { } ConverterInfoMgr.removeByJar(jarName); } + catch (StackOverflowError sOE){ + System.out.println("\nERROR : Stack OverFlow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n"); + } catch (Exception e) { System.out.println("Error:"+e); throw new IOException("Xmerge Exception");