001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.importexport;
029
030import org.opencms.configuration.CmsParameterConfiguration;
031import org.opencms.file.CmsFile;
032import org.opencms.file.CmsObject;
033import org.opencms.file.CmsProperty;
034import org.opencms.file.CmsResource;
035import org.opencms.file.types.CmsResourceTypePlain;
036import org.opencms.file.types.I_CmsResourceType;
037import org.opencms.i18n.CmsMessageContainer;
038import org.opencms.loader.CmsLoaderException;
039import org.opencms.main.CmsException;
040import org.opencms.main.CmsLog;
041import org.opencms.main.OpenCms;
042import org.opencms.relations.I_CmsLinkParseable;
043import org.opencms.report.I_CmsReport;
044import org.opencms.security.CmsAccessControlEntry;
045import org.opencms.security.CmsRole;
046import org.opencms.security.I_CmsPasswordHandler;
047import org.opencms.security.I_CmsPrincipal;
048import org.opencms.util.CmsDateUtil;
049import org.opencms.util.CmsUUID;
050import org.opencms.xml.CmsXmlEntityResolver;
051import org.opencms.xml.CmsXmlException;
052import org.opencms.xml.CmsXmlUtils;
053
054import java.io.File;
055import java.io.IOException;
056import java.text.ParseException;
057import java.util.ArrayList;
058import java.util.Collections;
059import java.util.HashMap;
060import java.util.Iterator;
061import java.util.List;
062import java.util.Map;
063import java.util.zip.ZipFile;
064
065import org.apache.commons.logging.Log;
066
067import org.dom4j.Document;
068import org.dom4j.Element;
069import org.dom4j.Node;
070
071/**
072 * Implementation of the OpenCms Import Interface ({@link org.opencms.importexport.I_CmsImport}) for
073 * the import version 4.<p>
074 *
075 * This import format is used in OpenCms since 5.1.6.<p>
076 *
077 * @since 6.0.0
078 *
079 * @see org.opencms.importexport.A_CmsImport
080 *
081 * @deprecated this import class is no longer in use and should only be used to import old export files
082 */
083@Deprecated
084public class CmsImportVersion4 extends A_CmsImport {
085
086    /** The version number of this import implementation.<p> */
087    private static final int IMPORT_VERSION = 4;
088
089    /** The log object for this class. */
090    private static final Log LOG = CmsLog.getLog(CmsImportVersion4.class);
091
092    /** Stores all resource of type that implements the {@link I_CmsLinkParseable} interface. */
093    private List<CmsResource> m_parseables;
094
095    /**
096     * Creates a new CmsImportVerion4 object.<p>
097     */
098    public CmsImportVersion4() {
099
100        m_convertToXmlPage = true;
101    }
102
103    /**
104     * @see org.opencms.importexport.I_CmsImport#getVersion()
105     * @return the version number of this import implementation
106     */
107    public int getVersion() {
108
109        return CmsImportVersion4.IMPORT_VERSION;
110    }
111
112    /**
113     * @see org.opencms.importexport.I_CmsImport#importData(CmsObject, I_CmsReport, CmsImportParameters)
114     */
115    public void importData(CmsObject cms, I_CmsReport report, CmsImportParameters params)
116    throws CmsImportExportException, CmsXmlException {
117
118        // initialize the import
119        initialize();
120        m_cms = cms;
121        m_importPath = params.getDestinationPath();
122        m_report = report;
123
124        m_linkStorage = new HashMap<String, String>();
125        m_linkPropertyStorage = new HashMap<String, List<CmsProperty>>();
126        m_parseables = new ArrayList<CmsResource>();
127
128        CmsImportHelper helper = new CmsImportHelper(params);
129        try {
130            helper.openFile();
131            m_importResource = helper.getFolder();
132            m_importZip = helper.getZipFile();
133            m_docXml = CmsXmlUtils.unmarshalHelper(
134                helper.getFileBytes(CmsImportExportManager.EXPORT_MANIFEST),
135                new CmsXmlEntityResolver(null));
136            // first import the user information
137            if (OpenCms.getRoleManager().hasRole(m_cms, CmsRole.ACCOUNT_MANAGER)) {
138                importGroups();
139                importUsers();
140            }
141            // now import the VFS resources
142            readResourcesFromManifest();
143            convertPointerToSiblings();
144            rewriteParseables();
145        } catch (IOException ioe) {
146            CmsMessageContainer msg = Messages.get().container(
147                Messages.ERR_IMPORTEXPORT_ERROR_READING_FILE_1,
148                CmsImportExportManager.EXPORT_MANIFEST);
149            if (LOG.isErrorEnabled()) {
150                LOG.error(msg.key(), ioe);
151            }
152            throw new CmsImportExportException(msg, ioe);
153        } finally {
154            helper.closeFile();
155            cleanUp();
156        }
157    }
158
159    /**
160     * @see org.opencms.importexport.I_CmsImport#importResources(org.opencms.file.CmsObject, java.lang.String, org.opencms.report.I_CmsReport, java.io.File, java.util.zip.ZipFile, org.dom4j.Document)
161     *
162     * @deprecated use {@link #importData(CmsObject, I_CmsReport, CmsImportParameters)} instead
163     */
164    @Deprecated
165    public void importResources(
166        CmsObject cms,
167        String importPath,
168        I_CmsReport report,
169        File importResource,
170        ZipFile importZip,
171        Document docXml)
172    throws CmsImportExportException {
173
174        CmsImportParameters params = new CmsImportParameters(
175            importResource != null ? importResource.getAbsolutePath() : importZip.getName(),
176            importPath,
177            true);
178
179        try {
180            importData(cms, report, params);
181        } catch (CmsXmlException e) {
182            throw new CmsImportExportException(e.getMessageContainer(), e);
183        }
184    }
185
186    /**
187     * @see org.opencms.importexport.A_CmsImport#importUser(String, String, String, String, String, String, long, Map, List)
188     */
189    @Override
190    protected void importUser(
191        String name,
192        String flags,
193        String password,
194        String firstname,
195        String lastname,
196        String email,
197        long dateCreated,
198        Map<String, Object> userInfo,
199        List<String> userGroups)
200    throws CmsImportExportException {
201
202        boolean convert = false;
203
204        CmsParameterConfiguration config = OpenCms.getPasswordHandler().getConfiguration();
205        if ((config != null) && config.containsKey(I_CmsPasswordHandler.CONVERT_DIGEST_ENCODING)) {
206            convert = config.getBoolean(I_CmsPasswordHandler.CONVERT_DIGEST_ENCODING, false);
207        }
208
209        if (convert) {
210            password = convertDigestEncoding(password);
211        }
212
213        super.importUser(name, flags, password, firstname, lastname, email, dateCreated, userInfo, userGroups);
214    }
215
216    /**
217     * Rewrites all parseable files, to assure link check.<p>
218     */
219    protected void rewriteParseables() {
220
221        if (m_parseables.isEmpty()) {
222            return;
223        }
224
225        m_report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
226
227        int i = 0;
228        Iterator<CmsResource> it = m_parseables.iterator();
229        while (it.hasNext()) {
230            CmsResource res = it.next();
231
232            m_report.print(
233                org.opencms.report.Messages.get().container(
234                    org.opencms.report.Messages.RPT_SUCCESSION_2,
235                    String.valueOf(i + 1),
236                    String.valueOf(m_parseables.size())),
237                I_CmsReport.FORMAT_NOTE);
238
239            m_report.print(
240                Messages.get().container(Messages.RPT_PARSE_LINKS_FOR_1, m_cms.getSitePath(res)),
241                I_CmsReport.FORMAT_NOTE);
242            m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
243
244            try {
245                // make sure the date last modified is kept...
246                CmsFile file = m_cms.readFile(res);
247                file.setDateLastModified(res.getDateLastModified());
248                m_cms.writeFile(file);
249
250                m_report.println(
251                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
252                    I_CmsReport.FORMAT_OK);
253            } catch (Throwable e) {
254                m_report.addWarning(e);
255                m_report.println(
256                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
257                    I_CmsReport.FORMAT_ERROR);
258                if (LOG.isWarnEnabled()) {
259                    LOG.warn(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_REWRITING_1, res.getRootPath()));
260                }
261                if (LOG.isDebugEnabled()) {
262                    LOG.debug(e.getLocalizedMessage(), e);
263                }
264            }
265            i++;
266        }
267
268        m_report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
269    }
270
271    /**
272     * Convert a given timestamp from a String format to a long value.<p>
273     *
274     * The timestamp is either the string representation of a long value (old export format)
275     * or a user-readable string format.
276     *
277     * @param timestamp timestamp to convert
278     * @return long value of the timestamp
279     */
280    private long convertTimestamp(String timestamp) {
281
282        long value = 0;
283        // try to parse the timestamp string
284        // if it successes, its an old style long value
285        try {
286            value = Long.parseLong(timestamp);
287
288        } catch (NumberFormatException e) {
289            // the timestamp was in in a user-readable string format, create the long value form it
290            try {
291                value = CmsDateUtil.parseHeaderDate(timestamp);
292            } catch (ParseException pe) {
293                value = System.currentTimeMillis();
294            }
295        }
296        return value;
297    }
298
299    /**
300     * Imports a resource (file or folder) into the cms.<p>
301     *
302     * @param source the path to the source-file
303     * @param destination the path to the destination-file in the cms
304     * @param type the resource type name of the file
305     * @param uuidresource  the resource uuid of the resource
306     * @param datelastmodified the last modification date of the resource
307     * @param userlastmodified the user who made the last modifications to the resource
308     * @param datecreated the creation date of the resource
309     * @param usercreated the user who created
310     * @param datereleased the release date of the resource
311     * @param dateexpired the expire date of the resource
312     * @param flags the flags of the resource
313     * @param properties a list with properties for this resource
314     *
315     * @return imported resource
316     */
317    private CmsResource importResource(
318        String source,
319        String destination,
320        I_CmsResourceType type,
321        String uuidresource,
322        long datelastmodified,
323        String userlastmodified,
324        long datecreated,
325        String usercreated,
326        long datereleased,
327        long dateexpired,
328        String flags,
329        List<CmsProperty> properties) {
330
331        byte[] content = null;
332        CmsResource result = null;
333
334        try {
335
336            // get the file content
337            if (source != null) {
338                content = getFileBytes(source);
339            }
340            int size = 0;
341            if (content != null) {
342                size = content.length;
343            }
344
345            // get UUIDs for the user
346            CmsUUID newUserlastmodified;
347            CmsUUID newUsercreated;
348            // check if user created and user lastmodified are valid users in this system.
349            // if not, use the current user
350            try {
351                newUserlastmodified = m_cms.readUser(userlastmodified).getId();
352            } catch (CmsException e) {
353                newUserlastmodified = m_cms.getRequestContext().getCurrentUser().getId();
354                // datelastmodified = System.currentTimeMillis();
355            }
356
357            try {
358                newUsercreated = m_cms.readUser(usercreated).getId();
359            } catch (CmsException e) {
360                newUsercreated = m_cms.getRequestContext().getCurrentUser().getId();
361                // datecreated = System.currentTimeMillis();
362            }
363
364            // get UUIDs for the resource and content
365            CmsUUID newUuidresource = null;
366            if ((uuidresource != null) && (!type.isFolder())) {
367                // create a UUID from the provided string
368                newUuidresource = new CmsUUID(uuidresource);
369            } else {
370                // folders get always a new resource record UUID
371                newUuidresource = new CmsUUID();
372            }
373
374            // create a new CmsResource
375            CmsResource resource = new CmsResource(
376                new CmsUUID(), // structure ID is always a new UUID
377                newUuidresource,
378                destination,
379                type.getTypeId(),
380                type.isFolder(),
381                Integer.valueOf(flags).intValue(),
382                m_cms.getRequestContext().getCurrentProject().getUuid(),
383                CmsResource.STATE_NEW,
384                datecreated,
385                newUsercreated,
386                datelastmodified,
387                newUserlastmodified,
388                datereleased,
389                dateexpired,
390                1,
391                size,
392                System.currentTimeMillis(),
393                0);
394
395            // import this resource in the VFS
396            result = m_cms.importResource(destination, resource, content, properties);
397
398            if (result != null) {
399                m_report.println(
400                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
401                    I_CmsReport.FORMAT_OK);
402            }
403        } catch (Exception exc) {
404            // an error while importing the file
405            m_report.println(exc);
406            try {
407                // Sleep some time after an error so that the report output has a chance to keep up
408                Thread.sleep(1000);
409            } catch (Exception e) {
410                //
411            }
412        }
413        return result;
414    }
415
416    /**
417     * Reads all file nodes plus their meta-information (properties, ACL)
418     * from the <code>manifest.xml</code> and imports them as Cms resources to the VFS.<p>
419     *
420     * @throws CmsImportExportException if something goes wrong
421     */
422    private void readResourcesFromManifest() throws CmsImportExportException {
423
424        String source = null, destination = null, uuidresource = null, userlastmodified = null, usercreated = null,
425        flags = null, timestamp = null;
426        long datelastmodified = 0, datecreated = 0, datereleased = 0, dateexpired = 0;
427
428        List<Node> fileNodes = null;
429        List<Node> acentryNodes = null;
430        Element currentElement = null, currentEntry = null;
431        List<CmsProperty> properties = null;
432
433        // get list of immutable resources
434        List<String> immutableResources = OpenCms.getImportExportManager().getImmutableResources();
435        if (immutableResources == null) {
436            immutableResources = Collections.emptyList();
437        }
438        if (LOG.isDebugEnabled()) {
439            LOG.debug(
440                Messages.get().getBundle().key(
441                    Messages.LOG_IMPORTEXPORT_IMMUTABLE_RESOURCES_SIZE_1,
442                    Integer.toString(immutableResources.size())));
443        }
444        // get list of ignored properties
445        List<String> ignoredProperties = OpenCms.getImportExportManager().getIgnoredProperties();
446        if (ignoredProperties == null) {
447            ignoredProperties = Collections.emptyList();
448        }
449
450        // get the desired page type for imported pages
451        m_convertToXmlPage = OpenCms.getImportExportManager().convertToXmlPage();
452
453        try {
454            // get all file-nodes
455            fileNodes = m_docXml.selectNodes("//" + A_CmsImport.N_FILE);
456            int importSize = fileNodes.size();
457
458            // walk through all files in manifest
459            for (int i = 0; i < fileNodes.size(); i++) {
460                m_report.print(
461                    org.opencms.report.Messages.get().container(
462                        org.opencms.report.Messages.RPT_SUCCESSION_2,
463                        String.valueOf(i + 1),
464                        String.valueOf(importSize)),
465                    I_CmsReport.FORMAT_NOTE);
466                currentElement = (Element)fileNodes.get(i);
467
468                // <source>
469                source = getChildElementTextValue(currentElement, A_CmsImport.N_SOURCE);
470                // <destination>
471
472                destination = getChildElementTextValue(currentElement, A_CmsImport.N_DESTINATION);
473
474                // <type>
475                String typeName = getChildElementTextValue(currentElement, A_CmsImport.N_TYPE);
476                I_CmsResourceType type;
477                try {
478                    type = OpenCms.getResourceManager().getResourceType(typeName);
479                } catch (CmsLoaderException e) {
480                    // unknown resource type, import resource as type "plain"
481                    type = OpenCms.getResourceManager().getResourceType(CmsResourceTypePlain.getStaticTypeName());
482                }
483
484                if (!type.isFolder()) {
485                    // <uuidresource>
486                    uuidresource = getChildElementTextValue(currentElement, A_CmsImport.N_UUIDRESOURCE);
487                } else {
488                    uuidresource = null;
489                }
490
491                // <datelastmodified>
492                timestamp = getChildElementTextValue(currentElement, A_CmsImport.N_DATELASTMODIFIED);
493                if (timestamp != null) {
494                    datelastmodified = convertTimestamp(timestamp);
495                } else {
496                    datelastmodified = System.currentTimeMillis();
497                }
498
499                // <userlastmodified>
500                userlastmodified = getChildElementTextValue(currentElement, A_CmsImport.N_USERLASTMODIFIED);
501                userlastmodified = OpenCms.getImportExportManager().translateUser(userlastmodified);
502
503                // <datecreated>
504                timestamp = getChildElementTextValue(currentElement, A_CmsImport.N_DATECREATED);
505                if (timestamp != null) {
506                    datecreated = convertTimestamp(timestamp);
507                } else {
508                    datecreated = System.currentTimeMillis();
509                }
510
511                // <usercreated>
512                usercreated = getChildElementTextValue(currentElement, A_CmsImport.N_USERCREATED);
513                usercreated = OpenCms.getImportExportManager().translateUser(usercreated);
514
515                // <datereleased>
516                timestamp = getChildElementTextValue(currentElement, A_CmsImport.N_DATERELEASED);
517                if (timestamp != null) {
518                    datereleased = convertTimestamp(timestamp);
519                } else {
520                    datereleased = CmsResource.DATE_RELEASED_DEFAULT;
521                }
522
523                // <dateexpired>
524                timestamp = getChildElementTextValue(currentElement, A_CmsImport.N_DATEEXPIRED);
525                if (timestamp != null) {
526                    dateexpired = convertTimestamp(timestamp);
527                } else {
528                    dateexpired = CmsResource.DATE_EXPIRED_DEFAULT;
529                }
530
531                // <flags>
532                flags = getChildElementTextValue(currentElement, A_CmsImport.N_FLAGS);
533
534                // apply name translation and import path
535                String translatedName = m_cms.getRequestContext().addSiteRoot(m_importPath + destination);
536                if (type.isFolder()) {
537                    // ensure folders end with a "/"
538                    if (!CmsResource.isFolder(translatedName)) {
539                        translatedName += "/";
540                    }
541                }
542
543                // check if this resource is immutable
544                boolean resourceNotImmutable = checkImmutable(translatedName, immutableResources);
545                translatedName = m_cms.getRequestContext().removeSiteRoot(translatedName);
546                // if the resource is not immutable and not on the exclude list, import it
547                if (resourceNotImmutable) {
548                    // print out the information to the report
549                    m_report.print(Messages.get().container(Messages.RPT_IMPORTING_0), I_CmsReport.FORMAT_NOTE);
550                    m_report.print(
551                        org.opencms.report.Messages.get().container(
552                            org.opencms.report.Messages.RPT_ARGUMENT_1,
553                            translatedName));
554                    m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
555                    // get all properties
556                    properties = readPropertiesFromManifest(currentElement, ignoredProperties);
557
558                    // import the resource
559                    CmsResource res = importResource(
560                        source,
561                        translatedName,
562                        type,
563                        uuidresource,
564                        datelastmodified,
565                        userlastmodified,
566                        datecreated,
567                        usercreated,
568                        datereleased,
569                        dateexpired,
570                        flags,
571                        properties);
572
573                    // if the resource was imported add the access control entrys if available
574                    if (res != null) {
575
576                        List<CmsAccessControlEntry> aceList = new ArrayList<CmsAccessControlEntry>();
577
578                        // write all imported access control entries for this file
579                        acentryNodes = currentElement.selectNodes("*/" + A_CmsImport.N_ACCESSCONTROL_ENTRY);
580
581                        // collect all access control entries
582                        for (int j = 0; j < acentryNodes.size(); j++) {
583                            currentEntry = (Element)acentryNodes.get(j);
584
585                            // get the data of the access control entry
586                            String id = getChildElementTextValue(currentEntry, A_CmsImport.N_ACCESSCONTROL_PRINCIPAL);
587                            String principalId = new CmsUUID().toString();
588                            String principal = id.substring(id.indexOf('.') + 1, id.length());
589
590                            try {
591                                if (id.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) {
592                                    principal = OpenCms.getImportExportManager().translateGroup(principal);
593                                    principalId = m_cms.readGroup(principal).getId().toString();
594                                } else {
595                                    principal = OpenCms.getImportExportManager().translateUser(principal);
596                                    principalId = m_cms.readUser(principal).getId().toString();
597                                }
598
599                                String acflags = getChildElementTextValue(currentEntry, A_CmsImport.N_FLAGS);
600
601                                String allowed = ((Element)currentEntry.selectNodes(
602                                    "./"
603                                        + A_CmsImport.N_ACCESSCONTROL_PERMISSIONSET
604                                        + "/"
605                                        + A_CmsImport.N_ACCESSCONTROL_ALLOWEDPERMISSIONS).get(0)).getTextTrim();
606
607                                String denied = ((Element)currentEntry.selectNodes(
608                                    "./"
609                                        + A_CmsImport.N_ACCESSCONTROL_PERMISSIONSET
610                                        + "/"
611                                        + A_CmsImport.N_ACCESSCONTROL_DENIEDPERMISSIONS).get(0)).getTextTrim();
612
613                                // add the entry to the list
614                                aceList.add(getImportAccessControlEntry(res, principalId, allowed, denied, acflags));
615                            } catch (CmsException e) {
616                                // user or group of ACE might not exist in target system, ignore ACE
617                                if (LOG.isWarnEnabled()) {
618                                    LOG.warn(
619                                        Messages.get().getBundle().key(
620                                            Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1,
621                                            translatedName),
622                                        e);
623                                }
624                                m_report.println(e);
625                            }
626                        }
627
628                        importAccessControlEntries(res, aceList);
629                        if (OpenCms.getResourceManager().getResourceType(
630                            res.getTypeId()) instanceof I_CmsLinkParseable) {
631                            // store for later use
632                            m_parseables.add(res);
633                        }
634                        if (LOG.isInfoEnabled()) {
635                            LOG.info(
636                                Messages.get().getBundle().key(
637                                    Messages.LOG_IMPORTING_4,
638                                    new Object[] {
639                                        String.valueOf(i + 1),
640                                        String.valueOf(importSize),
641                                        translatedName,
642                                        destination}));
643                        }
644                    } else {
645                        // resource import failed, since no CmsResource was created
646                        m_report.print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE);
647                        m_report.println(
648                            org.opencms.report.Messages.get().container(
649                                org.opencms.report.Messages.RPT_ARGUMENT_1,
650                                translatedName));
651
652                        if (LOG.isInfoEnabled()) {
653                            LOG.info(
654                                Messages.get().getBundle().key(
655                                    Messages.LOG_SKIPPING_3,
656                                    String.valueOf(i + 1),
657                                    String.valueOf(importSize),
658                                    translatedName));
659                        }
660                    }
661                } else {
662                    // skip the file import, just print out the information to the report
663                    m_report.print(Messages.get().container(Messages.RPT_SKIPPING_0), I_CmsReport.FORMAT_NOTE);
664                    m_report.println(
665                        org.opencms.report.Messages.get().container(
666                            org.opencms.report.Messages.RPT_ARGUMENT_1,
667                            translatedName));
668
669                    if (LOG.isInfoEnabled()) {
670                        LOG.info(
671                            Messages.get().getBundle().key(
672                                Messages.LOG_SKIPPING_3,
673                                String.valueOf(i + 1),
674                                String.valueOf(importSize),
675                                translatedName));
676                    }
677                }
678            }
679        } catch (Exception e) {
680            m_report.println(e);
681            m_report.addError(e);
682
683            CmsMessageContainer message = Messages.get().container(
684                Messages.ERR_IMPORTEXPORT_ERROR_IMPORTING_RESOURCES_0);
685            if (LOG.isDebugEnabled()) {
686                LOG.debug(message.key(), e);
687            }
688            throw new CmsImportExportException(message, e);
689        }
690    }
691}