Projects >> j2mepolish >>42d39cdbac87d8ea3af0f9cd22455f2390eaa87d

Chunk
Conflicting content
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
<<<<<<< HEAD
=======
import java.io.Reader;
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605

/**
 * This class parses JSON data encoded as a string and returns an equivalent native object tree.
Solution content
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 * This class parses JSON data encoded as a string and returns an equivalent native object tree.
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
	/**
	 * The underlying InputStreamReader of the parser 
	 */
<<<<<<< HEAD
	InputStreamReader streamReader;
=======
	Reader inputReader;
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	
	/**
	 * Convenience method for throwing a JSONException
Solution content
	/**
	 * The underlying InputStream of the parser 
	 */
	Reader inputReader;
	
	/**
	 * Convenience method for throwing a JSONException
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
	protected void skipWhitespace() throws IOException, JsonException {
		// Read character tokens until a non-whitespace one is encountered
		while ( this.currentChar == TOKEN_WHITESPACE_SPACE || this.currentChar == TOKEN_WHITESPACE_TAB || this.currentChar == TOKEN_WHITSPACE_LINE_FEED || this.currentChar == TOKEN_WHITESPACE_CARRIAGE_RETURN ) {
<<<<<<< HEAD
			this.currentChar = this.streamReader.read();
=======
			this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
		}	
		
		// Check for end of the stream and throw an error if found
Solution content
	protected void skipWhitespace() throws IOException, JsonException {
		// Read character tokens until a non-whitespace one is encountered
		while ( this.currentChar == TOKEN_WHITESPACE_SPACE || this.currentChar == TOKEN_WHITESPACE_TAB || this.currentChar == TOKEN_WHITSPACE_LINE_FEED || this.currentChar == TOKEN_WHITESPACE_CARRIAGE_RETURN ) {
			this.currentChar = this.inputReader.read();
		}	
		
		// Check for end of the stream and throw an error if found
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	 * @throws JsonException
	 */
	public Object parseJson(InputStream inputStream) throws IOException, JsonException {
<<<<<<< HEAD
		return parseJson(inputStream, null);
=======
		return parseJson( inputStream, null);
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	}
	
	/**
Solution content
	 * @throws JsonException
	 */
	public Object parseJson(InputStream inputStream) throws IOException, JsonException {
		return parseJson( inputStream, null);
	}
	
	/**
File
JsonParser.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Chunk
Conflicting content
	/**
	 * Parses JSON data from an InputStream
	 * @param inputStream the InputStream containing the JSON data
<<<<<<< HEAD
=======
	 * @param encoding the encoding of the stream
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	 * @return the native object hierarchy corresponding to the JSON data
	 * @throws IOException
	 * @throws JsonException
Solution content
	/**
	 * Parses JSON data from an InputStream
	 * @param inputStream the InputStream containing the JSON data
	 * @param encoding the encoding of the stream
	 * @return the native object hierarchy corresponding to the JSON data
	 * @throws IOException
	 * @throws JsonException
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
	 * @throws JsonException
	 */
	public Object parseJson(InputStream inputStream, String encoding) throws IOException, JsonException {
<<<<<<< HEAD
		if (encoding == null) {
			this.streamReader = new InputStreamReader(inputStream);
		} else {
			this.streamReader = new InputStreamReader(inputStream, encoding);
=======
		if (encoding != null) {
			this.inputReader = new InputStreamReader( inputStream, encoding );
		} else {
			this.inputReader = new InputStreamReader( inputStream );
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
		}
		this.currentChar = TOKEN_WHITESPACE_SPACE;
		skipWhitespace();
Solution content
	 * @throws JsonException
	 */
	public Object parseJson(InputStream inputStream, String encoding) throws IOException, JsonException {
		if (encoding != null) {
			this.inputReader = new InputStreamReader( inputStream, encoding );
		} else {
			this.inputReader = new InputStreamReader( inputStream );
		}
		this.currentChar = TOKEN_WHITESPACE_SPACE;
		skipWhitespace();
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
If statement
Method invocation
Chunk
Conflicting content
    	Object value;    	
		
		// Move inside the body of the object
<<<<<<< HEAD
		this.currentChar = this.streamReader.read();
=======
		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605

		// Read the first character in the object's body and check if it's the end of object token, just in case the object is empty
		skipWhitespace();   		
Solution content
    	Object value;    	
		
		// Move inside the body of the object
		this.currentChar = this.inputReader.read();

		// Read the first character in the object's body and check if it's the end of object token, just in case the object is empty
		skipWhitespace();   		
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
		skipWhitespace();   		
		if ( this.currentChar == TOKEN_END_OBJECT) {			
			// Move outside the body of the object, to the next character in the stream, and return an empty object.
<<<<<<< HEAD
			this.currentChar = this.streamReader.read();			
=======
			this.currentChar = this.inputReader.read();			
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
			return result;
		}
    	
Solution content
		skipWhitespace();   		
		if ( this.currentChar == TOKEN_END_OBJECT) {			
			// Move outside the body of the object, to the next character in the stream, and return an empty object.
			this.currentChar = this.inputReader.read();			
			return result;
		}
    	
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    		}
    		    		
    		// Read to the begining of the value
<<<<<<< HEAD
    		this.currentChar = this.streamReader.read();
=======
    		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    		skipWhitespace();
    		
    		// Read the value
Solution content
    		}
    		    		
    		// Read to the begining of the value
    		this.currentChar = this.inputReader.read();
    		skipWhitespace();
    		
    		// Read the value
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    		if ( this.currentChar == TOKEN_END_OBJECT) {
    			// If we have reached the end of the object's body, move outside the body of the object
    			// to the next character in the stream, and return the object   			
<<<<<<< HEAD
    			this.currentChar = this.streamReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next member name
    			this.currentChar = this.streamReader.read();
=======
    			this.currentChar = this.inputReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next member name
    			this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    			skipWhitespace();
    		} else {
    			// If we have read something else, throw an unexpected token exception
Solution content
    		if ( this.currentChar == TOKEN_END_OBJECT) {
    			// If we have reached the end of the object's body, move outside the body of the object
    			// to the next character in the stream, and return the object   			
    			this.currentChar = this.inputReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next member name
    			this.currentChar = this.inputReader.read();
    			skipWhitespace();
    		} else {
    			// If we have read something else, throw an unexpected token exception
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
<<<<<<< HEAD
    	// Move inside the body of the array
    	JsonArray result = new JsonArray();
    	
    	this.currentChar = this.streamReader.read();
=======
    	this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    	
		// Read the first character in the array and check if it's the end of array token, just in case the array is empty
		skipWhitespace();   		
Solution content
    	JsonArray result = new JsonArray();
    	
    	// Move inside the body of the array
    	this.currentChar = this.inputReader.read();
    	
		// Read the first character in the array and check if it's the end of array token, just in case the array is empty
		skipWhitespace();   		
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
		skipWhitespace();   		
		if ( this.currentChar == TOKEN_END_ARRAY) {			
			// Move outside the body of the array, to the next character in the stream, and return an empty array    			
<<<<<<< HEAD
			this.currentChar = this.streamReader.read();			
=======
			this.currentChar = this.inputReader.read();			
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
			return result;
		}
    	
Solution content
		skipWhitespace();   		
		if ( this.currentChar == TOKEN_END_ARRAY) {			
			// Move outside the body of the array, to the next character in the stream, and return an empty array    			
			this.currentChar = this.inputReader.read();			
			return result;
		}
    	
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    		if ( this.currentChar == TOKEN_END_ARRAY) {    			
    			// If we have reached the end of the array's body, move outside the body of the array
    			// to the next character in the stream and return the array.    			
<<<<<<< HEAD
    			this.currentChar = this.streamReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next value
    			this.currentChar = this.streamReader.read();
=======
    			this.currentChar = this.inputReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next value
    			this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    			skipWhitespace();
    		} else {
    			// If we have read something else, throw an unexpected token exception
Solution content
    		if ( this.currentChar == TOKEN_END_ARRAY) {    			
    			// If we have reached the end of the array's body, move outside the body of the array
    			// to the next character in the stream and return the array.    			
    			this.currentChar = this.inputReader.read();
    			return result;
    		} else if ( this.currentChar == TOKEN_VALUE_SEPARATOR ) {
    			// If we have reached a value separator token, read until the beginning of the next value
    			this.currentChar = this.inputReader.read();
    			skipWhitespace();
    		} else {
    			// If we have read something else, throw an unexpected token exception
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
    		}    		

    		// Read the next character from the stream
<<<<<<< HEAD
    		this.currentChar = this.streamReader.read();
=======
    		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    	}
    
    	// Everything went OK. Return the corresponding object
Solution content
    		}    		

    		// Read the next character from the stream
    		this.currentChar = this.inputReader.read();
    	}
    
    	// Everything went OK. Return the corresponding object
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
		// Handle the initial minus sign (if any)
    	if ( this.currentChar == '-' ) {
    		result.append('-');
<<<<<<< HEAD
    		this.currentChar = this.streamReader.read();
=======
    		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    	}		
		
    	// Handle the rest of the number
Solution content
		// Handle the initial minus sign (if any)
    	if ( this.currentChar == '-' ) {
    		result.append('-');
    		this.currentChar = this.inputReader.read();
    	}		
		
    	// Handle the rest of the number
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    		result.append((char) this.currentChar);
    		
    		// Go to the next character
<<<<<<< HEAD
    		this.currentChar = this.streamReader.read();
=======
    		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    	}
    }
    
Solution content
    		result.append((char) this.currentChar);
    		
    		// Go to the next character
    		this.currentChar = this.inputReader.read();
    	}
    }
    
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    	StringBuffer unicodeBuffer = new StringBuffer(4);
    	
    	// Move into the body of the string
<<<<<<< HEAD
    	this.currentChar = this.streamReader.read();
=======
    	this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    	
    	do {    		
    		
Solution content
    	// Move into the body of the string
    	StringBuffer unicodeBuffer = new StringBuffer(4);
    	
    	this.currentChar = this.inputReader.read();
    	
    	do {    		
    		
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	    			
	    		// End of string has been reached. Move outside the body of the string and return the result
	    		case TOKEN_QUOTATION_MARK:
<<<<<<< HEAD
	    			this.currentChar = this.streamReader.read();
=======
	    			this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	    			return buffer.toString();    			    			
	    			
	    		// Decode an escape character
Solution content
	    			
	    		// End of string has been reached. Move outside the body of the string and return the result
	    		case TOKEN_QUOTATION_MARK:
	    			this.currentChar = this.inputReader.read();
	    			return buffer.toString();    			    			
	    			
	    		// Decode an escape character
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	    			
	    		// Decode an escape character
	    		case TOKEN_ESCAPE_CHARACTER:
<<<<<<< HEAD
	    			this.currentChar = this.streamReader.read();
=======
	    			this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	    			switch (this.currentChar) {
	    				case  't':
	    					buffer.append(CHARACTER_TAB);
Solution content
	    			
	    		// Decode an escape character
	    		case TOKEN_ESCAPE_CHARACTER:
	    			this.currentChar = this.inputReader.read();
	    			switch (this.currentChar) {
	    				case  't':
	    					buffer.append(CHARACTER_TAB);
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	    					
	    					// First, get the four digits into the unicode string buffer.
	    					while (unicodeIndex < 4) {
<<<<<<< HEAD
	    						this.currentChar = this.streamReader.read();
=======
	    						this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	    						
	    						if ( this.currentChar == -1 ) {
	    							throwJsonException(EXCEPTION_UNEXPECTED_END_OF_STREAM, "while trying to read next unicode character in string \"" + buffer.toString() + "...\"");
Solution content
	    					
	    					// First, get the four digits into the unicode string buffer.
	    					while (unicodeIndex < 4) {
	    						this.currentChar = this.inputReader.read();
	    						
	    						if ( this.currentChar == -1 ) {
	    							throwJsonException(EXCEPTION_UNEXPECTED_END_OF_STREAM, "while trying to read next unicode character in string \"" + buffer.toString() + "...\"");
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    		}
    		
    		// Read the next char in the string
<<<<<<< HEAD
    		this.currentChar = this.streamReader.read();
=======
    		this.currentChar = this.inputReader.read();
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
    		
    	} while (true);
    }
Solution content
    		}
    		
    		// Read the next char in the string
    		this.currentChar = this.inputReader.read();
    		
    	} while (true);
    }
File
JsonParser.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
	private long duration = 500;
	private int direction = DIRECTION_DEFAULT;
	private long startTime;
<<<<<<< HEAD
	private int door = DOOR_BOTH;
=======
	//#if polish.css.vertical-doors-screen-change-animation-delay
		//#define tmp.pauseSupported
		private long pauseStartTime;
		private long pauseDelay;
		private boolean isBeforePause;
	//#endif
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605

	/**
	 * Creates a new animation 
Solution content
	private long duration = 500;
	private int direction = DIRECTION_DEFAULT;
	private long startTime;
	private int door = DOOR_BOTH;

	/**
	 * Creates a new animation 
File
VerticalDoorsScreenChangeAnimation.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
			if (doorInt != null)
				this.direction = DIRECTION_DEFAULT;
			}
		//#endif
<<<<<<< HEAD
		//#if polish.css.vertical-doors-screen-change-animation-door
			Integer doorInt = style.getIntProperty("vertical-doors-screen-change-animation-door");
			{
				this.door = doorInt.intValue();
			} else {
				this.door = DOOR_BOTH;
			}
		//#endif
=======
		//#if polish.css.vertical-doors-screen-change-animation-delay
			Integer delayInt = style.getIntProperty("vertical-doors-screen-change-animation-delay");
			if (delayInt != null)
			{
				this.pauseDelay = delayInt.longValue();
			}
		//#endif

>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
	}
	
	
Solution content
				this.direction = DIRECTION_DEFAULT;
			}
		//#endif
		//#if polish.css.vertical-doors-screen-change-animation-door
			Integer doorInt = style.getIntProperty("vertical-doors-screen-change-animation-door");
			if (doorInt != null)
			{
				this.door = doorInt.intValue();
			} else {
				this.door = DOOR_BOTH;
			}
		//#endif
	}
	
	
File
VerticalDoorsScreenChangeAnimation.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
			second = this.lastCanvasImage;
			height = this.currentY;
		}
<<<<<<< HEAD
		// draw last (direction==DIRECTION_CLOSING/isForwardAnimation) or next screen:
		g.drawImage(first, 0, 0, Graphics.TOP | Graphics.LEFT);
		// draw top door:
		//#if polish.css.vertical-doors-screen-change-animation-door
			if (this.door == DOOR_BOTH || this.door == DOOR_TOP) {
		//#endif
				g.setClip(0, 0, this.screenWidth, height );
				g.drawImage(second, 0, height - (this.screenHeight/2), Graphics.TOP | Graphics.LEFT);
		//#if polish.css.vertical-doors-screen-change-animation-door
			} else {
				g.setClip(0, 0, this.screenWidth, this.screenHeight/2 );
				g.drawImage(second, 0, 0, Graphics.TOP | Graphics.LEFT);				
			}
		//#endif
			
		// draw bottom door:
			//#if polish.css.vertical-doors-screen-change-animation-door
			if (this.door == DOOR_BOTH || this.door == DOOR_BOTTOM) {
		//#endif
				g.setClip(0, this.screenHeight-height, this.screenWidth, height );
				g.drawImage(second, 0, (this.screenHeight/2) - height , Graphics.TOP | Graphics.LEFT);
		//#if polish.css.vertical-doors-screen-change-animation-door
			} else {
				g.setClip(0, this.screenHeight/2, this.screenWidth, this.screenHeight/2 + 1 );
				g.drawImage(second, 0, 0, Graphics.TOP | Graphics.LEFT);				
=======
		if (next != null) {
			UiAccess.paint(next, g );
		} else {
			g.drawImage(first, 0, 0, Graphics.TOP | Graphics.LEFT);
		}
		// paint top door:
		//#if tmp.pauseSupported
			if (this.pauseDelay == 0 || this.isBeforePause) {
		//#endif
				g.setClip(0, 0, this.screenWidth, height );
				g.drawImage(second, 0, height - (this.screenHeight/2), Graphics.TOP | Graphics.LEFT);
		//#if tmp.pauseSupported
			}
		//#endif
		
		// paint bottom door:
		//#if tmp.pauseSupported
			if (this.pauseDelay == 0 || !this.isBeforePause) {
		//#endif
				g.setClip(0, this.screenHeight-height, this.screenWidth, height );
				g.drawImage(second, 0, (this.screenHeight/2) - height , Graphics.TOP | Graphics.LEFT);
		//#if tmp.pauseSupported
			} else {
				g.setClip(0, this.screenHeight/2, this.screenWidth, this.screenHeight/2 );
				g.drawImage(second, 0, 0 , Graphics.TOP | Graphics.LEFT);
>>>>>>> 015c7ef108cd87e1a13ab4095b78872a67dde605
			}
		//#endif
	}
Solution content
			second = this.lastCanvasImage;
			height = this.currentY;
		}
		// draw last (direction==DIRECTION_CLOSING/isForwardAnimation) or next screen:
		g.drawImage(first, 0, 0, Graphics.TOP | Graphics.LEFT);
		// draw top door:
		//#if polish.css.vertical-doors-screen-change-animation-door
			if (this.door == DOOR_BOTH || this.door == DOOR_TOP) {
		//#endif
				g.setClip(0, 0, this.screenWidth, height );
				g.drawImage(second, 0, height - (this.screenHeight/2), Graphics.TOP | Graphics.LEFT);
		//#if polish.css.vertical-doors-screen-change-animation-door
			} else {
				g.setClip(0, 0, this.screenWidth, this.screenHeight/2 );
				g.drawImage(second, 0, 0, Graphics.TOP | Graphics.LEFT);				
			}
		//#endif
			
		// draw bottom door:
			//#if polish.css.vertical-doors-screen-change-animation-door
			if (this.door == DOOR_BOTH || this.door == DOOR_BOTTOM) {
		//#endif
				g.setClip(0, this.screenHeight-height, this.screenWidth, height );
				g.drawImage(second, 0, (this.screenHeight/2) - height , Graphics.TOP | Graphics.LEFT);
		//#if polish.css.vertical-doors-screen-change-animation-door
			} else {
				g.setClip(0, this.screenHeight/2, this.screenWidth, this.screenHeight/2 + 1 );
				g.drawImage(second, 0, 0, Graphics.TOP | Graphics.LEFT);				
			}
		//#endif
	}
File
VerticalDoorsScreenChangeAnimation.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation