First step for analyse code, it is responsible for get only basic
 informations.
 @param pPath Path of file to be analysed.
498811
def analyse_first_step(fileElement, source)
      source.each do |line|
        next if line.gsub(/\s+/, '').size.zero?
        processedLines = handle_semicolon(line)
        next if processedLines.nil?
        processedLines.each do |proc_line|
          @state.handle_line(proc_line)
          fileElement = @state.execute(fileElement, proc_line)
        end
      end

      source.close
      @fileElements.push(fileElement)
    end
787538
protected void verifyThatPathIsEmpty(Stack<String> pPathStack) {
        if (pPathStack != null && pPathStack.size() > 0) {
            throw new IllegalArgumentException("Path contains extra elements not usable for a list request: " + pPathStack);
        }
    }
46596
private synchronized void initialize(String fileName, String path) throws ParameterException {
		if(!path.equals(this.path)){
			checkPath(path);
			this.path = path;
		}
		if(!fileName.equals(this.fileName)){
			checkFileName(fileName);
			this.fileName = fileName;
		}
	}
1267455
public function stream_open( $pPath, $pMode, $pFlags, &$pOpenedPath )
	{
		if( 'r' !== $pMode && 'rb' !== $pMode )
		{
			\trigger_error(
				 $pPath . ': failed to open stream: HTTP wrapper does not support writable connections'
			);
			return FALSE;
		}

		// TODO: Find out what needs to happen when the path is already open. I may have misunderstood here.

		$this->url = \parse_url( $pPath );
		//
		if ( static::$saveFilePersist )
		{
			++static::$persistFileIncrement;
		}
		// See if we have a save file for this request.
		$localFile = $this->getSaveFile();
		// Load from local file, or make an internet request.
		if ( \file_exists($localFile) )
		{
			$this->resourceType = static::RESOURCE_TYPE_FILE;
			$this->resource = \fopen( $localFile, 'r' );
		}
		else
		{
			$this->resourceType = static::RESOURCE_TYPE_SOCKET;
			$timeout = ini_get( 'default_socket_timeout' );
			$this->ssl = ( \strcmp($this->url['scheme'], 'https') === 0 );
			$port = ( $this->ssl ) ? 443 : 80;
			// When port is specified, use that.
			if ( \array_key_exists('port', $this->url) )
			{
				$port = ( int ) $this->url[ 'port' ];
			}

			// When context options are set, use them.
			$options = \stream_context_get_options( $this->context );
			$httpOptions = NULL;
			if ( \array_key_exists('http', $options) )
			{
				$httpOptions = $options['http'];
				$timeout = array_key_exists('timeout', $httpOptions) ? $httpOptions['timeout'] : $timeout;
			}

			if ( $this->ssl ) // HTTPS
			{
				$remoteSocket = sprintf('ssl://%s:%d', $this->url['host'], $port );
				$this->resource = \stream_socket_client(
					$remoteSocket,
					$errorNo,
					$errorStr,
					$timeout,
					( $pFlags ?: \STREAM_CLIENT_CONNECT ),
					$this->context
				);

				if ( $errorNo > 0 ) {
					\trigger_error($errorStr);
				}
			}
			else // HTTP
			{
				// Init socket resource.
				$this->resource = \socket_create( \AF_INET, \SOCK_STREAM, \SOL_TCP );
				if ( !is_resource( $this->resource ) )
				{
					\trigger_error( 'Unable to connect to ' . $this->url[ 'host' ] );
					return FALSE;
				}

				// Attempt to connect.
				$isConnected = @\socket_connect( $this->resource, $this->url[ 'host' ], $port );
				if ( !$isConnected )
				{
					$this->triggerSocketError();
					return FALSE;
				}
			}

			// TODO: figure out when to set blocking mode.
			if ( $pFlags !== 0 ) {
				// TODO: Handle flags.
			}

			$request = $this->buildRequest( $httpOptions );
			$lengthToWrite = \strlen( $request );
			$lengthWritten = 0;
			// Send the request.
			do
			{
				if ( $this->ssl )
				{
					$lengthWritten += \fputs( $this->resource, $request );
				}
				else
				{
					$lengthWritten += \socket_write( $this->resource, $request );
				}

				if ( $lengthWritten >= $lengthToWrite ) {
					break;
				}
				else
				{
					echo( 'still need to write this much to the socket: ' . ($lengthToWrite - $lengthWritten) . "\n" );
				}

			} while ( $lengthWritten < $lengthToWrite );
		}

		$this->populateResponseHeaders();

		// Indicate that we have successfully opened the path.
		$pOpenedPath = $pPath;

		return TRUE;
	}
55968
public void readData(String path) {
        reset();
        resetP();
        this.jTextFieldResultPath.setText(path);
        this.path = path;
        rf = new ReadFile(path);
        String str = rf.processFiles();
        if (str.equals("")) {

            int algSize = rf.getAlgShortNames().size();
            int streamSize = rf.getStream().size();
            this.measures = rf.getMeasures();
            for (int i = 0; i < algSize; i++) {
                this.algoritmModel.addRow(new Object[]{rf.getAlgNames().get(i), rf.getAlgShortNames().get(i)});
            }
            for (int i = 0; i < streamSize; i++) {
                this.streamModel.addRow(new Object[]{rf.getStream().get(i), rf.getStream().get(i)});
            }
            String measuresNames[] = measures.getFirst().split(",");
            for (String measuresName : measuresNames) {
                jComboBoxXColumn.addItem(measuresName);
                jComboBoxYColumn.addItem(measuresName);
                jComboBoxXColumnGnuP.addItem(measuresName);
                jComboBoxYColumnGnuP.addItem(measuresName);
                if (measuresName.equals("learning evaluation instances") == true) {
                    jComboBoxXColumn.setSelectedItem(measuresName);
                    jComboBoxXColumnGnuP.setSelectedItem(measuresName);
                }
                if (measuresName.equals("classifications correct (percent)") == true || measuresName.equals("[avg] classifications correct (percent)")) {
                    jComboBoxYColumn.setSelectedItem(measuresName);
                    jComboBoxYColumnGnuP.setSelectedItem(measuresName);
                }

            }
        } else {

            JOptionPane.showMessageDialog(this, str,
                    "Error", JOptionPane.ERROR_MESSAGE);
        }

    }
1312221
void init(String path) {
        this.path = checkHasText(path, "path cannot be null or empty");
        this.index = 0;
        this.offset = 0;
        this.nextSplit = StringUtil.indexOf(path, '.', 0);
        this.token = null;
        if (nextSplit == 0) {
            throw new IllegalArgumentException("The path cannot begin with a dot: " + path);
        }
    }
804156
public static void setInitFilePath(String filePath) {
		filePath=getPropertiesFilePath(filePath);
		
		if (staticFileProperties == null) {
			staticFileProperties=new FileProperties(filePath);
		} else {
			staticFileProperties.setInitFilePath(filePath);
		}
	}
660473
@Override
    public void build(IClassPath classPath, IClassPathBuilderProgress progress) throws CheckedAnalysisException, IOException,
    InterruptedException {
        // Discover all directly and indirectly referenced codebases
        processWorkList(classPath, projectWorkList, progress);

        // If not already located, try to locate any additional codebases
        // containing classes required for analysis.
        if (!discoveredCodeBaseList.isEmpty()) {
            locateCodebasesRequiredForAnalysis(classPath, progress);
        }

        // Add all discovered codebases to the classpath
        for (DiscoveredCodeBase discoveredCodeBase : discoveredCodeBaseList) {
            classPath.addCodeBase(discoveredCodeBase.getCodeBase());
        }

        Set<ClassDescriptor> appClassSet = new HashSet<>();

        // Build collection of all application classes.
        // Also, add resource name -> codebase entry mappings for application
        // classes.
        for (DiscoveredCodeBase discoveredCodeBase : discoveredCodeBaseList) {
            if (!discoveredCodeBase.getCodeBase().isApplicationCodeBase()) {
                continue;
            }

            codeBaseEntryLoop: for (ICodeBaseIterator i = discoveredCodeBase.iterator(); i.hasNext();) {
                ICodeBaseEntry entry = i.next();
                if (!DescriptorFactory.isClassResource(entry.getResourceName())) {
                    continue;
                }

                ClassDescriptor classDescriptor = entry.getClassDescriptor();
                if (classDescriptor == null) {
                    throw new IllegalStateException();
                }

                if (appClassSet.contains(classDescriptor)) {
                    // An earlier entry takes precedence over this class
                    continue codeBaseEntryLoop;
                }
                appClassSet.add(classDescriptor);
                appClassList.add(classDescriptor);

                classPath.mapResourceNameToCodeBaseEntry(entry.getResourceName(), entry);
            }
        }

        if (DEBUG) {
            System.out.println("Classpath:");
            dumpCodeBaseList(classPath.appCodeBaseIterator(), "Application codebases");
            dumpCodeBaseList(classPath.auxCodeBaseIterator(), "Auxiliary codebases");
        }

        // Make sure we always know if we can't find system classes
        ICodeBaseEntry resource = classPath.lookupResource("java/lang/Object.class");
        if(resource == null){
            throw new ResourceNotFoundException("java/lang/Object.class");
        }
    }
222590
public static void main(String[] args) throws IOException, JAXBException {
        if (args.length != 1)
            throw new IOException("A project directory path must be specified.");

        File projectDir = new File(args[0]);
        File outputDir;

        boolean failOnExit = true;

        if (projectDir.getName().equals("ant_build")) {
            // we are wanting to validate ALL projects, so we need to go up one level.
            System.out.println("Validating all projects...");
            projectDir = projectDir.getParentFile();
            outputDir = new File(projectDir.getAbsolutePath() + "/build.image/output/metatypeValidator/");
            projectDir = new File(projectDir, "build.image");
            projectDir = new File(projectDir, "wlp");
            projectDir = new File(projectDir, "lib");

            failOnExit = false;
        } else {
            outputDir = new File(projectDir.getAbsolutePath() + "/build/reports/metatypeValidator/");
            projectDir = new File(projectDir, "build");
            projectDir = new File(projectDir, "lib");
        }
        if (!outputDir.exists() && !outputDir.mkdirs())
            throw new IOException("Failed to create output directory: " + outputDir.getAbsolutePath());

        List<Project> projects = new MetatypeValidator(projectDir, outputDir).validate(!failOnExit);
        int rCode = -1;

        if (projects.isEmpty()) {
            System.out.println("uhh...something bad happened and no projects were returned...");
        } else {
            for (Project project : projects) {
                List<ValidationEntry> validationEntries = project.validationEntries;

                for (ValidationEntry validationEntry : validationEntries) {
                    if (validationEntry.validity == ValidityState.Pass) {
                        if (rCode == -1)
                            rCode = 0;
                    } else if (validationEntry.validity == ValidityState.Warning) {
                        if (rCode < 1)
                            rCode = 1;
                    } else if (validationEntry.validity == ValidityState.Failure) {
                        rCode = 2;
                    } else {
                        if (validationEntry.validity == ValidityState.MetatypeNotFound)
                            rCode = 3;
                        else if (validationEntry.validity == ValidityState.NotValidated)
                            rCode = 4;

                    }
                }
            }

            if (failOnExit) {
                if (rCode == 0)
                    System.out.println("Metatype validation passed.");
                else if (rCode == 1)
                    System.out.println("Metatype validation passed with warnings.");
                else if (rCode == 2) {
                    System.out.println("Metatype validation FAILED!");
                    System.exit(2);
                } else if (rCode == 3 || rCode == -1)
                    System.out.println("No metatype file(s) found.");
                else if (rCode == 4)
                    System.out.println("Could not validate metatype file(s).");
                else
                    System.out.println("return code " + rCode);
            }
        }
    }
284787
public final String evalFileNameWithoutExtension(final String pPath) {
    int idxStart = 0;
    int idxEnd = pPath.length();
    int lastFs = pPath.lastIndexOf('/');
    if (lastFs == -1) {
      lastFs = pPath.lastIndexOf('\\');
    }
    if (lastFs != -1) {
      idxStart = lastFs + 1;
    }
    int idxDot = pPath.lastIndexOf('.');
    if (idxDot != -1) {
      idxEnd = idxDot;
    }
    return pPath.substring(idxStart, idxEnd);
  }
904975
private void scanPlatformPath(PackageSymbol p) throws IOException {
        fillIn(p, PLATFORM_CLASS_PATH,
               list(PLATFORM_CLASS_PATH,
                    p,
                    p.fullname.toString(),
                    allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS,
                                               JavaFileObject.Kind.OTHER)
                                  : EnumSet.of(JavaFileObject.Kind.CLASS)));
    }
940161
private void executeInt(String []path, LineMap lineMap)
    throws JavaCompileException, IOException
  {
    MemoryStream tempStream = new MemoryStream();
    WriteStreamOld error = new WriteStreamOld(tempStream);

    try {
      // String parent = javaPath.getParent().getNativePath();

      ArrayList<String> argList = new ArrayList<String>();
      argList.add("-d");
      argList.add(_compiler.getClassDirName());
      if (_compiler.getEncoding() != null) {
        String encoding = Encoding.getJavaName(_compiler.getEncoding());
        if (encoding != null && ! encoding.equals("ISO8859_1")) {
          argList.add("-encoding");
          argList.add(_compiler.getEncoding());
        }
      }

      argList.add("-classpath");
      argList.add(_compiler.getClassPath());

      ArrayList<String> args = _compiler.getArgs();
      if (args != null)
        argList.addAll(args);

      for (int i = 0; i < path.length; i++) {
        PathImpl javaPath = _compiler.getSourceDir().lookup(path[i]);
        argList.add(javaPath.getNativePath());
      }

      if (log.isLoggable(Level.FINER)) {
        CharBuffer msg = new CharBuffer();
        msg.append("javac(int)");
        for (int i = 0; i < argList.size(); i++) {
          if (argList.get(i).equals("-classpath")
              && ! log.isLoggable(Level.FINEST)) {
            i++;
            continue;
          }

          msg.append(" ");
          msg.append(argList.get(i));
        }

        log.finer(msg.toString());
      }

      String []argArray = argList.toArray(new String[argList.size()]);

      int status = -1;
      
      Thread thread = Thread.currentThread();
      ClassLoader oldLoader = thread.getContextClassLoader();

      // env = _internalLoader;


      try {
        thread.setContextClassLoader(_envClassLoader);
        
        if (_javac == null)
          throw new ConfigException(L.l("javac compiler is not available in {0}. Check that you are using the JDK, not the JRE.",
                                        System.getProperty("java.runtime.name")
                                        + " " + System.getProperty("java.runtime.version")));
        
        status = _javac.run(null, error, error, argArray);
      
        error.close();
        tempStream.close();
      } finally {
        thread.setContextClassLoader(oldLoader);
      }

      ReadStreamOld read = tempStream.openReadAndSaveBuffer();
      JavacErrorParser parser = new JavacErrorParser(this, path[0], _compiler.getEncoding());

      String errors = parser.parseErrors((InputStream) read, lineMap);
      read.close();

      if (errors != null)
        errors = errors.trim();

      if (log.isLoggable(Level.FINE)) {
        read = tempStream.openReadAndSaveBuffer();
        CharBuffer cb = new CharBuffer();
        int ch;
        while ((ch = read.read()) >= 0) {
          cb.append((char) ch);
        }
        read.close();

        log.fine(cb.toString());
      }
      else if (status == 0 && errors != null && ! errors.equals("")) {
        final String msg = errors;

        new com.caucho.v5.loader.ClassLoaderContext(_compiler.getClassLoader()) {
          public void run()
          {
            log.warning(msg);
          }
        };
      }

      if (status != 0)
        throw new JavaCompileException(errors);
    } finally {
      tempStream.destroy();
    }
  }
823874
protected void initPaths() {
		// Hand-rolled String.join(), for java 6
		String[] split = getSplitDirPath();
		String[] obsolete = getObsoleteDirPath();

		//URLs are joined with '/'
		StringBuilder splitURL = new StringBuilder("/pub/pdb");
		for(int i=0;i<split.length;i++) {
			splitURL.append("/");
			splitURL.append(split[i]);
		}
		StringBuilder obsoleteURL = new StringBuilder("/pub/pdb");
		for(int i=0;i<obsolete.length;i++) {
			obsoleteURL.append("/");
			obsoleteURL.append(obsolete[i]);
		}

		splitDirURL = splitURL.toString();
		obsoleteDirURL = obsoleteURL.toString();


		//Files join themselves iteratively
		splitDirPath = path;
		for(int i=0;i<split.length;i++) {
			splitDirPath = new File(splitDirPath,split[i]);
		}
		obsoleteDirPath = path;
		for(int i=0;i<obsolete.length;i++) {
			obsoleteDirPath = new File(obsoleteDirPath,obsolete[i]);
		}
	}
1347050
public static void compile(Class<?> cls, File outputPath) {
        if (outputPath == null) {
            throw new NullPointerException("Param 'outputPath' is null.");
        }
        if (!outputPath.isDirectory()) {
            throw new RuntimeException("Param 'outputPath' value should be a path directory. path=" + outputPath);
        }

    }
1370621
private synchronized void checkPath(String logPath) throws ParameterException {
		Validate.notNull(path);
		File cPath = new File(logPath);
		if(!cPath.exists())
			cPath.mkdirs();
		if(!cPath.isDirectory())
			throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!");
	}
874719
public static InputStream getResourceAsStream(String pPath) {
        for (ClassLoader loader : new ClassLoader[] {
                Thread.currentThread().getContextClassLoader(),
                ClassUtil.class.getClassLoader()
        } ) {
            if (loader != null) {
                InputStream is = loader.getResourceAsStream(pPath);
                if (is != null) {
                    return is;
                }
            }
        }
        return null;
    }
1166789
static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager,
            final Path path) {
        return new PathFileObject(fileManager, path) {
            @Override
            String inferBinaryName(Iterable<? extends Path> paths) {
                Path absPath = path.toAbsolutePath();
                for (Path p: paths) {
                    Path ap = p.toAbsolutePath();
                    if (absPath.startsWith(ap)) {
                        try {
                            Path rp = ap.relativize(absPath);
                            if (rp != null) // maybe null if absPath same as ap
                                return toBinaryName(rp);
                        } catch (IllegalArgumentException e) {
                            // ignore this p if cannot relativize path to p
                        }
                    }
                }
                return null;
            }
        };
    }