Kaydet (Commit) e57eeb6d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#65168: Fix regressions introduced with de-extension-ing report builder

...in 90a326c7 "fdo#61950 move report builder
from bundled extensions to plain code":

* For one, ReportWizard.startReportWizard
(wizards/com/sun/star/wizards/report/ReportWizard.java) would still try to load
reportbuilderwizard.jar from the unpacked extension (and, failing that, fell
back to the old default engine, so this didn't cause any failure per se).
Instead, reference reportbuilderwizard.jar (which was also missing from scp2)
from report.jar's manifest Class-Path (which will always be OK, even if
reportbuilderwizard.jar is not installed) and check for the relevant class via
Class::forName directly.

* For another, the en-US/wizard/report/default.otr template had gone missing.
The way to find it inside the unpacked extension in the past was to include a
Paths.xcu update that extends the Template path.  Instead, install that
template directly into share/template now, and drop the (unused already)
Paths.xcu update.

Change-Id: I09eca2b69aa55d5b15fb5ecfec6881f8a6f6e5e5
üst e98c03ed
......@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,reportbuilder))
ifeq ($(ENABLE_REPORTBUILDER),TRUE)
$(eval $(call gb_Module_add_targets,reportbuilder,\
Jar_reportbuilder \
Package_reportbuilder-templates \
))
endif
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# There is currently only a single, en-US, template that needs to be included in
# any installation set regardless of language settings, so keep this as a
# Package instead of an AllLangPackage (whose content would need to go into a
# language pack in scp2) for now.
$(eval $(call gb_Package_Package,reportbuilder-templates,$(SRCDIR)/reportbuilder/template))
$(eval $(call gb_Package_set_outdir,reportbuilder-templates,$(INSTDIR)))
$(eval $(call gb_Package_add_files_with_dir,reportbuilder-templates,share/template, \
en-US/wizard/report/default.otr \
))
# vim: set noet sw=4 ts=4:
<?xml version='1.0' encoding='UTF-8'?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you 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 .
-->
<oor:component-data oor:package="org.openoffice.Office" oor:name="Paths" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <node oor:name="Paths">
<node oor:name="Template" oor:op="fuse">
<node oor:name="InternalPaths">
<node oor:name="%origin%/../../../../../template" oor:op="fuse"/>
</node>
</node>
</node>
</oor:component-data>
......@@ -38,7 +38,9 @@ Module gid_Module_Reportbuilder
gid_File_Lib_Rptui,
gid_File_Lib_Rptxml,
gid_File_Jar_Reportbuilder,
gid_File_Xcd_Reportbuilder);
gid_File_Jar_Reportbuilderwizard,
gid_File_Xcd_Reportbuilder,
gid_Filelist_ReportbuilderTemplates);
End
Directory gid_Dir_Share_Reportbuilder
......@@ -47,6 +49,7 @@ Directory gid_Dir_Share_Reportbuilder
End
STD_JAR_FILE( gid_File_Jar_Reportbuilder, reportbuilder )
STD_JAR_FILE( gid_File_Jar_Reportbuilderwizard, reportbuilderwizard )
#if !defined SYSTEM_APACHE_COMMONS
STD_JAR_FILE(gid_File_Jar_CommonsLogging, commons-logging-1.1.1)
......@@ -74,4 +77,11 @@ File gid_File_Xcd_Reportbuilder
Styles = (PACKED);
End
File gid_Filelist_ReportbuilderTemplates
TXT_FILE_BODY;
Dir = FILELIST_DIR;
Name = "reportbuilder-templates.filelist";
Styles = (FILELIST);
End
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Class-Path: reportbuilderwizard.jar
RegistrationClassName: com.sun.star.wizards.report.CallReportWizard
UNO-Type-Path:
......@@ -24,7 +24,6 @@ import com.sun.star.awt.XTextListener;
import com.sun.star.beans.PropertyValue;
import com.sun.star.container.XContentEnumerationAccess;
import com.sun.star.deployment.XPackageInformationProvider;
import com.sun.star.lang.EventObject;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.logging.XLogger;
......@@ -52,9 +51,6 @@ import com.sun.star.wizards.ui.TitlesComponent;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Map;
public class ReportWizard extends DatabaseObjectWizard implements XTextListener
......@@ -398,19 +394,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
return e.hasMoreElements();
}
/**
* Return the path to the "com.sun.reportdesigner" extension
* @param _xMSF
* @return
*/
public static String getPathToExtension(XMultiServiceFactory _xMSF)
{
// Get the path to the extension and try to add the path to the class loader
final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF);
final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
XPackageInformationProvider xProvider = UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
return xProvider.getPackageLocation("com.sun.reportdesigner");
}
private static XLogger m_xLogger;
private static void initializeLogger(XMultiServiceFactory _xMSF)
......@@ -438,19 +421,16 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
if (isReportBuilderInstalled())
{
// Get the path to the extension and try to add the path to the class loader
String sLocation = getPathToExtension(xMSF);
// TODO: Umlaut in filename!
if (sLocation.length() > 0)
Class<?> a = null;
try
{
a = Class.forName("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
}
catch (ClassNotFoundException e) {}
if (a != null)
{
try
{
URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar");
URL[] aURLs = new URL[1];
aURLs[0] = aLocationURI.toURL();
URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader());
Class<?> a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
Method aMethod = a.getMethod("create", new Class[]
{
XMultiServiceFactory.class
......@@ -460,8 +440,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
}
catch (Exception e)
{
// Maybe problems in URI create() if a wrong char is used like '[' ']', ...
System.out.println("There could be a problem with the path '" + sLocation + "'");
e.printStackTrace();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment