private Map getManualMappedLicenses()

in build-tools/src/main/java/co/elastic/otel/android/compilation/tools/tasks/subprojects/PomLicensesCollectorTask.java [57:83]


    private Map<String, String> getManualMappedLicenses() {
        Map<String, String> mappedLicenses = new HashMap<>();
        File manualMappingFile = getManualLicenseMapping().getOrNull();

        if (manualMappingFile == null) {
            return mappedLicenses;
        }

        try {
            BufferedReader reader = new BufferedReader(new FileReader(manualMappingFile));
            String line;
            while ((line = reader.readLine()) != null) {
                String[] parts = line.split("\\|");
                String dependencyUri = parts[0];
                String licenseId = parts[1];
                if (mappedLicenses.containsKey(dependencyUri)) {
                    throw new RuntimeException("Duplicated dependency license mapping for: " + licenseId);
                }
                mappedLicenses.put(dependencyUri, licenseId);
            }
            reader.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        return mappedLicenses;
    }