I got this error when i try to run my code:
Exception in thread "main" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at edu.ndhu.bm.healthow.HealThowConstant.<init>(HealThowConstant.java:91)
at edu.ndhu.bm.healthow.HealThow.main(HealThow.java:511)
i have searched for similiar answer but i still couldn't fix it. This must be something related to the conversion of data types but i do not know how to fix the problem.
I am new to Java programming so any help will be much appreciated. Thank you. and here's the code:
package edu.ndhu.bm.healthow;
import java.util.Properties;
public class HealThowConstant
{
public final int n;
public final int m;
public final int d;
public final int t;
public final double taux;
public final double etax;
public final double ax;
public final double bx;
public final double alphax;
public final double betax;
public final double qx;
public final double add_taux;
public final double tauUpperBoundx;
public final double lux;
public final double minlux;
public final double gux;
public final double mingux;
public final double tauy;
public final double etay;
public final double ay;
public final double by;
public final double alphay;
public final double betay;
public final double qy;
public final double add_tauy;
public final double tauUpperBoundy;
public final double luy;
public final double minluy;
public final double guy;
public final double minguy;
public final double tauw;
public final double etaw;
public final double aw;
public final double bw;
public final double alphaw;
public final double betaw;
public final double qw;
public final double add_tauw;
public final double tauUpperBoundw;
public final double luw;
public final double minluw;
public final double guw;
public final double minguw;
public final String nfetay;
public final int ant;
public final int iteration;
public final String parameter;
public final int fl;
public final int fu;
public final int pl;
public final int pu;
public final int cl;
public final int cu;
public final int rl;
public final int ru;
public final int Cl;
public final int Cu;
public final int ul;
public final int uu;
public final int al;
public final int au;
public final String scenario_generate;
public final int scenario;
public final int average;
public final int variance;
public final int stage;
public final double runtime;
public HealThowConstant(Properties properties)
{
n = Integer.parseInt(properties.getProperty("n"));
m = Integer.parseInt(properties.getProperty("m"));
d = Integer.parseInt(properties.getProperty("d"));
t = Integer.parseInt(properties.getProperty("t"));
taux = Double.parseDouble(properties.getProperty("taux"));
etax = Double.parseDouble(properties.getProperty("etax"));
ax = Double.parseDouble(properties.getProperty("ax"));
bx = Double.parseDouble(properties.getProperty("bx"));
alphax = Double.parseDouble(properties.getProperty("alphax"));
betax = Double.parseDouble(properties.getProperty("betax"));
qx = Double.parseDouble(properties.getProperty("qx"));
add_taux = Double.parseDouble(properties.getProperty("add_taux"));
tauUpperBoundx = Double.parseDouble(properties.getProperty("tauUpperBoundx"));
lux = Double.parseDouble(properties.getProperty("lux"));
minlux = Double.parseDouble(properties.getProperty("minlux"));
gux = Double.parseDouble(properties.getProperty("gux"));
mingux = Double.parseDouble(properties.getProperty("mingux"));
tauy = Double.parseDouble(properties.getProperty("tauy"));
etay = Double.parseDouble(properties.getProperty("etay"));
ay = Double.parseDouble(properties.getProperty("ay"));
by = Double.parseDouble(properties.getProperty("by"));
alphay = Double.parseDouble(properties.getProperty("alphay"));
betay = Double.parseDouble(properties.getProperty("betay"));
qy = Double.parseDouble(properties.getProperty("qy"));
add_tauy = Double.parseDouble(properties.getProperty("add_tauy"));
tauUpperBoundy = Double.parseDouble(properties.getProperty("tauUpperBoundy"));
luy = Double.parseDouble(properties.getProperty("luy"));
minluy = Double.parseDouble(properties.getProperty("minluy"));
guy = Double.parseDouble(properties.getProperty("guy"));
minguy = Double.parseDouble(properties.getProperty("minguy"));
tauw = Double.parseDouble(properties.getProperty("tauw"));
etaw = Double.parseDouble(properties.getProperty("etaw"));
aw = Double.parseDouble(properties.getProperty("aw"));
bw = Double.parseDouble(properties.getProperty("bw"));
alphaw = Double.parseDouble(properties.getProperty("alphaw"));
betaw = Double.parseDouble(properties.getProperty("betaw"));
qw = Double.parseDouble(properties.getProperty("qw"));
add_tauw = Double.parseDouble(properties.getProperty("add_tauw"));
tauUpperBoundw = Double.parseDouble(properties.getProperty("tauUpperBoundw"));
luw = Double.parseDouble(properties.getProperty("luw"));
minluw = Double.parseDouble(properties.getProperty("minluw"));
guw = Double.parseDouble(properties.getProperty("guw"));
minguw = Double.parseDouble(properties.getProperty("minguw"));
nfetay = properties.getProperty("nofactoryetay");
ant = Integer.parseInt(properties.getProperty("ant"));
iteration = Integer.parseInt(properties.getProperty("iteration"));
parameter = properties.getProperty("parameter");
fl = Integer.parseInt(properties.getProperty("fl"));
fu = Integer.parseInt(properties.getProperty("fu"));
pl = Integer.parseInt(properties.getProperty("pl"));
pu = Integer.parseInt(properties.getProperty("pu"));
rl = Integer.parseInt(properties.getProperty("rl"));
cl = Integer.parseInt(properties.getProperty("cl"));
cu = Integer.parseInt(properties.getProperty("cu"));
ru = Integer.parseInt(properties.getProperty("ru"));
Cl = Integer.parseInt(properties.getProperty("Cl"));
Cu = Integer.parseInt(properties.getProperty("Cu"));
ul = Integer.parseInt(properties.getProperty("ul"));
uu = Integer.parseInt(properties.getProperty("uu"));
al = Integer.parseInt(properties.getProperty("al"));
au = Integer.parseInt(properties.getProperty("au"));
scenario_generate = properties.getProperty("scenario_generate");
scenario = Integer.parseInt(properties.getProperty("scenario"));
average = Integer.parseInt(properties.getProperty("average"));
variance = Integer.parseInt(properties.getProperty("variance"));
stage = Integer.parseInt(properties.getProperty("stage"));
runtime = Double.parseDouble(properties.getProperty("runtime"));
}
}
This stack trace is saying that on line 91, you are using Integer.parseInt but you are passing in null into it. That is why this error is happening. You must pass in a String that represents an integer. You can't pass in null.
You either need to check for null and avoid passing it in, or make sure that line 91 always passes in non-null.
As Daniel Kaplan said, you are passing in a null value into Integer.parseInt which is causing the exception. The Javadoc for parseInt says that this will cause a NumberFormatException to be thrown:
Throws:
NumberFormatException - if the string does not contain a parsable integer
As you said in your comment, this is happening at t = Integer.parseInt(properties.getProperty("t")); The problem is that your properties variable is called and cannot find a property. Looking at the Javadoc for the java.util.Properties method public String getProperty(String key), emphasis mine:
Searches for the property with the specified key in this property
list. If the key is not found in this property list, the default
property list, and its defaults, recursively, are then checked. The
method returns null if the property is not found.
It seems like you want to avoid passing in a null to the Integer.parseInt method. You can do this is in different ways depending on how you want to model your class, but here are a few that you could do:
Do a null check before you do Integer.parseInt
Use the public String getProperty(String key, String defaultValue), that supplies a default if a property cannot be found. I.e., properties.getProperty("t", "15")
Related
I am new to Java Stream api and your help is highly appreciated.
I am trying to convert this structure(first Structure) to
[(id=BNA, name=Nashville, TN, loadsCount=1, distance=null, metricScoresList=[BattingOrderResponse.MetricScoresList(identifier=BNA, name=null, aggregatedScore=35.5, onTimeToDestinationPercentage=0.0, onTimeToPickupPercentage=0.0, onTimeToPickupDepartPercentage=0.0, tenderAcceptancePercentage=18.2, tenderCancellationPercentage=0.0, appUsageCompliancePercentage=100.0, revenue=0.0, loadsCount=1, distance=0.0)])...]
This is the class model:
#ToString
#Getter
public final class BattingOrderResponse {
private final String id;
private final String name;
private final long loadsCount;
private final Distance distance;
private final List<MetricScores> metricScores;
#JsonCreator
public BattingOrderResponse(#JsonProperty("id") final String id,
#JsonProperty("name") final String name,
#JsonProperty("loadsCount") final long loadsCount,
#JsonProperty("distance") final Distance distance,
#JsonProperty("metricScores") final List<MetricScores> metricScores) {
this.id = id;
this.name = name;
this.loadsCount = loadsCount;
this.distance = distance;
this.metricScores = metricScores;
}
#ToString
#Getter
public static final class Distance {
private final double value;
private final String unit;
#JsonCreator
public Distance(#JsonProperty("value") final double value,
#JsonProperty("unit") final String unit) {
this.value = value;
this.unit = unit;
}
}
#ToString
#Getter
public static final class MetricScores {
private final String identifier;
private final String name;
private final double aggregatedScore;
private final double onTimeToDestinationPercentage;
private final double onTimeToPickupPercentage;
private final double onTimeToPickupDepartPercentage;
private final double tenderAcceptancePercentage;
private final double tenderCancellationPercentage;
private final double appUsageCompliancePercentage;
private final double revenue;
private final long loadsCount;
private final double distance;
#JsonCreator
//CHECKSTYLE:SUPPRESS:ParameterNumberCheck
public MetricScores(#JsonProperty("identifier") final String identifier,
#JsonProperty("name") final String name,
#JsonProperty("aggregatedScore") final double aggregatedScore,
#JsonProperty("onTimeToDestinationPercentage") final double onTimeToDestinationPercentage,
#JsonProperty("onTimeToPickupPercentage") final double onTimeToPickupPercentage,
#JsonProperty("onTimeToPickupDepartPercentage") final double onTimeToPickupDepartPercentage,
#JsonProperty("tenderAcceptancePercentage") final double tenderAcceptancePercentage,
#JsonProperty("tenderCancellationPercentage") final double tenderCancellationPercentage,
#JsonProperty("appUsageCompliancePercentage") final double appUsageCompliancePercentage,
#JsonProperty("revenue") final double revenue,
#JsonProperty("loadsCount") final long loadsCount,
#JsonProperty("distance") final double distance) {
this.identifier = identifier;
this.name = name;
this.aggregatedScore = aggregatedScore;
this.onTimeToDestinationPercentage = onTimeToDestinationPercentage;
this.onTimeToPickupPercentage = onTimeToPickupPercentage;
this.onTimeToPickupDepartPercentage = onTimeToPickupDepartPercentage;
this.tenderAcceptancePercentage = tenderAcceptancePercentage;
this.tenderCancellationPercentage = tenderCancellationPercentage;
this.appUsageCompliancePercentage = appUsageCompliancePercentage;
this.revenue = revenue;
this.loadsCount = loadsCount;
this.distance = distance;
}
}
}
to
[(id=BNA, name=null, overallScore=35.5, onTimeScore=0.0, TenderAcceptanceScore=18.2, appUsageScore=100.0),...]
class model:
#Getter
#ToString
#Builder
public final class DomicileScore {
private final String id;
private final String name;
private final double overallScore;
private final double onTimeScore;
private final double TenderAcceptanceScore;
private final double appUsageScore;
}
Hint: id is BattingOrderResponse.id
name is BattingOrderResponse.name
overallScore is BattinOrderResponse.MetricScore
and remaining all are from BattinOrderResponse.MetricScore
where it should be 'name=Nashville' instead of 'name=null' (which has been referred from metricScoresList.
This is the code that i have tried.
scoreByDomicile.stream()
.peek(i -> System.out.println(i.getName()))
.map(i -> i.getMetricScoresList().get(0))
.map(i -> DomicileScore.builder()
.id(i.getIdentifier())
.name(i.getName())
.overallScore(i.getAggregatedScore())
.appUsageScore(i.getAppUsageCompliancePercentage())
.onTimeScore(i.getOnTimeToDestinationPercentage())
.TenderAcceptanceScore(i.getTenderAcceptancePercentage())
.build())
.collect(Collectors.toList());
where scoreByDomicile is the list of the raw data as in my first structure. I need to add the outcome of peek in the map(second map in the code) inside the build().
I am struck with this for last few hours and not able to resolve it. Let me know if you need more details. Thanks in advance.
You need both references, so you cann't use the double mapping
Try with this:
scoreByDomicile.stream()
.peek(i -> System.out.println(i.getName()))
.map(obj -> {
MetricScores i = obj.getMetricScoresList().get(0); //
return DomicileScore.builder()
.id(i.getIdentifier())
.name(obj.getName()) // obj has the original name
.overallScore(i.getAggregatedScore())
.appUsageScore(i.getAppUsageCompliancePercentage())
.onTimeScore(i.getOnTimeToDestinationPercentage())
.TenderAcceptanceScore(i.getTenderAcceptancePercentage())
.build();
})
.collect(Collectors.toList());
So i am trying to generate a house(at this point a very simple house) and I have this Class:
public class Probability {
public final int MinWindows = 0;
public final int MaxWindows = 0;
//double values represend the percent chance for a specific attribute to
//generate
public final double hasBackDoor = 0;
public final double hasSecondFloor = 0;
public final double hasChimny = 0;
public final double hasGarage = 0;
public final double hasPorch = 0;
}
This class is then inherited by subclasses for different types of houses:
public class LowClassHouseProbability extends Probability{
public final int MinWindows = 5;
public final int MaxWindows = 10;
public final double hasBackDoor = 55.0;
public final double hasSecondFloor = 10.0;
public final double hasChimny = 5.5;
public final double hasGarage = 30.0;
public final double hasPorch = 60.0;
}
public class MiddleClassHouseProbability extends Probability{
public final int MinWindows = 20;
public final int MaxWindows = 50;
public final double hasBackDoor = 80.0;
public final double hasSecondFloor = 70.0;
public final double hasChimny = 10.0;
public final double hasGarage = 90.0;
public final double hasPorch = 85.0;
}
public class UpperClassHouseProbability extends Probability{
public final int MinWindows = 50;
public final int MaxWindows = 100;
public final double hasBackDoor = 100.0;
public final double hasSecondFloor = 100.0;
public final double hasChimny = 80.0;
public final double hasGarage = 99.0;
public final double hasPorch = 100.0;
}
So all of the subclasses of Probability shadow all of its fields which in my opinioin looks sloppy and is kind of annoying to read, however i need them to extend Probability because it would make it easyer when i actually have to use the object, because it looks nicer doing this:
public class House {
public House(Probability prob){
}
}
Than if i did not have a Probability class and did this:
public class House {
public House(LowClassHouseProbability prob){
}
public House(MiddleClassHouseProbability prob){
}
public House(UpperClassHouseProbability prob){
}
}
And this would only get worse with the more sub-classes that I create.
So my question is is there a better way of doing this that I'm not thinking of, or do i just have to do it one way or the other of the two solutions that I thought of.
Since you can not override fields from the super class in java those classes dont need at all to define the field..
public class LowClassHouseProbability extends Probability{
//public final int MinWindows = 50;
//public final int MaxWindows = 100;
those all are final declared so you need to set those in the constructor...
LowClassHouseProbability(int minW, int maxW,...){
super(minW, maxW, ....);
MiddleClassHouseProbability(int minW, int maxW,...){
super(minW, maxW, ....);
UpperClassHouseProbability(int minW, int maxW,...){
super(minW, maxW, ....);
and in the superclass Probability define the constructor:
Probability(int minW, int maxW,...){
MinWindows = minW;
MaxWindows = maxW;
// .... etc etc
It's probably best to remove the child classes altogether and define instances of the Probability class pertinent to your house types, and build a multi-argument constructor to facilitate instance construction.
Alternatively, you could refactor this into an interface:
public interface Probability {
int getMinWindwsMinWindows();
/*and so on*/
}
Then,
public class LowClassHouseProbability implements Probability{
{
#Override
int getMinWindwsMinWindows()
{
return 5;
}
/*and so on*/
}
The problem of managing constructors with too many fields can be solved by using a step builder. A step builder works by creating an interface for each step, then having the builder implement all of them. This way after completing each build step, only the next step is available to complete.
Here's an example:
package mcve;
public class Probability {
public final int minWindows;
public final int maxWindows;
public final double hasBackDoor;
public final double hasSecondFloor;
public final double hasChimny;
public final double hasGarage;
public final double hasPorch;
private Probability(final int minWindows,
final int maxWindows,
final double hasBackDoor,
final double hasSecondFloor,
final double hasChimny,
final double hasGarage,
final double hasPorch) {
this.minWindows = minWindows;
this.maxWindows = maxWindows;
this.hasBackDoor = hasBackDoor;
this.hasSecondFloor = hasSecondFloor;
this.hasChimny = hasChimny;
this.hasGarage = hasGarage;
this.hasPorch = hasPorch;
}
public static final Probability LOW_CLASS =
builder().setMinWindows(5)
.setMaxWindows(10)
.setHasBackDoor(55.0)
.setHasSecondFloor(10.0)
.setHasChimny(5.5)
.setHasGarage(30.0)
.setHasPorch(60.0)
.build();
// public static final Probability MIDDLE_CLASS = ...;
// public static final Probability UPPER_CLASS = ...;
public static MinWindowsStep builder() {
return new Builder();
}
public interface MinWindowsStep { MaxWindowsStep setMinWindows(int n); }
public interface MaxWindowsStep { HasBackDoorStep setMaxWindows(int n); }
public interface HasBackDoorStep { HasSecondFloorStep setHasBackDoor(double n); }
public interface HasSecondFloorStep { HasChimnyStep setHasSecondFloor(double n); }
public interface HasChimnyStep { HasGarageStep setHasChimny(double n); }
public interface HasGarageStep { HasPorchStep setHasGarage(double n); }
public interface HasPorchStep { BuildStep setHasPorch(double n); }
public interface BuildStep { Probability build(); }
private static final class Builder
implements MinWindowsStep,
MaxWindowsStep,
HasBackDoorStep,
HasSecondFloorStep,
HasChimnyStep,
HasGarageStep,
HasPorchStep,
BuildStep {
private int minWindows;
private int maxWindows;
private double hasBackDoor;
private double hasSecondFloor;
private double hasChimny;
private double hasGarage;
private double hasPorch;
#Override
public MaxWindowsStep setMinWindows(int minWindows) {
this.minWindows = minWindows;
return this;
}
#Override
public HasBackDoorStep setMaxWindows(int maxWindows) {
this.maxWindows = maxWindows;
return this;
}
#Override
public HasSecondFloorStep setHasBackDoor(double hasBackDoor) {
this.hasBackDoor = hasBackDoor;
return this;
}
#Override
public HasChimnyStep setHasSecondFloor(double hasSecondFloor) {
this.hasSecondFloor = hasSecondFloor;
return this;
}
#Override
public HasGarageStep setHasChimny(double hasChimny) {
this.hasChimny = hasChimny;
return this;
}
#Override
public HasPorchStep setHasGarage(double hasGarage) {
this.hasGarage = hasGarage;
return this;
}
#Override
public BuildStep setHasPorch(double hasPorch) {
this.hasPorch = hasPorch;
return this;
}
#Override
public Probability build() {
return new Probability(minWindows,
maxWindows,
hasBackDoor,
hasSecondFloor,
hasChimny,
hasGarage,
hasPorch);
}
}
}
Fields have to be assigned by name, and if you forget which step you are on, the compiler error will tell you:
// This will cause an error with a message something like
// "Cannot find symbol method build() in interface MinWindowsStep".
Probability p = Probability.builder()
.build();
If it turns out that it really is the case that you need to use inheritance, the builder pattern can be adapted to that by having e.g. an abstract build step with multiple implementations.
How would I accomplish a similar query in realm java like that one asked in this question:
how do I query sql for a latest record date for each user
Cause it seems realm lacks a group by method when fetching queries
Here's my RealmObject:
public class Memo extends RealmObject {
#Ignore
public static final int SENT = 1;
#Ignore
public static final int UNREAD = 2;
#Ignore
public static final int READ = 3;
#Ignore
public static final int PENDING = 4;
private static final String TAG = Memo.class.getName();
#PrimaryKey
public String id = "";
#Index
public String connection = "";
public String subject = "";
public String body = "";
public int status = 0;
public Date date;
public Boolean sentByMe = false;
public String remoteId = "";
public Boolean isFile = false;
public String filepath = "";
}
This represents the user:
public String connection
RealmResults<Memo> latestMemos = realm.where(Memo.class)
.findAllSorted("date", Sort.DESCENDING)
.distinct("connection");
I've implemented a Java program that uses QuickFIX/J (version 1.6.0). It gets a FIX message (execution report) from the counterparty with the repeating group NoPartyIDs (Tag 453) with following the values
(Tag 453) NoPartyIDs = 4
(Tag 447) PartyIDSource = D
(Tag 448) Party ID = XXX
(Tag 452) PartyRole = 1
(Tag 447) PartyIDSource = D
(Tag 448) Party ID = XXX
(Tag 452) PartyRole = 66
(Tag 447) PartyIDSource = D
(Tag 448) Party ID = XXX
(Tag 452) PartyRole = 55
(Tag 802) NoPartySubIDs = 1
(Tag 447) PartyIDSource = D
(Tag 448) Party ID = XXX
(Tag 452) PartyRole = 7
Screenshot from this part of the message:
My program sends automatically an reject message with
(Tag 58) Text = "Value is incorrect (out of range) for this tag"
(Tag 371) RefTagID = 452
(Tag 373) SessionRejectReason = 5
Screentshot from the whole response:
Now, I am asking me, why my program reacts this way when it received the FIX message. Because the values of the message regarding tag 452 PartyRole are not out of range (look here for the documentation), or?!
The source file of the QuickFix/J implementation also should know these values.. Here the source:
/* Generated Java Source File */
/*******************************************************************************
* Copyright (c) quickfixengine.org All rights reserved.
*
* This file is part of the QuickFIX FIX Engine
*
* This file may be distributed under the terms of the quickfixengine.org
* license as defined by quickfixengine.org and appearing in the file
* LICENSE included in the packaging of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
* THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* See http://www.quickfixengine.org/LICENSE for licensing information.
*
* Contact ask#quickfixengine.org if any conditions of this licensing
* are not clear to you.
******************************************************************************/
package quickfix.field;
import quickfix.IntField;
public class PartyRole extends IntField {
static final long serialVersionUID = 20050617;
public static final int FIELD = 452;
public static final int EXECUTING_FIRM = 1;
public static final int BROKER_OF_CREDIT = 2;
public static final int CLIENT_ID = 3;
public static final int CLEARING_FIRM = 4;
public static final int INVESTOR_ID = 5;
public static final int INTRODUCING_FIRM = 6;
public static final int ENTERING_FIRM = 7;
public static final int LOCATE_LENDING_FIRM = 8;
public static final int FUND_MANAGER_CLIENT_ID = 9;
public static final int SETTLEMENT_LOCATION = 10;
public static final int ORDER_ORIGINATION_TRADER = 11;
public static final int EXECUTING_TRADER = 12;
public static final int ORDER_ORIGINATION_FIRM = 13;
public static final int GIVEUP_CLEARING_FIRM = 14;
public static final int CORRESPONDANT_CLEARING_FIRM = 15;
public static final int EXECUTING_SYSTEM = 16;
public static final int CONTRA_FIRM = 17;
public static final int CONTRA_CLEARING_FIRM = 18;
public static final int SPONSORING_FIRM = 19;
public static final int UNDERLYING_CONTRA_FIRM = 20;
public static final int CLEARING_ORGANIZATION = 21;
public static final int EXCHANGE = 22;
public static final int CUSTOMER_ACCOUNT = 24;
public static final int CORRESPONDENT_CLEARING_ORGANIZATION = 25;
public static final int CORRESPONDENT_BROKER = 26;
public static final int BUYER_SELLER = 27;
public static final int CUSTODIAN = 28;
public static final int INTERMEDIARY = 29;
public static final int AGENT = 30;
public static final int SUB_CUSTODIAN = 31;
public static final int BENEFICIARY = 32;
public static final int INTERESTED_PARTY = 33;
public static final int REGULATORY_BODY = 34;
public static final int LIQUIDITY_PROVIDER = 35;
public static final int ENTERING_TRADER = 36;
public static final int CONTRA_TRADER = 37;
public static final int POSITION_ACCOUNT = 38;
public static final int CONTRA_INVESTOR_ID = 39;
public static final int TRANSFER_TO_FIRM = 40;
public static final int CONTRA_POSITION_ACCOUNT = 41;
public static final int CONTRA_EXCHANGE = 42;
public static final int INTERNAL_CARRY_ACCOUNT = 43;
public static final int ORDER_ENTRY_OPERATOR_ID = 44;
public static final int SECONDARY_ACCOUNT_NUMBER = 45;
public static final int FORIEGN_FIRM = 46;
public static final int THIRD_PARTY_ALLOCATION_FIRM = 47;
public static final int CLAIMING_ACCOUNT = 48;
public static final int ASSET_MANAGER = 49;
public static final int PLEDGOR_ACCOUNT = 50;
public static final int PLEDGEE_ACCOUNT = 51;
public static final int LARGE_TRADER_REPORTABLE_ACCOUNT = 52;
public static final int TRADER_MNEMONIC = 53;
public static final int SENDER_LOCATION = 54;
public static final int SESSION_ID = 55;
public static final int ACCEPTABLE_COUNTERPARTY = 56;
public static final int UNACCEPTABLE_COUNTERPARTY = 57;
public static final int ENTERING_UNIT = 58;
public static final int EXECUTING_UNIT = 59;
public static final int INTRODUCING_BROKER = 60;
public static final int QUOTE_ORIGINATOR = 61;
public static final int REPORT_ORIGINATOR = 62;
public static final int SYSTEMATIC_INTERNALISER = 63;
public static final int MULTILATERAL_TRADING_FACILITY = 64;
public static final int REGULATED_MARKET = 65;
public static final int MARKET_MAKER = 66;
public static final int INVESTMENT_FIRM = 67;
public static final int HOST_COMPETENT_AUTHORITY = 68;
public static final int HOME_COMPETENT_AUTHORITY = 69;
public static final int COMPETENT_AUTHORITY_OF_THE_MOST_RELEVANT_MARKET_IN_TERMS_OF_LIQUIDITY = 70;
public static final int COMPETENT_AUTHORITY_OF_THE_TRANSACTION = 71;
public static final int REPORTING_INTERMEDIARY = 72;
public static final int EXECUTION_VENUE = 73;
public static final int MARKET_DATA_ENTRY_ORIGINATOR = 74;
public static final int LOCATION_ID = 75;
public static final int DESK_ID = 76;
public static final int MARKET_DATA_MARKET = 77;
public static final int ALLOCATION_ENTITY = 78;
public PartyRole() {
super(452);
}
public PartyRole(int data) {
super(452, data);
}
}
Maybe you had a similiar problem or you see my fallacy..
Thank you for your help dudes!!!
There is a field PartyRole=66 in the ExecutionReport, which is not a valid value for the PartyRole in FIX 4.4 (your reject message has 8=FIX.4.4). The documentation link you post is for FIX 5.0 SP2.
If your counterparty is sending PartyRole values that are not supported in FIX 4.4, you might consider creating a separate Data Dictionary to support them for this particular counterparty.
I was wondering if there is someway for me to set the color of the text that I output to the console in Java. It does not matter if it is system specific as the program will only be run on my Windows 7 x64 laptop.
This question: Change color in java eclipse console was asked several weeks ago and had a good solution(by #VonC) to a similar problem however it only addressed the issue inside eclipse.
Can the same effect be achieved if I execute my program from the command line? and if so how?
You can take a look at the Java Curses Library:
http://sourceforge.net/projects/javacurses/
Here's an entry on how to use it:
http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html
thy this....
furthermore read http://jansi.fusesource.org/
public static final String ANSI_RESET = "\u001B[0m";
public static final String ANSI_BLACK = "\u001B[30m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_YELLOW = "\u001B[33m";
public static final String ANSI_BLUE = "\u001B[34m";
public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_CYAN = "\u001B[36m";
public static final String ANSI_WHITE = "\u001B[37m";
Another library you may be interested in is Jansi: http://jansi.fusesource.org/
Jansi interprets ANSI code and format them for the console output. It works for both unix and windows.
Update 11/2014: you can also see the github Page
Not directly related to Java console output, but if you're looking to use ANSI colors in Kotlin console output, this is a great library to use - https://github.com/importre/crayon
I needed colors for a project. Here is a class for everyone. Just do Colors.(color) + "whatever" to add color, bold, or italic. Use Colors.reset to reset the colors. Hope this helps.
package util;
public class Colors {
public static final String reset = "\u001B[0m";
public static final String bold = "\u001b[1m";
public static final String italic = "\u001b[3m";
public static final String underline = "\u001b[4m";
public static final String reversed = "\u001b[7m";
public static final String black = "\u001b[30m";
public static final String blue = "\u001b[34m";
public static final String cyan = "\u001b[36m";
public static final String green = "\u001b[32m";
public static final String magenta = "\u001b[35m";
public static final String red = "\u001b[31m";
public static final String white = "\u001b[37m";
public static final String yellow = "\u001b[33m";
public static final String brightBlack = "\u001b[30;1m";
public static final String brightBlue = "\u001b[34;1m";
public static final String brightCyan = "\u001b[36;1m";
public static final String brightGreen = "\u001b[32;1m";
public static final String brightMagenta = "\u001b[35;1m";
public static final String brightRed = "\u001b[31;1m";
public static final String brightWhite = "\u001b[37;1m";
public static final String brightYellow = "\u001b[33;1m";
public static final String bgBlack = "\u001b[40m";
public static final String bgBlue = "\u001b[44m";
public static final String bgCyan = "\u001b[46m";
public static final String bgGreen = "\u001b[42m";
public static final String bgMagenta = "\u001b[45m";
public static final String bgRed = "\u001b[41m";
public static final String bgWhite = "\u001b[47m";
public static final String bgYellow = "\u001b[43m";
public static final String bgBrightBlack = "\u001b[40;1m";
public static final String bgBrightBlue = "\u001b[44;1m";
public static final String bgBrightCyan = "\u001b[46;1m";
public static final String bgBrightGreen = "\u001b[42;1m";
public static final String bgBrightMagenta = "\u001b[45;1m";
public static final String bgBrightRed = "\u001b[41;1m";
public static final String bgBrightWhite = "\u001b[47;1m";
public static final String bgBrightYellow = "\u001b[43;1m";
}