static String[] extractCNs(final String subjectPrincipal) throws SSLException {
if (subjectPrincipal == null) {
return null;
}
final List<String> cns = new ArrayList<String>();
final List<NameValuePair> nvps = DistinguishedNameParser.INSTANCE.parse(subjectPrincipal);
for (int i = 0; i < nvps.size(); i++) {
final NameValuePair nvp = nvps.get(i);
final String attribName = nvp.getName();
final String attribValue = nvp.getValue();
if (TextUtils.isBlank(attribValue)) {
throw new SSLException(subjectPrincipal + " is not a valid X500 distinguished name");
}
if (attribName.equalsIgnoreCase("cn")) {
cns.add(attribValue);
}
}
return cns.isEmpty() ? null : cns.toArray(new String[ cns.size() ]);
}
java类org.apache.http.util.TextUtils的实例源码
AbstractVerifierHC4.java 文件源码
项目:remote-files-sync
阅读 21
收藏 0
点赞 0
评论 0
ExportExcelForm.java 文件源码
项目:BeTranslate
阅读 22
收藏 0
点赞 0
评论 0
private void doExport(){
if (TextUtils.isEmpty(textFieldInput.getText())){
textHint.setText("Input file path can not be empty!");
btnChooseInputPath.requestFocus();
return;
}else if (TextUtils.isEmpty(textFieldOutput.getText())){
textHint.setText("Output path can not be empty!");
btnChooseOutputPath.requestFocus();
return;
}
String outputFilePath = textFieldOutput.getText() + "/BT_export_string_xml_" +
System.currentTimeMillis() + ".xlsx";
boolean exportSuccess = BeTranslateUtil.generateExcel(textFieldInput.getText(), outputFilePath);
if (exportSuccess){
Messages.showMessageDialog("Export file '" + outputFilePath + "' success!", "BeTranslate",
Messages.getInformationIcon());
dispose();
}else {
Messages.showMessageDialog("Export file failed!", "BeTranslate", Messages.getWarningIcon());
}
}
TGBot.java 文件源码
项目:gopstopbot
阅读 21
收藏 0
点赞 0
评论 0
@Override
public String getBotToken() {
if (TextUtils.isEmpty(token)) {
final Properties properties = new Properties();
try {
properties.load(properties.getClass().getResourceAsStream("/secret.properties"));
} catch (IOException e) {
throw new RuntimeException("No secret.properties with telegram token found in resources/");
}
token = properties.getProperty("token");
if (TextUtils.isEmpty(token)) {
throw new RuntimeException("No telegram token found in resources/secret.properties");
}
return token;
}
return token;
}
MainPresenter.java 文件源码
项目:Open-Uploader
阅读 27
收藏 0
点赞 0
评论 0
/**
* 处理文件上传
*
* @param url
* @param filePath
* @param tableParams
*/
public void handleUploadFile(String url, String filePath, TableModel tableParams) {
if (!VerifyUtil.verifyUrl(url)) {
mView.showE("请求的Url无效");
return;
}
if (TextUtils.isEmpty(filePath)) {
mView.showE("请选择一个上传的文件");
return;
}
File file = new File(filePath);
if (!file.exists()) {
mView.showE("选择的文件不存在");
return;
}
LinkedHashMap<String, String> params = ViewUtil.getTableContent(tableParams);
mView.startUpload();
upload(url, file, params);
}
EditorMVPDialog.java 文件源码
项目:MVPManager
阅读 25
收藏 0
点赞 0
评论 0
/**
* Get data in JTable
*
* @param jTable
* @return
*/
private ArrayList<String> getData(JTable jTable) {
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < jTable.getModel().getRowCount(); i++) {
TableModel model = jTable.getModel();
String returnStr = (String) model.getValueAt(i, 0);
String methodStr = (String) model.getValueAt(i, 1);
returnStr = returnStr.trim();
methodStr = methodStr.trim();
if (TextUtils.isEmpty(returnStr) || TextUtils.isEmpty(methodStr)) {
return null;
}
list.add(returnStr + "##" + methodStr);
}
return list;
}
RegistrationActivity.java 文件源码
项目:FutureErpAndroid
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btnregister:
username = edtname.getText().toString();
password = edtpass.getText().toString();
email = edtmail.getText().toString();
if (TextUtils.isEmpty(username)){
edtname.setError(username);
} else if(TextUtils.isEmpty(password)){
edtpass.setError("Enter Password");
}else if(TextUtils.isEmpty(email)){
edtmail.setError("Enter Password");
}
else
SendRegRequest();
}
}
LoginActivity.java 文件源码
项目:FutureErpAndroid
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnlogin:
username = name.getText().toString();
password = pass.getText().toString();
if(TextUtils.isEmpty(username))
{
name.setError("Enter Name");
}
else if(TextUtils.isEmpty(password)){
pass.setError("Enter Password");
}
else {
SendJsonRequest();
}
break;
case R.id.btnregister:
Intent it = new Intent(LoginActivity.this,RegistrationActivity.class);
startActivity(it);
break;
}
}
WxBot.java 文件源码
项目:WxBot
阅读 21
收藏 0
点赞 0
评论 0
public void start() {
this.getUuid();// 获取uuid
if (!TextUtils.isBlank(uuid)) {
this.downQrCode();// 下载二维码图片
this.showQrCode();// 显示二维码图片
}
this.login();// 登录操作
if (!TextUtils.isBlank(redirectUri)) {// 跳转到登录后页面
this.wxNewLoginPage();
}
if (!TextUtils.isBlank(skey)) {// 初始化微信
this.wxInit();
}
if (syncKeyJsonObject != null) {// 开启微信状态通知
this.wxStatusNotify();
this.listenMsg();
}
}
URIUtils.java 文件源码
项目:purecloud-iot
阅读 26
收藏 0
点赞 0
评论 0
/**
* A convenience method that creates a new {@link URI} whose scheme, host, port, path,
* query are taken from the existing URI, dropping any fragment or user-information.
* The path is set to "/" if not explicitly specified. The existing URI is returned
* unmodified if it has no fragment or user-information and has a path.
*
* @param uri
* original URI.
* @throws URISyntaxException
* If the resulting URI is invalid.
*/
public static URI rewriteURI(final URI uri) throws URISyntaxException {
Args.notNull(uri, "URI");
if (uri.isOpaque()) {
return uri;
}
final URIBuilder uribuilder = new URIBuilder(uri);
if (uribuilder.getUserInfo() != null) {
uribuilder.setUserInfo(null);
}
if (TextUtils.isEmpty(uribuilder.getPath())) {
uribuilder.setPath("/");
}
if (uribuilder.getHost() != null) {
uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ROOT));
}
uribuilder.setFragment(null);
return uribuilder.build();
}
BasicDomainHandler.java 文件源码
项目:purecloud-iot
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (TextUtils.isBlank(value)) {
throw new MalformedCookieException("Blank or null value for domain attribute");
}
// Ignore domain attributes ending with '.' per RFC 6265, 4.1.2.3
if (value.endsWith(".")) {
return;
}
String domain = value;
if (domain.startsWith(".")) {
domain = domain.substring(1);
}
domain = domain.toLowerCase(Locale.ROOT);
cookie.setDomain(domain);
}