I invested too much time, now I want to ask you how can I insert a line break at a specific position in the value of a .properties file-property. for example, I have:
the zul:
<zk xmlns:h="native" xmlns:x="xhtml">
<groupbox width="850px">
<caption label="${c:l('not this label')}" />
<h:table >
<h:tr>
<h:td>
<h:label>${c:l('mylabel.linebreakedlabel')}</h:label>
</h:td>
....
the .properties file:
mylabel.linebreakedlabel = Hello this label should be breaked into two lines
I tried many different solutions:
A:
Hello this label should be \ breaked
into two lines
-> second line in label gets thrown away
B:
{
Hello
second line
}
-> The {} gets rendered and second line is thrown away
C:
\n with and without enter either renders the sign or throws away the whole second line
D:
Tried </br>, the element itself gets rendered
Im asking on this platform because ZK Forums won't send me an email to confirm my register.
Anyone knows the problem or atleast know where the problem lies? (Using ZK Version 6)
Thank you!
please read Specify a Value with Multiple Lines, its code example, and properties file example .
Related
I have set some error code and message in a JSON file in my project which looks like (not original code for safety):
{
"ERROR":"Limit is £100."
}
When I set this message to be thrown as exception when testing from Postman, instead of showing Limit is £100., it shows like Limit is ?100.
So, I'm worried why £ gets converted to ?. Then, I tried to replace this ? with £ by using below code:
String message = fetchErrorMessage("ERROR", ***some parameters***);
if (message != null) {
message = message.contains("�")
? message.replaceAll("�", "£")
: message;
}
Note: I checked with � instead of ? because when I was debugging the code and hover over the message to check whether it contains the £ symbol or not, I found that it was having a weird looking square block (check screenshot below). So, I copy-paste it and got to know it's a question mark symbol inside a black diamond.
Now, with above piece of code change, the message is coming properly in Postman but soon I realized that when I deployed the code in UAT environment, it still shows ?.
So, any workaround how to fix it?
There is a specific character that shows up wrong when UTF-8 is set from the client(SoapUI) in the header content-type: application/json;charset=UTF-8.
For more details Check this link
I would like to know if there is a way on IntelliJ (v.2019.3) to copy a text, i.e. the following:
Screening a transaction should return ‘REJECTED’ if the email id of
transaction is in blacklist and transaction was made within last 30
days. In all other cases, it should return ‘ACCEPT’.
and to be paste as comment well formatted instead to have a single infinite line as:
could you try to go to Settings/Editor/Java/Wrapping and Braces/Ensure right margin is not exceeded
While integrating invoices into SAP in my Java application on Windows, I am having the following error "R6025 - Pure virtual function call".
However, my application runs on multiple clients in a single version and I have no problems with any of the clients, just this specific one!
During testing with the application in the client environment, I noticed that the error always happens when using the "add" to add the first line in the invoice.
invoiceV1.getLines().add(); // The error happens here!
System.out.println("THIS LINE NOT APPEARS ON CMD");
invoiceV1.getLines().setCurrentLine(lineNum);
............ SETTING LINE VALUES ..........
lineNum++;
As far as i know, you don't need to set the .add() on the first line. Try to put an if just to check if it is the first line or not.
If that doesn't work, you could consider an enviroment error? Or some instalattion problem?
I am working with ESAPI to try and validate windows directory paths. For some reason, the part of my directory path named \14\ is getting converted into a CRLF. The error I am receiving is below, what am I not understanding correctly? I feel like my regex should be working.
WARN IntrusionDetector [SECURITY FAILURE Anonymous:null#unknown -> /project-test/IntrusionDetector] Invalid input: context=directoryPath, type(DirectoryName)=^[a-zA-Z0-9:/\\!##$%^&{}\[\]()_+\-=,.~'` ]{1,255}$, input=C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace, orig=C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
As you can see, I am using the regex:
^[a-zA-Z0-9:/\!##$%^&{}[]()_+-=,.~'` ]$
My input is:
C:\Users\TESTUS~1\AppData\Local\Temp\14\TestCase8002TempWorkSpace
Ouput, after ESAPI does canonicalization and validation:
C:\UsersTESTUS~1AppDataLocalTempTestCase8002TempWorkSpace
Here is the line of code that causes me to receive the error;
String validatedSourcePath = ESAPI.validator().getValidInput("directoryUnzip", directory, "DirectoryName", 255, false);
File validFile = new File(validatedSourcePath);
#C.Williams: I was about 30 minutes into writing up a detailed reply in an editor and accidentally excited my editor window. I'm too ticked off at my stupidity of not saving it to write it again, especially since I was only about 75% done.
However, if you want to email me I can arrange to talk to you via Google Hangouts or Signal to tell you want your problem is and how you can fix it. But it's long and complicated and partially related to a bug the ESAPI team just fixed but is not in any official release yet. But I am not going to take another 45 minutes or more trying to reply with any written text. My email address should be easy enough to find. Just google for my name and ESAPI. I am one of the project co-leaders on ESAPI.
-kevin wall
Small disclaimer I am new to Java and this is my first real programme i am trying to write.
I am currently writing a programme with 3 class's. The first is a GUI with a JComboBox, 4 JButtons and 20 JTextFields.
The second takes information from the JComboBox box and uses it to give labels to the 4 JButtons using a set of if statements.
The third populates the JTextFields when one of the the JButtons is clicked depending on the button clicked and the choice in the JComboBox using a set of switch statements.
The first 2 class's work fine and the third works fine until i enter x amount of switches and then i start to get an error.
A small example of my code for the third class is
switch (hiddenText) {
case "Abecean Longfin":
if (command.equals("Weakness to Frost")){
gui.r1.setText("Elves Ear");
gui.r2.setText("Fire Salts");
gui.r3.setText("Ice Wraith Teeth");
gui.r4.setText("White Cap");
gui.r5.setText("");
gui.r6.setText("");
gui.r7.setText("");
gui.r8.setText("");
gui.r9.setText("");
gui.r10.setText("");
gui.r11.setText("");
gui.r12.setText("");
gui.r13.setText("");
gui.r14.setText("");
gui.r15.setText("");
gui.r16.setText("");
gui.r17.setText("");
gui.r18.setText("");
gui.r19.setText("");
gui.r20.setText("");
}
if (command.equals("Fortify Sneak")){
gui.r1.setText("Beehive Husk");
gui.r2.setText("Frost Mirriam");
gui.r3.setText("Hawk Feathers");
gui.r4.setText("Human Flesh");
gui.r5.setText("Powdered Mammoth Tusk");
gui.r6.setText("Purple Mountain Flower");
gui.r7.setText("");
gui.r8.setText("");
gui.r9.setText("");
gui.r10.setText("");
gui.r11.setText("");
gui.r12.setText("");
gui.r13.setText("");
gui.r14.setText("");
gui.r15.setText("");
gui.r16.setText("");
gui.r17.setText("");
gui.r18.setText("");
gui.r19.setText("");
gui.r20.setText("");
}
if (command.equals("Weakness to Poison")){
gui.r1.setText("Bleeding Crown");
gui.r2.setText("Chaurus Eggs");
gui.r3.setText("Deathbell");
gui.r4.setText("Giant Lichen");
gui.r5.setText("Pine Thrush Egg");
gui.r6.setText("Sabre Cat Tooth");
gui.r7.setText("Small Antlers");
gui.r8.setText("");
gui.r9.setText("");
gui.r10.setText("");
gui.r11.setText("");
gui.r12.setText("");
gui.r13.setText("");
gui.r14.setText("");
gui.r15.setText("");
gui.r16.setText("");
gui.r17.setText("");
gui.r18.setText("");
gui.r19.setText("");
gui.r20.setText("");
}
if (command.equals("Fortify Restoration")){
gui.r1.setText("Cyrodilic Spadetail");
gui.r2.setText("Salt Pile");
gui.r3.setText("Small Antlers");
gui.r4.setText("Small Pearl");
gui.r5.setText("");
gui.r6.setText("");
gui.r7.setText("");
gui.r8.setText("");
gui.r9.setText("");
gui.r10.setText("");
gui.r11.setText("");
gui.r12.setText("");
gui.r13.setText("");
gui.r14.setText("");
gui.r15.setText("");
gui.r16.setText("");
gui.r17.setText("");
gui.r18.setText("");
gui.r19.setText("");
gui.r20.setText("");
}
break;
There are a total of 92 cases, each with 4 if statements and the programme works fine until i get to 57 cases and 2 if statements then i get an error symbol in the class tab title in IDE (using NetBeans) but not within the code itself.
When i compile and run the code i get an error box appearing saying "One or more projects compiled with errors" but if i choose to run anyway the programme will run fine as far as i have seen.
I have tried writing the code in various ways.e.g. originally using if statements and originally having class 2 and 3 as the same class and i always get this error at reaching x amount of choices.
In previous versions i would sometimes get the error symbol appear in the class tab title in the IDE and not within the code as usual but when trying to run the programme it wouldn 't run at all and gave some classpath error which i can't seem to reproduce now so can't post the exact code.
From the testing i have done.e.g. removing different sections of code it appears that it happens when x amount of choices are added.i.e. i can add the 52nd case and 3rd if statement and the error appears but if i remove a previous if statement so there are 52 cases and 2 if statements still then everything if fine.
From experimenting it would seem there is a limit to the amount of switches/if statements i can use although from looking around i could in theory have an infinite amount?
So my question is, is there a limit to the amount of switches/if statements i can use or is there something else going on which is causing an error when i enter x number of switches/if statements?
you need to separate your data from your code. stick all that data in a combination of maps and lists and use some simple, common code to update the gui elements.
// setup data code
List<String> elements = Arrays.asList("Elves Ear", "Fire Salts", ...);
Map<String,List<String>> elementMap;
elementMap.put("Weakness to Frost");
// setup ui code
List<String> elements = elementMap.get(command);
initUI(elements);
public void initUI(List<String> elements) {
gui.r1.setText(elements.get(0));
// ...
}
note, you could keep all your text fields in a List, and then the update code is:
public void initUI(List<String> elements) {
for(int i = 0; i< textFields.size(); ++i) {
textFields.get(i).setText(elements.get(i));
}
}
in general, if you find yourself writing a lot of repetitive code, you are probably doing it wrong.
also, as #thatidiotguy pointed out in the comments, as you advance, you could move the data out of code like my example and into some sort of separate config file.