[#11761] - Images not show in Designer Ver 6.8

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

I have updated Jaspersoft Studio from 6.6 to 6.8 and now images are not shown in the design view. In the preview, the images are shown.
If the expression is prefixed with the source-folder (as it does with the selection dialog), the image will be shown but it will not work in the compiled .jar file.

AttachmentSize
Image icon imageselection.png80.22 KB
v6.7
Jaspersoft® Studio
mwrekers's picture
Joined: Jun 23 2011 - 1:00am
Last seen: 3 months 2 weeks ago

13 Comments:

#1
AttachmentSize
Image icon designview.png49.7 KB
#2
AttachmentSize
Image icon preview.png17.44 KB
#3
  • Priority:Normal» High

Hello,

I reproduce this bug in the last version of jasper studio 6.12.2.
There is a workaround ? When this bug will be fixed ?

#4
  • Assigned:nobody» morlandin

Hi, I'm trying to reproduce this bug but on my side everything is working correctly on 6.12.2, I've used the same folder structure and image name and using the image selection dialog the generated expression for a workspace resource is correct ("/icons/logo/logo-fb.jpg") and the image is displayed in design mode. Are you on windows? is there some steps that could help me to reproduce?
Also try to enable the internal JSS console (preferences -> Jaspersoft Studio -> Global settings), then open the console view (window -> show view -> console) and from the console view click the down arrow at the right of the computer screen and select JSS Internal Console and look if there is an error related to the image path

#5

Yes the logs shows an error:

Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
net.sf.jasperreports.engine.JRException: Byte data not found at: icons/logo/logo-fb.png.
at net.sf.jasperreports.repo.RepositoryUtil.getBytesFromLocation(RepositoryUtil.java:215)
at net.sf.jasperreports.renderers.util.RendererUtil.getNonLazyRenderable(RendererUtil.java:179)
at com.jaspersoft.studio.jasper.LazyImageConverter$1.run(LazyImageConverter.java:484)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Start ClassPath Mapping
Mapping: Archive: file:/C:/eclipse-oxygen/plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
Mapping: Archive: file:/C:/Program%2520Files/Java/jre1.8.0_202/lib/rt.jar
Error constructing classpath: file:/C:/Program%2520Files/Java/jre1.8.0_202/lib/rt.jar: java.io.FileNotFoundException: C:\Program%20Files\Java\jre1.8.0_202\lib\rt.jar (Das System kann den angegebenen Pfad nicht finden)
Mapping: Directory C:\Users\mawithak.AD\workspace_oxygen\rekers\bin
Mapping: Archive: file:/K:/edv/java/prd/lib/xml-rpc/ws-commons-util.jar
..... lots of mappings .....
Mapping: Archive: file:/K:/edv/java/prd/lib/flatlaf/flatlaf-jide-oss-0.35.jar
Mapping: Archive: file:/K:/edv/java/prd/lib/flatlaf/flatlaf-swingx-0.35.jar
End ClassPath Mapping#
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
Adding root: C:\Users\mawithak.AD\workspace_oxygen\rekers
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,71]
Message: found: DTD, expected START_ELEMENT or END_ELEMENT
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.nextTag(Unknown Source)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readXML(FileDataAdapterStorage.java:263)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readDataADapter(FileDataAdapterStorage.java:279)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.readDataADapter(FileDataAdapterStorage.java:329)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.checkFile(FileDataAdapterStorage.java:252)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage.access$0(FileDataAdapterStorage.java:246)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage$ResourceVisitor.visit(FileDataAdapterStorage.java:71)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at com.jaspersoft.studio.data.storage.FileDataAdapterStorage$1.runInWorkspace(FileDataAdapterStorage.java:95)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

It may be because the source and binary files directories are ignored. (The ignoring can unfortunately also be seen in the compiled .jasper files that are created in the source directory).
The full path of the file is C:\Users\mawithak.AD\workspace_oxygen\rekers\src\icons\logo\logo-fb.png

AttachmentSize
Image icon directories.png29.93 KB
#6

Are you using a plugin version? in case which is the base version of eclipse and did you do a clean install or an update? Can you do a test with an rcp 6.12?
Because looking at your log I see some error not realated to images that I think they could broke something in the image loading

#7

Yes it is a plugin version.
Version: 2020-03 (4.15.0)
Build id: 20200313-1211
This version is updated from previous version of eclipse.

Testing an RCP Version is not really an option. It should also work properly as an plugin.

#8

I've tested the plugin on your same version of eclipse and everything seems working correctly. Which version of java are you using?
Also can you try to check if this happen also on a new workspace?

#9

We are using Java 8.

Again, it seems that the separated directories for source and binary are the problem (see directories.png attached at #5 or create_java_project.png at this comment). If I chose the .png file with the filechooser from the properites page, the expression will be "/src/icons/logo/logo-fb.png" where "/src/" is wrong because this directory is not available in the binary. If i change it to "icons/logo/logo-fb.png" it will work in the compiled jar but not in the designer.

AttachmentSize
Image icon create_java_project.png42.88 KB
#10

Can you give a look to this screencast and tell me if I'm doing the correct steps: https://www.screencast.com/t/O5Gw9kINmVkL
As you can see I create the image in the source folder and even with /src/icons/.... it is able to read it both in the editor and in the preview. The version is a plugin 6.12.2 installed on an eclipse 4.15.0

#11

Yes, this works in the designer and the preview, but not in the running program because the /src directory is not present. The location in the running program is /images/logo/cherry.jpg respectively as relative path images/logo/cherry.jpg not /src/images/logo/cherry.jpg

#12

What do you mean with the running program? if I understood well you are packaging your project at jar and using it somewhere else? If this is the case it is outside the studio functionality to automatically copy stuff from a source folder to a binary folder. If when creating the report you select a resource in the workspace it use the current path of the resource. So the dialog is doing the correct thing, you are selecting a resource in a specific path and that path is used.
By the way if in the example of the screencast you change the path to "/images/logo/cherry.jpg" it works anyway both in design and preview, because JR in the last version is able to resolve it anyway. But this is something that JR does in a cascade search for the resource, but the dialog providing the selection path with the src is doing the correct thing since that is the path of the resource.

#13

Eclipse is automatically exporting it to the binary folder if configured (See the .png at comment #5 "Standardausgabeordner"). If a binary folder is configured, all compiled binarys should be exported to this folder. This means the .jasper files should also exported to this binary folder. The java .class files are not directly next to the .java files in the src folder, they are in the bin folder.

We have 6.12.2, is this the last version that you mentioned? This version dosen't show the image if it begins with a slash without /src.
We also use JFormDesigner which has a dialog to select icons. Their dialog recognizes the src folder and selects /icons/FILENAME.png without /src.

AttachmentSize
Image icon jformdesigner.png58.56 KB
Feedback