Instantiate the configured {@link OASModelReader} and invoke it. If no reader is configured, then return null. If a class is configured but there is an
error either instantiating or invokig it, a {@link RuntimeException} is thrown.
192020
private OpenAPIImpl modelFromReader() {
        ClassLoader cl = getContextClassLoader();
        if (cl == null) {
            cl = OpenApiServletContextListener.class.getClassLoader();
        }
        return OpenApiProcessor.modelFromReader(config, cl);
    }
969947
@SuppressWarnings("unchecked")
    void read(ObjectInputStream in) throws ClassNotFoundException, IOException {
        GetField fields = in.readFields();

        internalPropNames = (Set<String>) fields.get(INTERNAL_PROP_NAMES, null);

        byte[] bytes = (byte[]) fields.get(OBJECT, null);

        // TODO: for internal usage, find a way to supply the class loader of the bundle that creates the contextual object?

        DeserializationObjectInputStream doin = new DeserializationObjectInputStream(
                        new ByteArrayInputStream(bytes),
                        AccessController.doPrivileged(getThreadContextClassLoader));
        object = (T) doin.readObject();
        doin.close();

        Map<String, String> execProps = (Map<String, String>) fields.get(EXEC_PROPS, null);

        bytes = (byte[]) fields.get(CONTEXT, null);
        threadContextDescriptor = (ThreadContextDescriptorImpl) ThreadContextDeserializer.deserialize(bytes, execProps);
    }
432813
public Reader create(Reader input, MtasConfiguration config)
      throws IOException {
    MtasFetchData fetchData = new MtasFetchData(input);
    if (config.attributes
        .containsKey(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)) {
      if (config.attributes.get(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)
          .equals(VALUE_TYPE_URL)) {
        try {
          return fetchData.getUrl(
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_PREFIX),
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_POSTFIX));
        } catch (MtasParserException e) {
          log.debug(e);
          throw new IOException(e.getMessage());
        }
      } else if (config.attributes
          .get(MtasConfiguration.CHARFILTER_CONFIGURATION_TYPE)
          .equals(VALUE_TYPE_FILE)) {
        try {
          return fetchData.getFile(
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_PREFIX),
              config.attributes
                  .get(MtasConfiguration.CHARFILTER_CONFIGURATION_POSTFIX));
        } catch (MtasParserException e) {
          throw new IOException(e);
        }
      } else {
        return fetchData.getDefault();
      }
    } else {
      return fetchData.getDefault();
    }
  }
409890
public Reader openReader() throws FetchException {
        try {
            return getInternalClobForFetch().getCharacterStream();
        } catch (SQLException e) {
            throw mRepo.toFetchException(e);
        }
    }
1066045
private Class<?> loadClassByName(String className) throws TransformationOperationException {
        Exception e;
        if (className.contains(";")) {
            try {
                String[] parts = className.split(";");
                ModelDescription description = new ModelDescription();
                description.setModelClassName(parts[0]);
                if (parts.length > 1) {
                    description.setVersionString(new Version(parts[1]).toString());
                }
                return modelRegistry.loadModel(description);
            } catch (Exception ex) {
                e = ex;
            }
        } else {
            try {
                return this.getClass().getClassLoader().loadClass(className);
            } catch (Exception ex) {
                e = ex;
            }
        }
        String message = "The class %s can't be found. The instantiate operation will be ignored.";
        message = String.format(message, className);
        getLogger().error(message);
        throw new TransformationOperationException(message, e);        
    }
857751
XMLReader newXMLReader() throws ParserConfigurationException, SAXException, FactoryConfigurationError {
		SAXParserFactory parserFactory = SAXParserFactory.newInstance();
		SAXParser saxParser = parserFactory.newSAXParser();
		XMLReader reader = saxParser.getXMLReader();
		reader.setContentHandler(this);
		return reader;
	}
1013924
public static XMLReader createXMLReader() throws SAXException, ParserConfigurationException, FactoryConfigurationError {
        try {
            return (XMLReader) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                public Object run() throws SAXException, ParserConfigurationException, FactoryConfigurationError {
                    Thread currThread = Thread.currentThread();
                    ClassLoader oldLoader = currThread.getContextClassLoader();
                    currThread.setContextClassLoader(ParserFactory.class.getClassLoader());
                    try {
                        /**
                         * Changed to use pluggable parser version. Needed for JDK 1.4.1
                         */
                        return SAXParserFactory.newInstance().newSAXParser().getXMLReader();
                        //return XMLReaderFactory.createXMLReader();
                    }
                                        finally {
                                            currThread.setContextClassLoader(oldLoader);
                                        }
                                    }
            });
        } catch (PrivilegedActionException pae) {
            Throwable t = pae.getCause();
            if (t instanceof SAXException) {
                throw (SAXException) t;
            } else if (t instanceof ParserConfigurationException) {
                throw (ParserConfigurationException) t;
            } else if (t instanceof FactoryConfigurationError) {
                throw (FactoryConfigurationError) t;
            }
        }
        return null;
    }
113382
private Class<?> instantiate(String className) {
    try {
      return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
    } catch (Throwable t) {
      try {
        serializer.serialize(
            new SuiteFailureEvent(
                new Failure(Description.createSuiteDescription(className), t)));
        if (flushFrequently)
          serializer.flush();
      } catch (Exception e) {
        warn("Could not report failure back to master.", t);
      }
      return null;
    }
  }
95011
public static ObjectReader init(ObjectReader reader) {
        return reader.withAttribute(ATTR_STRING_CACHE, new DeserializerStringCache(
                new HashMap<CharBuffer, String>(2048), new LinkedHashMap<CharBuffer, String>(4096, 0.75f, true) {
                    @Override
                    protected boolean removeEldestEntry(Entry<CharBuffer, String> eldest) {
                        return size() > LRU_LIMIT;
                    }

                }));
    }
596480
public void register(Class<? extends ValueReader> reader) {

		Assert.notNull(reader, "Missing reader class!");
		boolean registered = false;

		Consumes found = reader.getAnnotation(Consumes.class);
		if (found != null) {
			MediaType[] consumes = MediaTypeHelper.getMediaTypes(found.value());
			if (consumes != null && consumes.length > 0) {
				for (MediaType type : consumes) {
					register(type, reader);
				}
			}
			registered = true;
		}

		Assert.isTrue(registered,
		              "Failed to register reader: '" + reader.getName() + "', missing @Consumes annotation!");
	}
433044
protected SnapshotReader openReader(SnapshotReader reader, SnapshotDescriptor descriptor) {
    Assert.state(descriptor.locked(), "cannot read from unlocked snapshot descriptor");
    return reader;
  }
533600
public static Parameters parse(Reader reader) throws AponParseException {
        if (reader == null) {
            throw new IllegalArgumentException("reader must not be null");
        }
        AponReader aponReader = new AponReader(reader);
        return aponReader.read();
    }
97259
private synchronized void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();

        // the transient _nameMap is null after an instance of
        // NameService has been serialized.
        if (_nameMap == null) {
            _nameMap = new HashMap();
        }
    }
1354663
@Override
  public StreamImpl openReadImpl() throws IOException
  {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    
    if (loader == null) {
      loader = ClassLoader.getSystemClassLoader();
    }

    InputStream is = loader.getResourceAsStream(getTrimPath());

    if (is == null) {
      throw new FileNotFoundException(getURL());
    }
    
    return new VfsStreamOld(is, null);
  }
183158
protected void initJsonReader() {
		String readerList = config.getJsonReaders();
		if (readerList != null) {
			String[] readers = readerList.split(",");
			Set<String> supportedReaders = TreeReaderRegistry.getReadersByFormat("json");
			TreeReader selectedReader = null;
			for (String reader : readers) {
				reader = reader.trim().toLowerCase();
				if (!reader.isEmpty()) {
					for (String supportedReader : supportedReaders) {
						int i = supportedReader.lastIndexOf('.');
						if (i > -1) {
							supportedReader = supportedReader.substring(i + 1);
						}
						if (supportedReader.toLowerCase().contains(reader)) {
							selectedReader = TreeReaderRegistry.getReader(supportedReader);
							logger.info("Default JSON deserializer/reader is \"" + selectedReader.getClass() + "\".");
							TreeReaderRegistry.setReader("json", selectedReader);
							break;
						}
					}
					if (selectedReader != null) {
						break;
					}
				}
			}
		}
	}
1216828
private void init(Reader reader) {
		names = new TreeSet<String>();
		failedLines = new LinkedHashMap<Integer,String>();

		BufferedReader br = null;

		try {

			br = new BufferedReader(reader);

			logger.info("Reading ASTRAL file...");

			String line = "";
			int i = 0;
			while ((line = br.readLine()) != null) {
				if (line.startsWith(">")) {
					try {
						String scopId = line.split("\\s")[0].substring(1);
						names.add(scopId);
						if (i % 1000 == 0) {
							logger.debug("Reading ASTRAL line for " + scopId);
						}
						i++;
					} catch (RuntimeException e) {
						failedLines.put(i, line);
						logger.warn("Couldn't read line " + line, e);
					}
				}
			}

			br.close();

		} catch (IOException e) {
			throw new RuntimeException("Couldn't read the input stream ", e);
		} finally {
			if (br != null) {
				try {
					br.close();
				} catch (IOException e) {
					logger.warn("Could not close stream", e);
				}
			}
		}

	}
536472
public void parse(Reader reader) throws IOException {
        mScanner = new Scanner(reader);

        mScanner.addErrorListener(new ErrorListener() {
            public void parseError(ErrorEvent e) {
                dispatchParseError(e);
            }
        });

        try {
            parseProperties();
        }
        finally {
            mScanner.close();
        }
    }