/** {@inheritDoc} */ @Override public Map<String, SubmoduleStatus> call() throws GitAPIException { checkCallable(); try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); Map<String, SubmoduleStatus> statuses = new HashMap<>(); while (generator.next()) { SubmoduleStatus status = getStatus(generator); statuses.put(status.getPath(), status); } return statuses; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e); } }
int c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name)); name.append((char) c); else throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name));
/** * Parse and load the repository specific configuration. * <p> * The default implementation reads {@code gitDir/config}, or returns an * empty configuration if gitDir was not set. * * @return the repository's configuration. * @throws java.io.IOException * the configuration is not available. */ protected Config loadConfig() throws IOException { if (getGitDir() != null) { // We only want the repository's configuration file, and not // the user file, as these parameters must be unique to this // repository and not inherited from other files. // File path = safeFS().resolve(getGitDir(), Constants.CONFIG); FileBasedConfig cfg = new FileBasedConfig(path, safeFS()); try { cfg.load(); } catch (ConfigInvalidException err) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().repositoryConfigFileInvalid, path .getAbsolutePath(), err.getMessage())); } return cfg; } else { return new Config(); } }
throw new ConfigInvalidException( JGitText.get().newlineInQuotesNotAllowed); switch (c) { case -1: throw new ConfigInvalidException(JGitText.get().endOfFileInEscape);
throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e);
int c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); throw new ConfigInvalidException(JGitText.get().badEntryDelimiter); break; } else throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEntryName, name));
throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e);
private void addIncludedConfig(final List<ConfigLine> newEntries, ConfigLine line, int depth) throws ConfigInvalidException { if (!line.name.equalsIgnoreCase("path") || //$NON-NLS-1$ line.value == null || line.value.equals(MAGIC_EMPTY_VALUE)) { throw new ConfigInvalidException(MessageFormat.format( JGitText.get().invalidLineInConfigFileWithParam, line)); } byte[] bytes = readIncludedConfig(line.value); if (bytes == null) { return; } String decoded; if (isUtf8(bytes)) { decoded = RawParseUtils.decode(UTF_8, bytes, 3, bytes.length); } else { decoded = RawParseUtils.decode(bytes); } try { newEntries.addAll(fromTextRecurse(decoded, depth + 1, line.value)); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, line.value), e); } }
throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new JGitInternalException(e.getMessage(), e);
/** * {@inheritDoc} * * @since 4.10 */ @Override protected byte[] readIncludedConfig(String relPath) throws ConfigInvalidException { final File file; if (relPath.startsWith("~/")) { //$NON-NLS-1$ file = fs.resolve(fs.userHome(), relPath.substring(2)); } else { file = fs.resolve(configFile.getParentFile(), relPath); } if (!file.exists()) { return null; } try { return IO.readFully(file); } catch (IOException ioe) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, relPath), ioe); } } }
throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new InvalidConfigurationException(e.getMessage(), e);
throw new ConfigInvalidException( JGitText.get().newlineInQuotesNotAllowed); switch (c) { case -1: throw new ConfigInvalidException(JGitText.get().endOfFileInEscape); case '\n': continue; continue; default: throw new ConfigInvalidException(MessageFormat.format( JGitText.get().badEscape, Character.valueOf(((char) c))));
void setConfig(FileBasedConfig config) throws IOException { editableConfig = config; try { editableConfig.clear(); editableConfig.load(); } catch (ConfigInvalidException e) { throw new IOException(e.getMessage()); } initControlsFromConfig(); }
private List<ConfigLine> fromTextRecurse(String text, int depth, String includedFrom) throws ConfigInvalidException { if (depth > MAX_DEPTH) { throw new ConfigInvalidException( JGitText.get().tooManyIncludeRecursions); throw new ConfigInvalidException(JGitText.get().badGroupHeader); e.suffix = ""; //$NON-NLS-1$ throw new ConfigInvalidException(JGitText.get().invalidLineInConfigFile);
throw new JGitInternalException(e.getMessage(), e); } catch (ConfigInvalidException e) { throw new InvalidConfigurationException(e.getMessage(), e);
.format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e);
private static StoredConfig loadRepoScopedConfig(Repository repo) { StoredConfig c = repo.getConfig(); try { c.load(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } catch (ConfigInvalidException e) { Activator.handleError(e.getMessage(), e, true); } return c; }
throw new ConfigInvalidException( JGitText.get().newlineInQuotesNotAllowed); switch (c) { case -1: throw new ConfigInvalidException(JGitText.get().endOfFileInEscape);
private static StoredConfig loadUserScopedConfig() { StoredConfig c = SystemReader.getInstance().openUserConfig(null, FS.DETECTED); try { c.load(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } catch (ConfigInvalidException e) { Activator.handleError(e.getMessage(), e, true); } return c; }
int c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); c = in.read(); if (c < 0) throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile); throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name)); name.append((char) c); else throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name));