Changes in DB Value not Reflected in Output

J

John Smith

brief description of problem:
I have created a Java app that
- adds two columns to a GUI window
- shows N in column if boolean flag is false; blank if boolean flag is
true

- adds two columns to an output file
- shows -1 in column if boolean flag is false; 0 if boolean flag is
true

problem:
- when running main entry on desktop against code base on desktop,
then the two columns showed up on on both the GUI window as blank and
the output file with value 0; but once I change the value from true to
false the two columsn GUI window shows up with "N" (correct) but the
output file shows up with 0 (incorrect - false should be -1)

- when running main entry on desktop against code base on server, then
the two columns showed up on on both the GUI window as blank and but
the two columns did not even show up in the output file

- when running main entry on server against code base on server, then
the two columns showed up on on both the GUI window as blank ; and the
run on the server for the output file failed with no obvious error
show in the logs.

note that the codebase has been deployed from desktop to server prior
to all tests.


summary:
two problems here:
- why are the two columns not showing up consistently across desktop
and server runs?
- why the column in the report file remains as 0 after changing the
value from true to false?


The Java code involves several classes and quite long to post; but I
can provide snippets if it helps.
Any suggestions to the two questions raised in the "summary" section
is appreciated.

Thanks.
 
A

Arne Vajhøj

summary:
two problems here:
- why are the two columns not showing up consistently across desktop
and server runs?
- why the column in the report file remains as 0 after changing the
value from true to false?


The Java code involves several classes and quite long to post; but I
can provide snippets if it helps.
Any suggestions to the two questions raised in the "summary" section
is appreciated.

Posting some code that can recreate the problems would give
a better chance for a solution than waiting for somebody
with the psychic abilities to envision your code.

:)

Arne
 
J

Joshua Cranmer

- why are the two columns not showing up consistently across desktop
and server runs?

Without knowing anything else, I am going to guess that the answer is
you misprogrammed some concurrency code--on the desktop, contacting the
database on itself is likely to cause some caches to end up being
flushed and thereby causing memory to become updated across threads,
while a database on the server is not going to cause remote cache flushes.
- why the column in the report file remains as 0 after changing the
value from true to false?

This I can't answer without knowing anything else. Concurrency could
again be a fault here, but I really don't know.
The Java code involves several classes and quite long to post; but I
can provide snippets if it helps.

SSCCE would be invaluable if possible. To beat a horse to a bloody
death, if all other explanations fail, concurrency can be a good guess
for failure, but that does imply that most of the other code is not
buggy in this sense. In any case, I'm not entirely sure what you're
doing or what the correct outputs of those actions should have been, let
alone where in the code it could be failing.
 
J

John Smith

Without knowing anything else, I am going to guess that the answer is
you misprogrammed some concurrency code--on the desktop, contacting the
database on itself is likely to cause some caches to end up being
flushed and thereby causing memory to become updated across threads,
while a database on the server is not going to cause remote cache flushes..


This I can't answer without knowing anything else. Concurrency could
again be a fault here, but I really don't know.


SSCCE would be invaluable if possible. To beat a horse to a bloody
death, if all other explanations fail, concurrency can be a good guess
for failure, but that does imply that most of the other code is not
buggy in this sense. In any case, I'm not entirely sure what you're
doing or what the correct outputs of those actions should have been, let
alone where in the code it could be failing.

When running the following code snippet to display the two columns in
the file,
gen.isGenViaFeed(curve) returns true and gen.isSaveRecRate(curve)
returns true
so iss.setMarkitCurve(""); and iss.setMarkitRecRate(""); are
executed

expected behaviour:
since I have set GEN_VIA_FEED = false via the GUI I expect
gen.isGenViaFeed(curve) to return false
so iss.setMarkitCurve("N"); and iss.setMarkitRecRate("N"); should be
exectued.

String curveKey = (iss.getCurrency() == null ? DEFAULT_CURRENCY :
iss.getCurrency()) +
SNP_RATING_DELIMITER +
iss.getIssuerId() +
SNP_RATING_DELIMITER +
(iss.getSeniority() == null ? domainSen : iss.getSeniority()) +
SNP_RATING_DELIMITER +
(iss.getRestructuringType() == null ? domainRT :
iss.getRestructuringType());

CurveProbability curve = curvesMap.get(curveKey);

CurveGeneratorProbability gen = new
CurveGeneratorProbability();
if (curve == null || gen.isGenViaFeed(curve) ) {
iss.setMarkitCurve("");
} else {
iss.setMarkitCurve("N");
}
if ( gen.isSaveRecRate(curve) ) {
iss.setMarkitRecRate("");
} else {
iss.setMarkitRecRate("N");
}
}

/**
* Is parameter GEN_VIA_FEED set to "true" (ignore case)
*
* @param curve Curve to examine
* @return True or false
*/
public boolean isGenViaFeed(Curve curve)
{
if (curve == null || curve.getGeneratorParameters() == null)
{
return false;
}
String param = (String)
(curve.getGeneratorParameters()).get(GEN_VIA_FEED);
if (param == null)
{
return false;
}
else
{
return param.equalsIgnoreCase("true");
}
}

I found a couple of references to curve.setGeneratorParameters() but
when I put in a breakpoint none of those references were hit.
The obvious answer here is to "change the code such that
curve.setGeneratorParameters() will be run"; however I have seen this
same code being able
to print "N" (=false) and "N" (=false) in the GUI. When print to the
file the logic goes thorough the same code snippet, reading the same
value in the DB.
Why is "0" (=true) and "0" (=true") printed in the report file?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top