private boolean canRetrieveAllChunks()

in indexer-reader/src/main/java/org/apache/maven/index/reader/IndexReader.java [200:228]


    private boolean canRetrieveAllChunks() {
        String localChainId = localIndexProperties.getProperty("nexus.index.chain-id");
        String remoteChainId = remoteIndexProperties.getProperty("nexus.index.chain-id");

        // If no chain id, or not the same, do full update
        if (localChainId == null || !localChainId.equals(remoteChainId)) {
            return false;
        }

        try {
            int localLastIncremental =
                    Integer.parseInt(localIndexProperties.getProperty("nexus.index.last-incremental"));
            String currentLocalCounter = String.valueOf(localLastIncremental);
            String nextLocalCounter = String.valueOf(localLastIncremental + 1);
            // check remote props for existence of current or next chunk after local
            for (Object key : remoteIndexProperties.keySet()) {
                String sKey = (String) key;
                if (sKey.startsWith("nexus.index.incremental-")) {
                    String value = remoteIndexProperties.getProperty(sKey);
                    if (currentLocalCounter.equals(value) || nextLocalCounter.equals(value)) {
                        return true;
                    }
                }
            }
        } catch (NumberFormatException e) {
            // fall through
        }
        return false;
    }