| Chunk |
|---|
| Conflicting content |
|---|
import java.security.Principal; import java.util.ArrayList; <<<<<<< HEAD import java.util.GregorianCalendar; ======= >>>>>>> 8deba33f0f8954d30f92a43aaba02b865d15e26d import java.util.HashMap; import java.util.List; import java.util.Map; |
| Solution content |
|---|
import java.security.Principal; import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; |
| File |
|---|
| DirectoryUserManager.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
{
}
}
<<<<<<< HEAD
/**
* {@inheritDoc}
*/
@Override
public void updateTrackingInformation(Principal account)
throws AuthenticationException, NamingException
{
DirContext dirContext = getPersonalData(account);
DirectoryParameters params = new DirectoryParameters(dirContext);
bumpUpLogonCounter(params);
refreshTimestamp(params);
dirContext.close();
}
/**
* Bumps up logon counter
*
* @param params
*/
private void bumpUpLogonCounter(DirectoryParameters params)
{
String logonCount = "0";
boolean existed = true;
try
{
logonCount = params.get(logonCountAttribute);
}
catch(UndefinedParameterException e)
{
// parameter was not defined so it remains as 0
existed = false;
}
int bumpedCounter = Integer.parseInt(logonCount);
bumpedCounter = bumpedCounter + 1;
if(existed)
{
params.set(logonCountAttribute, Integer.valueOf(bumpedCounter).toString());
}
else
{
params.add(logonCountAttribute, Integer.valueOf(bumpedCounter).toString());
}
}
/**
* Sets last logon timestamp to now.
*
* @param params
*/
private void refreshTimestamp(DirectoryParameters params)
{
GeneralizedTime timestamp = new GeneralizedTime(new GregorianCalendar());
boolean existed = true;
try
params.get(lastLogonTimestampAttribute);
}
catch(UndefinedParameterException e)
{
existed = false;
}
if(existed)
{
params.set(lastLogonTimestampAttribute, timestamp.toGeneralizedTime());
}
else
{
params.add(lastLogonTimestampAttribute, timestamp.toGeneralizedTime());
}
}
=======
@Override
public String getUserAttribute(Principal account, String attribute)
throws AuthenticationException
{
{
String storedAttribute = "";
DirContext ctx = null;
try
{
ctx = directory.lookupDirContext(account.getName());
if(ctx == null)
{
throw new UserUnknownException("user " + account.getName() + " does not exist");
}
String[] attrIds = { attribute };
Attribute attr = ctx.getAttributes("", attrIds).get(attribute);
Object obj = attr.get();
if(obj instanceof String)
{
storedAttribute = (String)obj;
}
else
{
storedAttribute = new String((byte[])obj);
}
}
catch(Exception e)
{
throw new AuthenticationException("attribute retreiveal failed", e);
}
finally
{
closeContext(ctx);
}
return storedAttribute;
}
}
>>>>>>> 8deba33f0f8954d30f92a43aaba02b865d15e26d
} |
| Solution content |
|---|
}
}
/**
* {@inheritDoc}
*/
@Override
public void updateTrackingInformation(Principal account)
throws AuthenticationException, NamingException
{
DirContext dirContext = getPersonalData(account);
DirectoryParameters params = new DirectoryParameters(dirContext);
bumpUpLogonCounter(params);
refreshTimestamp(params);
dirContext.close();
}
/**
* Bumps up logon counter
*
* @param params
*/
private void bumpUpLogonCounter(DirectoryParameters params)
{
String logonCount = "0";
boolean existed = true;
try
{
logonCount = params.get(logonCountAttribute);
}
catch(UndefinedParameterException e)
{
// parameter was not defined so it remains as 0
existed = false;
}
int bumpedCounter = Integer.parseInt(logonCount);
bumpedCounter = bumpedCounter + 1;
if(existed)
{
params.set(logonCountAttribute, Integer.valueOf(bumpedCounter).toString());
}
else
{
params.add(logonCountAttribute, Integer.valueOf(bumpedCounter).toString());
}
}
/**
* Sets last logon timestamp to now.
*
* @param params
*/
private void refreshTimestamp(DirectoryParameters params)
{
GeneralizedTime timestamp = new GeneralizedTime(new GregorianCalendar());
boolean existed = true;
try
{
params.get(lastLogonTimestampAttribute);
}
catch(UndefinedParameterException e)
{
existed = false;
}
if(existed)
{
params.set(lastLogonTimestampAttribute, timestamp.toGeneralizedTime());
}
else
{
params.add(lastLogonTimestampAttribute, timestamp.toGeneralizedTime());
}
}
@Override
public String getUserAttribute(Principal account, String attribute)
throws AuthenticationException
{
{
String storedAttribute = "";
DirContext ctx = null;
try
{
ctx = directory.lookupDirContext(account.getName());
if(ctx == null)
{
throw new UserUnknownException("user " + account.getName() + " does not exist");
}
String[] attrIds = { attribute };
Attribute attr = ctx.getAttributes("", attrIds).get(attribute);
Object obj = attr.get();
if(obj instanceof String)
{
storedAttribute = (String)obj;
}
else
{
storedAttribute = new String((byte[])obj);
}
}
catch(Exception e)
{
throw new AuthenticationException("attribute retreiveal failed", e);
}
finally
{
closeContext(ctx);
}
return storedAttribute;
}
}
} |
| File |
|---|
| DirectoryUserManager.java |
| Developer's decision |
|---|
| Concatenation |
| Kind of conflict |
|---|
| Annotation |
| Comment |
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
public void changeUserAttribiutes(Principal account, Attributes attribiutes)
throws AuthenticationException
{
<<<<<<< HEAD
throw new UnsupportedOperationException("Dummy manager cannot change user attributes");
}
@Override
public void updateTrackingInformation(Principal account)
{
throw new UnsupportedOperationException(
"Dummy manager cannot perform update tracking information operation");
=======
throw new UnsupportedOperationException("Dummy manager cannot change user attribute");
}
@Override
public String getUserAttribute(Principal account, String attribute)
throws AuthenticationException
{
throw new UnsupportedOperationException("Dummy manager cannot get user attribute");
>>>>>>> 8deba33f0f8954d30f92a43aaba02b865d15e26d
}
} |
| Solution content |
|---|
public void changeUserAttribiutes(Principal account, Attributes attribiutes)
throws AuthenticationException
{
throw new UnsupportedOperationException("Dummy manager cannot change user attributes");
}
@Override
public void updateTrackingInformation(Principal account)
{
throw new UnsupportedOperationException(
"Dummy manager cannot perform update tracking information operation");
}
@Override
public String getUserAttribute(Principal account, String attribute)
throws AuthenticationException
{
throw new UnsupportedOperationException("Dummy manager cannot get user attribute");
}
} |
| File |
|---|
| DummyUserManager.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Annotation |
| Method signature |
| Throw statement |