Free Support Forum - aspose.com

Exception in hyperlink creation

We have found next stacktrace in our server log.


[digestScheduler_Worker-1] 13 июл 2011 08:00:02,952 [com.iqmen.export.BaseDocumentBuilder] 11769901 java.lang.IllegalArgumentException: displayText
java.lang.IllegalArgumentException: displayText
at asposewobfuscated.jr.a(MiscUtil.java:322)
at com.aspose.words.DocumentBuilder.insertHyperlink(DocumentBuilder.java:797)
at com.iqmen.export.callback.DoclistCallback.fieldMerging(DoclistCallback.java:40)
at com.aspose.words.MailMerge.a(MailMerge.java:430)
at com.aspose.words.yc.a(MailMergeRegion.java:326)
at com.aspose.words.ni.a(FieldMergeField.java:157)
at com.aspose.words.ni.Fm(FieldMergeField.java:134)
at com.aspose.words.Field.a(Field.java:396)
at com.aspose.words.ol.a(FieldUpdater.java:144)
at com.aspose.words.ol.l(FieldUpdater.java:101)
at com.aspose.words.oi.execute(FieldUpdateExecutionItem.java:81)
at com.aspose.words.ol.hd(FieldUpdater.java:91)
at com.aspose.words.ol.a(FieldUpdater.java:67)
at com.aspose.words.yc.a(MailMergeRegion.java:257)
at com.aspose.words.yc.Th(MailMergeRegion.java:233)
at com.aspose.words.yc.a(MailMergeRegion.java:70)
at com.aspose.words.MailMerge.executeWithRegions(MailMerge.java:162)
at com.iqmen.export.BaseDocumentBuilder.generateDocument(BaseDocumentBuilder.java:149)
at com.iqmen.export.BaseDocumentBuilder.generateDocumentStream(BaseDocumentBuilder.java:162)
at com.iqmen.core.business.subscribe.DigestExporter.export(DigestExporter.java:151)
at com.iqmen.core.business.subscribe.DigestJob.execute(DigestJob.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
[digestScheduler_Worker-2] 13 июл 2011 08:00:02,992 [com.iqmen.export.BaseDocumentBuilder] 11769941 java.lang.IllegalArgumentException: displayText
java.lang.IllegalArgumentException: displayText
at asposewobfuscated.jr.a(MiscUtil.java:322)
at com.aspose.words.DocumentBuilder.insertHyperlink(DocumentBuilder.java:797)
at com.iqmen.export.callback.DoclistCallback.fieldMerging(DoclistCallback.java:40)
at com.aspose.words.MailMerge.a(MailMerge.java:430)
at com.aspose.words.yc.a(MailMergeRegion.java:326)
at com.aspose.words.ni.a(FieldMergeField.java:157)
at com.aspose.words.ni.Fm(FieldMergeField.java:134)
at com.aspose.words.Field.a(Field.java:396)
at com.aspose.words.ol.a(FieldUpdater.java:144)
at com.aspose.words.ol.l(FieldUpdater.java:101)
at com.aspose.words.oi.execute(FieldUpdateExecutionItem.java:81)
at com.aspose.words.ol.hd(FieldUpdater.java:91)
at com.aspose.words.ol.a(FieldUpdater.java:67)
at com.aspose.words.yc.a(MailMergeRegion.java:257)
at com.aspose.words.yc.Th(MailMergeRegion.java:233)
at com.aspose.words.yc.a(MailMergeRegion.java:70)
at com.aspose.words.MailMerge.executeWithRegions(MailMerge.java:162)
at com.iqmen.export.BaseDocumentBuilder.generateDocument(BaseDocumentBuilder.java:149)
at com.iqmen.export.BaseDocumentBuilder.generateDocumentStream(BaseDocumentBuilder.java:162)
at com.iqmen.core.business.subscribe.DigestExporter.export(DigestExporter.java:151)
at com.iqmen.core.business.subscribe.DigestJob.execute(DigestJob.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)

What does it means? And what should we do to prevent it in future?

Hi Alexey,

Thanks for your request. Could you please provide a simple code example that will allow us to reproduce the problem? We will check the issue and provide you more information.

Best regards,

Here the code. The bold line is line number 40, where exception occurs :

public void fieldMerging(FieldMergingArgs e) throws Exception {
if (“docAuthor”.equals(e.getFieldName())) {
Object[] values = new Object[1];
dataSource.getValueAt(“docAuthorUrl”, values, e.getRecordIndex());
String authorUrl = (String) values[0];
if (authorUrl != null) {
DocumentBuilder builder = new DocumentBuilder(e.getDocument());
builder.moveToMergeField(e.getDocumentFieldName());
builder.insertHyperlink((String) e.getFieldValue(), authorUrl, false);
e.setText("");
}
} else if (“docBlog”.equals(e.getFieldName())) {
Object[] values = new Object[1];
dataSource.getValueAt(“docBlogUrl”, values, e.getRecordIndex());
String blogUrl = (String) values[0];
if (blogUrl != null) {
DocumentBuilder builder = new DocumentBuilder(e.getDocument());
builder.moveToMergeField(e.getDocumentFieldName());
builder.insertHyperlink((String) e.getFieldValue(), blogUrl, false);
e.setText("");
}
} else if (“docUrl”.equals(e.getFieldName())) {
DocumentBuilder builder = new DocumentBuilder(e.getDocument());
builder.moveToMergeField(e.getDocumentFieldName());
builder.insertHyperlink((String) e.getFieldValue(), (String) e.getFieldValue(), false);
e.setText("");
} else …
}
The template in the attachment

Hi Alexey,

Thank you for additional information. But it seems the problem is cause by the value you are using. Could you please provide me this value? I will try to reproduce the problem on my side.

Best regards,

We have found that text for hyperlink are null or empty. Now we are replase null ar empty values by needed constant.

Hi Alexey,

Thank you for additional information. It is perfect that you managed to resolve the problem/

Best regards,