Example usage for org.apache.commons.io FilenameUtils separatorsToUnix

List of usage examples for org.apache.commons.io FilenameUtils separatorsToUnix

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils separatorsToUnix.

Prototype

public static String separatorsToUnix(String path) 

Source Link

Document

Converts all separators to the Unix separator of forward slash.

Usage

From source file:com.ariht.maven.plugins.config.generator.ConfigGeneratorImpl.java

/**
 * Read properties from filter file and substitute template place-holders.
 *
 * Typical output is to .../filter-dir/filter-name-no-extension/template-dir/template.name
 *//*from w ww.j a  va 2 s. com*/
private void generateConfig(final FileInfo template, final FileInfo filter, final String outputBasePath,
        final StrSubstitutor strSubstitutor, final Map<String, Set<String>> missingPropertiesByFilename,
        final boolean missingPropertyFound) throws IOException, ConfigurationException, MojoFailureException {

    final String outputDirectory = createOutputDirectory(template, filter, outputBasePath);
    final String templateFilename = template.getFile().getName();
    final String outputFilename = FilenameUtils.separatorsToUnix(outputDirectory + templateFilename);

    if (configGeneratorParameters.isLogOutput()) {
        log.info("Creating : " + StringUtils.replace(outputFilename, outputBasePath, ""));
    } else if (log.isDebugEnabled()) {
        log.debug("Creating : " + String.valueOf(outputFilename));
    }
    log.debug("Applying filter : " + filter.toString() + " to template : " + template.toString());

    final String rawTemplate = FileUtils.readFileToString(template.getFile());
    final String processedTemplate = strSubstitutor.replace(rawTemplate);

    // No point in running regex against long strings if properties are all present
    if (missingPropertyFound) {
        checkForMissingProperties(filter.getFile().getAbsolutePath(), processedTemplate,
                missingPropertiesByFilename);
    }

    // Only write out the generated io if there were no errors or errors are specifically ignored
    if (StringUtils.isNotBlank(configGeneratorParameters.getEncoding())) {
        FileUtils.writeStringToFile(new File(outputFilename), processedTemplate,
                configGeneratorParameters.getEncoding());
    } else {
        FileUtils.writeStringToFile(new File(outputFilename), processedTemplate);
    }
}

From source file:com.thoughtworks.go.publishers.GoArtifactsManipulator.java

private String removeLeadingSlash(File artifactDest) {
    return removeStart(FilenameUtils.separatorsToUnix(artifactDest.getPath()), "/");
}

From source file:com.thoughtworks.go.domain.ArtifactPlan.java

protected String destinationURL(File rootPath, File file, String src, String dest) {
    String trimmedPattern = rtrimStandardrizedWildcardTokens(src);
    if (StringUtils.equals(FilenameUtils.separatorsToUnix(trimmedPattern),
            FilenameUtils.separatorsToUnix(src))) {
        return dest;
    }/* w ww . ja va2s .co  m*/
    String trimmedPath = removeStart(subtractPath(rootPath, file),
            FilenameUtils.separatorsToUnix(trimmedPattern));
    if (!StringUtils.startsWith(trimmedPath, "/") && StringUtils.isNotEmpty(trimmedPath)) {
        trimmedPath = "/" + trimmedPath;
    }
    return dest + trimmedPath;
}

From source file:de.hybris.platform.impex.jalo.ImpExMediasImportTest.java

/**
 * Calls the <code>importData</code> method of given handler with an zip-file path in different formats.
 * //from  w  w w  .  j av a 2s.c  om
 * @param handler
 *           handler which will be used for test
 * @param media
 *           media where the data will be imported to
 */
private void mediaImportFromZip(final MediaDataHandler handler, final Media media) {
    File testFile = null;
    try {
        testFile = File.createTempFile("mediaImportTest", ".zip");
        final ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(testFile));
        zos.putNextEntry(new ZipEntry(new File("files", "dummy.txt").getPath()));
        zos.putNextEntry(new ZipEntry(new File("files", "test.txt").getPath()));
        final PrintWriter printer = new PrintWriter(zos);
        printer.print("testest");
        printer.flush();
        zos.flush();
        printer.close();
        zos.close();
    } catch (final IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    final String unixPathRel = ImpExConstants.Syntax.ZIP_BASED_FILE_PATH_PREFIX
            + FilenameUtils.separatorsToUnix(testFile.getPath()) + "&files/test.txt";
    final String unixPathAbs = ImpExConstants.Syntax.ZIP_BASED_FILE_PATH_PREFIX
            + FilenameUtils.separatorsToUnix(testFile.getAbsolutePath()) + "&files/test.txt";
    final String winPathRel = ImpExConstants.Syntax.ZIP_BASED_FILE_PATH_PREFIX
            + FilenameUtils.separatorsToWindows(testFile.getPath()) + "&files\\test.txt";
    final String winPathAbs = ImpExConstants.Syntax.ZIP_BASED_FILE_PATH_PREFIX
            + FilenameUtils.separatorsToWindows(testFile.getAbsolutePath()) + "&files\\test.txt";
    try {
        mediaImport(handler, media, unixPathRel, "testest");
        mediaImport(handler, media, unixPathAbs, "testest");
        mediaImport(handler, media, winPathRel, "testest");
        mediaImport(handler, media, winPathAbs, "testest");
    } catch (final Exception e) {
        fail(e.getMessage());
    }
    if (!testFile.delete()) {
        fail("Can not delete temp file: " + testFile.getPath());
    }
}

From source file:com.thoughtworks.go.util.FileUtil.java

public static String subtractPath(File rootPath, File file) {
    String fullPath = FilenameUtils.separatorsToUnix(file.getParentFile().getPath());
    String basePath = FilenameUtils.separatorsToUnix(rootPath.getPath());
    return StringUtils.removeStart(StringUtils.removeStart(fullPath, basePath), "/");
}

From source file:eu.asterics.mw.services.ResourceRegistry.java

/**
 * Returns the URI of the requested resource.
 * Generally the URI is not tested for existence it just constructs a valid URI for the given parameters.
 * The returned URI can be opened with {@link URI#toURL()} and {@link URL#openStream()}, or better use directly {@link ResourceRegistry#getResourceInputStream(String, RES_TYPE)}.
 * If you know that it is a file path URI and need to perform file operations, convert it to a file with {@link ResourceRegistry#toFile(URI)}.
 * //  ww  w .  j a  va2s . c o  m
 * resourcePath can be 
 *     an absolute URL-conforming string (e.g. file://, http://). In this case the string must be encoded correctly.
 *   or an absolute or relative file path (windows or unix-style). In this case {@link File} class and its method {@link File#toURI()} is used. The file path may contain both \\ and / seperators. Relative resourcePaths are resolved against the ARE.baseURI or a subfolder depending on the provided type ({@link RES_TYPE}). 
        
 * The type ({@link RES_TYPE}) determines the type of the resource which is used to append the respective subfolder for the resource type (e.g. data, models).
 * In case of {@value RES_TYPE#DATA} a 4 step approach is used to guess the correct subfolder (e.g. a sensor.facetrackerLK or pictures):
 *   Step 1: If resource ARE.baseURI/data/{resourcePath} exists, return
 *   Step 2: If componentTypeId!=null and resource ARE.baseURI/{DATA_FOLDER}/{componentTypeId}/{resourcePath} exists, return
 *   Step 3: If componentTypeId!=null and resource ARE.baseURI/{DATA_FOLDER}/{*componentTypeId*}/{resourcePath} exists, return
 *   Step 4: If resource ARE.baseURI/{DATA_FOLDER}/{*}/{resourcePath} exists, return
 *   Default: If none of the above was successful, ARE.baseURI/data/{resourcePath} is returned.
 * In case of {@value RES_TYPE#ANY} no subfolder is appended. 
 * 
 * @param resourcePath an absolute URL-conforming string or an absolute or relative file path string
 * @param type The resource type {@link RES_TYPE} for the requested resource
 * @param componentTypeId Hint for a better guessing of a {@value RES_TYPE#DATA} resource.
 * @param runtimeComponentInstanceId Hint for a better guessing of a {@value RES_TYPE#DATA} resource.
 * @return a valid URI.
 * @throws URISyntaxException
 */
public URI getResource(String resourcePath, RES_TYPE type, String componentTypeId,
        String runtimeComponentInstanceId) throws URISyntaxException {
    URI uri = null;
    File resFilePath = null;

    try {
        URL url = new URL(resourcePath);
        AstericsErrorHandling.instance.getLogger().fine("Resource URL: " + url);
        uri = url.toURI();
    } catch (MalformedURLException e) {
        //Fix the string first, because it could have \ and / mixed up and stuff and convert it to path with unix-style path seperator (/)
        //Thanks to apache commons io lib this is very easy!! :-)
        final String resourcePathSlashified = FilenameUtils.separatorsToUnix(resourcePath);
        //AstericsErrorHandling.instance.getLogger().fine("resourceNameArg: "+resourcePath+", resourceName after normalization: "+resourcePathSlashified+", concat: "+FilenameUtils.concat(getAREBaseURI().getPath(), resourcePath));

        File resourceNameAsFile = new File(resourcePathSlashified);
        //AstericsErrorHandling.instance.getLogger().fine("resourceName: "+resourcePathSlashified+", resourceNameAsFile: "+resourceNameAsFile+", resourceNameAsFile.toURI: "+resourceNameAsFile.toURI());

        if (!resourceNameAsFile.isAbsolute()) {
            switch (type) {
            case MODEL:
                resFilePath = resolveRelativeFilePath(toAbsolute(MODELS_FOLDER), resourcePathSlashified, false);
                break;
            case PROFILE:
                resFilePath = resolveRelativeFilePath(toAbsolute(PROFILE_FOLDER), resourcePathSlashified,
                        false);
                break;
            case LICENSE:
                resFilePath = resolveRelativeFilePath(toAbsolute(LICENSES_FOLDER), resourcePathSlashified,
                        false);
                break;
            case DATA:
                /*
                 * 1) Check resourceName directly, if it exists return
                 * 2) Check resourceName with exactly matching componentTypeId, if it exists return
                 * 3) Check resourceName with first subfolder containing componentTypeId, if it exists return
                 * 4) Check all subfolders (only first level) and resolve against the given resourceName, if it exists return 
                 */
                URI dataFolderURI = toAbsolute(DATA_FOLDER);
                File dataFolderFile = ResourceRegistry.toFile(dataFolderURI);

                //1) Check resourceName directly, if it exists return
                resFilePath = resolveRelativeFilePath(dataFolderFile, resourcePathSlashified, false);
                if (resFilePath.exists()) {
                    break;
                }

                if (componentTypeId != null) {
                    //2) Check resourceName with exactly matching componentTypeId, if it exists return
                    resFilePath = resolveRelativeFilePath(dataFolderFile,
                            componentTypeId + "/" + resourcePathSlashified, false);
                    if (resFilePath.exists()) {
                        break;
                    }

                    //3) Check resourceName with first subfolder containing componentTypeId (but only last part of asterics.facetrackerLK or sensor.facetrackerLK)
                    //if it exists return
                    String[] componentTypeIdSplit = componentTypeId.split("\\.");
                    //split returns the given string as element 0 if the regex patterns was not found.
                    final String componentTypeIdLC = componentTypeIdSplit[componentTypeIdSplit.length - 1]
                            .toLowerCase();

                    File[] dataSubFolderFiles = dataFolderFile.listFiles(new FileFilter() {
                        @Override
                        public boolean accept(File dirFile) {
                            //AstericsErrorHandling.instance.getLogger().fine("Step3, dirFile: "+dirFile);
                            if (dirFile.isDirectory() && dirFile.exists()) {
                                //lowercase name contains lowercase componentTypeId
                                return (dirFile.getName().toLowerCase().indexOf(componentTypeIdLC) > -1);
                            }
                            return false;
                        }
                    });
                    //AstericsErrorHandling.instance.getLogger().fine("Data, Step3, resourceName="+resourceName+", componentTypeIdLC="+componentTypeIdLC+", runtimeComponentInstanceId="+runtimeComponentInstanceId+", dataSubFolderFiless <"+Arrays.toString(dataSubFolderFiles)+">");
                    if (dataSubFolderFiles.length > 0) {
                        resFilePath = resolveRelativeFilePath(dataSubFolderFiles[0], resourcePathSlashified,
                                false);
                        if (resFilePath.exists()) {
                            break;
                        }
                    }
                }

                //4) Check all subfolders (only first level) and resolve against the given resourceName, if it exists return
                File[] dataSubFolderFiles = dataFolderFile.listFiles(new FileFilter() {
                    @Override
                    public boolean accept(File dirFile) {
                        //AstericsErrorHandling.instance.getLogger().fine("Step3, dirFile: "+dirFile);
                        if (dirFile.isDirectory() && dirFile.exists()) {
                            File resourceFile;
                            //resourceFile = toFile(dirFile.toURI().resolve(resourceName));
                            resourceFile = resolveRelativeFilePath(dirFile, resourcePathSlashified, false);
                            return resourceFile.exists();
                        }
                        return false;
                    }
                });
                //AstericsErrorHandling.instance.getLogger().fine("Data, Step4, resourceName="+resourceName+", componentTypeId="+componentTypeId+", runtimeComponentInstanceId="+runtimeComponentInstanceId+", dataSubFolderFiless <"+Arrays.toString(dataSubFolderFiles)+">");
                if (dataSubFolderFiles.length > 0) {
                    resFilePath = resolveRelativeFilePath(dataSubFolderFiles[0], resourcePathSlashified, false);
                    if (resFilePath.exists()) {
                        break;
                    }
                }

                break;
            case IMAGE:
                resFilePath = resolveRelativeFilePath(toAbsolute(IMAGES_FOLDER), resourcePathSlashified, false);
                break;
            case STORAGE:
                resFilePath = resolveRelativeFilePath(toAbsolute(STORAGE_FOLDER), resourcePathSlashified,
                        false);
                break;
            case TMP:
                resFilePath = resolveRelativeFilePath(toAbsolute(TMP_FOLDER), resourcePathSlashified, false);
                break;
            default:
                resFilePath = resolveRelativeFilePath(getAREBaseURIFile(), resourcePathSlashified, false);
                break;
            }

            uri = resFilePath.toURI();
        } else {
            uri = resourceNameAsFile.toURI();
        }
    }
    //System.out.println("file absolute: "+resourceNameAsFile.isAbsolute()+", uri absolute: "+uri.isAbsolute()+", uri opaque: "+uri.isOpaque());
    //System.out.println("resource File.toURI: "+resourceNameAsFile.toURI());
    //AstericsErrorHandling.instance.getLogger().fine("URI before normalize: "+uri.normalize());
    if (uri != null) {
        uri = uri.normalize();
    }
    AstericsErrorHandling.instance.getLogger()
            .fine("resourceName=" + resourcePath + ", componentTypeId=" + componentTypeId
                    + ", runtimeComponentInstanceId=" + runtimeComponentInstanceId + ", Resource URI <" + uri
                    + ">");
    return uri;
}

From source file:com.searchcode.app.jobs.IndexSvnRepoJob.java

/**
 * Indexes all the documents in the repository changed file effectively performing a delta update
 * Should only be called when there is a genuine update IE something was indexed previously and
 * has has a new commit./*  w  ww  .  j  a  va2 s . com*/
 */
public void indexDocsByDelta(Path path, String repoName, String repoLocations, String repoRemoteLocation,
        RepositoryChanged repositoryChanged) {
    SearchcodeLib scl = Singleton.getSearchCodeLib(); // Should have data object by this point
    Queue<CodeIndexDocument> codeIndexDocumentQueue = Singleton.getCodeIndexQueue();
    String fileRepoLocations = FilenameUtils.separatorsToUnix(repoLocations);

    Singleton.getLogger().info("Repository Changed File List " + repositoryChanged.getChangedFiles());

    for (String changedFile : repositoryChanged.getChangedFiles()) {

        Singleton.getLogger().info("Indexing " + changedFile + " in " + repoName);

        while (CodeIndexer.shouldPauseAdding()) {
            Singleton.getLogger().info("Pausing parser.");
            try {
                Thread.sleep(SLEEPTIME);
            } catch (InterruptedException ex) {
            }
        }

        String[] split = changedFile.split("/");
        String fileName = split[split.length - 1];
        changedFile = fileRepoLocations + repoName + "/" + changedFile;

        String md5Hash = Values.EMPTYSTRING;
        List<String> codeLines = null;

        try {
            codeLines = Helpers.readFileLines(changedFile, MAXFILELINEDEPTH);
        } catch (IOException ex) {
            Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                    + "\n with message: " + ex.getMessage());
            break;
        }

        try {
            FileInputStream fis = new FileInputStream(new File(changedFile));
            md5Hash = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
            fis.close();
        } catch (IOException ex) {
            Singleton.getLogger().warning("Unable to generate MD5 for " + changedFile);
        }

        if (scl.isMinified(codeLines)) {
            Singleton.getLogger().info("Appears to be minified will not index  " + changedFile);
            break;
        }

        String languageName = scl.languageGuesser(changedFile, codeLines);
        String fileLocation = changedFile.replace(fileRepoLocations, Values.EMPTYSTRING).replace(fileName,
                Values.EMPTYSTRING);
        String fileLocationFilename = changedFile.replace(fileRepoLocations, Values.EMPTYSTRING);
        String repoLocationRepoNameLocationFilename = changedFile;

        String newString = getBlameFilePath(fileLocationFilename);
        String codeOwner = getInfoExternal(codeLines.size(), repoName, fileRepoLocations, newString).getName();

        if (codeLines != null) {
            if (this.LOWMEMORY) {
                try {
                    CodeIndexer.indexDocument(new CodeIndexDocument(repoLocationRepoNameLocationFilename,
                            repoName, fileName, fileLocation, fileLocationFilename, md5Hash, languageName,
                            codeLines.size(), StringUtils.join(codeLines, " "), repoRemoteLocation, codeOwner));
                } catch (IOException ex) {
                    Singleton.incrementCodeIndexLinesCount(codeLines.size());
                    Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                            + "\n with message: " + ex.getMessage());
                }
            } else {
                codeIndexDocumentQueue.add(new CodeIndexDocument(repoLocationRepoNameLocationFilename, repoName,
                        fileName, fileLocation, fileLocationFilename, md5Hash, languageName, codeLines.size(),
                        StringUtils.join(codeLines, " "), repoRemoteLocation, codeOwner));
            }
        }
    }

    for (String deletedFile : repositoryChanged.getDeletedFiles()) {
        Singleton.getLogger().info("Missing from disk, removing from index " + deletedFile);
        try {
            CodeIndexer.deleteByFileLocationFilename(deletedFile);
        } catch (IOException ex) {
            Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                    + "\n with message: " + ex.getMessage());
        }
    }
}

From source file:com.googlecode.fascinator.harvester.workflow.WorkflowHarvester.java

/**
 * Store the provided file in storage. Ensure proper queue routing is set
 * in object properties.//from   w ww .  j a  va  2  s  .com
 *
 * @param file : The file to store
 * @return String : The OID of the stored object
 * @throws HarvesterException : if there was an error accessing storage
 * @throws StorageException : if there was an error writing to storage
 */
private String createDigitalObject(File file) throws HarvesterException, StorageException {
    String objectId;
    DigitalObject object;
    if (forceUpdate) {
        object = StorageUtils.storeFile(getStorage(), file, !forceLocalStorage);
    } else {
        String oid = StorageUtils.generateOid(file);
        String pid = StorageUtils.generatePid(file);
        object = getStorage().createObject(oid);
        if (forceLocalStorage) {
            try {
                object.createStoredPayload(pid, new FileInputStream(file));
            } catch (FileNotFoundException ex) {
                throw new HarvesterException(ex);
            }
        } else {
            object.createLinkedPayload(pid, file.getAbsolutePath());
        }

    }
    // update object metadata
    Properties props = object.getMetadata();
    props.setProperty("render-pending", "true");
    props.setProperty("file.path", FilenameUtils.separatorsToUnix(file.getAbsolutePath()));
    objectId = object.getId();

    // Store rendition information if we have it
    String ext = FilenameUtils.getExtension(file.getName());
    for (String chain : renderChains.keySet()) {
        Map<String, List<String>> details = renderChains.get(chain);
        if (details.get("fileTypes").contains(ext)) {
            storeList(props, details, "harvestQueue");
            storeList(props, details, "indexOnHarvest");
            storeList(props, details, "renderQueue");
        }
    }

    object.close();
    return objectId;
}

From source file:be.fedict.eid.applet.service.signer.ooxml.OOXMLSignatureFacet.java

private void addManifestReferences(XMLSignatureFactory signatureFactory, Document document,
        List<Reference> manifestReferences)
        throws IOException, JAXBException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
    CTTypes contentTypes = getContentTypes();
    List<String> relsEntryNames = getRelsEntryNames();
    DigestMethod digestMethod = signatureFactory.newDigestMethod(this.digestAlgo.getXmlAlgoId(), null);
    Set<String> digestedPartNames = new HashSet<String>();
    for (String relsEntryName : relsEntryNames) {
        CTRelationships relationships = getRelationships(relsEntryName);
        List<CTRelationship> relationshipList = relationships.getRelationship();
        RelationshipTransformParameterSpec parameterSpec = new RelationshipTransformParameterSpec();
        for (CTRelationship relationship : relationshipList) {
            String relationshipType = relationship.getType();
            STTargetMode targetMode = relationship.getTargetMode();
            if (null != targetMode) {
                LOG.debug("TargetMode: " + targetMode.name());
                if (targetMode == STTargetMode.EXTERNAL) {
                    /*/*from w w w .j a v a 2 s . c  o m*/
                     * ECMA-376 Part 2 - 3rd edition
                     * 
                     * 13.2.4.16 Manifest Element
                     * 
                     * "The producer shall not create a Manifest element that references any data outside of the package."
                     */
                    continue;
                }
            }
            if (false == OOXMLSignatureFacet.isSignedRelationship(relationshipType)) {
                continue;
            }
            String baseUri = "/" + relsEntryName.substring(0, relsEntryName.indexOf("_rels/"));
            String relationshipTarget = relationship.getTarget();
            String partName = FilenameUtils
                    .separatorsToUnix(FilenameUtils.normalize(baseUri + relationshipTarget));
            LOG.debug("part name: " + partName);
            String relationshipId = relationship.getId();
            parameterSpec.addRelationshipReference(relationshipId);
            String contentType = getContentType(contentTypes, partName);
            if (relationshipType.endsWith("customXml")) {
                if (false == contentType.equals("inkml+xml") && false == contentType.equals("text/xml")) {
                    LOG.debug("skipping customXml with content type: " + contentType);
                    continue;
                }
            }
            if (false == digestedPartNames.contains(partName)) {
                /*
                 * We only digest a part once.
                 */
                Reference reference = signatureFactory.newReference(partName + "?ContentType=" + contentType,
                        digestMethod);
                manifestReferences.add(reference);
                digestedPartNames.add(partName);
            }
        }
        if (false == parameterSpec.getSourceIds().isEmpty()) {
            List<Transform> transforms = new LinkedList<Transform>();
            transforms.add(
                    signatureFactory.newTransform(RelationshipTransformService.TRANSFORM_URI, parameterSpec));
            transforms.add(signatureFactory.newTransform(CanonicalizationMethod.INCLUSIVE,
                    (TransformParameterSpec) null));
            Reference reference = signatureFactory.newReference(
                    "/" + relsEntryName
                            + "?ContentType=application/vnd.openxmlformats-package.relationships+xml",
                    digestMethod, transforms, null, null);

            manifestReferences.add(reference);
        }
    }
}

From source file:com.searchcode.app.jobs.IndexGitRepoJob.java

/**
 * Indexes all the documents in the repository changed file effectively performing a delta update
 * Should only be called when there is a genuine update IE something was indexed previously and
 * has has a new commit.//from  w ww.  j  a v a 2  s . c  o m
 */
public void indexDocsByDelta(Path path, String repoName, String repoLocations, String repoRemoteLocation,
        RepositoryChanged repositoryChanged) {
    SearchcodeLib scl = Singleton.getSearchCodeLib(); // Should have data object by this point
    Queue<CodeIndexDocument> codeIndexDocumentQueue = Singleton.getCodeIndexQueue();
    String fileRepoLocations = FilenameUtils.separatorsToUnix(repoLocations);

    for (String changedFile : repositoryChanged.getChangedFiles()) {

        while (CodeIndexer.shouldPauseAdding()) {
            Singleton.getLogger().info("Pausing parser.");
            try {
                Thread.sleep(SLEEPTIME);
            } catch (InterruptedException ex) {
            }
        }

        String[] split = changedFile.split("/");
        String fileName = split[split.length - 1];
        changedFile = fileRepoLocations + "/" + repoName + "/" + changedFile;

        String md5Hash = Values.EMPTYSTRING;
        List<String> codeLines = null;

        try {
            codeLines = Helpers.readFileLines(changedFile, this.MAXFILELINEDEPTH);
        } catch (IOException ex) {
            Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                    + "\n with message: " + ex.getMessage());
            break;
        }

        try {
            FileInputStream fis = new FileInputStream(new File(changedFile));
            md5Hash = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis);
            fis.close();
        } catch (IOException ex) {
            Singleton.getLogger().warning("Unable to generate MD5 for " + changedFile);
        }

        if (scl.isMinified(codeLines)) {
            Singleton.getLogger().info("Appears to be minified will not index  " + changedFile);
            break;
        }

        String languageName = scl.languageGuesser(changedFile, codeLines);
        String fileLocation = changedFile.replace(fileRepoLocations, Values.EMPTYSTRING).replace(fileName,
                Values.EMPTYSTRING);
        String fileLocationFilename = changedFile.replace(fileRepoLocations, Values.EMPTYSTRING);
        String repoLocationRepoNameLocationFilename = changedFile;

        String newString = getBlameFilePath(fileLocationFilename);
        List<CodeOwner> owners;
        if (this.USESYSTEMGIT) {
            owners = getBlameInfoExternal(codeLines.size(), repoName, fileRepoLocations, newString);
        } else {
            owners = getBlameInfo(codeLines.size(), repoName, fileRepoLocations, newString);
        }
        String codeOwner = scl.codeOwner(owners);

        if (codeLines != null) {
            if (this.LOWMEMORY) {
                try {
                    CodeIndexer.indexDocument(new CodeIndexDocument(repoLocationRepoNameLocationFilename,
                            repoName, fileName, fileLocation, fileLocationFilename, md5Hash, languageName,
                            codeLines.size(), StringUtils.join(codeLines, " "), repoRemoteLocation, codeOwner));
                } catch (IOException ex) {
                    Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                            + "\n with message: " + ex.getMessage());
                }
            } else {
                Singleton.incrementCodeIndexLinesCount(codeLines.size());
                codeIndexDocumentQueue.add(new CodeIndexDocument(repoLocationRepoNameLocationFilename, repoName,
                        fileName, fileLocation, fileLocationFilename, md5Hash, languageName, codeLines.size(),
                        StringUtils.join(codeLines, " "), repoRemoteLocation, codeOwner));
            }
        }
    }

    for (String deletedFile : repositoryChanged.getDeletedFiles()) {
        Singleton.getLogger().info("Missing from disk, removing from index " + deletedFile);
        try {
            CodeIndexer.deleteByFileLocationFilename(deletedFile);
        } catch (IOException ex) {
            Singleton.getLogger().warning("ERROR - caught a " + ex.getClass() + " in " + this.getClass()
                    + "\n with message: " + ex.getMessage());
        }
    }
}