FIX Engine supporting different versions - fix-protocol

We have developed a FIX Engine to support 4.2 version.But however we got a new Liquidity Provider who resides on FIX 4.4 version.Any ideas on how to convert the FIX 4.2 message to 4.4?

Using quickfix you can extract and fill FIX messages using the most abstract type: quickfix.Message. Both quickfix.fix42.NewOrderSingle and quickfix.fix44.NewOrderSingle have the same supertype.
private void processNewOrder(quickfix.Message message) {
String symbol = message.getString(Symbol.FIELD);
char side = message.getChar(Side.FIELD);
...
}
You can extract and fill the common fields for FIX.4.2 and FIX.4.4. For FIX version specific fields, you can check the BEGIN_STRING field and identify the FIX protocol version.

Related

Malformed schema version 1,000

I have a problem whereby the generator is producing a malformed schema version. Does anyone know why this is the case?
public class MyDaoGenerator {
public static void main(String[] args) throws Exception {
Schema schema = new Schema(1000, "com.mydomain");
...
}
}
OUTPUT
public class MyDaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 1,000;
...
}
The fix will be available today in maven central. Update your greenDAO generator version to 1.3.1.
Probably this is a error coming from freemarker that occurs in greendao-generator <= 1.3.0.
Freemarker is used by greendao-generator to generate the *.java-files. If not configured freemarker uses a locale-sensitive output (for numbers).
See the Freemarker Manual
If you want to use greendao with schema-version > 999 you probably have to add this line in greendao-generator-project rebuild it and use the modified greendao-generator.jar. This causes all numbers used in the templates to be without grouping signs.
File DaoGenerator.java (line 63):
config.setNumberFormat("#*");
Another way would be to manually edit the schema version in your generated file. But you would have to repeat this everytime you regenerate your code.

FindBugs shows only the first occurrence of a bug

FindBugs seems to show only the first occurrence of a particular bug in each method. This occurs in Eclipse as well as in the FindBugs stand-alone client.
How can I configure FindBugs to show all occurrences?
Example:
import javax.annotation.Nonnull;
public class Bar
{
public void meth(#Nonnull final String pArg) {
System.out.println(pArg);
}
public void foo() {
String s = null;
meth(s); // <<== bug marker here (NP_NONNULL_PARAM_VIOLATION)
meth(null); // no bug marker here
meth(s); // and none here either :-(
}
}
Im am using the latest FindBugs 2.0.2 Eclipse plugin (with Eclipse 3.6).
The problem appears to depend on the bug pattern. For example, I see more than one hit per method with DLS_DEAD_LOCAL_STORE, but not with NP_NONNULL_PARAM_VIOLATION. The latter is shown above.
Thanks!
It seems that Findbugs only checks those lines of code for this specific error, which can actually be reached according to a control flow analysis. With your 3 method invocations, the first one leads to a NPE, therefore the second and third will never be reached.
There have been similar bug reports for previous versions: http://sourceforge.net/p/findbugs/bugs/980/

Using Java.util.scanner with GWT

for some reason when I try to use scanner with gwt, i get the following error:
No source code is available for type java.util.Scanner; did you forget to inherit a required module?
I looked around and it seems the "No source code is available for type xxxx" errors are due to not having a Javascript equivalent type for the Java type.
Is scanner not able to be used with GWT?
Here is a snippet of my code:
import java.util.Scanner;
...
public void submit(){
String text = editor.getEditor().getText();
Scanner input = new Scanner(text);
while(input.hasNextLine()){
String line = input.nextLine();
if(line.contains("//")){
cInfo.setDone(false);
cInfo.setCode(text);
return;
}
cInfo.setDone(true);
cInfo.setCode(text);
}
}
}
java.util.Scanner is not part of the GWT JRE Emulation. If you need a detail overview of what is inside the emulation here is the link to the docs:
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation#Package_java_util
Your code (at least the one in the current version of your question) is probably[*] equivalent to
public void submit() {
String text = editor.getEditor().getText();
if ("".equals(text))
return;
cInfo.setDone(!text.contains("//"));
cInfo.setCode(text);
}
However, I have a feeling that this may not actually be what want to do (or is it?)
If you need to split strings on the client side, I usually recommend the Splitter class in Guava. Most of its methods are GwtCompatible, and (together with CharMatcher, Joiner, ...) it's great to use both on the client and server side of your Java code.
[*] assuming, that setDone and setCode are simple setters without side effects

Enterprise Library Logging tracelistener extension issue with resolving ILogFormatter

I have been sitting with a problem for quite a while now and I just can't seem to find what I'm missing.
I have written a custom trace listener component for Enterprise Library 5.0 for the Logging application block which works but the configured ILogFormatter just won't resolve and so I always end up with the basic string text when it gets handled by my component.
I saw in the enterprise library source code that they use the "Container.ResolvedIfNotNull()" method. It doesn't seem to work for me. I need it to write out a custom formatted string for my component to use. You know, not just the message but the timestamp, machinename, threadId, etc.
Does anyone have any ideas on how to fix this?
Thanks in advance.
Like I've mentioned on this site: http://entlib.codeplex.com/discussions/261749
When you create your CreationExpression in the TraceListener data class make sure you have a flat constructor definition. To put it in other words, don't return:
() => new MyTraceListener(new TraceListenerConfig(..., Container.ResolvedIfNotNull<ILogFormatter>(), ...));
just have it in the constructor of the MyTraceListener:
() => new MyTraceListener(..., Container.ResolvedIfNotNull<ILogFormatter>(), ...);

How to fix issues when MSCRM Plugin Registration fails

When you register a plug-in in Microsoft CRM all kinds of things can go wrong. Most commonly, the error I get is "An error occurred."
When you look for more detail you just get: "Server was unable to process request" and under detail you see "An unexpected error occurred."
Not very helpful. However, there are some good answers out there if you really dig. Anybody out there encountered this and how do you fix it?
The most common issue is that the meta parameter names must match.
For example:
public static DependencyProperty householdProperty = DependencyProperty.Register("household", typeof(Microsoft.Crm.Sdk.Lookup), typeof(AssignHouseholds));
[CrmInput("AccountId")]
[CrmReferenceTarget("account")]
public Microsoft.Crm.Sdk.Lookup household
{
get
{
return (Microsoft.Crm.Sdk.Lookup)base.GetValue(accountidProperty);
}
set
{
base.SetValue(accountidProperty, value);
}
}
Note the name after DependencyProperty (housedProperty) must exactly match the string after DependencyProperty.Register (in this case ("household") with the word "Property" appended.
Also, that value must match the value of public variabletype (in this case "household"). If any one of them don't match, it will error.
This is by design and is how MSCRM ties the values together.
A common cause is that your CRM SDK references must use the 64 bit version if you are on a 64 bit machine.
These will be located at
C:\sdk\bin\64bit\microsoft.crm.sdk.dll
and
C:\sdk\bin\64bit\microsoft.crm.sdktypeproxy.dll
if you installed the sdk to C:\sdk.
Also your build settings should be set to "Any CPU" under Project properties->Build.
You may also need to move the two dlls to your debug or release folder before you build.