コード例 #1
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((response == null) ? 0 : response.hashCode());
   result = prime * result + statusCode;
   return result;
 }
コード例 #2
0
 public static ContributorFact createContributorFact(HttpResponse res) {
   if (null == res) {
     return null;
   }
   XMLParser parser = new XMLParser(res.asString());
   ContributorFact contributorFact = new ContributorFactImpl(parser, false);
   return contributorFact;
 }
コード例 #3
0
 public String getResponseHeader(String name) {
   String value = null;
   if (response != null) {
     List<String> header = response.getResponseHeaderFields().get(name);
     if (header.size() > 0) {
       value = header.get(0);
     }
   }
   return value;
 }
コード例 #4
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   OhlohException other = (OhlohException) obj;
   if (response == null) {
     if (other.response != null) return false;
   } else if (!response.equals(other.response)) return false;
   if (statusCode != other.statusCode) return false;
   return true;
 }
コード例 #5
0
 public static ResponseList<ContributorFact> createContributorFactList(HttpResponse res) {
   if (null == res) {
     return null;
   }
   XMLParser parser = new XMLParser(res.asString());
   NodeList nodelist = parser.getNodeList("response/result/contributor_fact");
   ResponseList<ContributorFact> list =
       new ResponseListImpl<ContributorFact>(nodelist.getLength(), res);
   for (int i = 0; i < nodelist.getLength(); i++) {
     Node node = nodelist.item(i);
     try {
       XMLParser childParser = new XMLParser(XMLParser.getXmlStringFromNode(node));
       ContributorFact contributorFact = new ContributorFactImpl(childParser, true);
       list.add(contributorFact);
     } catch (TransformerFactoryConfigurationError e) {
       e.printStackTrace();
     } catch (TransformerException e) {
       e.printStackTrace();
     }
   }
   return list;
 }
コード例 #6
0
 public OhlohException(String message, HttpResponse res) {
   this(message);
   response = res;
   this.statusCode = res.getStatusCode();
 }