test_class.declarator: urlHelper
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private UrlHelper urlHelper;
test_class.type: UrlHelper
test_class.var_name: urlHelper
test_class.file: herd-code/herd-dao/src/test/java/org/finra/herd/dao/helper/UrlHelperTest.java
test_class.identifier: UrlHelperTest
test_class.superclass: extends AbstractDaoTest
test_case.body: @Test
      public void testParseJsonObjectFromUrlMalformedURLException()
      {
          try
          {
              urlHelper.parseJsonObjectFromUrl(MockUrlOperationsImpl.MOCK_URL_MALFORMED_URL_EXCEPTION);
          }
          catch (IllegalArgumentException e)
          {
              assertEquals(String.format("Failed to read JSON from the URL: url=\"%s\"", MockUrlOperationsImpl.MOCK_URL_MALFORMED_URL_EXCEPTION), e.getMessage());
          }
      }
test_case.class_method_signature: UrlHelperTest.testParseJsonObjectFromUrlMalformedURLException()
test_case.full_signature: @Test public void testParseJsonObjectFromUrlMalformedURLException()
test_case.identifier: testParseJsonObjectFromUrlMalformedURLException
test_case.invocations: parseJsonObjectFromUrl assertEquals format getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testParseJsonObjectFromUrlMalformedURLException()
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.declarator: urlOperations
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private UrlOperations urlOperations;
focal_class.type: UrlOperations
focal_class.var_name: urlOperations
focal_class.file: herd-code/herd-dao/src/main/java/org/finra/herd/dao/helper/UrlHelper.java
focal_class.identifier: UrlHelper
focal_class.class_method_signature: UrlHelper.parseJsonObjectFromUrl(String url)
focal_class.full_signature: public JSONObject parseJsonObjectFromUrl(String url)
focal_class.identifier: parseJsonObjectFromUrl
focal_class.modifiers: public
focal_class.parameters: (String url)
focal_class.return: JSONObject
focal_class.signature: JSONObject parseJsonObjectFromUrl(String url)
focal_method.body: public JSONObject parseJsonObjectFromUrl(String url)
      {
          try
          {
              // Get proxy information.
              Proxy proxy;
              String httpProxyHost = configurationHelper.getProperty(ConfigurationValue.HTTP_PROXY_HOST);
              Integer httpProxyPort = configurationHelper.getProperty(ConfigurationValue.HTTP_PROXY_PORT, Integer.class);
              if (StringUtils.isNotBlank(httpProxyHost) && httpProxyPort != null)
              {
                  proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(httpProxyHost, httpProxyPort));
              }
              else
              {
                  proxy = Proxy.NO_PROXY;
              }
  
              // Open an input stream as per specified URL.
              InputStream inputStream = urlOperations.openStream(new URL(url), proxy);
  
              try
              {
                  // Parse the JSON object from the input stream.
                  JSONParser jsonParser = new JSONParser();
                  return (JSONObject) jsonParser.parse(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
              }
              catch (ParseException e)
              {
                  throw new IllegalArgumentException(String.format("Failed to parse JSON object from the URL: url=\"%s\"", url), e);
              }
              finally
              {
                  inputStream.close();
              }
          }
          catch (IOException e)
          {
              throw new IllegalArgumentException(String.format("Failed to read JSON from the URL: url=\"%s\"", url), e);
          }
      }
focal_method.class_method_signature: UrlHelper.parseJsonObjectFromUrl(String url)
focal_method.full_signature: public JSONObject parseJsonObjectFromUrl(String url)
focal_method.identifier: parseJsonObjectFromUrl
focal_method.invocations: getProperty getProperty isNotBlank openStream parse format close format
focal_method.modifiers: public
focal_method.parameters: (String url)
focal_method.return: JSONObject
focal_method.signature: JSONObject parseJsonObjectFromUrl(String url)