Skip to content

Commit

Permalink
Review Import / Export Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
yurem committed Mar 6, 2017
1 parent 2cd3cc8 commit 08224f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.unboundid.ldif.LDIFReader;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.xdi.util.StringHelper;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -276,22 +277,23 @@ private void disposeLdifReader(LDIFReader ldifReader) {
}
}

public ResultCode validateLDIF(LDIFReader ldifReader,String dn){
public ResultCode validateLDIF(LDIFReader ldifReader, String dn) {
String baseDn = dn.toLowerCase();
ResultCode resultCode = ResultCode.SUCCESS;
while (true) {
// Read the next change to process
LDIFChangeRecord ldifRecord = null;
try {
ldifRecord = ldifReader.readChangeRecord(true);
if (ldifRecord != null) {
if (dn != null && !dn.isEmpty()) {
if (!ldifRecord.getDN().equals(dn)) {
if (StringHelper.isNotEmpty(baseDn)) {
if (!ldifRecord.getDN().toLowerCase().endsWith(baseDn)) {
resultCode = ResultCode.NOT_SUPPORTED;
break;
}
}
}

} catch (LDIFException le) {
log.info("Malformed ldif record " + ldifRecord);
log.error("Malformed ldif record", le);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
@Scope(APPLICATION)
@AutoCreate
@Startup
public class CacheProviderAdapter extends AbstractCacheProvider<CacheProvider> {
public class CacheProviderAdapter extends AbstractCacheProvider<CacheProvider<?>> {

@Logger
private Log log;

@In(required = true)
private CacheConfiguration cacheConfiguration;

private AbstractCacheProvider cacheProvider = null;
private AbstractCacheProvider<?> cacheProvider = null;

@Create
public void create() {
Expand Down Expand Up @@ -59,7 +59,7 @@ public void destroy() {
}

@Override
public CacheProvider getDelegate() {
public CacheProvider<?> getDelegate() {
return cacheProvider;
}

Expand Down

0 comments on commit 08224f9

Please sign in to comment.