auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<String> getAuthenticatedUserRoles(IdentityProvider identityProvider) { List<String> roles = identityProvider != null ? identityProvider.getRoles() : new ArrayList<>(); if (roles == null || roles.isEmpty()) { roles = new ArrayList<>(); roles.add(""); } return roles; }

Target:
public static List<String> getAuthenticatedUserRoles(IdentityProvider identityProvider) { List<String> roles = identityProvider != null ? identityProvider.getRoles() : new ArrayList<String>(); if (roles == null || roles.isEmpty()) { roles = new ArrayList<String>(); roles.add(""); } return roles; }
Source:
public void addValues(String key, Collection<String> values) { if (values == null || values.size() == 0) return; String[] existingvals = md.get(key); if (existingvals == null) { md.put(key, values.toArray(new String[values.size()])); return; } ArrayList<String> existing = new ArrayList<String>(existingvals.length); for (String v : existingvals) existing.add(v); existing.addAll(values); md.put(key, existing.toArray(new String[existing.size()])); }

Target:
public void addValues(String key, Collection<String> values) { if (values == null || values.size() == 0) return; String[] existingvals = md.get(key); if (existingvals == null) { md.put(key, values.toArray(new String[values.size()])); return; } ArrayList<String> existing = new ArrayList<String>(existingvals.length + values.size()); for (String v : existingvals) existing.add(v); existing.addAll(values); md.put(key, existing.toArray(new String[existing.size()])); }
Source:
public HasSelfVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) { super(conf, inferenceEngine); include = conf.isInferInverseOf(); }

Target:
public HasSelfVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) { super(conf, inferenceEngine); include = conf.hasSelf(); }
Source:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,5,0),new K2UpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,7,1), new UpgradeScriptForModifySchemaPermission(sdd,tc)); }

Target:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,5,0),new K2UpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,5,1), new UpgradeScriptForModifySchemaPermission(sdd,tc)); }
Source:
private static String typeAdapterGetter(Property prop, ClassName jsonAdapter, TypeMirror typeAdapterFactory, Types typeUtils, List<TypeVariableName> typeParams) { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; ParameterizedTypeName adp = ParameterizedTypeName.get(jsonAdapter, type); CodeBlock.Builder codeBuilder = CodeBlock.builder(); if (prop.typeAdapter != null) { if (typeUtils.isAssignable(prop.typeAdapter, typeAdapterFactory)) { if (prop.type instanceof ParameterizedTypeName || prop.type instanceof TypeVariableName) { codeBuilder.add("(($T) new $T().create(gson, $L))", adp, TypeName.get(prop.typeAdapter), makeParameterizedType(prop.type, typeParams)); } else { codeBuilder.add("(new $T().create(gson, $T.get($T.class)))", TypeName.get(prop.typeAdapter), TypeToken.class, prop.type); } } else { codeBuilder.add("(new $T())", TypeName.get(prop.typeAdapter)); } } else if (prop.type instanceof ParameterizedTypeName || prop.type instanceof TypeVariableName) { codeBuilder.add("(($T) gson.getAdapter($L))", adp, makeParameterizedType(prop.type, typeParams)); } else { codeBuilder.add("(gson.getAdapter($T.class))", type); } return codeBuilder.build().toString(); }

Target:
private static String typeAdapterGetter(Property prop, ClassName jsonAdapter, TypeMirror typeAdapterFactory, Types typeUtils, List<TypeVariableName> typeParams) { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; ParameterizedTypeName adp = ParameterizedTypeName.get(jsonAdapter, type); CodeBlock.Builder codeBuilder = CodeBlock.builder(); if (prop.typeAdapter != null) { if (typeUtils.isAssignable(prop.typeAdapter, typeAdapterFactory)) { if (prop.type instanceof ParameterizedTypeName || prop.type instanceof TypeVariableName) { codeBuilder.add("($T) new $T().create(gson, $L)", adp, TypeName.get(prop.typeAdapter), makeParameterizedType(prop.type, typeParams)); } else { codeBuilder.add("new $T().create(gson, $T.get($T.class))", TypeName.get(prop.typeAdapter), TypeToken.class, prop.type); } } else { codeBuilder.add("new $T()", TypeName.get(prop.typeAdapter)); } } else if (prop.type instanceof ParameterizedTypeName || prop.type instanceof TypeVariableName) { codeBuilder.add("($T) gson.getAdapter($L)", adp, makeParameterizedType(prop.type, typeParams)); } else { codeBuilder.add("gson.getAdapter($T.class)", type); } return codeBuilder.build().toString(); }
Source:
public synchronized void releaseContainer(ContainerId containerId, boolean releasedByNode) { RMContainer container = getContainer(containerId); super.releaseContainer(containerId, releasedByNode); if (container != null) { removeContainerForPreemption(container); } }

Target:
public synchronized void releaseContainer(ContainerId containerId, boolean releasedByNode) { RMContainer container = getContainer(containerId); super.releaseContainer(containerId, releasedByNode); if (container != null) { containersForPreemption.remove(container); } }
Source:
boolean selectConflictingRevision() throws CouchbaseLiteException { try { if (!c4doc.getRawDoc().selectNextLeaf(false, true)) return false; setC4Doc(c4doc); } catch (LiteCoreException e) { Log.e(TAG, "Failed to selectNextLeaf: doc -> " + c4doc, e); return false; } return true; }

Target:
boolean selectConflictingRevision() { try { if (!c4doc.getRawDoc().selectNextLeaf(false, true)) return false; setC4Doc(c4doc); } catch (LiteCoreException e) { Log.e(TAG, "Failed to selectNextLeaf: doc -> " + c4doc, e); return false; } return true; }
Source:
private void initDisplayProtocol() { ArrayList<EntityModel> displayProtocolOptions = new ArrayList<EntityModel>(); getDisplayProtocol().setItems(displayProtocolOptions); getDisplayProtocol().getSelectedItemChangedEvent().addListener(this); }

Target:
private void initDisplayProtocol() { getDisplayProtocol().getSelectedItemChangedEvent().addListener(this); }
Source:
public void abortProcessInstance(Long processInstanceId) { ProcessInstanceDesc piDesc = dataService.getProcessInstanceById(processInstanceId); if (piDesc == null || piDesc.getState() != 1) { throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " was not found"); } abortProcessInstance(piDesc.getDeploymentId(), processInstanceId); }

Target:
public void abortProcessInstance(Long processInstanceId) { ProcessInstanceDesc piDesc = dataService.getProcessInstanceById(processInstanceId); if (piDesc == null || piDesc.getState() != ProcessInstance.STATE_ACTIVE) { throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " was not found"); } abortProcessInstance(piDesc.getDeploymentId(), processInstanceId); }
Source:
public D[] getAllUserData(D[] array) { if (this.data == null) { return (D[]) Array.newInstance(array.getClass(),0); } return this.data.toArray(array); }

Target:
public D[] getAllUserData(D[] array) { if (this.data == null) { return null; } return this.data.toArray(array); }
Source:
public Response deleteContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { Field field = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); fieldAPI.delete(field, user); response = Response.ok(new ResponseEntityView(null)).build(); } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }

Target:
public Response deleteContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { final Field field = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); fieldAPI.delete(field, user); response = Response.ok(new ResponseEntityView(null)).build(); } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }
Source:
public static double get(MetricKey<ASTAnyTypeDeclaration> key, ASTAnyTypeDeclaration node, MetricVersion version) { if (!key.getCalculator().supports(node)) { return Double.NaN; } MetricVersion safeVersion = (version == null) ? Version.STANDARD : version; return TOP_LEVEL_PACKAGE.compute(key, node, false, safeVersion); }

Target:
public static double get(MetricKey<ASTAnyTypeDeclaration> key, ASTAnyTypeDeclaration node, MetricVersion version) { if (!key.supports(node)) { return Double.NaN; } MetricVersion safeVersion = (version == null) ? Version.STANDARD : version; return TOP_LEVEL_PACKAGE.compute(key, node, false, safeVersion); }
Source:
public void addHeader(String name, String value) { if (name.equalsIgnoreCase("COOKIE")) { this.cookieInHeaders=value; } else if (!NOT_ADD_HEADERS.contains(name)) { headers.put(name, value); } }

Target:
public void addHeader(String name, String value) { if ("COOKIE".equalsIgnoreCase(name)) { this.cookieInHeaders = value; } else if (!HEADERS_TO_IGNORE.contains(name)) { headers.put(name, value); } }
Source:
private GitResourceVariantTreeProvider createTreeProviderWithDeletions() throws Exception { file1 = testRepo.createFile(iProject, "file1"); testRepo.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "Creation of file1 in branch1."); file2 = testRepo.createFile(iProject, "file2"); testRepo.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "Creation of file2 in branch2."); testRepo.createBranch(MASTER, BASE); testRepo.createAndCheckoutBranch(MASTER, BRANCH); testRepo.untrack(file2); testRepo.commit("Removed file2 in branch."); testRepo.checkoutBranch(MASTER); testRepo.untrack(file1); testRepo.commit("Removed file1 in master."); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); try (RevWalk walk = new RevWalk(repo)) { RevTree baseTree = walk.parseTree(repo.resolve(BASE)); RevTree sourceTree = walk.parseTree(repo.resolve(MASTER)); RevTree remoteTree = walk.parseTree(repo.resolve(BRANCH)); TreeWalk tw = new NameConflictTreeWalk(repo); tw.addTree(baseTree); tw.addTree(sourceTree); tw.addTree(remoteTree); return new TreeWalkResourceVariantTreeProvider(repo, tw, 0, 1, 2); } }

Target:
private GitResourceVariantTreeProvider createTreeProviderWithDeletions() throws Exception { file1 = testRepo.createFile(iProject, "file1"); testRepo.appendContentAndCommit(iProject, file1, INITIAL_CONTENT_1, "Creation of file1 in branch1."); file2 = testRepo.createFile(iProject, "file2"); testRepo.appendContentAndCommit(iProject, file2, INITIAL_CONTENT_2, "Creation of file2 in branch2."); testRepo.createBranch(MASTER, BASE); testRepo.createAndCheckoutBranch(MASTER, BRANCH); testRepo.untrack(file2); testRepo.commit("Removed file2 in branch."); testRepo.checkoutBranch(MASTER); testRepo.untrack(file1); testRepo.commit("Removed file1 in master."); iProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); try (RevWalk walk = new RevWalk(repo)) { RevTree baseTree = walk.parseTree(repo.resolve(BASE)); RevTree sourceTree = walk.parseTree(repo.resolve(MASTER)); RevTree remoteTree = walk.parseTree(repo.resolve(BRANCH)); TreeWalk tw = new TreeWalk(repo); tw.addTree(baseTree); tw.addTree(sourceTree); tw.addTree(remoteTree); return new TreeWalkResourceVariantTreeProvider(repo, tw, 0, 1, 2); } }
Source:
private static <T> Object[] toArray(Iterable<T> elements) { if (elements instanceof Array) { final Array<T> array = (Array<T>) elements; return array.delegate; } else if (elements instanceof java.util.Collection) { final java.util.Collection<T> collection = (java.util.Collection<T>) elements; return collection.toArray(); } else { final java.util.Iterator<? extends T> it = elements.iterator(); final java.util.List<T> list = new java.util.ArrayList<>(); while (it.hasNext()) { list.add(it.next()); } return list.toArray(); } }

Target:
private static <T> Object[] toArray(Iterable<T> elements) { if (elements instanceof Array) { final Array<T> array = (Array<T>) elements; return array.delegate; } else { return Collections.withSize(elements).toArray(); } }
Source:
protected FileInfo addFile(InputStream inputStream, FileInfo fileInfo) throws Exception { final String updatedFileStorageName = getFileStorageName(fileInfo.getName()); fileInfo.setStoredFileName(updatedFileStorageName); log.info("Uploading File with fileInfo [{}]", fileInfo); final String uploadedFileStoragePath = catalogService.uploadFileToStorage(inputStream, updatedFileStorageName); log.info("Received File with fileInfo is uploaded to [{}]", uploadedFileStoragePath); fileInfo.setTimestamp(System.currentTimeMillis()); return catalogService.addFile(fileInfo); }

Target:
protected FileInfo addFile(InputStream inputStream, FileInfo fileInfo) { uploadFile(inputStream, fileInfo); return catalogService.addFile(fileInfo); }
Source:
public ICredentialsFactory asCredentialsFactory(ClassLoader cl) { if (implementation != null) { return implementation; } else { try { ICredentialsFactory credentialsFactory = ClassLoaderUtil.newInstance(cl, className); credentialsFactory.init(properties); return credentialsFactory; } catch (Exception e) { throw new IllegalArgumentException("Could not create instance of '" + className + "', cause: " + e.getMessage(), e); } } }

Target:
public ICredentialsFactory asCredentialsFactory(ClassLoader cl) { if (implementation == null) { try { implementation = ClassLoaderUtil.newInstance(cl, className); implementation.init(properties); } catch (Exception e) { throw new IllegalArgumentException("Could not create instance of '" + className + "', cause: " + e.getMessage(), e); } } return implementation; }
Source:
public String getClientToken(String params) { try (Scope orderSpanScope = TracingUtil.buildSpan(CommandType.GET_CLIENT_TOKEN.toString(), true)) { TracingUtil.setTag("end-point", "/get-client-token"); return process(CommandType.GET_CLIENT_TOKEN, params, GetClientTokenParams.class, null); } }

Target:
public String getClientToken(String params) { return process(CommandType.GET_CLIENT_TOKEN, params, GetClientTokenParams.class, null, uriInfo); }
Source:
@Override public void start0() throws IgniteCheckedException { CacheConfiguration cfg = cctx.config(); if (cctx.isNear()) { plc = (cfg.getNearConfiguration().getNearEvictionPolicyFactory() != null) ? (EvictionPolicy)cfg.getNearConfiguration().getNearEvictionPolicyFactory().create() : cfg.getNearConfiguration().getNearEvictionPolicy(); } else if (cfg.getEvictionPolicyFactory() != null) plc = (EvictionPolicy)cfg.getEvictionPolicyFactory().create(); else plc = cfg.getEvictionPolicy(); plcEnabled = plc != null; filter = cfg.getEvictionFilter(); if (plcEnabled) cctx.kernalContext().cache().prepare(cctx.config(),plc,cctx.isNear()); if (log.isDebugEnabled()) log.debug("Eviction manager started on node: " + cctx.nodeId()); }

Target:
@Override public void start0() throws IgniteCheckedException { CacheConfiguration cfg = cctx.config(); if (cctx.isNear()) { plc = (cfg.getNearConfiguration().getNearEvictionPolicyFactory() != null) ? (EvictionPolicy)cfg.getNearConfiguration().getNearEvictionPolicyFactory().create() : cfg.getNearConfiguration().getNearEvictionPolicy(); } else if (cfg.getEvictionPolicyFactory() != null) plc = (EvictionPolicy)cfg.getEvictionPolicyFactory().create(); else plc = cfg.getEvictionPolicy(); plcEnabled = plc != null; if (plcEnabled) prepare(cfg, plc, cctx.isNear()); filter = cfg.getEvictionFilter(); if (log.isDebugEnabled()) log.debug("Eviction manager started on node: " + cctx.nodeId()); }
Source:
public void shutdown() throws ReplicationException { try { for (String datacenter : replicaThreadPools.keySet()) { for (ReplicaThread replicaThread : replicaThreadPools.get(datacenter)) { replicaThread.shutdown(); } } persistor.write(true); } catch (Exception e) { logger.error("Error shutting down replica manager {}", e); throw new ReplicationException("Error shutting down replica manager"); } }

Target:
public void shutdown() throws ReplicationException { try { for (Map.Entry<String, List<ReplicaThread>> replicaThreads : replicaThreadPools.entrySet()) { if (replicaThreads.getKey().equals(dataNodeId.getDatacenterName())) { for (ReplicaThread replicaThread : replicaThreads.getValue()) { replicaThread.shutdown(); } } } for (Map.Entry<String, List<ReplicaThread>> replicaThreads : replicaThreadPools.entrySet()) { if (!replicaThreads.getKey().equals(dataNodeId.getDatacenterName())) { for (ReplicaThread replicaThread : replicaThreads.getValue()) { replicaThread.shutdown(); } } } persistor.write(true); } catch (Exception e) { logger.error("Error shutting down replica manager {}", e); throw new ReplicationException("Error shutting down replica manager"); } }
Source:
public static String[] getRecommendedProtocols() { String[] supportedProtocols = { "TLSv1", "TLSv1.1", "TLSv1.2" }; return supportedProtocols; }

Target:
public static String[] getRecommendedProtocols() { return new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }; }
Source:
public void handleGetAdministrativeStatusResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException, final AdministrativeStatusTypeDto administrativeStatusTypeDto) { LOGGER.info("handleGetAdministrativeStatusResponse for MessageType: {}, with result: {}", deviceMessageMetadata.getMessageType(), responseMessageResultType.toString()); ResponseMessageResultType result = responseMessageResultType; if (osgpException != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, osgpException); result = ResponseMessageResultType.NOT_OK; } final AdministrativeStatusType administrativeStatusType = this.configurationMapper .map(administrativeStatusTypeDto, AdministrativeStatusType.class); this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(osgpException).withDataObject(administrativeStatusType) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleGetAdministrativeStatusResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException, final AdministrativeStatusTypeDto administrativeStatusTypeDto) { LOGGER.info("handleGetAdministrativeStatusResponse for MessageType: {}, with result: {}", deviceMessageMetadata.getMessageType(), responseMessageResultType.toString()); ResponseMessageResultType result = responseMessageResultType; if (osgpException != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, osgpException); result = ResponseMessageResultType.NOT_OK; } final AdministrativeStatusType administrativeStatusType = this.configurationMapper .map(administrativeStatusTypeDto, AdministrativeStatusType.class); ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(osgpException).withDataObject(administrativeStatusType) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send( responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public TestNGTestListener() { EnvironmentCheck.checkJVMVersion(); progressLogger = new TestSuiteProgress(); }

Target:
public TestNGTestListener() { progressLogger = new TestSuiteProgress(); }
Source:
public @Nullable Comparator<?> getComparator() { return new Comparator<CalledFunction>() { @Override public int compare(@Nullable CalledFunction o1, @Nullable CalledFunction o2) { if (o1 == null || o2 == null) { throw new IllegalArgumentException(); } return Long.compare(o1.getLength(), o2.getLength()); } }; }

Target:
public @Nullable Comparator<?> getComparator() { return new Comparator<ISegment>() { @Override public int compare(@Nullable ISegment o1, @Nullable ISegment o2) { if (o1 == null || o2 == null) { throw new IllegalArgumentException(); } return Long.compare(o1.getLength(), o2.getLength()); } }; }
Source:
public Image getImage() { Iterable<TemporalField<Image>> primaryImages = Iterables.filter( images, new Predicate<TemporalField<Image>>() { @Override public boolean apply(TemporalField<Image> input) { Image image = input.getValue(); return IS_PRIMARY_IMAGE.apply(image); } } ); return TemporalField.currentOrFutureValue(primaryImages); }

Target:
public Image getImage() { Iterable<TemporalField<Image>> primaryImages = Iterables.filter( images, MorePredicates.transformingPredicate(TemporalField.<Image>toValueFunction(), IS_PRIMARY_IMAGE) ); return TemporalField.currentOrFutureValue(primaryImages); }
Source:
public void updateMapping(final JID jid, final Map<String, String> resourceNameMapping) { final Map<String, String> lastResourceNameMapping = getMapping(jid); final Set<String> resourceNameDestinations = new HashSet<>(resourceNameMapping.values()); for (final Iterator<Entry<String, String>> it = lastResourceNameMapping.entrySet().iterator(); it.hasNext(); ) { final Entry<String, String> entry = it.next(); if (resourceNameDestinations.contains(entry.getValue())) it.remove(); } lastResourceNameMapping.putAll(resourceNameMapping); if (lastResourceNameMapping.isEmpty()) return; final StringBuilder builder = new StringBuilder(); for (final Entry<String, String> entry : lastResourceNameMapping.entrySet()) { builder.append(escape(entry.getKey())); builder.append(DELIMITER); builder.append(escape(entry.getValue())); builder.append(DELIMITER); } builder.setLength(builder.length() - 1); store.setValue(RESOURCE_MAPPING_STORE_PREFIX + jid.getBase(), builder.toString()); }

Target:
public void updateMapping(final JID jid, final Map<String, String> resourceNameMapping) { final Map<String, String> lastResourceNameMapping = getMapping(jid); final Set<String> resourceNameDestinations = new HashSet<>(resourceNameMapping.values()); final Iterator<Entry<String, String>> it = lastResourceNameMapping.entrySet().iterator(); while (it.hasNext()) { final Entry<String, String> entry = it.next(); if (resourceNameDestinations.contains(entry.getValue())) it.remove(); } lastResourceNameMapping.putAll(resourceNameMapping); if (lastResourceNameMapping.isEmpty()) return; final StringBuilder builder = new StringBuilder(); for (final Entry<String, String> entry : lastResourceNameMapping.entrySet()) { builder.append(escape(entry.getKey())); builder.append(DELIMITER); builder.append(escape(entry.getValue())); builder.append(DELIMITER); } builder.setLength(builder.length() - DELIMITER.length()); store.setValue(RESOURCE_MAPPING_STORE_PREFIX + jid.getBase(), builder.toString()); }
Source:
public Iterator<String> iterator() { LOG.debug("Not json, hoping it is a good string : %s", string); return Splitter.on( new CharMatcher() { private boolean inQuotes = false; @Override public boolean matches(char c) { if ('"' == c) { inQuotes = !inQuotes; } if (inQuotes) { return false; } return CharMatcher.BREAKING_WHITESPACE.matches(c); } } ).omitEmptyStrings().split(string).iterator(); }

Target:
public Iterator<String> iterator() { return Splitter.on( new CharMatcher() { private boolean inQuotes = false; @Override public boolean matches(char c) { if ('"' == c) { inQuotes = !inQuotes; } if (inQuotes) { return false; } return CharMatcher.BREAKING_WHITESPACE.matches(c); } } ).omitEmptyStrings().split(string).iterator(); }
Source:
private void handleRequest(RpcMessageProto rpcRequestProto, ByteString rpcContent, RpcModule module) { Tracer.SpanBuilder spanBuilder = buildSpanFromRpcMessage(rpcRequestProto); Span minionSpan = spanBuilder.start(); RpcRequest request = module.unmarshalRequest(rpcContent.toStringUtf8()); setTagsOnMinion(rpcRequestProto, request, minionSpan); CompletableFuture<RpcResponse> future = module.execute(request); future.whenComplete((res, ex) -> { final RpcResponse response; if (ex != null) { LOG.warn("An error occured while executing a call in {}.", module.getId(), ex); response = module.createResponseWithException(ex); minionSpan.log(ex.getMessage()); minionSpan.setTag(TAG_RPC_FAILED, "true"); } else { response = res; } minionSpan.finish(); bulkhead.onComplete(); sendResponse(rpcRequestProto.getRpcId(), response, module); }); }

Target:
private void handleRequest(RpcMessageProto rpcRequestProto, ByteString rpcContent, RpcModule module) { Tracer.SpanBuilder spanBuilder = buildSpanFromRpcMessage(rpcRequestProto); Span minionSpan = spanBuilder.start(); RpcRequest request = module.unmarshalRequest(rpcContent.toStringUtf8()); setTagsOnMinion(rpcRequestProto, request, minionSpan); CompletableFuture<RpcResponse> future = module.execute(request); final Meter requestSentMeter = getMetrics().meter(MetricRegistry.name(module.getId(), RPC_REQUESTS_RECEIVED)); requestSentMeter.mark(); future.whenComplete((res, ex) -> { final RpcResponse response; if (ex != null) { LOG.warn("An error occured while executing a call in {}.", module.getId(), ex); response = module.createResponseWithException(ex); minionSpan.log(ex.getMessage()); minionSpan.setTag(TAG_RPC_FAILED, "true"); Meter failedMeter = getMetrics().meter(MetricRegistry.name(module.getId(), RPC_FAILED)); failedMeter.mark(); } else { response = res; } minionSpan.finish(); uncheckBulkhead(); sendResponse(rpcRequestProto.getRpcId(), response, module); }); }
Source:
public void onReceive(Context ctx, Intent intent) { String referrerStr = intent.getStringExtra(REFERRER_KEY); L.d("Received install referrer: " + referrerStr); if (!INSTALL_ACTION.equals(intent.getAction()) || TextUtils.isEmpty(referrerStr)) { return; } try { Uri uri = Uri.parse("/?" + referrerStr); String refUrl = uri.getQueryParameter(InstallReferrerFunnel.PARAM_REFERRER_URL); String refCampaignId = uri.getQueryParameter(InstallReferrerFunnel.PARAM_CAMPAIGN_ID); String refCampaignInstallId = uri.getQueryParameter(InstallReferrerFunnel.PARAM_CAMPAIGN_INSTALL_ID); if (!TextUtils.isEmpty(refUrl) || !TextUtils.isEmpty(refCampaignId) || !TextUtils.isEmpty(refCampaignInstallId)) { InstallReferrerFunnel funnel = new InstallReferrerFunnel(WikipediaApp.getInstance()); funnel.logInstall(refUrl, refCampaignId, refCampaignInstallId); } } catch (UnsupportedOperationException e) { } }

Target:
public void onReceive(Context ctx, Intent intent) { String referrerStr = intent.getStringExtra(REFERRER_KEY); L.d("Received install referrer: " + referrerStr); if (!INSTALL_ACTION.equals(intent.getAction()) || TextUtils.isEmpty(referrerStr)) { return; } String refUrl = null; String refCampaignId = null; String refCampaignInstallId = null; try { Uri uri = Uri.parse("/?" + referrerStr); refUrl = uri.getQueryParameter(InstallReferrerFunnel.PARAM_REFERRER_URL); refCampaignId = uri.getQueryParameter(InstallReferrerFunnel.PARAM_CAMPAIGN_ID); refCampaignInstallId = uri.getQueryParameter(InstallReferrerFunnel.PARAM_CAMPAIGN_INSTALL_ID); } catch (UnsupportedOperationException e) { } if (!TextUtils.isEmpty(refUrl) || !TextUtils.isEmpty(refCampaignId) || !TextUtils.isEmpty(refCampaignInstallId)) { InstallReferrerFunnel funnel = new InstallReferrerFunnel(WikipediaApp.getInstance()); funnel.logInstall(refUrl, refCampaignId, refCampaignInstallId); } }
Source:
private StreamWriter getStreamWriterForPipe(PipeConfiguration pipeConf) throws IOException { StreamClient client = pipeConf.getSinkConfiguration().getStreamClient(); String streamName = pipeConf.getSinkConfiguration().getStreamName(); try { client.create(streamName); StreamWriter writer = null; writer = client.createWriter(streamName); return writer; } catch (IOException e) { throw new IOException("Can not create/get client stream by name:" + streamName + ": " + e.getMessage()); } }

Target:
private StreamWriter getStreamWriterForPipe(PipeConfiguration pipeConf) throws IOException { StreamClient client = pipeConf.getSinkConfiguration().getStreamClient(); String streamName = pipeConf.getSinkConfiguration().getStreamName(); try { client.create(streamName); StreamWriter writer = client.createWriter(streamName); return writer; } catch (IOException e) { throw new IOException(String.format("Cannot create/get client stream by name: %s: %s", streamName, e)); } }
Source:
public LoadFileUtils() { throw new IllegalAccessError("This utility class as static methods, you should not instantiate this object."); }

Target:
public LoadFileUtils() { throw new IllegalAccessError("This utility class has static methods, you should not instantiate this object."); }
Source:
private BytesValues(byte[][] values, boolean nullAllowed) { super(true, nullAllowed); requireNonNull(values, "values is null"); checkArgument(values.length > 0, "values must contain at least 1 entries"); this.values = values; lengthExists = new boolean[Arrays.stream(values).mapToInt(value -> value.length).max().getAsInt() + 1]; int hashTableSize = Integer.highestOneBit(values.length * 4); hashTableSizeMask = hashTableSize - 1; hashTable = new byte[hashTableSize][]; bloomSize = Math.max(1, hashTableSize / 8); bloom = new long[bloomSize]; for (byte[] value : values) { lengthExists[value.length] = true; long hashCode = hash(value, 0, value.length); bloom[bloomIndex(hashCode)] |= bloomMask(hashCode); int position = (int) (hashCode & hashTableSizeMask); for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & hashTableSizeMask; if (hashTable[index] == null) { hashTable[index] = value; break; } if (compareRanges(value, 0, value.length, hashTable[index], 0, hashTable[index].length) == 0) { break; } } } }

Target:
private BytesValues(byte[][] values, boolean nullAllowed) { super(true, nullAllowed); requireNonNull(values, "values is null"); checkArgument(values.length > 0, "values must not be empty"); this.values = values; lengthExists = new boolean[Arrays.stream(values).mapToInt(value -> value.length).max().getAsInt() + 1]; int hashTableSize = Integer.highestOneBit(values.length * 4); hashTableSizeMask = hashTableSize - 1; hashTable = new byte[hashTableSize][]; bloomSize = Math.max(1, hashTableSize / 8); bloom = new long[bloomSize]; for (byte[] value : values) { lengthExists[value.length] = true; long hashCode = hash(value, 0, value.length); bloom[bloomIndex(hashCode)] |= bloomMask(hashCode); int position = (int) (hashCode & hashTableSizeMask); for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & hashTableSizeMask; if (hashTable[index] == null) { hashTable[index] = value; break; } if (compareRanges(value, 0, value.length, hashTable[index], 0, hashTable[index].length) == 0) { break; } } } }
Source:
private BlackboardArtifact createDownloadSourceArtifact(AbstractFile downloadFile, ZoneIdentifierInfo zoneInfo) { Collection<BlackboardAttribute> bbattributes = new ArrayList<>(); bbattributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, RecentActivityExtracterModuleFactory.getModuleName(), (zoneInfo.getURL() != null) ? zoneInfo.getURL() : "")); bbattributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN, RecentActivityExtracterModuleFactory.getModuleName(), (zoneInfo.getURL() != null) ? NetworkUtils.extractDomain(zoneInfo.getURL()) : "")); bbattributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, RecentActivityExtracterModuleFactory.getModuleName(), (zoneInfo.getZoneIdAsString() != null) ? zoneInfo.getZoneIdAsString() : "")); return addArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_DOWNLOAD_SOURCE, downloadFile, bbattributes); }

Target:
private BlackboardArtifact createDownloadSourceArtifact(AbstractFile downloadFile, ZoneIdentifierInfo zoneInfo) { Collection<BlackboardAttribute> bbattributes = new ArrayList<>(); bbattributes.addAll(Arrays.asList( new BlackboardAttribute(TSK_URL, RecentActivityExtracterModuleFactory.getModuleName(), StringUtils.defaultString(zoneInfo.getURL(), "")), new BlackboardAttribute(TSK_DOMAIN, RecentActivityExtracterModuleFactory.getModuleName(), (zoneInfo.getURL() != null) ? NetworkUtils.extractDomain(zoneInfo.getURL()) : ""), new BlackboardAttribute(TSK_LOCATION, RecentActivityExtracterModuleFactory.getModuleName(), StringUtils.defaultString(zoneInfo.getZoneIdAsString(), "")))); return addArtifact(TSK_DOWNLOAD_SOURCE, downloadFile, bbattributes); }
Source:
protected void disableAndRemoveECrossReferenceAdapters() { ResourceSet resourceSet = getTransactionalEditingDomain().getResourceSet(); List<Adapter> adaptersToRemove = new ArrayList<Adapter>(); for (Adapter next : resourceSet.eAdapters()) { if (next instanceof SiriusCrossReferenceAdapter) { ((SiriusCrossReferenceAdapter) next).disableResolveProxy(); adaptersToRemove.add(next); } } resourceSet.eAdapters().removeAll(adaptersToRemove); for (Resource resource : resourceSet.getResources()) { disableCrossReferencerResolve(resource); resource.eAdapters().clear(); } Collection<Resource> semanticResources = getSemanticResources(); EList<Resource> controlledResources = getControlledResources(); Set<Resource> allSessionResources = getAllSessionResources(); ECrossReferenceAdapterWithUnproxyCapability semanticCrossReferencer = getSemanticCrossReferencer(); Iterable<Resource> resources = Iterables.concat(semanticResources, controlledResources, allSessionResources); for (Resource resource : resources) { if (!(resourceSet.getResources().contains(resource))) { disableCrossReferencerResolve(resource); resource.eAdapters().remove(semanticCrossReferencer); } } for (final DAnalysis analysis : Iterables.filter(allAnalyses(), Predicates.notNull())) { removeAdaptersOnAnalysis(analysis); } }

Target:
protected void disableAndRemoveECrossReferenceAdapters() { ResourceSet resourceSet = getTransactionalEditingDomain().getResourceSet(); List<Adapter> adaptersToRemove = new ArrayList<Adapter>(); for (Adapter next : resourceSet.eAdapters()) { if (next instanceof SiriusCrossReferenceAdapter) { ((SiriusCrossReferenceAdapter) next).disableResolveProxy(); adaptersToRemove.add(next); } } resourceSet.eAdapters().removeAll(adaptersToRemove); for (Resource resource : resourceSet.getResources()) { disableCrossReferencerResolve(resource); resource.eAdapters().clear(); } Collection<Resource> semanticResources = getSemanticResources(); Collection<Resource> controlledResources = getControlledResources(); Set<Resource> allSessionResources = getAllSessionResources(); Object semanticCrossReferencer = getSemanticCrossReferencer(); Iterable<Resource> resources = Iterables.concat(semanticResources, controlledResources, allSessionResources); for (Resource resource : resources) { if (!(resourceSet.getResources().contains(resource))) { disableCrossReferencerResolve(resource); resource.eAdapters().remove(semanticCrossReferencer); } } for (final DAnalysis analysis : Iterables.filter(allAnalyses(), Predicates.notNull())) { removeAdaptersOnAnalysis(analysis); } }
Source:
public SpatialKnownIndex( IndexDirectoryStructure directoryStructure, CoordinateReferenceSystem crs, long indexId, PageCache pageCache, FileSystemAbstraction fs, SchemaIndexProvider.Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector ) { this.crs = crs; this.indexId = indexId; this.pageCache = pageCache; this.fs = fs; this.monitor = monitor; this.recoveryCleanupWorkCollector = recoveryCleanupWorkCollector; SchemaIndexProvider.Descriptor crsDescriptor = new SchemaIndexProvider.Descriptor( Integer.toString( crs.getTable().getTableId() ), Integer.toString( crs.getCode() ) ); IndexDirectoryStructure indexDir = IndexDirectoryStructure.directoriesBySubProvider( directoryStructure ).forProvider( crsDescriptor ); indexFile = new File( indexDir.directoryForIndex( indexId ), indexFileName( indexId ) ); curve = new HilbertSpaceFillingCurve2D( envelopeFromCRS( crs ), 8 ); }

Target:
public SpatialKnownIndex( IndexDirectoryStructure directoryStructure, CoordinateReferenceSystem crs, long indexId, PageCache pageCache, FileSystemAbstraction fs, SchemaIndexProvider.Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector ) { this.crs = crs; this.indexId = indexId; this.pageCache = pageCache; this.fs = fs; this.monitor = monitor; this.recoveryCleanupWorkCollector = recoveryCleanupWorkCollector; SchemaIndexProvider.Descriptor crsDescriptor = new SchemaIndexProvider.Descriptor( Integer.toString( crs.getTable().getTableId() ), Integer.toString( crs.getCode() ) ); IndexDirectoryStructure indexDir = IndexDirectoryStructure.directoriesBySubProvider( directoryStructure ).forProvider( crsDescriptor ); indexFile = new File( indexDir.directoryForIndex( indexId ), "index-" + indexId ); curve = new HilbertSpaceFillingCurve2D( envelopeFromCRS( crs ), 8 ); state = State.NONE; }
Source:
public static File createTempFile(String prefix, String suffix, File parentDir, boolean deleteOnExit) throws IOException { File result = null; File parent = (parentDir == null) ? getDefaultTempDir() : parentDir; if (suffix == null) { suffix = ".tmp"; } if (prefix == null) { prefix = "cxf"; } else if (prefix.length() < 3) { prefix = prefix + "cxf"; } result = Files.createTempFile(parent.toPath(), prefix, suffix).toFile(); if (deleteOnExit && parentDir != null) { result.deleteOnExit(); } return result; }

Target:
public static File createTempFile(String prefix, String suffix, File parentDir, boolean deleteOnExit) throws IOException { File parent = (parentDir == null) ? getDefaultTempDir() : parentDir; if (prefix == null) { prefix = "cxf"; } else if (prefix.length() < 3) { prefix = prefix + "cxf"; } File result = Files.createTempFile(parent.toPath(), prefix, suffix).toFile(); if (deleteOnExit && parentDir != null) { result.deleteOnExit(); } return result; }
Source:
public String url(boolean isHttps) { String mergedIP = ipAddress().replaceAll("\\.", ""); char[] domainChars = mergedIP.toCharArray(); for (int i = 0; i < domainChars.length; i++) { char c = domainChars[i]; domainChars[i] = (char) (c + 97); } String domain = String.valueOf(domainChars); if (isHttps) return "https://" + domain + ".com"; else return "http://" + domain + ".com"; }

Target:
public String url(boolean isHttps) { String mergedIP = ipAddress().replaceAll("\\.", ""); char[] domainChars = mergedIP.toCharArray(); for (int i = 0; i < domainChars.length; i++) { char c = domainChars[i]; domainChars[i] = (char) (c + 97); } String domain = String.valueOf(domainChars); if (isHttps) { return "https://" + domain + ".com"; } else { return "http://" + domain + ".com"; } }
Source:
public void run(BatchActionContext batchActionContext) throws Exception { int retries = 0; Exception exception = null; do { HttpURLConnection conn = null; Map<String, List<String>> headers = conf.parseRequestProperties(); try { URL url = new URL(conf.url); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod(conf.method); conn.setConnectTimeout(conf.connectTimeoutMillis); for (Map.Entry<String, List<String>> propertyEntry : headers.entrySet()) { String propertyKey = propertyEntry.getKey(); for (String propertyValue : propertyEntry.getValue()) { conn.setRequestProperty(propertyKey, propertyValue); } } if (conf.body != null) { conn.setDoOutput(true); try (OutputStream outputStream = conn.getOutputStream()) { outputStream.write(conf.body.getBytes(Charsets.UTF_8)); } } LOG.info("Request to resulted in response code {}.", conf.url, conn.getResponseCode()); break; } catch (MalformedURLException | ProtocolException e) { throw new IllegalStateException("Error opening url connection. Reason: " + e.getMessage(), e); } catch (Exception e) { LOG.warn("Error making request to url with headers {}.", conf.method, conf.url, headers); exception = e; } finally { if (conn != null) { conn.disconnect(); } } retries++; } while (retries < conf.numRetries); if (exception != null) { throw exception; } }

Target:
public void run(BatchActionContext batchActionContext) throws Exception { int retries = 0; Exception exception = null; do { HttpURLConnection conn = null; Map<String, List<String>> headers = conf.parseRequestProperties(); try { URL url = new URL(conf.url); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod(conf.method); conn.setConnectTimeout(conf.connectTimeoutMillis); for (Map.Entry<String, List<String>> propertyEntry : headers.entrySet()) { String propertyKey = propertyEntry.getKey(); for (String propertyValue : propertyEntry.getValue()) { conn.addRequestProperty(propertyKey, propertyValue); } } if (conf.body != null) { conn.setDoOutput(true); try (OutputStream outputStream = conn.getOutputStream()) { outputStream.write(conf.body.getBytes(Charsets.UTF_8)); } } LOG.info("Request to resulted in response code {}.", conf.url, conn.getResponseCode()); break; } catch (MalformedURLException | ProtocolException e) { throw new IllegalStateException("Error opening url connection. Reason: " + e.getMessage(), e); } catch (Exception e) { LOG.warn("Error making request to url with headers {}.", conf.method, conf.url, headers); exception = e; } finally { if (conn != null) { conn.disconnect(); } } retries++; } while (retries < conf.numRetries); if (exception != null) { throw exception; } }
Source:
public boolean delete(long contestPK) { final boolean[] result = new boolean[1]; dslContext.transaction(configuration -> { DSLContext ctx = DSL.using(configuration); deleteContestData(ctx, contestPK); deleteContestPhases(ctx, contestPK); deleteOrphanProposals(ctx); result[0] = deleteContest(ctx, contestPK); }); return result[0]; }

Target:
public boolean delete(long contestPK) { AtomicBoolean result = new AtomicBoolean(); dslContext.transaction(configuration -> { DSLContext ctx = DSL.using(configuration); deleteContestData(ctx, contestPK); deleteContestPhases(ctx, contestPK); deleteOrphanProposals(ctx); result.set(deleteContest(ctx, contestPK)); }); return result.get(); }
Source:
public String createHiddenSpace(String spaceId, int expirationInDays) { String bucketName = getHiddenBucketName(spaceId); try { Bucket bucket = s3Client.createBucket(bucketName); BucketLifecycleConfiguration.Rule expiresRule = new BucketLifecycleConfiguration.Rule() .withId("ExpireInSeconds") .withExpirationInDays(expirationInDays) .withStatus(BucketLifecycleConfiguration.ENABLED); BucketLifecycleConfiguration configuration = new BucketLifecycleConfiguration() .withRules(expiresRule); s3Client.setBucketLifecycleConfiguration(bucketName, configuration); return spaceId; } catch (AmazonClientException e) { String err = "Could not create S3 bucket with name " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } }

Target:
public String createHiddenSpace(String spaceId, int expirationInDays) { String bucketName = getHiddenBucketName(spaceId); try { Bucket bucket = s3Client.createBucket(bucketName); BucketLifecycleConfiguration.Rule expiresRule = new BucketLifecycleConfiguration.Rule() .withId("ExpirationRule") .withExpirationInDays(expirationInDays) .withStatus(BucketLifecycleConfiguration.ENABLED); BucketLifecycleConfiguration configuration = new BucketLifecycleConfiguration() .withRules(expiresRule); s3Client.setBucketLifecycleConfiguration(bucketName, configuration); return spaceId; } catch (AmazonClientException e) { String err = "Could not create S3 bucket with name " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } }
Source:
protected void execute() { for (ExpireBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { Long nextExpireTs = nextExpireTsMap.get(itemName); if (nextExpireTs == null || nextExpireTs <= System.currentTimeMillis()) { logger.info("Item was not updated for - setting state to undefined", itemName, "5s"); eventPublisher.postUpdate(itemName, UnDefType.UNDEF); nextExpireTsMap.put(itemName, Long.MAX_VALUE); } } } }

Target:
protected void execute() { for (ExpireBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { Long nextExpireTs = nextExpireTsMap.get(itemName); if (nextExpireTs == null) { long expireAfterMs = provider.getExpiresAfterMs(itemName); nextExpireTsMap.put(itemName, System.currentTimeMillis() + expireAfterMs); } else if (nextExpireTs <= System.currentTimeMillis()) { State newState = provider.getExpiredState(itemName); logger.debug("Item was not updated for - setting state to {}", itemName, provider.getExpiresAfterAsText(itemName), newState); eventPublisher.postUpdate(itemName, newState); nextExpireTsMap.put(itemName, Long.MAX_VALUE); } } } }
Source:
public void shutdown() throws StoreException { long startTimeInMs = time.milliseconds(); synchronized (storeWriteLock) { checkStarted(); try { logger.info("Store : " + dataDir + " shutting down"); blobStoreStats.close(); metrics.deregisterMetrics(storeId); compactor.close(30); index.close(); log.close(); started = false; } catch (Exception e) { logger.error("Store : " + dataDir + " shutdown of store failed for directory ", e); } finally { try { fileLock.destroy(); } catch (IOException e) { logger.error("Store : " + dataDir + " IO Exception while trying to close the file lock", e); } metrics.storeShutdownTimeInMs.update(time.milliseconds() - startTimeInMs); } } }

Target:
public void shutdown() throws StoreException { long startTimeInMs = time.milliseconds(); synchronized (storeWriteLock) { checkStarted(); try { logger.info("Store : " + dataDir + " shutting down"); blobStoreStats.close(); compactor.close(30); index.close(); log.close(); metrics.deregisterMetrics(storeId); started = false; } catch (Exception e) { logger.error("Store : " + dataDir + " shutdown of store failed for directory ", e); } finally { try { fileLock.destroy(); } catch (IOException e) { logger.error("Store : " + dataDir + " IO Exception while trying to close the file lock", e); } metrics.storeShutdownTimeInMs.update(time.milliseconds() - startTimeInMs); } } }