J'en perd mon Latin (enfin mon Java) ... Mon code fonctionnait parfaitement avant. Je ne comprends ce que j'ai pu faire d'un coups, il ne fonctionnait plus. Je suis perdu et je vais bientôt devenir fou. J'espere que quelqu'un pourra m'aider.
J'ai une dizaine de fois le même essaie (sans rien changer ni dans le code ni dans la maniere de l'utiliser). Mais rien y fais, l'erreur arrive presque une fois sur deux.
Mon but et de creer un graphique tres simple : une matrice de bouleens ou les valeurs vrais sont representes par des points. Ce graphique est ensuite envoye en tant que java.awt.Image a un JasperReport.
Je vous en supplie, sauvez moi de ce calvere.
Voici l'erreur genere :
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Unknown Source) at sun.awt.windows.WToolkit.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at java.awt.Toolkit$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Unknown Source) at javax.swing.UIManager.<clinit>(Unknown Source) at org.jfree.chart.JFreeChart.<clinit>(JFreeChart.java:261) at org.jfree.chart.ChartFactory.createScatterPlot(ChartFactory.java:1513) at ics.eaat.jasper.reporting.chart.DSMChart.createChart(DSMChart.java:65) at ics.eaat.jasper.reporting.chart.DSMChart.createDirectDependencyMatrix(DSMChart.java:38) at ics.eaat.jasper.reporting.report.BeanDSM.<init>(BeanDSM.java:25) at ics.eaat.jasper.reporting.report.DataSourceFactory.dataSourceDSMAnalyze(DataSourceFactory.java:24) at ics.eaat.jasper.reporting.report.PdfFactory.generateDSMReport(PdfFactory.java:36) at ics.eaat.concretemodeller.modelexplorer.actions.CalculateDSM.run(CalculateDSM.java:92) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at ics.eaat.concretemodeller.main.Application.start(Application.java:20) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public static Image createDirectDependencyMatrix(ArrayList<IPrmClass> listOfElement) { String title = "Input matrix"; XYSeries series = new XYSeries(""/*title*/); for (IPrmClass used : listOfElement){ series.add(used.getIndexArchitectView()+1, used.getIndexArchitectView()+1); for(IAssociation ia : used.getAssociations()){ IPrmClass user = (IPrmClass) ia.getParentPort().getOwner(); if (used != user && listOfElement.contains(user)) { series.add(used.getIndexArchitectView()+1, user.getIndexArchitectView()+1); // warning : Y axis is vertical and X axis is horizontal } } } return createChart(series, null, listOfElement.size()); } private static Image createChart (XYSeries series, String title, int size){ XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createScatterPlot(/*title*/ "", "" /* label Axis x*/, "" /* label Axis y*/, dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = chart.getXYPlot(); Color cBlack = new Color(0, 0, 0); plot.getRenderer().setSeriesPaint(0, cBlack); plot.setBackgroundPaint(Color.WHITE); plot.getRangeAxis().setInverted(true); plot.getRangeAxis().setRange(0, size + 1); plot.getRangeAxis().setVisible(false); plot.getDomainAxis().setRange(0, size + 1); plot.getDomainAxis().setVisible(false); chart.createBufferedImage(1000, 1000); return null; }
Partager