How to fix 'The string was not recognized as a valid DateTime.' error in BizTalk Test map? - xslt-1.0

I'm working on a BizTalk orchestrations with a map which contains an XSLT script. When I launch the orchestration I got this error
Error encountered while executing the transform. Error: Unable to create the transform.
So I go back to the map
XSL transform error:
Unable to write output instance. Exception has been thrown by the target of an invocation. The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.
I already tried to do a ParseExact but got the same error
Here is my code to convert DateTime:
public string FormatDate(string inputDate)
{
System.DateTime date = System.DateTime.Parse(inputDate);
return date.ToString("yyyy-MM-dd");
}
...and the code I tried with ParseExact:
public string FormatDate(string inputDate)
{
System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.InvariantCulture;
System.DateTime date = System.DateTime.ParseExact(inputDate, "yyyyMMdd", culture);
return date.ToString("yyyy-MM-dd");
}
The expected result is to have the date with "yyyy-MM-dd" format.

The problem came from several scripting functoid with the same method name inside. Just gave each methods a different name and the errors has gone.
Thank you to all users for your time.

Related

Jira Rest API - Problems to set custom fields

I try to set the field for Testcases in a Testplan. The value I get when reading it is JSONArray.
But when I write the very same JSONArray I extract to a new created Testplan, I get an error message.
Exception in thread "main" com.atlassian.jira.rest.client.api.domain.input.CannotTransformValueException: Any of available transformers was able to transform given value. Value is: org.codehaus.jettison.json.JSONArray: ["SBNDTST-361","SBNDTST-360","SBNDTST-358","SBNDTST-359"]
at com.atlassian.jira.rest.client.api.domain.input.ValueTransformerManager.apply(ValueTransformerManager.java:83)
at com.atlassian.jira.rest.client.api.domain.input.IssueInputBuilder.setFieldValue(IssueInputBuilder.java:134)
My method to set the field is this:
public void updateIssue(String issueKey, String fieldId, Object fieldValue) {
IssueInput input = new IssueInputBuilder()
.setFieldValue(fieldId, fieldValue)
.build();
restClient.getIssueClient()
.updateIssue(issueKey, input)
.claim();
The value for the fieldId is "customfield_17473". There is very little documentation on this. Does anyone have an idea how to proceed?
I found the solution by trial and error.
When I send an ArrayList it works.

How to use FormComponentPanel for FileUpload Field in Apache wicket 9.x?

I am trying to create FileUploadPanel that can be used in the form.
But however at runtime I facing some conversion error, I did debug the code it is going to the ConverterLocater.class in the wicket-core jar there it fails on the typecasting.
So when I debug I found filename is passed a in the below method public C convertToObject(String value, Locale locale) and in the conversion it fails because the value is string and it trying to caste to fileUpload.class.
Error:
throw (new ConversionException("Could not convert value: " + value + " to type: " + theType.getName() + ". Could not find compatible converter.")).setSourceValue(value);
Here value is passed as file name and theType is FileUpload.
I referred some examples, there setType is mandatory so I tried to set with String.class
but again next time fileUpload class was failing.
Could not convert value: test.pdf to type: org.apache.wicket.markup.html.form.upload.FileUpload. Could not find compatible converter.
I found the solution
Model name parameter was the issue, after changing this to List it got fixed.
private List<FileUpload> fileUploads = new ArrayList<FileUpload>();
new MultiFileUploadField("fileField",new PropertyModel(this,"fileUploads"),maxFiles)

TIBCO BW6 custom function with dateTime return type

I'm building a custom function for BW6 that should parse ISO 8601 formatted string to a dateTime object.
So far I have built this function:
#XPathFunction(helpText = "Parse a ISO 8601 datetime string",
parameters = {
#XPathFunctionParameter(name = "isoDateTimeString", optional = false)
},
returnType = "dateTime")
public Date parseIsoDateTime(String isoDateTimeString) throws ParseException {
StringBuilder dateFormatBuilder = new StringBuilder();
dateFormatBuilder.append("yyyy-MM-dd'T'HH:mm:ss");
if (isoDateTimeString.contains(".")) {
dateFormatBuilder.append(".SSS");
}
DateFormat dateFormat = new SimpleDateFormat(dateFormatBuilder.toString());
return dateFormat.parse(isoDateTimeString);
}
When I run this function an exception is thrown by BW
09:02:42.412 ERROR [bwEngThread:In-Memory Process Worker-1] com.tibco.bw.core - TIBCO-BW-CORE-500050: The BW process [demo.parse-datetime.module.Process] instance faulted, JobId [bw0a100], ProcessInstanceId [bw0a100], ParentProcessInstanceId [-], Module [demo.parse-datetime.module:1.0.0.qualifier], Application [demo.parse-datetime:1.0].
<CausedBy> TIBCO-BW-CORE-500058: Activity [SetDateTimeValue] XML related error.
<CausedBy> com.tibco.pvm.dataexch.xml.util.exceptions.PmxException: PVM-XML-106017: Expression Evaluation Error: 'bxcom:parseIsoDateTime($dateTimeAsString)'
<CausedBy> java.lang.ClassCastException: java.util.Date cannot be cast to com.tibco.xml.data.primitive.XmlAtomicValue
So how can I return an XML dateTime object from a custom xslt function in BW6.
You need to create a Plug-in Project to allow Custom XPath Function. (You will need the ActiveMatrix BusinessWorks™ Plug-in Development Kit)
Create Custom XPath Functions
If you want to use them Design time, you'll need to export the Plugin Project and include the jar as a dependency.
Using Custom XPath Function at Design Time and Run Time

SharePoint 2010: Error Mapping to Picture Hyperlink with SPMetal

Whenever I have a column of type hyperlink with the format set for pictures, I get an error whenever there is actually a value in that column.
The exception it throws is "Specified cast is not valid".
My thought is that the problem is either here (the FieldType being set to Url):
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "FOO", Storage = "FOO_", FieldType = "Url")]
public string FOO
{
get
{
return this._FOO;
}
set
{
if ((value != this._FOO))
{
this.OnPropertyChanging("FOO", this._FOO);
this._FOO = value;
this.OnPropertyChanged("FOO");
}
}
}
Or here (it being cast to a string):
private string _FOO;
But I'd have no idea what the proper values for either of those fields should be.
Any help would be greatly appreciated.
It works whenever this field does not have data in it and I JUST used SPMetal to generate the class, so I'll get the two most obvious questions out of the way.
Link to the answer:
https://mgreasly.wordpress.com/2012/06/25/spmetal-and-workflow-associations/
Turns out it is a known bug when mapping lists that have associated workflows.
SPMetal assigns it as a nullable integer when it's supposed to be an Object, hence the cast error.
Workaround: manually edit the mappings to make the type it returns an object or ignore the column by using a parameter map.

axis2 xsd:date format issue

Merged with axis2 xsd:date format issue.
In WSDL I have the following format:
USER_ACT_STRDT is a date.
When I generate the STUB (using Axis2 1.5.3), the generated stub (ADB Data Binding) has the following source code :
public void setUSER_ACT_STRDT_TypeDef(Date param) {
if (ConverterUtil.convertToString(param).matches("\d{4}-\d{2}-\d{2}")) {
this.localUSER_ACT_STRDT_TypeDef=param; } else { throw new java.lang.RuntimeException();
} }
This method always throws RuntimeException because the ConverterUtil.convertToString() method returns a String in a different format than "yyyy-mm-dd". It returns the date by appending +5.30 as 2011-03-21+05:30.
I tried passing the date in different formats but same result for all.
Can any one suggest how to resolve this issue.