Projects >> fanfoudroid >>0a781430fbb222ba33b28a665eba9b64b4fa97fa

Chunk
Conflicting content
import org.json.JSONObject;
import org.w3c.dom.Document;

<<<<<<< HEAD
import com.ch_linghu.fanfoudroid.json.JsonParserException;

public class Response {
    private static boolean DEBUG = true;
    private HttpResponse mResponse = null;
=======
import android.util.Log;

import com.ch_linghu.fanfoudroid.util.DebugTimer;

public class Response {
    private final HttpResponse mResponse;
>>>>>>> b807edeecf20796a588b8510ceb86d80f0cad699
    private boolean mStreamConsumed = false;
    
    public Response(HttpResponse res) {
Solution content
import org.json.JSONObject;
import org.w3c.dom.Document;

import android.util.Log;

import com.ch_linghu.fanfoudroid.util.DebugTimer;

public class Response {
    private final HttpResponse mResponse;
    private boolean mStreamConsumed = false;
    
    public Response(HttpResponse res) {
File
Response.java
Developer's decision
Version 2
Kind of conflict
Attribute
Class signature
Import
Chunk
Conflicting content
     * @throws ResponseException
     */
    public InputStream asStream() throws ResponseException {
<<<<<<< HEAD
        HttpEntity entity = mResponse.getEntity();
        
        /* copy response content for debug
        if (DEBUG && entity != null) {
            try {
                entity = new BufferedHttpEntity(entity);
                debugEntity(entity); // copy 
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        */
=======
        return asStream(mResponse.getEntity());
    }
    
    /**
     * @deprecated use entity.getContent();  
     * @param entity
     * @return
     * @throws ResponseException
     */
    private InputStream asStream(HttpEntity entity) throws ResponseException {
        if (null == entity) {
            return null;
        }
>>>>>>> b807edeecf20796a588b8510ceb86d80f0cad699

        InputStream is = null;
        try {
Solution content
     * @throws ResponseException
     */
    public InputStream asStream() throws ResponseException {
        return asStream(mResponse.getEntity());
    }
    
    /**
     * @deprecated use entity.getContent();  
     * @param entity
     * @return
     * @throws ResponseException
     */
    private InputStream asStream(HttpEntity entity) throws ResponseException {
        if (null == entity) {
            return null;
        }

        InputStream is = null;
        try {
File
Response.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
     * @throws ResponseException
     */
    public String asString() throws ResponseException {
<<<<<<< HEAD

        String str = null;
        InputStream is = asStream();
        if (null == is) {
            return str;
=======
        try {
            return entityToString(mResponse.getEntity());
        } catch (IOException e) {
            throw new ResponseException(e.getMessage(), e);
>>>>>>> b807edeecf20796a588b8510ceb86d80f0cad699
        }
    }
    
Solution content
     * @throws ResponseException
     */
    public String asString() throws ResponseException {
        try {
            return entityToString(mResponse.getEntity());
        } catch (IOException e) {
            throw new ResponseException(e.getMessage(), e);
        }
    }
    
File
Response.java
Developer's decision
Version 2
Kind of conflict
Catch clause
If statement
Method invocation
Return statement
Throw statement
Try statement
Variable
Chunk
Conflicting content
                setStreamConsumed(true);
            }
        }
<<<<<<< HEAD
        return str;
=======
>>>>>>> b807edeecf20796a588b8510ceb86d80f0cad699
    }

    public JSONObject asJSONObject() throws ResponseException {
Solution content
                setStreamConsumed(true);
            }
        }
    }

    public JSONObject asJSONObject() throws ResponseException {
File
Response.java
Developer's decision
Version 2
Kind of conflict
Return statement
Variable
Chunk
Conflicting content
        return null;
    }
    
<<<<<<< HEAD
    // ignore me, it's only for debug
    @SuppressWarnings("unused")
    private void debugEntity(HttpEntity entity) throws IOException,
            JsonParserException {
        InputStream is = entity.getContent();
        Header ceheader = entity.getContentEncoding();
        if (ceheader != null && ceheader.getValue().equalsIgnoreCase("gzip")) {
            is = new GZIPInputStream(is);
        }
=======
    private static Pattern escaped = Pattern.compile("&#([0-9]{3,5});");

    /**
     * Unescape UTF-8 escaped characters to string.
     * @author pengjianq...@gmail.com
     *
     * @param original The string to be unescaped.
     * @return The unescaped string
     */
    public static String unescape(String original) {
        Matcher mm = escaped.matcher(original);
        StringBuffer unescaped = new StringBuffer();
        while (mm.find()) {
            mm.appendReplacement(unescaped, Character.toString(
                    (char) Integer.parseInt(mm.group(1), 10)));
        }
        mm.appendTail(unescaped);
        return unescaped.toString();
>>>>>>> b807edeecf20796a588b8510ceb86d80f0cad699
    }

}
Solution content
        return null;
    }
    
    private static Pattern escaped = Pattern.compile("&#([0-9]{3,5});");

    /**
     * Unescape UTF-8 escaped characters to string.
     * @author pengjianq...@gmail.com
     *
     * @param original The string to be unescaped.
     * @return The unescaped string
     */
    public static String unescape(String original) {
        Matcher mm = escaped.matcher(original);
        StringBuffer unescaped = new StringBuffer();
        while (mm.find()) {
            mm.appendReplacement(unescaped, Character.toString(
                    (char) Integer.parseInt(mm.group(1), 10)));
        }
        mm.appendTail(unescaped);
        return unescaped.toString();
    }

}
File
Response.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Comment
If statement
Method invocation
Method signature
Return statement
Variable
While statement