Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

FileLine
com/meltmedia/cadmium/core/worker/ConfigCoordinatedWorkerImpl.java162
com/meltmedia/cadmium/core/worker/CoordinatedWorkerImpl.java175
    doneMessage.setCommand(ProtocolMessage.CONFIG_UPDATE_FAILED);
    if(repo != null) {
      doneMessage.getProtocolParameters().put("repo", repo);
    }
    if(branch != null) {
      doneMessage.getProtocolParameters().put("branch", branch);
    }
    if(sha != null) {
      doneMessage.getProtocolParameters().put("sha", sha);
    }
    if(openId != null) {
      doneMessage.getProtocolParameters().put("openId", openId);
    }
    if(uuid != null) {
      doneMessage.getProtocolParameters().put("uuid", uuid);
    }
    try {
      sender.sendMessage(doneMessage, null);
    } catch (Exception e) {
      log.warn("Failed to send fail message: {}", e.getMessage());
    }
  }

  @Override
  public void close() throws IOException {
    try {
      if(!pool.isShutdown() || !pool.isTerminated()) {
        pool.shutdownNow();
      }
    } catch(Throwable t) {
      throw new IOException(t);
    } finally {
      pool = null;
    }
  }

}
FileLine
com/meltmedia/cadmium/core/commands/ConfigUpdateFailedCommandAction.java57
com/meltmedia/cadmium/core/commands/UpdateFailedCommandAction.java57
      lifecycleService.updateMyConfigState(UpdateState.IDLE);
      if(historyManager != null) {
        String repo = "";
        if(ctx.getMessage().getProtocolParameters().containsKey("repo")) {
          repo = ctx.getMessage().getProtocolParameters().get("repo");
        }
        String branch = "";
        if(ctx.getMessage().getProtocolParameters().containsKey("branch")) {
          branch = ctx.getMessage().getProtocolParameters().get("branch");
        }
        String sha = "";
        if(ctx.getMessage().getProtocolParameters().containsKey("sha")) {
          sha = ctx.getMessage().getProtocolParameters().get("sha");
        }
        String openId = "";
        if(ctx.getMessage().getProtocolParameters().containsKey("openId")) {
          openId = ctx.getMessage().getProtocolParameters().get("openId");
        }
        historyManager.logEvent(EntryType.CONFIG, repo, branch, sha, openId, "", ctx.getMessage().getProtocolParameters().get("uuid"), FAILED_LOG_MESSAGE, false, false, true, true);
FileLine
com/meltmedia/cadmium/core/messaging/ChannelMember.java47
com/meltmedia/cadmium/status/StatusMember.java55
  public Address getAddress() {
    return address;
  }

  public boolean isCoordinator() {
    return coordinator;
  }

  public void setCoordinator(boolean coordinator) {
    this.coordinator = coordinator;
  }

  public boolean isMine() {
    return mine;
  }

  public UpdateState getState() {
    return state;
  }

  public void setState(UpdateState state) {
    this.state = state;
  }

  public UpdateState getConfigState() {
    return configState;
  }

  public void setConfigState(UpdateState configState) {
    this.configState = configState;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((address == null) ? 0 : address.toString().hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
FileLine
com/meltmedia/cadmium/core/worker/CleanUpTask.java43
com/meltmedia/cadmium/core/worker/ParseConfigDirectoryTask.java41
  }

  @Override
  public Boolean call() throws Exception {
    if(previousTask != null) {
      try{
        Boolean lastResponse = previousTask.get();
        if(lastResponse != null && !lastResponse.booleanValue() ) {
          throw new Exception("Previous task failed");
        }
      } catch(Exception e) {
        log.warn("Work failed!", e);
        listener.workFailed(properties.get("repo"), properties.get("branch"), properties.get("sha"), properties.get("openId"), properties.get("uuid"));
        return false;
      }
    }
    
    log.info("Cleaning up directories");
FileLine
com/meltmedia/cadmium/core/worker/CheckConfigInitializedTask.java56
com/meltmedia/cadmium/core/worker/CheckInitializedTask.java62
  public CheckConfigInitializedTask setExecutor(ExecutorService pool) {
    this.pool = pool;
    return this;
  }

  @Override
  public Boolean call() throws Exception {
    GitService git = null;
    try {
      if((git = futureTask.get()) == null) {
        File gitCheckout = new File(new File(sharedContentRoot, warName), "git-checkout");
        if(gitCheckout.exists() && gitCheckout.isDirectory()) {
          try {
            git = GitService.createGitService(gitCheckout.getAbsolutePath());
            gitInit.setGitService(git);
          } catch(Exception e){
            logger.warn("Config Git Service did not initialize.", e);
FileLine
com/meltmedia/cadmium/core/git/GithubConfigSessionFactory.java74
com/meltmedia/cadmium/core/git/LocalConfigSessionFactory.java92
			}
			
		});
	}

	
	@Override
	public synchronized RemoteSession getSession(URIish arg0,
			CredentialsProvider arg1, FS arg2, int arg3)
			throws TransportException {
		return super.getSession(arg0, arg1, arg2, arg3);
	}

	protected com.jcraft.jsch.JSch getJSch(OpenSshConfig.Host hc, FS fs)
      throws com.jcraft.jsch.JSchException
      {
		JSch jsch = super.getJSch(hc, fs);
    JSch.setConfig("StrictHostKeyChecking", "no");
		  if(FileSystemManager.exists(privateKeyFile)) {
		    jsch.addIdentity(privateKeyFile);
		  }