2016-04-04 29 views
2

Jira Rest java istemcisini sorunları oluşturmak/güncellemek için kullanıyorum ve kapatırken sorunun çözülmesini güncellemeye ihtiyacım var. Aşağıdaki istisna alındığında yukarıdaki kodu çalıştırdıktan sonraJira sorun giderme Jira Rest java istemcisini kullanarak nasıl güncelleştirilir

public static void main(String[] args) { 
    try { 
     Issue issue = restClient.getIssueClient().getIssue("CER-3").get(); 
     Iterator<Transition> transitions = 
       restClient.getIssueClient().getTransitions(issue).get().iterator(); 
     int transitionId = 0; 
     while (transitions.hasNext()) { 
      Transition transition = transitions.next(); 
      if (transition.getName().contains("Closed") 
        || transition.getName().contains("Done")) { 
       transitionId = transition.getId(); 
      } 
     } 
     final Collection<FieldInput> fieldInputs; 
     fieldInputs = 
       Arrays.asList(new FieldInput("resolution", ComplexIssueInputFieldValue.with(
         "name", "Won't Fix"))); 
     TransitionInput tInput = 
       new TransitionInput(transitionId, fieldInputs, Comment.valueOf("My comment")); 

     restClient.getIssueClient().transition(issue, tInput).claim(); 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 

: Aşağıdaki kodu denedi alan çözünürlükte

RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={Resolution=Field 'Resolution' cannot be set. It is not on the appropriate screen, or unknown.}, errorMessages=[]}]} 
at com.atlassian.jira.rest.client.internal.async.DelegatingPromise.claim(DelegatingPromise.java:47) 
at com.instigatemobile.cerebro.clients.JiraRestClientModule.main(JiraRestClientModule.java:157) 
Caused by: RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={Resolution=Field 'Resolution' cannot be set. It is not on the appropriate screen, or unknown.}, errorMessages=[]}]} 
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:166) 
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:160) 
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:48) 
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:12) 
at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:285) 
at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:162) 
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1072) 
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) 
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:161) 
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:146) 
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:235) 
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:172) 
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53) 
at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:285) 
at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:162) 
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1072) 
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) 
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:161) 
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:146) 
at com.google.common.util.concurrent.AbstractFuture.done(AbstractFuture.java:235) 
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:172) 
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53) 
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$1$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:46) 
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:197) 
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient.runInContext(SettableFuturePromiseHttpPromiseAsyncClient.java:90) 
at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable.run(SettableFuturePromiseHttpPromiseAsyncClient.java:192) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745) 

cevap

1

Java hata ipuçları hedef ekranın parçası olmayan. Bu, Jira'daki "Sorun Düzenle" ekranınız "Çözünürlük" adlı alanı içermiyorsa gerçekleşir. Jira doğrudan hedef konuyu açma ve Çözünürlük alan eklemek için çalışıyor, aşağıdaki açılır messsage görecekti:

enter image description here

Daha sonra "Edit yönetici ayrıcalıklarına sahip Jira giriş ve düzenlemeniz gerekebilir

Bu alanı eklemek için "ekran".