001 package org.sonar.wsclient; 002 003 import org.sonar.wsclient.services.WSUtils; 004 005 import java.io.UnsupportedEncodingException; 006 import java.net.URLEncoder; 007 import java.text.SimpleDateFormat; 008 import java.util.Date; 009 010 public class JdkUtils extends WSUtils { 011 012 @Override 013 public String format(Date date, String format) { 014 SimpleDateFormat dateFormat = new SimpleDateFormat(format); 015 return dateFormat.format(date); 016 } 017 018 @Override 019 public String encodeUrl(String url) { 020 try { 021 return URLEncoder.encode(url, "UTF-8"); 022 023 } catch (UnsupportedEncodingException e) { 024 throw new RuntimeException(e); 025 } 026 } 027 028 }