Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wikipedia plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
JOSM trac
JOSM trac
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JOSM
wikipedia plugin
Commits
5a2f8ce1
Commit
5a2f8ce1
authored
Aug 09, 2018
by
Florian Schäfer
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NullPointerException when adding names from wikipedia tag
See
https://josm.openstreetmap.de/ticket/16586
parent
6adfaad8
Pipeline
#27576466
passed with stages
in 23 minutes and 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
WikipediaAddNamesAction.java
...n/java/org/wikipedia/actions/WikipediaAddNamesAction.java
+15
-5
No files found.
src/main/java/org/wikipedia/actions/WikipediaAddNamesAction.java
View file @
5a2f8ce1
...
...
@@ -13,9 +13,13 @@ import org.openstreetmap.josm.Main;
import
org.openstreetmap.josm.actions.JosmAction
;
import
org.openstreetmap.josm.data.osm.DataSet
;
import
org.openstreetmap.josm.data.osm.OsmPrimitive
;
import
org.openstreetmap.josm.gui.Notification
;
import
org.openstreetmap.josm.io.remotecontrol.AddTagsDialog
;
import
org.openstreetmap.josm.tools.I18n
;
import
org.openstreetmap.josm.tools.ImageProvider
;
import
org.openstreetmap.josm.tools.Logging
;
import
org.wikipedia.WikipediaApp
;
import
org.wikipedia.WikipediaPlugin
;
import
org.wikipedia.data.WikipediaEntry
;
public
class
WikipediaAddNamesAction
extends
JosmAction
{
...
...
@@ -29,15 +33,21 @@ public class WikipediaAddNamesAction extends JosmAction {
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
final
WikipediaEntry
wp
=
WikipediaEntry
.
parseTag
(
"wikipedia"
,
getWikipediaValue
());
List
<
String
[]>
tags
=
new
ArrayList
<>();
WikipediaApp
.
forLanguage
(
wp
.
lang
).
getInterwikiArticles
(
wp
.
article
).
stream
()
if
(
wp
==
null
)
{
new
Notification
(
I18n
.
tr
(
"Could not add names. Wikipedia tag is not recognized!"
))
.
setIcon
(
WikipediaPlugin
.
W_IMAGE
.
setMaxSize
(
ImageProvider
.
ImageSizes
.
LARGEICON
).
get
())
.
show
();
}
else
{
List
<
String
[]>
tags
=
new
ArrayList
<>();
WikipediaApp
.
forLanguage
(
wp
.
lang
).
getInterwikiArticles
(
wp
.
article
).
stream
()
.
filter
(
this
::
useWikipediaLangArticle
)
.
map
(
i
->
new
String
[]{
"name:"
+
i
.
lang
,
i
.
article
})
.
forEach
(
tags:
:
add
);
if
(
Logging
.
isDebugEnabled
())
{
Logging
.
debug
(
tags
.
toString
());
if
(
Logging
.
isDebugEnabled
())
{
Logging
.
debug
(
tags
.
toString
());
}
AddTagsDialog
.
addTags
(
tags
.
toArray
(
new
String
[
tags
.
size
()][]),
"Wikipedia"
,
getLayerManager
().
getEditDataSet
().
getSelected
());
}
AddTagsDialog
.
addTags
(
tags
.
toArray
(
new
String
[
tags
.
size
()][]),
"Wikipedia"
,
getLayerManager
().
getEditDataSet
().
getSelected
());
}
private
boolean
useWikipediaLangArticle
(
WikipediaEntry
i
)
{
...
...
Florian Schäfer
@floscher
mentioned in commit
3c4a7994
·
Aug 09, 2018
mentioned in commit
3c4a7994
mentioned in commit 3c4a7994ae7e054728294c8451a136919f5e6c0f
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment