Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#20741 closed enhancement (fixed)

[patch] Code improvements

Reported by: gaben Owned by: simon04
Priority: minor Milestone: 21.04
Component: Core Version: latest
Keywords: Cc:

Description

While I looked for JOSM core functionality, found these minor issues and fixed them. There is no intended functionality change, only semantics.

Attachments (1)

josm_20741.diff (34.0 KB ) - added by gaben 4 years ago.

Download all attachments as: .zip

Change History (11)

by gaben, 4 years ago

Attachment: josm_20741.diff added

comment:1 by taylor.smock, 4 years ago

Just out of curiosity, why did you change L816 in src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java like so:

-            } catch (NumberFormatException ignore) {
-                Logging.trace(ignore);
+            } catch (NumberFormatException e) {
+               Logging.trace(e);

ignore seems to be fairly clear as to why we continue without re-throwing, where e isn't.

comment:2 by GerdP, 4 years ago

My understanding of the "TODO: convert this to switch/case and make sure the parsing still works" is that there is a script which parses the java source to extract the shortcuts and this script may not work. I don't know know how to make sure. Do you?

in reply to:  2 comment:3 by taylor.smock, 4 years ago

I think the script might be hidden on the server somewhere, and not in the source, so I can't check. I don't know who has server access. I think don-vip and stoecker have access, but I don't know about anyone else.

in reply to:  1 comment:4 by simon04, 4 years ago

Replying to taylor.smock:

Just out of curiosity, why did you change L816 in src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java like so:

IntelliJ by default reports the warning "'catch' parameter named 'ignore' is used", but those warnings are configurable.

in reply to:  2 comment:5 by gaben, 4 years ago

Replying to taylor.smock:

Just out of curiosity, why did you change L816 in src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

As Simon said, by default those reported by IntelliJ. An error is ignored by inspection definition when it's not used in the catch block, example: trunk/src/com/kitfox/svg/xml/XMLParseUtil.java#L359.

Replying to GerdP:
Speaking of the removed TODO, I have no idea, the script is probably not public. At least you can test if it still works :)

Last edited 4 years ago by gaben (previous) (diff)

comment:6 by simon04, 4 years ago

Milestone: 21.04
Owner: changed from team to simon04
Status: newassigned

comment:7 by simon04, 4 years ago

In 17786/josm:

see #20741 - Fix typos in code and strings (patch by gaben)

comment:8 by simon04, 4 years ago

Resolution: fixed
Status: assignedclosed

In 17787/josm:

fix #20741 - Various code simplifications (patch by gaben)

comment:9 by simon04, 4 years ago

I've split your patch in two commits. I've excluded the ignore exception variable name, and the patch around "TODO: convert this to switch/case and make sure the parsing still works" (since I cannot).

comment:10 by gaben, 4 years ago

Thank you and sorry for the extra work. I was having issues keeping the patch up to date because you made changes faster than I found issues 😄

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.