Skip to content

Commit

Permalink
Whitespace correction
Browse files Browse the repository at this point in the history
  • Loading branch information
kmpoppe committed Jun 12, 2022
1 parent 10b0893 commit b12adf2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,30 @@ private String getUrl(Object inputObject, Enum<linkTypes> linkType) {
return returnValue;
}

private String getOnlineNoteStatus(long noteId) {
private String getOnlineNoteStatus(long noteId) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
String result = "";
String apiUrl = getServerUrl() + "api/0.6/notes/" + Long.toString(noteId);

try {
URLConnection conn = new URL(apiUrl).openConnection();
try (InputStream is = conn.getInputStream()) {
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder dBuilder = dbf.newDocumentBuilder();
Document doc = dBuilder.parse(is);
Element element = doc.getDocumentElement();
try {
URLConnection conn = new URL(apiUrl).openConnection();
try (InputStream is = conn.getInputStream()) {
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder dBuilder = dbf.newDocumentBuilder();
Document doc = dBuilder.parse(is);
Element element = doc.getDocumentElement();

NodeList nodeList = element.getElementsByTagName("status");
if (nodeList.getLength() > 0) {
NodeList nodeList = element.getElementsByTagName("status");
if (nodeList.getLength() > 0) {
result = nodeList.item(0).getTextContent();
}
}
} catch (Exception e) {
result = "failure";
}

return result;
}
}
}
} catch (Exception e) {
result = "failure";
}

return result;
}

private static String getServerUrl() {
final String customServerUrl = Config.getPref().get("osm-server.url");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.openstreetmap.josm.data.notes.*;

public class NoteText {
private static int maxMenuItemLen = 50;
public static String noteShortText(Note n) {
private static int maxMenuItemLen = 50;
public static String noteShortText(Note n) {
String firstComment = n.getFirstComment().toString();
if (firstComment.length() > maxMenuItemLen) firstComment = firstComment.substring(0, maxMenuItemLen) + "...";
String menuItemText =
Expand Down

0 comments on commit b12adf2

Please sign in to comment.