Does IntelliJ IDEA (2018.2+) offer the formatting option for comma-first style in Java?
public void example(
String one
, String two
, String three) { ... }
I've read about it somewhere but I can't find it anymore.
There is no such option at the moment. Please vote for the related request on YouTrack: https://youtrack.jetbrains.com/issue/IDEABKL-6965
Related
I recently got a report that a few Google Analytics event category names were being recorded with an i character with out a dot on top.
Pageviews and events occurring twice, once without dots over the i.
I had to look to believe it. Sure enough, I had an event called favorite and there was a handful called favorıte. Copy and paste that weird character into a terminal or a monospace font just to see how weird it is. favorıte
My first suspicion is my code where I generate the strings for the category names using toString on an enum.
public enum AnalyticsEvent {
SCREEN_VIEW,
FAVORITE,
UN_FAVORITE,
CLICK_EVENT,
... reduced for brevity;
public String val() {
return this.toString().toLowerCase();
}
}
Example of how that enum is used:
#Override
public void logSearchTag(String type, String value) {
...
logGAEvent(AnalyticsEvent.SEARCH_TAG.val(), type, value);
}
private void logGAEvent(String category, String action, String label) {
... // mGATracker = instance of com.google.android.gms.analytics.Tracker;
mGATracker.send(addCustomDimensions(new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action)
.setLabel(label))
.build());
...
}
I am going to solve this by actually assigning a string to the enums and instead return that in the val() function.
Though, I am curious if anyone knows why on a small handful of devices Enum.toString returns the enum name with that weird character replacing the i. I mean small. 8 out 50,000 is the average. Or is it possible that assumption is wrong and the error is on analytics service end somewhere? Really highly doubt that.
The String#toLowerCase method uses the default locale of the system. This use locale specific characters such as ı instead of i. In order to fix this problem call toLowerCase with a locale:
String test = "testString";
test.toLowerCase(java.util.Locale.ENGLISH) // Or your preferred locale
I am trying to import test case results in TestLink. To do that, I have to use the method : api.getTestCaseIDByName(testCaseName, testSuiteName, projectName, testCasePathName) from the TestLinkAPI library.
The problem is I can't find out what "testCasePathName" corresponds to ...
Do you have any idea ?
It would be very helpful ! Thank you
Finally managed to find out what was the testCasePathName.
It is a String with this format : "[projectName]::[testSuiteName]::[testCaseName]" where :
- projectName is the name of your project in TestLink,
- testSuiteName is the name of your TestSuite int TestLink
- testCaseName is the name of your testCase in TestLink
Hope it will help someone someday ! :)
Presuming that the library you're speaking about is this one...
public Integer getTestCaseIDByName(String testCaseName, String testSuiteName, String testProjectName,
String testCasePathName) throws TestLinkAPIException {
return this.testCaseService.getTestCaseIDByName(testCaseName, testSuiteName, testProjectName, testCasePathName);
}
The program is going to expect a pile of Strings as the types for your parameters. You'll have to provide the names of the elements which are named. You may also want to look at the method which is referenced in the return statement to get a better understanding of how the matching system works in this library.
when I am trying to call method with parameter using my Polish language f.e.
node.call("ąćęasdasdęczć")
I get these characters as input characters.
Ä?Ä?Ä?asdasdÄ?czÄ
I don't know where to set correct encoding in maven pom.xml? or in my IDE? I tried to change UTF-8 to ISO_8859-2 in my IDE setting, but it didn't work. I was searching similiar questions, but I didn't find the answer.
#Edit 1
Sample code:
public void findAndSendKeys(String vToSet , By vLocator){
WebElement element;
element = webDriverWait.until(ExpectedConditions.presenceOfElementLocated(vLocator));
element.sendKeys(vToSet);
}
By nameLoc = By.id("First_Name");
findAndSendKeys("ąćęasdasdęczć" , nameLoc );
Then in input field I got Ä?Ä?Ä?asdasdÄ?czÄ. Converting string to Basic Latin in my IDE helps, but It's not the solution that I needed.
I have also problems with fields in classes f.e. I have class in which I have to convert String to basic Latin
public class Contacts{
private static final By LOC_ADDRESS_BTN = By.xpath("//button[contains(#aria-label,'Wybór adresu')]");
// it doesn't work, I have to use basic latin and replace "ó" with "\u00f3" in my IDE
}
#Edit 2 - Changed encoding, but problem still exists
1:
I am using XStream 1.4.3 to move between Java and XML documents when messaging to another process. Most everything works. However, I can't seem to get one reply document to deserialize properly. Here is the reply:
<AddToBatchResponse>
<MerchantOrderNumber>1525675</MerchantOrderNumber>
<MerchantOrderNumber>1525676</MerchantOrderNumber>
<ResponseReasonCode>100</ResponseReasonCode>
<AuthResponseType>S</AuthResponseType>
</AddToBatchResponse>
When XStream gets to the 2nd MerchantOrderNumber, it gives an error saying "Duplicate field MerchantOrderNumber". I've tried different designs, but it just won't work. Here is the relevant Java code:
Snippet from calling class
xstream.alias("AddToBatchResponse", AddToBatchResponse.class);
xstream.alias("MerchantOrderNumber", OrderNumber.class);
xstream.addImplicitCollection(AddToBatchResponse.class, "orderNumbers");
response = (AddToBatchResponse)xstream.fromXML(responseXml);
AddToBatchResponse.java (leaving out getters and setters)
public class AddToBatchResponse {
protected List<OrderNumber> orderNumbers;
protected String ResponseReasonCode;
protected String AuthResponseType;
...
OrderNumber.java
public class OrderNumber {
protected String MerchantOrderNumber;
...
Can someone tell me what I'm doing wrong? Thanks.
Well, no answer - so here's what I did:
I used regex + String manipulation to pull out and process the extra elements in my code. Not elegant not desirable, but it works. If anyone ever finds an answer to this question, please share.
I'm working on migrating a textile plugin for a java blogging platform from one library (textile4j) to Mylyn's WikiText. So far very promising, but I have some unit tests that are failing:
public void testLinksSyntax44() {
String in = "\"link text(with title)\":http://example.com/";
String out = "<p>link text</p>";
textile.parse(in);
String content = writer.toString();
assertEquals(out, content);
}
public void testLinksSyntax46() {
String in = "\"(link)link text(with title)\":http://example.com/";
String out = "<p>link text</p>";
textile.parse(in);
String content = writer.toString();
assertEquals(out, content);
}
Basically, the output is showing a problem with WikiText parsing the title syntax. The output for each test is as follows:
In #44, the output is: <p>link text(with title)</p>
In #46, the output is: <p>link text(with title)</p>
The Textpattern Textile web widget correctly parses the link with class and title ("(link)link text(with title)":http://www.example.com/) and the link with title ("link text(with title)":http://www.example.com/) short forms.
Am I doing something wrong, or did I find a bug? I'm still groking the library, but it might be that one familiar with the library knows the problem, can find the error, or can help correct me.
Much thanks!
Tim
I found that the bug has been reported...
Eclipse Mylyn WikiText Bugzilla