コード例 #1
0
ファイル: Tasks.java プロジェクト: masch/sonar
 private void validateCommand(TaskDefinition def) {
   String command = def.getCommand();
   if (StringUtils.isBlank(command)) {
     throw new SonarException(
         "Task definition '" + def.getName() + "' doesn't define task command");
   }
   if (!Pattern.matches(COMMAND_PATTERN, command)) {
     throw new SonarException(
         "Command '"
             + command
             + "' for task definition '"
             + def.getName()
             + "' is not valid and should match "
             + COMMAND_PATTERN);
   }
   if (taskDefByCommand.containsKey(command)) {
     throw new SonarException(
         "Task '"
             + def.getName()
             + "' uses the same command than task '"
             + taskDefByCommand.get(command).getName()
             + "'");
   }
   taskDefByCommand.put(command, def);
 }
コード例 #2
0
ファイル: Tasks.java プロジェクト: masch/sonar
 private void validateDescription(TaskDefinition def) {
   if (StringUtils.isBlank(def.getDescription())) {
     LOG.warn(
         "Task definition {} doesn't define a description. Using name as description.",
         def.getName());
     def.setDescription(def.getName());
   }
 }
コード例 #3
0
ファイル: Tasks.java プロジェクト: masch/sonar
 private void validateTask(TaskDefinition def) {
   Class<? extends Task> taskClass = def.getTask();
   if (taskClass == null) {
     throw new SonarException(
         "Task definition '" + def.getName() + "' doesn't define the associated task class");
   }
   if (taskDefByTask.containsKey(taskClass)) {
     throw new SonarException(
         "Task '"
             + def.getTask().getName()
             + "' is defined twice: first by '"
             + taskDefByTask.get(taskClass).getName()
             + "' and then by '"
             + def.getName()
             + "'");
   }
   taskDefByTask.put(taskClass, def);
 }
コード例 #4
0
ファイル: Tasks.java プロジェクト: masch/sonar
 private void validateName(TaskDefinition def) {
   if (StringUtils.isBlank(def.getName())) {
     throw new SonarException(
         "Task definition for task '" + def.getTask().getName() + "' doesn't define task name");
   }
 }