test_class.declarator: format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm")
test_class.modifier: static final
test_class.original_string: static final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
test_class.type: SimpleDateFormat
test_class.var_name: format
test_class.file: rest-backend/src/test/java/org/eclipse/steady/backend/cve/CveReader2Test.java
test_class.identifier: CveReader2Test
test_case.body: @Test
    public void testFetch() throws CacheException {
      NvdRestServiceMockup.create();
      final CveReader2 reader = new CveReader2();
      reader.fetch("CVE-2019-17531");
    }
test_case.class_method_signature: CveReader2Test.testFetch()
test_case.full_signature: @Test public void testFetch()
test_case.identifier: testFetch
test_case.invocations: create fetch
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFetch()
focal_class.declarator: log = LoggerFactory.getLogger(CveReader2.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger log = LoggerFactory.getLogger(CveReader2.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: CVE_CACHE = new Cache<String, Cve>(new CveReader2(), 1440)
focal_class.modifier: private static
focal_class.original_string: private static Cache<String, Cve> CVE_CACHE = new Cache<String, Cve>(new CveReader2(), 1440);
focal_class.type: Cache<String, Cve>
focal_class.var_name: CVE_CACHE
focal_class.file: rest-backend/src/main/java/org/eclipse/steady/backend/cve/CveReader2.java
focal_class.identifier: CveReader2
focal_class.interfaces: implements ObjectFetcher<String, Cve>
focal_class.class_method_signature: CveReader2.read(String _key)
focal_class.full_signature: public static Cve read(String _key)
focal_class.identifier: read
focal_class.modifiers: public static
focal_class.parameters: (String _key)
focal_class.return: Cve
focal_class.signature: Cve read(String _key)
focal_class.class_method_signature: CveReader2.read(String _key, boolean _force_fetch)
focal_class.full_signature: public static Cve read(String _key, boolean _force_fetch)
focal_class.identifier: read
focal_class.modifiers: public static
focal_class.parameters: (String _key, boolean _force_fetch)
focal_class.return: Cve
focal_class.signature: Cve read(String _key, boolean _force_fetch)
focal_class.class_method_signature: CveReader2.fetch(String _key)
focal_class.full_signature: public Cve fetch(String _key)
focal_class.identifier: fetch
focal_class.modifiers: public
focal_class.parameters: (String _key)
focal_class.return: Cve
focal_class.signature: Cve fetch(String _key)
focal_class.class_method_signature: CveReader2.buildFromJson(String _id, String _json)
focal_class.full_signature: private static final Cve buildFromJson(String _id, String _json)
focal_class.identifier: buildFromJson
focal_class.modifiers: private static final
focal_class.parameters: (String _id, String _json)
focal_class.return: Cve
focal_class.signature: Cve buildFromJson(String _id, String _json)
focal_method.body: public Cve fetch(String _key) throws CacheException {
      if (_key == null) return null;
  
      Cve cve = null;
      int sc = -1;
      String result = null;
      String uri = null;
  
      try {
        final String url = VulasConfiguration.getGlobal().getServiceUrl(Service.CVE, true);
  
        final CloseableHttpClient httpclient = HttpClients.createDefault();
        uri = url.replaceAll("<ID>", _key);
        log.info("Query details of [" + _key + "] at [" + uri + "]");
        final HttpGet method = new HttpGet(uri);
        if (ConnectionUtil.getProxyConfig() != null)
          method.setConfig(ConnectionUtil.getProxyConfig());
        final CloseableHttpResponse response = httpclient.execute(method);
        try {
          sc = response.getStatusLine().getStatusCode();
          final HttpEntity entity = response.getEntity();
          if (sc == org.apache.http.HttpStatus.SC_OK && entity != null) {
            result = ConnectionUtil.readInputStream(entity.getContent());
            cve = CveReader2.buildFromJson(_key, result);
          } else {
            log.error(
                "HTTP GET [url="
                    + uri
                    + "] completed with ["
                    + sc
                    + "], and entity ["
                    + entity
                    + "]");
          }
        } catch (ParseException e) {
          log.error("HTTP GET [url=" + uri + "] caused an exception: " + e.getMessage());
          throw new CacheException(_key, e);
        } finally {
          response.close();
        }
        log.info("Fetched " + cve + " for key [" + _key + "]");
      } catch (ClientProtocolException e) {
        log.error("HTTP GET [url=" + uri + "] caused an exception: " + e.getMessage());
        throw new CacheException(_key, e);
      } catch (IOException e) {
        log.error("HTTP GET [url=" + uri + "] caused an exception: " + e.getMessage());
        log.error("Error: " + e.getMessage(), e);
        throw new CacheException(_key, e);
      } catch (ServiceConnectionException e) {
        log.error(e.getMessage());
        throw new CacheException(_key, e);
      }
      return cve;
    }
focal_method.class_method_signature: CveReader2.fetch(String _key)
focal_method.full_signature: public Cve fetch(String _key)
focal_method.identifier: fetch
focal_method.invocations: getServiceUrl getGlobal createDefault replaceAll info getProxyConfig setConfig getProxyConfig execute getStatusCode getStatusLine getEntity readInputStream getContent buildFromJson error error getMessage close info error getMessage error getMessage error getMessage error getMessage
focal_method.modifiers: public
focal_method.parameters: (String _key)
focal_method.return: Cve
focal_method.signature: Cve fetch(String _key)