Jenkins Serialization Error

63 views
Skip to first unread message

JordanGS

unread,
Apr 10, 2017, 11:40:25 PM4/10/17
to Jenkins Developers

I am trying to minimize how vertical my items are.

Original (Working):

<f:section title="${%Source Details}" >
 
<f:entry title="${%Title}" field="exportreportTitle">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%By}" field="exportreportBy">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%For}" field="exportreportFor">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%Scan Date}" field="exportreportScanDate">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%Report Date}" field="exportreportReportDate">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%Scan Version}" field="exportreportScanVersion">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%Report Version}" field="exportreportReportVersion">
   
<f:textbox />
 
</f:entry>
 
<f:entry title="${%Description}" field="exportreportReportDescription">
   
<f:textarea />
 
</f:entry>
</f:section>

Desired:

<f:section title="${%Source Details}">
 
<f:entry>
   
<table width="100%">
     
<tr>
       
<td>Title</td>
       
<td colspan="3"><f:textbox field="exportreportTitle"/></td>
     
</tr>
     
<tr>
       
<td>Scan Date</td>
       
<td><f:textbox field="exportreportScanDate"/></td>
       
<td>Scan Version</td>
       
<td><f:textbox field="exportreportReportDate"/></td>
     
</tr>
     
<tr>
       
<td>Report Date</td>
       
<td><f:textbox field="exportreportScanVersion"/></td>
       
<td>Report Version</td>
       
<td><f:textbox field="exportreportReportVersion"/></td>
     
</tr>
     
<tr>
       
<td>Description</td>
       
<td colspan="3"><f:textbox field="exportreportReportDescription"/></td>
     
</tr>
   
</table>
 
</f:entry>
</f:section>

Now what i've realized is that because i no longer have the ${%} which is for internationalization i get a serialization error. So to compensate for that, please see the attached image. Notice how that worked? That's my desired table and it seriabled properly BUT the variable names have A appended to the end, making me lose everything on a load. But if i remove the A, then i still have a serialization error.

I've tried everything i can think of, and i looked at the jenkins jelly usage documentation. So please, someone help me from bashing my head in. What am i doing wrong?
Message has been deleted

JordanGS

unread,
Apr 11, 2017, 1:14:20 AM4/11/17
to Jenkins Developers


<f:entry title="${%Title}" field="exportreportTitle">
 
<f:textbox />
</f:entry>

What i want though, is the following:

<f:entry>
 
<table width="100%">
   
<tr>

     
<td>${%Title}</td>
     
<td><f:textbox field="exportreportTitle"/></td>
   
</tr>
 
</table>
</f:entry>

The reason is that i want multiple rows/cols like in the picture above. Yet when i made this SIMPLE change, i get the following error:


The data bound constructor: https://github.com/jenkinsci/zap-plugin/blob/development/src/main/resources/org/jenkinsci/plugins/zap/ZAPDriver/config.jelly#L252-L255

Full project: https://github.com/jenkinsci/zap-plugin/

If anyone can spare 10-15minutes to take a look, maybe you'll see what i missed. Thanks.


java.lang.NullPointerException
        at org
.jenkinsci.plugins.zap.ZAPBuilder.<init>(ZAPBuilder.java:94)
        at sun
.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun
.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun
.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java
.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org
.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:529)
        at org
.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:783)
        at org
.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83)
        at org
.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678)
        at org
.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478)
        at org
.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:474)
        at hudson
.model.Descriptor.newInstance(Descriptor.java:591)
Caused: java.lang.Error: Failed to instantiate class org.jenkinsci.plugins.zap.ZAPBuilder from {"zapHost":"127.0.0.1","zapPort":"9090","startZAPFirst":false,"jdk":"InheritFromJob","autoInstall":"true","toolUsed":"","zapHome":"ZAPROXY_HOME","timeout":"60","zapSettingsDir":"","autoLoadSession":"true","loadSession":"","sessionFilename":"","removeExternalSites":false,"internalSites":"","contextName":"","includedURL":"","excludedURL":"","authMode":false,"username":"user1","password":"pwd1","loggedInIndicator":"","authMethod":"FORM_BASED","loginURL":"","usernameParameter":"","passwordParameter":"","extraPostData":"","authScript":"","targetURL":"","spiderScanURL":false,"spiderScanRecurse":true,"spiderScanSubtreeOnly":false,"spiderScanMaxChildrenToCrawl":"0","ajaxSpiderURL":false,"ajaxSpiderInScopeOnly":false,"activeScanURL":false,"activeScanPolicy":"","activeScanRecurse":true,"generateReports":false,"deleteReports":false,"reportFilename":"JENKINS_ZAP_VULNERABILITY_REPORT","selectedReportMethod":"DEFAULT_REPORT","selectedReportFormats":[],"selectedExportFormats":[],"exportreportTitle":"","exportreportBy":"","exportreportFor":"","exportreportScanDate":"","exportreportReportDate":"","exportreportScanVersion":"","exportreportReportVersion":"","exportreportReportDescription":"","exportreportAlertHigh":true,"exportreportAlertMedium":true,"exportreportAlertLow":true,"exportreportAlertInformational":true,"exportreportCWEID":true,"exportreportWASCID":true,"exportreportDescription":true,"exportreportOtherInfo":true,"exportreportSolution":true,"exportreportReference":true,"exportreportRequestHeader":false,"exportreportResponseHeader":false,"exportreportRequestBody":false,"exportreportResponseBody":false,"jiraCreate":false,"jiraProjectKey":"","jiraAssignee":"","jiraAlertHigh":false,"jiraAlertMedium":false,"jiraAlertLow":false,"jiraFilterIssuesByResourceType":false,"stapler-class":"org.jenkinsci.plugins.zap.ZAPBuilder","$class":"org.jenkinsci.plugins.zap.ZAPBuilder"}

Oleg Nenashev

unread,
Apr 12, 2017, 5:29:48 PM4/12/17
to Jenkins Developers
From what I see in the code, the issue is for the missing ZAPDriver structure, which should be passed within the "zaproxy" structure. Due to whatever reason, in your case this entire structure went to the top level of JSON, likely because of the "table" tag in the entry (Jenkins UI is table-based and hence it does not like tables much).

The general recommendation is to avoid using any custom HTML tags within "f:entry".

For the layout you want to achieve you will likely need to customize classes, e.g. by Javascript. Or maybe a custom Jelly control.

вторник, 11 апреля 2017 г., 7:14:20 UTC+2 пользователь JordanGS написал:

JordanGS

unread,
Apr 12, 2017, 8:10:30 PM4/12/17
to Jenkins Developers
Cool thank you, could you please link me any tutorials or guide or maybe other plugins you're familiar with that use JavaScript or Custom Jelly controls. Always open to learning but not sure where to start. (Google search isn't returning anything useful)

Oleg Nenashev

unread,
Apr 13, 2017, 3:07:39 AM4/13/17
to JenkinsCI Developers
Hi,

Hopefully it helps,


2017-04-13 2:10 GMT+02:00 JordanGS <develop...@gmail.com>:
Cool thank you, could you please link me any tutorials or guide or maybe other plugins you're familiar with that use JavaScript or Custom Jelly controls. Always open to learning but not sure where to start. (Google search isn't returning anything useful)

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/acAcP0XNooo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/7e131dfd-b1ca-4ece-a896-5f3e714dc244%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

JordanGS

unread,
Apr 13, 2017, 11:27:42 AM4/13/17
to Jenkins Developers
Oleg, thank you so much. Especially for "Understanding Jelly Tags", the GitHub repository linked in there is incredibly useful. I'll be learning the plugins you linked and looking at them very carefully.

I have one question though. If you look at: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/lib/form/optionalBlock.jelly

i can see all the attributes the tag has. This is a checkbox that can be expanded/collapsed however it requires the inline tag to be set, otherwise the data is inaccessible and a error is thrown. If the inline tag is set then every time you set the checked state to true, the job config window annoyingly scrolls all the way down. I'm not sure if this is a bug with inline or intended functionality. But my question is, how do i find out what the proper usage for these tags is. Like in this case, i'm assuming i need a new class specifically for that optional block with it's own data bound constructor.
  1. So then what is that class supposed to look like
  2. how do i access the values from another class
  3. will this change result in version incompatibility in a plugin

Thank you +1

Reply all
Reply to author
Forward
0 new messages