List of usage examples for org.w3c.dom Document getElementsByTagNameNS
public NodeList getElementsByTagNameNS(String namespaceURI, String localName);
NodeList
of all the Elements
with a given local name and namespace URI in document order. From source file:com.fujitsu.dc.test.jersey.AbstractCase.java
/** * ?????DOM????./*w w w .ja v a 2 s . c om*/ * @param doc Document * @param name ????? * @param ns ????? * @return ???Node */ private Node getElementByTagNameNS(final Document doc, final String name, final String ns) { NodeList nl = doc.getElementsByTagNameNS(ns, name); if (nl.getLength() > 0) { return nl.item(0); } else { return null; } }
From source file:be.fedict.eid.applet.service.signer.ooxml.OOXMLSignatureVerifier.java
public List<X509Certificate> getSigners(URL url) throws IOException, ParserConfigurationException, SAXException, TransformerException, MarshalException, XMLSignatureException, JAXBException { List<X509Certificate> signers = new LinkedList<X509Certificate>(); List<String> signatureResourceNames = getSignatureResourceNames(url); if (signatureResourceNames.isEmpty()) { LOG.debug("no signature resources"); }/* w ww . j a v a2s.c o m*/ for (String signatureResourceName : signatureResourceNames) { Document signatureDocument = getSignatureDocument(url, signatureResourceName); if (null == signatureDocument) { continue; } NodeList signatureNodeList = signatureDocument.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature"); if (0 == signatureNodeList.getLength()) { return null; } Node signatureNode = signatureNodeList.item(0); KeyInfoKeySelector keySelector = new KeyInfoKeySelector(); DOMValidateContext domValidateContext = new DOMValidateContext(keySelector, signatureNode); domValidateContext.setProperty("org.jcp.xml.dsig.validateManifests", Boolean.TRUE); OOXMLURIDereferencer dereferencer = new OOXMLURIDereferencer(url); domValidateContext.setURIDereferencer(dereferencer); XMLSignatureFactory xmlSignatureFactory = XMLSignatureFactory.getInstance(); XMLSignature xmlSignature = xmlSignatureFactory.unmarshalXMLSignature(domValidateContext); boolean valid = xmlSignature.validate(domValidateContext); if (!valid) { LOG.debug("not a valid signature"); continue; } /* * Check the content of idPackageObject. */ List<XMLObject> objects = xmlSignature.getObjects(); XMLObject idPackageObject = null; for (XMLObject object : objects) { if ("idPackageObject".equals(object.getId())) { idPackageObject = object; break; } } if (null == idPackageObject) { LOG.debug("idPackageObject ds:Object not present"); continue; } List<XMLStructure> idPackageObjectContent = idPackageObject.getContent(); Manifest idPackageObjectManifest = null; for (XMLStructure content : idPackageObjectContent) { if (content instanceof Manifest) { idPackageObjectManifest = (Manifest) content; break; } } if (null == idPackageObjectManifest) { LOG.debug("no ds:Manifest present within idPackageObject ds:Object"); continue; } LOG.debug("ds:Manifest present within idPackageObject ds:Object"); List<Reference> idPackageObjectReferences = idPackageObjectManifest.getReferences(); Set<String> idPackageObjectReferenceUris = new HashSet<String>(); Set<String> remainingIdPackageObjectReferenceUris = new HashSet<String>(); for (Reference idPackageObjectReference : idPackageObjectReferences) { idPackageObjectReferenceUris.add(idPackageObjectReference.getURI()); remainingIdPackageObjectReferenceUris.add(idPackageObjectReference.getURI()); } LOG.debug("idPackageObject ds:Reference URIs: " + idPackageObjectReferenceUris); CTTypes contentTypes = getContentTypes(url); List<String> relsEntryNames = getRelsEntryNames(url); for (String relsEntryName : relsEntryNames) { LOG.debug("---- relationship entry name: " + relsEntryName); CTRelationships relationships = getRelationships(url, relsEntryName); List<CTRelationship> relationshipList = relationships.getRelationship(); boolean includeRelationshipInSignature = false; for (CTRelationship relationship : relationshipList) { String relationshipType = relationship.getType(); STTargetMode targetMode = relationship.getTargetMode(); if (null != targetMode) { LOG.debug("TargetMode: " + targetMode.name()); if (targetMode == STTargetMode.EXTERNAL) { /* * ECMA-376 Part 2 - 3rd edition * * 13.2.4.16 Manifest Element * * "The producer shall not create a Manifest element that references any data outside of the package." */ continue; } } if (false == OOXMLSignatureFacet.isSignedRelationship(relationshipType)) { continue; } String relationshipTarget = relationship.getTarget(); String baseUri = "/" + relsEntryName.substring(0, relsEntryName.indexOf("_rels/")); String streamEntry = baseUri + relationshipTarget; LOG.debug("stream entry: " + streamEntry); streamEntry = FilenameUtils.separatorsToUnix(FilenameUtils.normalize(streamEntry)); LOG.debug("normalized stream entry: " + streamEntry); String contentType = getContentType(contentTypes, streamEntry); if (relationshipType.endsWith("customXml")) { if (false == contentType.equals("inkml+xml") && false == contentType.equals("text/xml")) { LOG.debug("skipping customXml with content type: " + contentType); continue; } } includeRelationshipInSignature = true; LOG.debug("content type: " + contentType); String referenceUri = streamEntry + "?ContentType=" + contentType; LOG.debug("reference URI: " + referenceUri); if (false == idPackageObjectReferenceUris.contains(referenceUri)) { throw new RuntimeException( "no reference in idPackageObject ds:Object for relationship target: " + streamEntry); } remainingIdPackageObjectReferenceUris.remove(referenceUri); } String relsReferenceUri = "/" + relsEntryName + "?ContentType=application/vnd.openxmlformats-package.relationships+xml"; if (includeRelationshipInSignature && false == idPackageObjectReferenceUris.contains(relsReferenceUri)) { LOG.debug("missing ds:Reference for: " + relsEntryName); throw new RuntimeException("missing ds:Reference for: " + relsEntryName); } remainingIdPackageObjectReferenceUris.remove(relsReferenceUri); } if (false == remainingIdPackageObjectReferenceUris.isEmpty()) { LOG.debug("remaining idPackageObject reference URIs" + idPackageObjectReferenceUris); throw new RuntimeException("idPackageObject manifest contains unknown ds:References: " + remainingIdPackageObjectReferenceUris); } X509Certificate signer = keySelector.getCertificate(); signers.add(signer); } return signers; }
From source file:eu.elf.license.LicenseQueryHandler.java
/** * Gets the price of the License Model/*from w w w . j a va 2 s . co m*/ * * @param lm - LicenseModel object * @param userId - UserId * @throws Exception * @return - ProductPriceSum as String */ public String getLicenseModelPrice(LicenseModel lm, String userId) throws Exception { StringBuffer buf = null; String productPriceSum = ""; List<LicenseParam> lpList = lm.getParams(); String productPriceQuery = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wpos:WPOSRequest xmlns:wpos=\"http://www.conterra.de/wpos/1.1\" version=\"1.1.0\">" + "<wpos:GetPrice collapse=\"true\">" + "<wpos:Product id=\"" + StringEscapeUtils.escapeXml10(lm.getId()) + "\">" + "<wpos:ConfigParams>"; for (int i = 0; i < lpList.size(); i++) { if (lpList.get(i).getParameterClass().equals("configurationParameter")) { LicenseParam lp = (LicenseParam) lpList.get(i); String priceQuery = "<wpos:Parameter name=\"" + StringEscapeUtils.escapeXml10(lp.getName()) + "\">"; if (lp instanceof LicenseParamInt) { LicenseParamInt lpi = (LicenseParamInt) lp; priceQuery += "<wpos:Value selected=\"true\">" + lpi.getValue() + "</wpos:Value>" + "</wpos:Parameter>"; } else if (lp instanceof LicenseParamBln) { LicenseParamBln lpBln = (LicenseParamBln) lp; priceQuery += "<wpos:Value selected=\"true\">" + lpBln.getValue() + "</wpos:Value>" + "</wpos:Parameter>"; } else if (lp instanceof LicenseParamDisplay) { LicenseParamDisplay lpd = (LicenseParamDisplay) lp; List<String> values = lpd.getValues(); if (lp.getName().equals("LICENSE_USER_GROUP")) { priceQuery += "<wpos:Value>Users</wpos:Value>"; } else if (lp.getName().equals("LICENSE_USER_ID")) { priceQuery += "<wpos:Value>" + userId + "</wpos:Value>"; } else { for (int l = 0; l < values.size(); l++) { priceQuery += "<wpos:Value selected=\"true\">" + StringEscapeUtils.escapeXml10(values.get(l)) + "</wpos:Value>"; } } priceQuery += "</wpos:Parameter>"; } else if (lp instanceof LicenseParamEnum) { LicenseParamEnum lpEnum = (LicenseParamEnum) lp; List<String> tempOptions = lpEnum.getOptions(); List<String> tempSelections = lpEnum.getSelections(); if (tempSelections.size() == 0) { priceQuery = ""; } else { String selectionsString = ""; for (int j = 0; j < tempSelections.size(); j++) { if (j == 0) { selectionsString = tempSelections.get(j); } else { selectionsString += ", " + tempSelections.get(j); } } priceQuery += "<wpos:Value selected=\"true\">" + StringEscapeUtils.escapeXml10(selectionsString) + "</wpos:Value>" + "</wpos:Parameter>"; } } else if (lp instanceof LicenseParamText) { LicenseParamText lpText = (LicenseParamText) lp; List<String> values = lpText.getValues(); for (int k = 0; k < values.size(); k++) { priceQuery += "<wpos:Value selected=\"true\">" + lpText.getValues() + "</wpos:Value>"; } priceQuery += "</wpos:Parameter>"; } productPriceQuery += priceQuery; } } productPriceQuery += "</wpos:ConfigParams>" + "</wpos:Product>" + "</wpos:GetPrice>" + "</wpos:WPOSRequest>"; //System.out.println("query: "+productPriceQuery.toString()); try { buf = doHTTPQuery(this.wposURL, "post", productPriceQuery, false); //System.out.println("response: "+buf.toString()); // Get productPriceInfo from the response Document xmlDoc = LicenseParser.createXMLDocumentFromString(buf.toString()); Element catalogElement = (Element) xmlDoc .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "catalog").item(0); NodeList productGroupElementList = catalogElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "productGroup"); for (int m = 0; m < productGroupElementList.getLength(); m++) { Element productGroupElement = (Element) productGroupElementList.item(m); Element calculationElement = (Element) productGroupElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "calculation").item(0); Element declarationListElement = (Element) calculationElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "declarationList").item(0); Element referencedParametersElement = (Element) declarationListElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "referencedParameters").item(0); NodeList referencedParametersParameterList = referencedParametersElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "parameter"); for (int n = 0; n < referencedParametersParameterList.getLength(); n++) { Element referencedParametersParameterElement = (Element) referencedParametersParameterList .item(n); NamedNodeMap referencedParametersParameterAttributeMap = referencedParametersParameterElement .getAttributes(); for (int o = 0; o < referencedParametersParameterAttributeMap.getLength(); o++) { Attr attrs = (Attr) referencedParametersParameterAttributeMap.item(o); if (attrs.getNodeName().equals("name")) { if (attrs.getNodeValue().equals("productPriceSum")) { Element valueElement = (Element) referencedParametersParameterElement .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "value").item(0); productPriceSum = valueElement.getTextContent(); } } } } } } catch (Exception e) { throw e; } return productPriceSum; }
From source file:com.wavemaker.tools.ws.WebServiceToolsManager.java
private void modifyServiceName(java.io.File wsdlf) throws IOException, ParserConfigurationException, SAXException, TransformerException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true);/* w w w . ja va2 s . c o m*/ DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document doc = docBuilder.parse(wsdlf); NodeList nlistOp = doc.getElementsByTagNameNS("*", "operation"); NodeList nlistSvc = doc.getElementsByTagNameNS("*", "service"); if (nlistOp == null || nlistOp.getLength() == 0 || nlistSvc == null || nlistSvc.getLength() == 0) { return; } String[] opList = new String[nlistOp.getLength()]; for (int i = 0; i < nlistOp.getLength(); i++) { Node nodeOp = nlistOp.item(i); NamedNodeMap nMap = nodeOp.getAttributes(); for (int j = 0; j < nMap.getLength(); j++) { Node attr = nMap.item(j); if (attr.getNodeName().equals("name")) { opList[i] = attr.getNodeValue(); break; } } } String svcName = null; Node nodeSvc = nlistSvc.item(0); // assumes there is only once service // name defined in a WSDL Node svcNameAttr = null; NamedNodeMap nMap = nodeSvc.getAttributes(); nMap.getLength(); for (int j = 0; j < nMap.getLength(); j++) { svcNameAttr = nMap.item(j); if (svcNameAttr.getNodeName().equals("name")) { svcName = svcNameAttr.getNodeValue(); break; } } if (opList.length == 0 || svcName == null) { return; } boolean sameName = false; for (String opName : opList) { if (opName != null && opName.equals(svcName)) { sameName = true; break; } } if (!sameName) { return; } svcNameAttr.setNodeValue(svcName + "Svc"); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer tFormer = tFactory.newTransformer(); Source source = new DOMSource(doc); Result dest = new StreamResult(wsdlf); tFormer.transform(source, dest); }
From source file:javax.microedition.ims.core.xdm.XDMServiceImpl.java
private List<URIListData> parseURIListDocument(final Document doc) { final List<URIListData> retValue = new ArrayList<URIListData>(); NodeList nodeList = doc.getElementsByTagNameNS("*", LIST_NODE_NAME); for (int listIndex = 0; listIndex < nodeList.getLength(); listIndex++) { Node node = nodeList.item(listIndex); retValue.add(handleListNode(node)); }// w w w .ja v a 2 s. co m return retValue; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.harvester.FileHarvestController.java
/** * Parse an additions file (RDF/XML) to get the URIs of newly-harvested data, which will be sent to the browser and * displayed to the user as links.// w w w .j av a2s . c o m * @param additionsFile the file containing the newly-added RDF/XML * @param newlyAddedUris a list in which to place the newly added URIs */ private void extractNewlyAddedUris(File additionsFile, List<String> newlyAddedUris, FileHarvestJob job) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document document = factory.newDocumentBuilder().parse(additionsFile); //Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(additionsFile); NodeList descriptionNodes = document .getElementsByTagNameNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "Description"); int numNodes = descriptionNodes.getLength(); for (int i = 0; i < numNodes; i++) { Node node = descriptionNodes.item(i); ArrayList<String> types = getRdfTypes(node); boolean match = false; String[] validRdfTypesForJob = job.getRdfTypesForLinks(); for (String rdfType : validRdfTypesForJob) { if (types.contains(rdfType)) match = true; break; } if (match) { NamedNodeMap attributes = node.getAttributes(); Node aboutAttribute = attributes.getNamedItemNS("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "about"); if (aboutAttribute != null) { String value = aboutAttribute.getNodeValue(); newlyAddedUris.add(value); } } } } catch (Exception e) { log.error(e, e); } }
From source file:javax.microedition.ims.core.xdm.XDMServiceImpl.java
private List<PresenceListData> parsePresenceListDocument(final Document doc) { final List<PresenceListData> retValue = new ArrayList<PresenceListData>(); NodeList nodeList = doc.getElementsByTagNameNS("*", XDMHelper.SERVICE_NODE_NAME); for (int listIndex = 0; listIndex < nodeList.getLength(); listIndex++) { Node node = nodeList.item(listIndex); retValue.add(XDMHelper.handleServiceNode(node)); }/* ww w . j av a 2 s .c o m*/ return retValue; }
From source file:org.dataconservancy.access.connector.HttpDcsConnector.java
@Override public URL depositSIP(Dcp dcp) throws DcsClientFault { HttpPost post;/* w w w.ja v a2 s. c o m*/ try { post = new HttpPost(config.getDepositSipUrl().toURI()); } catch (URISyntaxException e) { final String msg = "Malformed deposit sip endpoint URL " + config.getUploadFileUrl() + ": " + e.getMessage(); log.debug(msg, e); throw new DcsClientFault(msg, e); } post.setHeader("Content-Type", "application/xml"); post.setHeader("X-Packaging", "http://dataconservancy.org/schemas/dcp/1.0"); ByteArrayOutputStream dcp_buf = new ByteArrayOutputStream(); mb.buildSip(dcp, dcp_buf); ByteArrayEntity data = new ByteArrayEntity(dcp_buf.toByteArray()); post.setEntity(data); HttpResponse resp = execute(post, HttpStatus.SC_ACCEPTED); // Parse atom feed and pull out <link href> containing sip status url Document doc = null; ByteArrayOutputStream atom_buf = null; try { atom_buf = new ByteArrayOutputStream(); resp.getEntity().writeTo(atom_buf); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(new ByteArrayInputStream(atom_buf.toByteArray())); } catch (IOException e) { throw new DcsClientFault("Error reading server response", e); } catch (ParserConfigurationException e) { throw new DcsClientFault("Error parsing atom: " + atom_buf, e); } catch (SAXException e) { throw new DcsClientFault("Error parsing atom: " + atom_buf, e); } NodeList nl = doc.getElementsByTagNameNS("http://www.w3.org/2005/Atom", "link"); if (nl.getLength() == 0) { throw new DcsClientFault("Could not parse atom: " + atom_buf); } String status_url = ((Element) nl.item(0)).getAttribute("href"); if (status_url == null) { throw new DcsClientFault("Could not parse atom: " + atom_buf); } try { return new URL(status_url); } catch (MalformedURLException e) { throw new DcsClientFault("Malformed status url: " + status_url, e); } }
From source file:ddf.catalog.source.opensearch.CddaOpenSearchSite.java
/** * @param is//from w w w . jav a 2 s . c om * @param queryRequest * @return * @throws UnsupportedQueryException */ private SourceResponseImpl processResponse(InputStream is, QueryRequest queryRequest) throws ConversionException { List<Result> resultQueue = new ArrayList<Result>(); Document atomDoc = null; try { atomDoc = OpenSearchSiteUtil.convertStreamToDocument(is); if (logger.isDebugEnabled()) { logger.debug("Incoming response from OpenSearch site: " + XPathHelper.xmlToString(atomDoc)); } } finally { IOUtils.closeQuietly(is); } Map<String, String> securityProps = updateDefaultClassification(); Document ddmsDoc = OpenSearchSiteUtil.normalizeAtomToDDMS(tf, atomDoc, normalizeXslt, securityProps); if (logger.isDebugEnabled()) { logger.debug("Incoming response from OpenSearch site normalized to DDMS: " + XPathHelper.xmlToString(ddmsDoc)); } NodeList list = ddmsDoc.getElementsByTagNameNS("http://metadata.dod.mil/mdr/ns/DDMS/2.0/", "Resource"); String resultNum = evaluate("//opensearch:totalResults", atomDoc); long totalResults = 0; if (resultNum != null && !resultNum.isEmpty()) { totalResults = Integer.parseInt(resultNum); } else { // if no openseach:totalResults element, spec says to use list // of current items as totalResults totalResults = list.getLength(); } // offset always comes in as 0 from DDF federation logic for (int i = 0; i < list.getLength(); i++) { try { Node curNode = list.item(i); String relevance = OpenSearchSiteUtil.popAttribute(curNode, "score"); String id = OpenSearchSiteUtil.popAttribute(curNode, "id"); String date = OpenSearchSiteUtil.popAttribute(curNode, "date"); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); doc.appendChild(doc.importNode(curNode, true)); if (logger.isDebugEnabled()) { logger.debug(XPathHelper.xmlToString(doc)); } resultQueue.add(createResponse(doc, id, date, relevance)); } catch (ParserConfigurationException pce) { throw new ConversionException("Couldn't convert node to document. ", pce); } if (logger.isDebugEnabled()) { logger.debug("Returning " + list.getLength() + " entries in response."); } } SourceResponseImpl response = new SourceResponseImpl(queryRequest, resultQueue); response.setHits(totalResults); return response; }
From source file:fr.gouv.finances.dgfip.xemelios.importers.DefaultImporter.java
protected void processTempFile(final File df, final String fileEncoding, final String xmlVersion, final String header, final String footer, final TDocument persistenceConfig, final Pair collectivite, final Pair codeBudget, final File originalFile, final int docCount, final boolean shouldDelete, final int progress) { try {/* w w w . j ava2 s .co m*/ long startFile = System.currentTimeMillis(); String data = FileUtils.readTextFile(df, fileEncoding); StringBuilder fullText = new StringBuilder(); fullText.append("<?xml version=\"").append(xmlVersion).append("\" encoding=\"").append(fileEncoding) .append("\"?>"); fullText.append(header).append(data).append(footer); String sFullText = fullText.toString(); byte[] bData = sFullText.getBytes(fileEncoding); Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(bData)); // il faut retrouver de quel etat est ce document // on cherche si la balise root contient un // dm.getEtatxxx().getBalise() EtatModel currentEtat = null; for (EtatModel em : dm.getEtats()) { String balise = em.getBalise(); NodeList nl = doc.getElementsByTagName(balise); if (nl.getLength() > 0) { currentEtat = em; break; } else { nl = doc.getElementsByTagNameNS(em.getBaliseNamespace(), balise); if (nl.getLength() > 0) { currentEtat = em; break; } } } // traitement d'erreur, on n'arrive pas identifier l'etat if (currentEtat == null) { StringWriter sw = new StringWriter(); sw.append("Impossible de dterminer l'tat de ce document :\n"); TransformerFactory errorTransFactory = FactoryProvider.getTransformerFactory(); Transformer errorTransformer = errorTransFactory.newTransformer(); errorTransformer.transform(new DOMSource(doc), new StreamResult(sw)); sw.flush(); sw.close(); logger.error(sw.getBuffer().toString()); return; } // apply before-import xslt if (persistenceConfig.getEtat(currentEtat.getId()).getImportXsltFile() != null) { Transformer trans = importXsltCache .get(persistenceConfig.getEtat(currentEtat.getId()).getImportXsltFile()); if (trans == null) { TransformerFactory tf = FactoryProvider.getTransformerFactory(); File directory = new File(currentEtat.getParent().getBaseDirectory()); File xslFile = new File(directory, persistenceConfig.getEtat(currentEtat.getId()).getImportXsltFile()); trans = tf.newTransformer(new StreamSource(xslFile)); importXsltCache.put(persistenceConfig.getEtat(currentEtat.getId()).getImportXsltFile(), trans); } // important, maintenant que c'est mis en cache ! trans.reset(); if (codeBudget != null) { trans.setParameter("CodeBudget", codeBudget.key); trans.setParameter("LibelleBudget", codeBudget.libelle); } if (collectivite != null) { trans.setParameter("CodeCollectivite", collectivite.key); trans.setParameter("LibelleCollectivite", collectivite.libelle); } if (getManifeste() != null) { trans.setParameter("manifeste", new DOMSource(getManifeste())); } // on passe en parametre le nom du fichier trans.setParameter("file.name", originalFile.getName()); trans.setOutputProperty(OutputKeys.ENCODING, fileEncoding); ByteArrayOutputStream baos = new ByteArrayOutputStream(); trans.transform(new StreamSource(new ByteArrayInputStream(sFullText.getBytes(fileEncoding))), new StreamResult(baos)); bData = baos.toByteArray(); } importTimingOS.append(originalFile.getName()).append(";").append(df.toURI().toURL().toExternalForm()) .append(";XSL;").append(Long.toString(startFile)).append(";") .append(Long.toString(startFile = System.currentTimeMillis())); importTimingOS.println(); String docName = StringUtilities.removeFileNameSuffix(originalFile.getName()) + "-" + docCount + "." + dm.getExtension(); if (!isCancelled()) { try { if (!DataLayerManager.getImplementation().importElement(dm, currentEtat, codeBudget, collectivite, originalFile.getName(), docName, bData, fileEncoding, getArchiveName(), user)) { logger.warn(DataLayerManager.getImplementation().getWarnings()); warningCount++; } } catch (DataAccessException daEx) { logger.error("importing element:", daEx); throw (Exception) daEx; } catch (DataConfigurationException dcEx) { logger.error("importing element:", dcEx); throw (Exception) dcEx.getCause(); } } if (shouldDelete) { df.delete(); } importTimingOS.append(originalFile.getName()).append(";").append(df.toURI().toURL().toExternalForm()) .append(";IDX;").append(Long.toString(startFile)).append(";") .append(Long.toString(startFile = System.currentTimeMillis())); importTimingOS.println(); this.getImpSvcProvider().pushCurrentProgress(progress); } catch (Exception ex) { //TODO } }