Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1022758 // DocumentBuilder_parse (for StackOverflow)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (46L/1K).

import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

static Document DocumentBuilder_parse(DocumentBuilder b, String uri) throws SAXException, IOException {
  UnknownHostException lastException = null;
  for (int tries = 0; tries < 2; tries++) {
    try {
      return b.parse(uri);
    } catch (UnknownHostException e) {
      lastException = e;
      System.out.println("Retrying because of: " + e);
      continue;
    }
  }
  throw lastException;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022758
Snippet name: DocumentBuilder_parse (for StackOverflow)
Eternal ID of this version: #1022758/3
Text MD5: 8d380ee9c021ee7ef813094527db4ae6
Transpilation MD5: 3d8375ac1274290e268cbf07ce2d98a6
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-06 14:17:07
Source code size: 520 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 185 / 249
Version history: 2 change(s)
Referenced in: [show references]