Projects >> eucalyptus >>6ac2e64a991843e3c649829300626d4808a4c259

Chunk
Conflicting content
import org.xbill.DNS.TSIGRecord;
import org.xbill.DNS.Type;

<<<<<<< HEAD
=======
import org.apache.log4j.Logger;

import com.eucalyptus.dns.SetResponse;
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
import com.eucalyptus.dns.Zone;
import com.eucalyptus.dns.Cache;
import com.eucalyptus.util.dns.DnsResolvers;
Solution content
import org.xbill.DNS.TSIGRecord;
import org.xbill.DNS.Type;

import com.eucalyptus.dns.Zone;
import com.eucalyptus.dns.Cache;
import com.eucalyptus.util.dns.DnsResolvers;
File
ConnectionHandler.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
			flags |= FLAG_SIGONLY;
		}

<<<<<<< HEAD
    try {
      sr = DnsResolvers.findRecords(response, response.getQuestion( ), ConnectionHandler.getRemoteInetAddress( ) );
      if ( sr != null && !sr.isUnknown( ) ) {
        return Rcode.NOERROR;
      }
    } catch ( Exception ex ) {
      Logger.getLogger( DnsResolvers.class ).error( ex );
    }
		Zone zone = findBestZone(name);
		if (zone != null) {
			if (type == Type.AAAA) {
				addSOA(response, zone);
				response.getHeader().setFlag(Flags.AA);
				return (Rcode.NOERROR);
			}
			sr = zone.findRecords(name, type);
		}
=======
		Zone zone = findBestZone(name, internal);
		Cache cache = getCache(dclass, internal);
		if (zone != null)
			sr = zone.findRecords(name, type, internal);
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
		else {
			sr = cache.lookupRecords(name, type, Credibility.NORMAL);
		}
Solution content
    try {
			flags |= FLAG_SIGONLY;
		}

      sr = DnsResolvers.findRecords(response, response.getQuestion( ), ConnectionHandler.getRemoteInetAddress( ) );
      if ( sr != null && !sr.isUnknown( ) ) {
        return Rcode.NOERROR;
      }
    } catch ( Exception ex ) {
      Logger.getLogger( DnsResolvers.class ).error( ex );
    }
		Zone zone = findBestZone(name);
		if (zone != null) {
			if (type == Type.AAAA) {
				addSOA(response, zone);
				response.getHeader().setFlag(Flags.AA);
				return (Rcode.NOERROR);
			}
			sr = zone.findRecords(name, type);
		}
		else {
			Cache cache = getCache(dclass);
			sr = cache.lookupRecords(name, type, Credibility.NORMAL);
		}
File
ConnectionHandler.java
Developer's decision
Manual
Kind of conflict
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
				addRRset(name, response, rrset, Section.ANSWER, flags);
				if (zone != null && iterations == 0)
					response.getHeader().setFlag(Flags.AA);
<<<<<<< HEAD
				rcode = addAnswer(response, newname, type, dclass, iterations + 1, flags);
=======
				rcode = addAnswer(response, newname, type, dclass,
						iterations + 1, flags, internal);
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
			}
		}
		else if (sr.isSuccessful()) {
Solution content
				addRRset(name, response, rrset, Section.ANSWER, flags);
				if (zone != null && iterations == 0)
					response.getHeader().setFlag(Flags.AA);
				rcode = addAnswer(response, newname, type, dclass, iterations + 1, flags);
			}
		}
		else if (sr.isSuccessful()) {
File
ConnectionHandler.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
			byte [] response = null;
			try {
				query = new Message(inBytes);
<<<<<<< HEAD
        ConnectionHandler.setRemoteInetAddress( socket.getInetAddress( ) );
        try {
          response = generateReply(query, inBytes, inBytes.length, socket);
        } catch ( RuntimeException ex ) {
          response = errorMessage(query, Rcode.SERVFAIL);
          throw ex;
        } finally {
          ConnectionHandler.removeRemoteInetAddress( );
        }
=======
				String client = socket.getInetAddress().getHostAddress();
				boolean internal = isInternal(client);
				response = generateReply(query, inBytes, inBytes.length, socket, internal);
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
				if (response == null)
					return;
			}
Solution content
			byte [] response = null;
			try {
				query = new Message(inBytes);
        ConnectionHandler.setRemoteInetAddress( socket.getInetAddress( ) );
        try {
          response = generateReply(query, inBytes, inBytes.length, socket);
        } catch ( RuntimeException ex ) {
          response = errorMessage(query, Rcode.SERVFAIL);
          throw ex;
        } finally {
          ConnectionHandler.removeRemoteInetAddress( );
        }
				if (response == null)
					return;
			}
File
TCPHandler.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Try statement
Variable
Chunk
Conflicting content
            byte [] in = new byte[udpLength];
            DatagramPacket indp = new DatagramPacket(in, in.length);
            DatagramPacket outdp = null;
<<<<<<< HEAD
            while (Bootstrap.isOperational( )) {
=======
            boolean internal = false;
            while (true) {
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
                indp.setLength(in.length);
                try {
                    socket.receive(indp);
Solution content
            byte [] in = new byte[udpLength];
            DatagramPacket indp = new DatagramPacket(in, in.length);
            DatagramPacket outdp = null;
            while (Bootstrap.isOperational( )) {
                indp.setLength(in.length);
                try {
                    socket.receive(indp);
File
UDPHandler.java
Developer's decision
Version 1
Kind of conflict
Variable
While statement
Chunk
Conflicting content
                    internal = isInternal(client);

                    query = new Message(in);
<<<<<<< HEAD
                    ConnectionHandler.setRemoteInetAddress( indp.getAddress( ) );
                    try {
                      response = generateReply( query, in,
                        indp.getLength( ),
                        null );
                    } catch ( RuntimeException ex ) {
                      response = errorMessage(query, Rcode.SERVFAIL);
                      throw ex;
                    } finally {
                      ConnectionHandler.removeRemoteInetAddress( );
                    }
=======
                    response = generateReply(query, in,
                            indp.getLength(),
                            null, internal);
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
                    if (response == null)
                        continue;
                } catch (Exception e) {
Solution content
                    query = new Message(in);
                    ConnectionHandler.setRemoteInetAddress( indp.getAddress( ) );
                    try {
                      response = generateReply( query, in,
                        indp.getLength( ),
                        null );
                    } catch ( RuntimeException ex ) {
                      response = errorMessage(query, Rcode.SERVFAIL);
                      throw ex;
                    } finally {
                      ConnectionHandler.removeRemoteInetAddress( );
                    }
                    if (response == null)
                        continue;
                } catch (Exception e) {
File
UDPHandler.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Try statement
Variable
Chunk
Conflicting content
			if(name.toString().endsWith("in-addr.arpa.")) {
				//create new transient zone to handle reverse lookups
				return TransientZone.getPtrZone(name);
<<<<<<< HEAD
			} else {
				try {
					if(!ZoneManager.zones.containsKey(TransientZone.getExternalName())){
						ZoneManager.registerZone(TransientZone.getExternalName( ),TransientZone.getInstanceExternalZone());
					} else if(!ZoneManager.zones.containsKey(TransientZone.getInternalName())){
						ZoneManager.registerZone(TransientZone.getInternalName(),TransientZone.getInstanceInternalZone());
					} else if(!ZoneManager.zones.containsKey(ServiceZone.getName())){
						ZoneManager.registerZone(ServiceZone.getName(),ServiceZone.getZone());
					}	
				} catch(Exception e) {
					LOG.debug( e, e );
=======
			} 
			try {
				Name internalName = TransientZone.getInternalName();
				Name externalName = TransientZone.getExternalName();

				if(!ZoneManager.zones.containsKey(externalName)){
					ZoneManager.registerZone(externalName,TransientZone.getInstanceExternalZone());
					LOG.info("Registering zone: " + externalName.toString());
				} else if(!ZoneManager.zones.containsKey(internalName)){
					ZoneManager.registerZone(internalName,TransientZone.getInstanceInternalZone());
					LOG.info("Registering zone: " + internalName.toString());
				}
				if (name == internalName && !internal) {
					LOG.error("Invalid external query for " + internalName.toString());
					return null;
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
				}
			} catch(Exception e) {
				LOG.debug( e, e );
Solution content
			if(name.toString().endsWith("in-addr.arpa.")) {
				//create new transient zone to handle reverse lookups
				return TransientZone.getPtrZone(name);
			} else {
				try {
					if(!ZoneManager.zones.containsKey(TransientZone.getExternalName())){
						ZoneManager.registerZone(TransientZone.getExternalName( ),TransientZone.getInstanceExternalZone());
					} else if(!ZoneManager.zones.containsKey(TransientZone.getInternalName())){
						ZoneManager.registerZone(TransientZone.getInternalName(),TransientZone.getInstanceInternalZone());
					} else if(!ZoneManager.zones.containsKey(ServiceZone.getName())){
						ZoneManager.registerZone(ServiceZone.getName(),ServiceZone.getZone());
					}	
				} catch(Exception e) {
					LOG.debug( e, e );
				}
File
ZoneManager.java
Developer's decision
Combination
Kind of conflict
Catch clause
If statement
Method invocation
Return statement
Try statement
Variable
Chunk
Conflicting content
 */
@Override
  public SetResponse findRecords( Name name, int type ) {
<<<<<<< HEAD
	if(type == Type.AAAA)
		return(SetResponse.ofType(SetResponse.SUCCESSFUL));

	if( StackConfiguration.USE_INSTANCE_DNS && name.toString( ).matches("euca-.+{3}-.+{3}-.+{3}-.+{3}\\..*") ) {
=======
    return this.findRecords( name, type, false );
  }

@Override
  public SetResponse findRecords( Name name, int type, boolean internal ) {
    if (!name.toString().endsWith(this.getOrigin().toString())) {
      return super.findRecords( name, type );
    }
    if ( internal ) {
      LOG.debug("Processing internal request for " + name.toString() + " in Zone " + getOrigin().toString());
    } else {
      LOG.debug("Processing external request for " + name.toString() + " in Zone " + getOrigin().toString());
    }
    if( StackConfiguration.USE_INSTANCE_DNS && name.toString( ).matches("euca-.+{3}-.+{3}-.+{3}-.+{3}\\..*") ) {
>>>>>>> d2a1daf47df854f0193693194da90c72f816c05e
      try {
        String[] tryIp = name.toString( ).replaceAll( "euca-", "" ).replaceAll(VmInstances.INSTANCE_SUBDOMAIN + ".*", "").split("-");
        if( tryIp.length < 4 ) return super.findRecords( name, type );
Solution content
 */
@Override
  public SetResponse findRecords( Name name, int type ) {
	if(type == Type.AAAA)
		return(SetResponse.ofType(SetResponse.SUCCESSFUL));

	if( StackConfiguration.USE_INSTANCE_DNS && name.toString( ).matches("euca-.+{3}-.+{3}-.+{3}-.+{3}\\..*") ) {
      try {
        String[] tryIp = name.toString( ).replaceAll( "euca-", "" ).replaceAll(VmInstances.INSTANCE_SUBDOMAIN + ".*", "").split("-");
        if( tryIp.length < 4 ) return super.findRecords( name, type );
File
TransientZone.java
Developer's decision
Version 1
Kind of conflict
Annotation
If statement
Method invocation
Method signature
Return statement