Skip to content

Commit

Permalink
修改 添加附件之后,如果是原始图像的大小质量的话,会出现NullPointer的问题
Browse files Browse the repository at this point in the history
修改 所有分支版本的配置文件到1.16版本
  • Loading branch information
yuchting committed May 3, 2013
1 parent 2663291 commit 2140b4f
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 49 deletions.
12 changes: 6 additions & 6 deletions server/config.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Yuchberry userPassword="111111" serverPort="9716" pushInterval="10" userSSL="0" convertoSimpleChar="0" disableLog="0" disableReport="0">
<EmailAccount
<!--EmailAccount
account="tzt-123@163.com"
password="superman"
cryptPassword=""
Expand All @@ -19,7 +19,7 @@
appendHTML="1"
pushHistoryMsg="1"
/>
/-->

<!--EmailAccount
account="yuchting@gmail.com"
Expand Down Expand Up @@ -107,7 +107,7 @@
commentSum="5"
/-->

<!--WeiboAccount
<WeiboAccount
type="sina"
account="yuchberry"
accessToken="1eef9899c847f1cd0735c6775fdcc576"
Expand All @@ -118,7 +118,7 @@
directMessageSum="5"
atMeSum="5"
commentSum="5"
/-->
/>

<!--WeiboAccount
type="qq"
Expand Down Expand Up @@ -146,7 +146,7 @@
cryptPassword="396bc581a6277f66ca6d40eb5fd98d38ef8857158d44258d"
/-->

<IMAccount
<!--IMAccount
type="gtalk"
xmppHost=""
Expand All @@ -155,7 +155,7 @@
account="yuchdroid@gmail.com"
password=""
cryptPassword="12eb2c6d63809ffab74725f2b6282bd0ef8857158d44258d"
/>
/-->


</Yuchberry>
63 changes: 55 additions & 8 deletions server/src/com/yuchting/yuchberry/server/HelloWorld.java
Expand Up @@ -31,7 +31,6 @@
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -47,12 +46,8 @@
import java.security.KeyStore;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import java.util.TimeZone;
import java.util.Vector;
import java.util.concurrent.Callable;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

Expand Down Expand Up @@ -179,6 +174,34 @@ private static boolean cmpNameString(String a,String b){
}
}

/**
* compare the string array
* @param a
* @param b
* @return
*/
private static boolean cmpNameStringArr(String[] a,String[] b){
if(a == null && b == null){
return true;
}

if(a == null || b == null){
return false;
}

if(a.length != b.length){
return false;
}

for(int i = 0;i < a.length;i++){
if(!cmpNameString(a[i], b[i])){
return false;
}
}

return true;
}

/**
* replace the old String in replace one with newStr
* @param replaceStr
Expand All @@ -196,9 +219,33 @@ public static String repleaceStr(String replaceStr,String oldStr,String newStr){

return replaceStr;
}



public static void main(String arg[])throws Exception{

String[] arr = "RRULE:FREQ=YEARLY;;BYDAY=111213;UNTIL=11234;COUNT=11".split("\n");
for(String re : arr){

if(re.indexOf("FREQ=YEARLY") != -1){

String util = "";
int idx = re.indexOf(";UNTIL=");
if(idx != -1){
int endIdx = re.indexOf(";",idx + 1);
if(endIdx == -1){
util = re.substring(idx);
}else{
util = re.substring(idx,endIdx);
}
}
// Google calendar is NOT support relative date by year
//
re = "RRULE:FREQ=YEARLY;INTERVAL=1" + util;
}

System.out.println(re);
}


//cmpBoolean(null);
//System.out.println(repleaceStr("nihao buhaode wodejiushi nide","n","w"));
//Vector t = splitStr(",,d,,d,ddd,,",',');
Expand Down Expand Up @@ -237,7 +284,7 @@ public static void main(String arg[])throws Exception{
// System.setProperty("proxyPort", "8088");
//
// System.out.println(fetchTWeibo.replaceGFWVerified_URL("http://t.co/HPjdqFCN sdfsdfs http://bit.ly/PU7zFy sdfskljfeind sdfjsdkfs "));
berryRecvTest();
//berryRecvTest();
//berrySendTest();

//requestPOSTHTTP("http://localhost:8888",(new String("{\"return_code\":0,\"return_message\":\"success\",\"data\":{\"data\":[{\"id\":\"1\",\"question\":\"公主令牌在哪交?\"},{\"id\":\"2\",\"question\":\"公主护使有什么用?\"},{\"id\":\"3\",\"question\":\"角斗场在哪?\"},{\"id\":\"4\",\"question\":\"北部断层在哪?\"},{\"id\":\"5\",\"question\":\"欢乐令有什么用?\"},{\"id\":\"6\",\"question\":\"令牌积分有什么用?\"},{\"id\":\"7\",\"question\":\"南部断层在哪?\"},{\"id\":\"8\",\"question\":\"大妖魔令牌交给谁?\"},{\"id\":\"9\",\"question\":\"神工坊在哪?\"},{\"id\":\"10\",\"question\":\"警戒妖珠有什么用?\"}]}}")).getBytes("UTF-8"),true);
Expand Down
2 changes: 1 addition & 1 deletion yuchbox42/src/com/yuchting/yuchberry/client/Indicator.java
@@ -1,5 +1,5 @@
package com.yuchting.yuchberry.client;
//

//import net.rim.blackberry.api.messagelist.ApplicationIcon;
//import net.rim.blackberry.api.messagelist.ApplicationIndicator;
//import net.rim.blackberry.api.messagelist.ApplicationIndicatorRegistry;
Expand Down
Expand Up @@ -2206,7 +2206,7 @@ else if (obj instanceof TextBodyPart)
// }
// }
// }
//

// else if (mimeType.indexOf(ContentType.TYPE_TEXT_HTML_STRING) != -1)
// {
// m_plainTextContain = m_htmlTextContain.concat(body);
Expand Down
Expand Up @@ -31,7 +31,6 @@
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.SeparatorField;
import net.rim.device.api.ui.component.BasicEditField;
Expand Down
56 changes: 31 additions & 25 deletions yuchbox42/src/com/yuchting/yuchberry/client/ui/CameraFileOP.java
Expand Up @@ -144,28 +144,34 @@ static public byte[] resizePicFile(String _imageFile,XYPoint _point)throws Excep

static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exception{

// if(_imageBytes != null){
//
// EncodedImage t_origImage = EncodedImage.createEncodedImage(_imageBytes, 0, _imageBytes.length);
//
// if(t_origImage == null){
// throw new Exception("Can't createEncodedImage for this bytes!");
// }
//
// int t_origWidth = t_origImage.getWidth();
// int t_origHeight = t_origImage.getHeight();
//
// XYPoint t_scaleSize = new XYPoint(_point);
//
// float t_orgRate = (float)t_origWidth / (float)t_origHeight;
// float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
//
// if(Math.abs(t_orgRate - t_scaleRate) > 1e-5){
// // the rate is note same, convert the scale size to keep orig rate
// //
// t_scaleSize.y = (int)(t_scaleSize.x / t_orgRate);
// }
//
if(_imageBytes != null){

EncodedImage t_origImage = EncodedImage.createEncodedImage(_imageBytes, 0, _imageBytes.length);

if(t_origImage == null){
throw new Exception("Can't createEncodedImage for this bytes!");
}

int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;

if(Math.abs(t_orgRate - t_scaleRate) > 1e-5){
// the rate is note same, convert the scale size to keep orig rate
//
t_scaleSize.y = (int)(t_scaleSize.x / t_orgRate);
}

// try{
//
// JPEGEncodedImage finalJPEG;
Expand All @@ -189,10 +195,10 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
// _imageBytes = finalJPEG.getData();
//
// }finally{
//
// t_origImage = null;

t_origImage = null;
// }
// }
}

return _imageBytes;
}
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down
Expand Up @@ -155,7 +155,13 @@ static public byte[] resizePicBytes(byte[] _imageBytes,XYPoint _point)throws Exc
int t_origWidth = t_origImage.getWidth();
int t_origHeight = t_origImage.getHeight();

XYPoint t_scaleSize = new XYPoint(_point);
XYPoint t_scaleSize = null;

if(_point != null){
t_scaleSize = new XYPoint(_point);
}else{
t_scaleSize = new XYPoint(t_origWidth,t_origHeight);
}

float t_orgRate = (float)t_origWidth / (float)t_origHeight;
float t_scaleRate = (float)t_scaleSize.x / (float)t_scaleSize.y;
Expand Down

0 comments on commit 2140b4f

Please sign in to comment.