From 7245687377ec203771d5e248571063efc359ca29 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 3 Dec 2017 14:37:20 +0100 Subject: [PATCH] IDEMPIERE-2544:to more warning compiler hidden good warning code warning --- org.adempiere.base/META-INF/MANIFEST.MF | 3 +++ .../base/ComponentBlackListService.java | 25 ++++++++++--------- .../org/adempiere/report/jasper/Barbecue.java | 9 ++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index cb71359c21..2b64bd4c53 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -101,7 +101,10 @@ Import-Package: com.sun.mail.smtp;version="1.5", org.osgi.framework, org.osgi.service.cm;version="1.3.0", org.osgi.service.component;version="1.1.0", + org.osgi.service.component.runtime;version="1.3.0", + org.osgi.service.component.runtime.dto;version="1.3.0", org.osgi.service.event;version="1.2.0", + org.osgi.util.promise;version="1.0.0", org.osgi.util.tracker;version="1.5.0", org.restlet, org.restlet.data, diff --git a/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java b/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java index ddefa16f38..f6f565c45f 100644 --- a/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java +++ b/org.adempiere.base/src/org/adempiere/base/ComponentBlackListService.java @@ -19,10 +19,9 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import org.apache.felix.scr.Component; -import org.apache.felix.scr.ScrService; import org.compiere.util.Ini; import org.compiere.util.Util; import org.osgi.framework.BundleContext; @@ -30,6 +29,8 @@ import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.runtime.ServiceComponentRuntime; +import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO; /** * @author hengsin @@ -37,11 +38,11 @@ import org.osgi.service.component.ComponentConstants; */ public class ComponentBlackListService implements ServiceListener { - private ScrService scrService = null; + private ServiceComponentRuntime scrService = null; private List blackListComponentNames = null; protected ComponentBlackListService(BundleContext context) { - ServiceReference ref = context.getServiceReference(ScrService.class); + ServiceReference ref = context.getServiceReference(ServiceComponentRuntime.class); scrService = context.getService(ref); blackListComponentNames = new ArrayList(); retrieveBlacklistCandidates(); @@ -89,20 +90,20 @@ public class ComponentBlackListService implements ServiceListener { private void disableComponents() { - Component[] comps = scrService.getComponents(); - for (Component comp : comps) { - if (blackListComponentNames.contains(comp.getName())) { - comp.disable(); + Collection comps = scrService.getComponentDescriptionDTOs(); + for (ComponentDescriptionDTO comp : comps) { + if (blackListComponentNames.contains(comp.name)) { + scrService.disableComponent(comp); } } } private void disableComponent(String componentName) { - Component[] comps = scrService.getComponents(); - for (Component comp : comps) { - if (comp.getName().equals(componentName)) { - comp.disable(); + Collection comps = scrService.getComponentDescriptionDTOs(); + for (ComponentDescriptionDTO comp : comps) { + if (comp.name.equals(componentName)) { + scrService.disableComponent(comp); break; } } diff --git a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java index 6cc619f6db..c3fd85c29b 100644 --- a/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java +++ b/org.adempiere.report.jasper/src/org/adempiere/report/jasper/Barbecue.java @@ -2,10 +2,12 @@ package org.adempiere.report.jasper; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; -import net.sf.jasperreports.engine.JRAbstractSvgRenderer; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JasperReportsContext; +import net.sf.jasperreports.renderers.AbstractRenderToImageDataRenderer; import net.sourceforge.barbecue.Barcode; -public class Barbecue extends JRAbstractSvgRenderer +public class Barbecue extends AbstractRenderToImageDataRenderer { private static final long serialVersionUID = 5112469398754718739L; @@ -29,7 +31,8 @@ public class Barbecue extends JRAbstractSvgRenderer m_barcode.setDrawingText(showDrawingText); } - public void render(Graphics2D grx, Rectangle2D rectangle) + @Override + public void render(JasperReportsContext jasperReportsContext, Graphics2D grx, Rectangle2D rectangle) throws JRException { try {