private static void verifySourceCodeFileHasCorrectPackageName(File source,
            PackDetails packDetails) throws IOException {
        final String requiredPackage = "package " + packDetails.PackageName + ";";
        System.out.println("Verifying source file " + source + " for package name validity ("
                + requiredPackage + ")...");
        if (!source.exists()) {
            throw new InvalidPackConfiguration(source.getAbsolutePath(),
                    "Source file does not exist!");
        }
        if (!source.isFile()) {
            throw new InvalidPackConfiguration(source.getAbsolutePath(),
                    "Specified file is not a file!");
        }

        BufferedReader in = new BufferedReader(new FileReader(source));
        String strLine = null;
        boolean found = false;
        try {
            while (!found && (strLine = in.readLine()) != null) {
                if (strLine.equals(requiredPackage))
                    found = true;
            }
        } finally {
            in.close();
        }

        if (!found) {
            throw new InvalidPackConfiguration(source.getAbsolutePath(),
                    "Package name is invalid, it should be " + packDetails.PackageName);
        }
    }