TRX to HTML using TRXER - formatexception invalid string for TimeSpan - visual-studio-2012

I am using the following utility from the link https://github.com/NivNavick/trxer.
I get the following error when I try to execute the same to generate the report.
TrxerConsole.exe unitestresult.trx.trx
Trx File
unitestresult.trx.trx
Loading xslt template...
Loading css...
Loading javascript...
Transforming...
Unhandled Exception: System.FormatException: String was not recognized as a valid TimeSpan.
at System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpan
StandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
at System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider for
matProvider)
at System.TimeSpan.Parse(String s)
at System.Xml.Xsl.CompiledQuery.Script1.ToExactTimeDefinition(String duration
)
at System.Xml.Xsl.CompiledQuery.Query.(XmlQuery
Runtime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schem
as-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debu
g}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList1 {urn:sche mas-microsoft-com:xslt-debug}namespaces, IList1 testId, IList`1 testDescription
)
at System.Xml.Xsl.CompiledQuery.Query.
If anybody has gone through similar issue, please let me know how to resolve this.
Thanks
Murali

I have resolved the issue. There was some problem with String format returned by one of the API in XSLT provided by the Trxer tool. I have updated the same in trxer git hub.Please refer to the below link for the fix.
https://github.com/NivNavick/trxer/pull/17/files

Related

Preferences library is causing E/libc & E/Pref errors

I'm building a weather app using MVVM and retrofit and i recently added a PreferencesFragmentCompat subclass to implement some user settings using the preferences lib. After doing so, my app won't run and i keep getting these few lines of errors :
2020-04-08 00:54:12.346 18079-18079/? E/de.flogaweathe: Unknown bits set in runtime_flags: 0x8000
2020-04-08 00:54:12.410 18079-18079/com.nesoinode.flogaweather E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: Fail to get file list com.nesoinode.flogaweather
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2020-04-08 00:54:12.421 18079-18110/com.nesoinode.flogaweather E/Perf: Fail to get file list oat
2020-04-08 00:54:12.422 18079-18110/com.nesoinode.flogaweather E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
I've got no idea what these are and i can't find any specific answers on stack or google.There are no indications on what is causing the error so i can't figure out if i'm doing something wrong or if it is a library issue. Any ideas?
Here's the SettingsFragment where i'm adding the preferences from an xml resource file :
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.settings_prefs)
}
}
And here's how i'm reading some values from the sharedPrefs:
class UnitProviderImpl(context: Context) : UnitProvider {
private val appContext = context.applicationContext
private val preferences:SharedPreferences
get() = PreferenceManager.getDefaultSharedPreferences(appContext)
override fun getUnitSystem(): String {
val selectedUnitSystemName = preferences.getString(UNIT_SYSTEM_KEY,
UnitSystem.SI.name.toLowerCase(Locale.ROOT))
return selectedUnitSystemName!!
}
}
I managed to figure out a solution to the issue after doing some more research. Firstly, i commented out all the code related to the preferences library (and the lib itself) and run the app again. The run was successful without any errors so that narrowed it down to the androidx.preference:preference-ktx:1.1.0 library itself since my code was reviewed and couldn't find any issues with it. Looking through the preference docs i figured i could try out a beta or alpha version that may have fixed this issue. And lo and behold, after using the androidx.preference:preference-ktx:1.1.0-beta01 beta version and uncommenting the relative code, everything worked once again.

cereal::defer and CEREAL_NVP?

I am trying to use the name-value-pairs functionality and the deferred serialization features of Cereal together, but I can't seem to get it to work.
It seems that cereal::defer( CEREAL_NVP( vecOfSharedPtrs ) ) works in the save(Archive& ar) const function, producing correctly-named output, but writing the same in load(Archive& ar) produces a compilation error.
I get the feeling I'm using it wrong, or it's not supported?
I recently faced the same scenario. I believe you do not need to use cereal::defer in your load function. I have posted a working excerpt below.
template <class Archive>
void load(Archive& archive) {
//deserializes components
archive(values);
}
template <class Archive>
void save(Archive& archive) const {
//serializes components
archive(cereal::defer(CEREAL_NVP(values)));
archive.serializeDeferments();
}

Not able to publish Hybris Promotion

I have created a promotion in hybris 1808 but when I am trying to publish the promotion it's Failing. The same promotion is working in 1808 Vanilla Hybris
I have added following properties in localextension.xml and tried but still facing the same issue
promotionenginesamplesaddon
promotionengineatddtests
I expected the promotion status to Publish but it's failing while publishing with following error logs :
19.04.23 17:54:40:527 INFO *************************************
19.04.23 17:54:40:535 INFO Starting RuleEngineCompilePublishJob
19.04.23 17:54:40:535 INFO *************************************
19.04.23 17:54:44:903 ERROR The rule compilation finished with errors
19.04.23 17:54:44:910 ERROR Exception caught - de.hybris.platform.servicelayer.exceptions.ModelSavingException: [de.hybris.platform.droolsruleengineservices.interceptors.DroolsRuleValidateInterceptor#3d9f547f]:rule(code:testPromotion) The drl content does not contain the matching rule declaration with the value of your hybris rule's uuid attribute. Please adjust the uuid of your hybris rule and/or add: rule "2e0e0ac2-7475-44c1-9114-07a0d7174534" (i.e. putting the rule uuid in double-quotes) in your drl content.
19.04.23 17:54:44:915 INFO *************************************
19.04.23 17:54:44:915 INFO RuleEngineCompilePublishJob finished with errors
19.04.23 17:54:44:915 INFO *************************************
Which verion of hybris are you using?
Because I faced this while upgrading from 6.3 to 6.7 while publishing the promotion.
I had overridden the method in my custom class in 6.3 which looks has follows:
#Override
protected String generateRuleContentRule(final DroolsRuleGeneratorContext context, final String actions, final String metadata)
{
final AbstractRuleModel rule = context.getRuleCompilerContext().getRule();
final Map variables = context.getVariables();
final StringBuilder buffer = new StringBuilder(4096);
buffer.append("rule \"").append(rule.getUuid()).append("\"\n");
buffer.append("#ruleCode(\"").append(rule.getCode()).append("\")\n");
buffer.append(metadata);
buffer.append("dialect \"mvel\" \n");
buffer.append("salience ").append(rule.getPriority()).append('\n');
...
This overridden method from the class DefaultDroolsRuleTargetCodeGenerator had to be changed to include droolRule uuid rather than rule uuid which is the change incorporated in OOTB DefaultDroolsRuleTargetCodeGenerator class in 6.7
protected String generateRuleContentRule(DroolsRuleGeneratorContext context, String actions, String metadata) {
AbstractRuleModel rule = context.getRuleCompilerContext().getRule();
DroolsRuleModel droolsRule = context.getDroolsRule();
StringBuilder buffer = new StringBuilder(4096);
buffer.append("rule \"").append(droolsRule.getUuid()).append("\"\n");
buffer.append("#ruleCode(\"").append(rule.getCode()).append("\")\n");
buffer.append("#moduleName(\"").append(context.getRuleCompilerContext().getModuleName()).append("\")\n");
buffer.append(metadata);
buffer.append("dialect \"mvel\" \n");
This resolved the error above.
Hope this helps.
Happy Coding.

Get rid of token recognition error

How can I get rid of the default ANTLR recognition error?
I want to write another message using my own error class instead of ANTLR's error.
I mean is there any possibility that some ANTLR error classes can be extended in order to display my own message?
More clearly, I do not want to see the following error message in my console :
token recognition error at:
If you simply want to suppress the messages, you can call lexer.removeErrorListeners(). However, a better approach is writing your lexer rules such that all possible input is tokenized, with the following rule at the end of the lexer. This will cause all error reporting to go through the parser instead of both the parser and lexer.
// handle characters which failed to match any other token
ErrorCharacter : . ;
In order to create a custom error handler you can extend the BaseErrorListener class and override the syntaxError method, e.g.:
public class MyErrorListener extends BaseErrorListener {
#Override
public void syntaxError( Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
String msg, RecognitionException e ) {
// method arguments should be used for more detailed report
throw new RuntimeException("syntax error occurred");
}
}
Now when you create a lexer and a parser you should remove the default error listeners and attach your custom one:
MyErrorListener errorListener = new MyErrorListener();
Lexer lexer = new MyLexer( ... );
lexer.removeErrorListeners();
lexer.addErrorListener( errorListener );
CommonTokenStream tokens = new CommonTokenStream( lexer );
Parser parser = new MyParser( tokens );
parser.removeErrorListeners();
parser.addErrorListener( errorListener );
The default message "line x:x token recognition error at: 'xxx'" comes from the default ConsoleErrorListener class. If you don't remove it using lexer/parser.removeErrorListeners() and only add your custom one it will still be triggered.
The error handling strategies are thoroughly described in a dedicated chapter of The Definitive ANTLR4 Reference book (mentioned on the ANTLR4 Documentation page). I currently have no access to the book itself, so would be grateful if someone edits this answer with a concrete page number of the book. Also, I couldn't find a related guide on the ANTLR4 doc page, so if it exists - a link would be helpful, too.

kxml is giving a xmlpullparser exception

I checked SO for the xmlpullparser exception but it's giving me others questions with Android and SOUP. I am using J2me and normal HTTPrequest to get my XML and I am using kXMl to parser the xml text. Below is the code that I am working on. And above it is more parsing code and they work perfectly.
if (parser.getName().equals("comments")) {
event = parser.next();
boolean flag = false;
if (parser.getName().equals("comment")) {
flag = true;
System.out.println("Flag is true");
}
while (flag) {
event = parser.next();
Questioncomments.addComponent(new Label(parser.nextText()));
event = parser.next();
System.out.println("Inside the While");
if (!parser.getName().equals("comment")) {
flag = false;
System.out.println("Flag is false");
}
}
Questioncomments.repaint();
}
XML I am sending this side - <comments><comment>Awesome Question #dulitha<idComment></idComment></comment></comments>
The error is -
org.xmlpull.v1.XmlPullParserException: precondition: START_TAG
(position:TEXT Awesome Question...#1:399 in
java.io.InputStreamReader#f828ed68)
at org.kxml2.io.KXmlParser.exception(+47)
at org.kxml2.io.KXmlParser.nextText(+14)
at
com.petmill.mobile.view.qanda.QuestionCanvas.setData(QuestionCanvas.java:189)
at
com.petmill.mobile.view.qanda.QuestionsList$5$1$1.actionPerformed(QuestionsList.java:119)
The error comes up at the line where I am trying to get the text - parser.nextText(). How can I parse the xml to get the data required... Thanks in advance.
It looks like you are not on the START_TAG event when you call parser.nextText(). Check that you are on a START_TAG event when you call parser.nextText() with the parser.getEventType(). I suspect that you have some whitespace between <comments> and <comment> tag and therefore your parser is not at the event that you expect it to be.
Perhaps you should also consider a safer approach for parsing this xml.
<comments>
<comment>Awesome Question #dulitha
<idComment></idComment>
</comment>
</comments>
this is not valid xml

Resources