auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) { boolean changed = false; for (MavenProjectChangedEvent event : ((events != null) ? events : new MavenProjectChangedEvent[0])) { Kind kind = Kind.get(event); logger.debug("{}: mavenProjectChanged({}, {})", getName(), kind, event.getSource()); switch (kind) { case ADDED : case CHANGED : IMavenProjectFacade projectFacade = event.getMavenProject(); Set<File> collected = collect(projectFacade, monitor); if (!collected.isEmpty()) { index(projectFacade.getProject(), collected); changed = true; } break; case REMOVED : changed = remove(event .getOldMavenProject() .getProject()); break; } } if (changed) { list = memoize(this::list0); unchecked(() -> Central.refreshPlugins()); } }

Target:
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) { boolean changed = false; for (MavenProjectChangedEvent event : ((events != null) ? events : new MavenProjectChangedEvent[0])) { Kind kind = Kind.get(event); logger.debug("{}: mavenProjectChanged({}, {})", getName(), kind, event.getSource()); switch (kind) { case ADDED : case CHANGED : if (process(event.getMavenProject(), monitor)) { changed = true; } break; case REMOVED : if (remove(event.getOldMavenProject() .getProject())) { changed = true; } break; } } if (changed) { list = memoize(this::list0); unchecked(() -> Central.refreshPlugins()); } }
Source:
public void setup() { doReturn(dbFacade).when(validator).getDbFacade(); doReturn(storageServerConnectionExtensionDao).when(dbFacade).getStorageServerConnectionExtensionDao(); doReturn(vdsDao).when(dbFacade).getVdsDao(); doReturn(new VDS()).when(vdsDao).get(any(Guid.class)); conn = new StorageServerConnectionExtension(); conn.setHostId(Guid.newGuid()); conn.setIqn("iqn1"); conn.setUserName("user1"); conn.setPassword("password1"); }

Target:
public void setup() { Guid hostId = Guid.newGuid(); doReturn(dbFacade).when(validator).getDbFacade(); doReturn(storageServerConnectionExtensionDao).when(dbFacade).getStorageServerConnectionExtensionDao(); doReturn(vdsDao).when(dbFacade).getVdsDao(); doReturn(new VDS()).when(vdsDao).get(hostId); conn = new StorageServerConnectionExtension(); conn.setHostId(hostId); conn.setIqn("iqn1"); conn.setUserName("user1"); conn.setPassword("password1"); }
Source:
public Transcoder getTranscoder(MediaType mediaType, MediaType another) { Optional<Transcoder> transcoder = transcoders .stream() .filter(t -> t.supportsConversion(mediaType, another)) .findAny(); if (!transcoder.isPresent()) { throw new EncodingException("Cannot find transcoder from " + mediaType + " to " + another); } return transcoder.get(); }

Target:
public Transcoder getTranscoder(MediaType mediaType, MediaType another) { Optional<Transcoder> transcoder = transcoders .stream() .filter(t -> t.supportsConversion(mediaType, another)) .findAny(); if (!transcoder.isPresent()) { throw log.cannotFindTranscoder(mediaType, another); } return transcoder.get(); }
Source:
private String analyzerName(Class<?> entityType, DocumentFieldMetadata fieldMetadata) { AnalyzerReference analyzer = fieldMetadata.getAnalyzer(); if ( analyzer.is( RemoteAnalyzerReference.class ) ) { return analyzer.unwrap( RemoteAnalyzerReference.class ).getName(); } LOG.analyzerIsNotRemote( entityType, fieldMetadata.getFieldName(), analyzer.toString() ); return null; }

Target:
private String analyzerName(Class<?> entityType, DocumentFieldMetadata fieldMetadata) { AnalyzerReference analyzer = fieldMetadata.getAnalyzer(); if ( analyzer.is( RemoteAnalyzerReference.class ) ) { return analyzer.unwrap( RemoteAnalyzerReference.class ).getName(); } LOG.analyzerIsNotRemote( entityType, fieldMetadata.getFieldName(), analyzer ); return null; }
Source:
private boolean removeContactFromGroupsExcluding(XMPPContact contact, List<String> exclude) { boolean change = contactsGrouped .entrySet() .stream() .filter(entry -> !exclude.contains(entry.getKey())) .map( entry -> Optional.ofNullable( entry.getValue().remove(GET_BASEJID_STRING.apply(contact)))) .filter(Optional::isPresent) .count() != 0; removeEmptyGroups(); return change; }

Target:
private boolean removeContactFromGroupsExcluding(XMPPContact contact, List<String> exclude) { String jid = GET_BAREJID_STRING.apply(contact); long removed = contactsGrouped .entrySet() .stream() .filter(entry -> !exclude.contains(entry.getKey())) .map(entry -> Optional.ofNullable(entry.getValue().remove(jid))) .filter(Optional::isPresent) .count(); removeEmptyGroups(); return removed != 0; }
Source:
public void notifyOnVoiceMessage() { Log.d("ttpl", "notify listeners: "); int i = 0; for (VoiceMessageListener lnt : voiceMessageListeners.keySet()) { Log.d("ttpl", "listner " + ++i); lnt.onVoiceMessage(); } }

Target:
public void notifyOnVoiceMessage() { for (WeakReference<VoiceMessageListener> weakReferenceWrapper : voiceMessageListeners.keySet()) { VoiceMessageListener lnt = weakReferenceWrapper.get(); if (lnt != null) { lnt.onVoiceMessage(); } } }
Source:
public void execute(ApplicationContext currentContext) throws CLIException { try { validateFilePath(currentContext); File jobFile = new File(pathname); String contentType = URLConnection.getFileNameMap().getContentTypeFor(pathname); System.out.println(contentType); JobIdData jobId; if (APPLICATION_XML.getMimeType().equals(contentType)) { jobId = currentContext.getRestClient().submitXml(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } else { jobId = currentContext.getRestClient().submitJobArchive(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } writeLine(currentContext, "Job('%s') successfully submitted: job('%d')", pathname, jobId.getId()); resultStack(currentContext).push(jobId); } catch (Exception e) { handleError(String.format("An error occurred while attempting to submit job('%s'):", pathname), e, currentContext); } }

Target:
public void execute(ApplicationContext currentContext) throws CLIException { try { validateFilePath(currentContext); File jobFile = new File(pathname); String contentType = URLConnection.getFileNameMap().getContentTypeFor(pathname); JobIdData jobId; if (APPLICATION_XML.getMimeType().equals(contentType)) { jobId = currentContext.getRestClient().submitXml(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } else { jobId = currentContext.getRestClient().submitJobArchive(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } writeLine(currentContext, "Job('%s') successfully submitted: job('%d')", pathname, jobId.getId()); resultStack(currentContext).push(jobId); } catch (Exception e) { handleError(String.format("An error occurred while attempting to submit job('%s'):", pathname), e, currentContext); } }
Source:
public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException { return null; }

Target:
public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException { LOG.info("Attempt to retrieve record for identifier \"{}\"", identifier); DataRecord result = null; DataStore ds = getDelegateForId(identifier); if (null != ds) { result = ds.getRecordIfStored(identifier); } if (null == result) { try { Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(identifier); if (iter.hasNext()) { while (iter.hasNext()) { ds = iter.next(); result = ds.getRecordIfStored(identifier); if (null != result) { mapIdToDelegate(identifier, ds); LOG.info("Matching record found in delegate role \"{}\"", rolesForDelegates.getOrDefault(ds, "<not found>")); break; } } } else { LOG.info("No mapping for identifier \"{}\", trying all delegates", identifier); iter = delegateHandler.getAllDelegatesIterator(); while (iter.hasNext()) { ds = iter.next(); result = ds.getRecordIfStored(identifier); if (null != result) { mapIdToDelegate(identifier, ds); LOG.info("Matching record found in delegate role \"{}\"", rolesForDelegates.getOrDefault(ds, "<not found")); break; } } } } catch (DataStoreException e) { LOG.error("Error retrieving record [{}]", identifier, e); return null; } if (null == result) { LOG.error("Error retrieving record [{}]", identifier); } } return result; }
Source:
protected boolean isWindowResizable() { return false; }

Target:
protected boolean isWindowResizable() { return true; }
Source:
public void selectFirst() { ((ToolbarMenuBar)menuBar_).selectFirst(); }

Target:
public void selectFirst() { getMenuBar().selectFirst(); }
Source:
private static void buildDiskRequestsEntries(Disk disk, ITmfTrace trace, TimeGraphEntry traceEntry, ITmfStateSystem ssq, long startTime, long endTime, Map<Object, TimeGraphEntry> entryMap) { DiskRequestQueue driverQueue = disk.getDriverQueue(); DiskRequestQueue waitingQueue = disk.getWaitingQueue(); TimeGraphEntry diskEntry = createOrUpdateDiskEntry(disk, entryMap, trace, traceEntry, startTime, endTime); if (waitingQueue != null) { TimeGraphEntry wqEntry = createOrUpdateQueueEntry(waitingQueue, entryMap, diskEntry, startTime, endTime, WAITING_QUEUE, DESCENDING); for (int wqRequestsQuark : waitingQueue.getQuarks()) { createOrUpdateRequestsEntry(wqRequestsQuark, waitingQueue, entryMap, wqEntry, ssq, startTime, endTime); } } if (driverQueue != null) { TimeGraphEntry wqEntry = createOrUpdateQueueEntry(driverQueue, entryMap, diskEntry, startTime, endTime, DRIVER_QUEUE, ASCENDING); for (int wqRequestsQuark : driverQueue.getQuarks()) { createOrUpdateRequestsEntry(wqRequestsQuark, driverQueue, entryMap, wqEntry, ssq, startTime, endTime); } } }

Target:
private static void buildDiskRequestsEntries(Disk disk, ITmfTrace trace, TimeGraphEntry traceEntry, ITmfStateSystem ssq, long startTime, long endTime, Map<Object, TimeGraphEntry> entryMap) { DiskRequestQueue driverQueue = disk.getDriverQueue(); DiskRequestQueue waitingQueue = disk.getWaitingQueue(); TimeGraphEntry diskEntry = createOrUpdateDiskEntry(disk, entryMap, trace, traceEntry, startTime, endTime); if (waitingQueue != null) { TimeGraphEntry wqEntry = createOrUpdateQueueEntry(waitingQueue, entryMap, diskEntry, startTime, endTime, WAITING_QUEUE, DESCENDING); waitingQueue.getQuarks().forEach(wqQuark -> createOrUpdateRequestsEntry(wqQuark, waitingQueue, entryMap, wqEntry, ssq, startTime, endTime)); } if (driverQueue != null) { TimeGraphEntry wqEntry = createOrUpdateQueueEntry(driverQueue, entryMap, diskEntry, startTime, endTime, DRIVER_QUEUE, ASCENDING); driverQueue.getQuarks().forEach(wqQuark -> createOrUpdateRequestsEntry(wqQuark, driverQueue, entryMap, wqEntry, ssq, startTime, endTime)); } }
Source:
public int getSSLPort() { for (PortType portType : ports.keySet()) { if (portType == PortType.SSL) { return ports.get(portType); } } throw new IllegalArgumentException("No SSL port exists for the datanode " + hostname + ":" + port); }

Target:
public int getSSLPort() { if (hasSSLPort()) { return ports.get(PortType.SSL); } throw new IllegalArgumentException("No SSL port exists for the datanode " + hostname + ":" + port); }
Source:
public ChannelHandler storeListingRequestHandler( CatchupServerProtocol catchupServerProtocol ) { return new PrepareStoreCopyRequestHandler( catchupServerProtocol, checkPointerServiceBundle::getCheckPointer, storeCopyCheckPointMutex, dataSourceSupplier, new PrepareStoreCopyFilesProvider( pageCache, fs ) ); }

Target:
public ChannelHandler storeListingRequestHandler( CatchupServerProtocol catchupServerProtocol ) { return new PrepareStoreCopyRequestHandler( catchupServerProtocol, checkPointerService::getCheckPointer, storeCopyCheckPointMutex, dataSourceSupplier, new PrepareStoreCopyFilesProvider( pageCache, fs ) ); }
Source:
public static void serializeHeader(ByteBuffer outputBuffer, long totalSize, int blobEncryptionKeyRecordRelativeOffset, int blobPropertiesRecordRelativeOffset, int deleteRecordRelativeOffset, int userMetadataRecordRelativeOffset, int blobRecordRelativeOffset) throws MessageFormatException { checkHeaderConstraints(totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset); int startOffset = outputBuffer.position(); outputBuffer.putShort(Message_Header_Version_V2); outputBuffer.putLong(totalSize); outputBuffer.putInt(blobEncryptionKeyRecordRelativeOffset); outputBuffer.putInt(blobPropertiesRecordRelativeOffset); outputBuffer.putInt(deleteRecordRelativeOffset); outputBuffer.putInt(userMetadataRecordRelativeOffset); outputBuffer.putInt(blobRecordRelativeOffset); Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getHeaderSize() - Crc_Size); outputBuffer.putLong(crc.getValue()); Logger logger = LoggerFactory.getLogger(MessageHeader_Format_V2.class); logger.trace( "serializing header : version size blobencryptionkeyrecordrelativeoffset blobpropertiesrecordrelativeoffset " + "deleterecordrelativeoffset usermetadatarecordrelativeoffset blobrecordrelativeoffset crc {}", Message_Header_Version_V2, totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobPropertiesRecordRelativeOffset, crc.getValue()); }

Target:
public static void serializeHeader(ByteBuffer outputBuffer, long totalSize, int blobEncryptionKeyRecordRelativeOffset, int blobPropertiesRecordRelativeOffset, int deleteRecordRelativeOffset, int userMetadataRecordRelativeOffset, int blobRecordRelativeOffset) throws MessageFormatException { checkHeaderConstraints(totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobRecordRelativeOffset); int startOffset = outputBuffer.position(); outputBuffer.putShort(Message_Header_Version_V2); outputBuffer.putLong(totalSize); outputBuffer.putInt(blobEncryptionKeyRecordRelativeOffset); outputBuffer.putInt(blobPropertiesRecordRelativeOffset); outputBuffer.putInt(deleteRecordRelativeOffset); outputBuffer.putInt(userMetadataRecordRelativeOffset); outputBuffer.putInt(blobRecordRelativeOffset); Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getHeaderSize() - Crc_Size); outputBuffer.putLong(crc.getValue()); logger.trace( "serializing header : version size blobencryptionkeyrecordrelativeoffset blobpropertiesrecordrelativeoffset " + "deleterecordrelativeoffset usermetadatarecordrelativeoffset blobrecordrelativeoffset crc {}", Message_Header_Version_V2, totalSize, blobEncryptionKeyRecordRelativeOffset, blobPropertiesRecordRelativeOffset, deleteRecordRelativeOffset, userMetadataRecordRelativeOffset, blobPropertiesRecordRelativeOffset, crc.getValue()); }
Source:
public int[] execute() { if (parts.isEmpty()) { return new int[] {}; } @SuppressWarnings("PMD.CloseResource") Statement stmt; try { try { stmt = getHandle().getStatementBuilder().create(getHandle().getConnection(), getContext()); addCleanable(stmt::close); Integer queryTimeout = getConfig(Connections.class).getQueryTimeout(); if (queryTimeout != null) { stmt.setQueryTimeout(queryTimeout); } } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } LOG.trace("Execute batch ["); try { for (String part : parts) { final String sql = getConfig(SqlStatements.class).getTemplateEngine().render(part, getContext()); LOG.trace(" {}", sql); stmt.addBatch(sql); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Unable to configure JDBC statement", e, getContext()); } try { return SqlLoggerUtil.wrap(stmt::executeBatch, getContext(), getConfig(SqlStatements.class).getSqlLogger()); } catch (SQLException e) { throw new UnableToExecuteStatementException(mungeBatchException(e), getContext()); } } finally { close(); } }

Target:
public int[] execute() { if (parts.isEmpty()) { return new int[] {}; } @SuppressWarnings("PMD.CloseResource") Statement stmt; try { try { stmt = getHandle().getStatementBuilder().create(getHandle().getConnection(), getContext()); addCleanable(stmt::close); getConfig(SqlStatements.class).customize(stmt); } catch (SQLException e) { throw new UnableToCreateStatementException(e, getContext()); } LOG.trace("Execute batch ["); try { for (String part : parts) { final String sql = getConfig(SqlStatements.class).getTemplateEngine().render(part, getContext()); LOG.trace(" {}", sql); stmt.addBatch(sql); } } catch (SQLException e) { throw new UnableToExecuteStatementException("Unable to configure JDBC statement", e, getContext()); } try { return SqlLoggerUtil.wrap(stmt::executeBatch, getContext(), getConfig(SqlStatements.class).getSqlLogger()); } catch (SQLException e) { throw new UnableToExecuteStatementException(mungeBatchException(e), getContext()); } } finally { close(); } }
Source:
public PoolInitializationException(Throwable t) { super(t); }

Target:
public PoolInitializationException(Throwable t) { super("Exception during pool initialization: " + t.getMessage(), t); }
Source:
private static OverlapDetector<ShardBoundary> getShardBoundaryOverlapDetector(final SAMFileHeader header, final List<SimpleInterval> intervals, final int readShardSize, final int readShardPadding) { final OverlapDetector<ShardBoundary> shardBoundaryOverlapDetector = new OverlapDetector<>(0, 0); intervals.stream() .flatMap(interval -> Shard.divideIntervalIntoShards(interval, readShardSize, readShardSize, readShardPadding, header.getSequenceDictionary()).stream()) .forEach(boundary -> shardBoundaryOverlapDetector.addLhs(boundary, boundary.getPaddedInterval())); return shardBoundaryOverlapDetector; }

Target:
private static OverlapDetector<ShardBoundary> getShardBoundaryOverlapDetector(final SAMFileHeader header, final List<SimpleInterval> intervals, final int readShardSize, final int readShardPadding) { final OverlapDetector<ShardBoundary> shardBoundaryOverlapDetector = new OverlapDetector<>(0, 0); intervals.stream() .flatMap(interval -> Shard.divideIntervalIntoShards(interval, readShardSize, readShardPadding, header.getSequenceDictionary()).stream()) .forEach(boundary -> shardBoundaryOverlapDetector.addLhs(boundary, boundary.getPaddedInterval())); return shardBoundaryOverlapDetector; }
Source:
public RuleBuilder(String name, String clazz, String language) { this.name = name; this.resourceLoader = new ResourceLoader(); language(language); className(clazz); }

Target:
public RuleBuilder(String name, String clazz, String language) { this(name, new ResourceLoader(), clazz, language); }
Source:
public void queryChangesReviewerAfterReview() throws Exception { PushOneCommit.Result r = createChange(); AddReviewerInput in = new AddReviewerInput(); in.reviewer = user.email; gApi.changes() .id("p~master~" + r.getChangeId()) .addReviewer(in); setApiUser(user); revision(r).review(ReviewInput.recommend()); assertTrue(get(r.getChangeId()).reviewed); }

Target:
public void queryChangesReviewerAfterReview() throws Exception { PushOneCommit.Result r = createChange(); AddReviewerInput in = new AddReviewerInput(); in.reviewer = user.email; gApi.changes() .id("p~master~" + r.getChangeId()) .addReviewer(in); setApiUser(user); assertNull(get(r.getChangeId()).reviewed); revision(r).review(ReviewInput.recommend()); assertTrue(get(r.getChangeId()).reviewed); }
Source:
public GeoscalingWebClient() { this(HttpTool.httpClientBuilder().trustAll().build()); }

Target:
public GeoscalingWebClient() { this(HttpTool.httpClientBuilder().build()); }
Source:
private static String getFailMessage(ProcessStatus result) { ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) { return result.getMessage() + ": " + getFailMessage(firstFail) + getLineMessage(firstFail); } return result.getMessage(); }

Target:
private static String getFailMessage(ProcessStatus result) { ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) { return getLineMessage(firstFail) + result.getMessage() + ": " + getFailMessage(firstFail); } return result.getMessage(); }
Source:
public void testNotStoredQualitiesFields(final String inputFile, final double expectedValue) throws IOException { final SamReader reader = SamReaderFactory.makeDefault().open((new File(TEST_DATA_DIR, inputFile))); final Histogram<String> results = executeValidation(reader, null, IndexValidationStringency.EXHAUSTIVE); Assert.assertEquals(results.get(SAMValidationError.Type.QUALITY_NOT_STORED.getHistogramString()).getValue(), expectedValue); }

Target:
public void testNotStoredQualitiesFields(final String inputFile, final double expectedValue) throws IOException { try (final SamReader reader = SamReaderFactory.makeDefault().open((new File(TEST_DATA_DIR, inputFile)))) { final Histogram<String> results = executeValidation(reader, null, IndexValidationStringency.EXHAUSTIVE); Assert.assertEquals(results.get(SAMValidationError.Type.QUALITY_NOT_STORED.getHistogramString()).getValue(), expectedValue); } }
Source:
StatementClient startQuery(String sql, Map<String, String> sessionPropertiesOverride) { String source = firstNonNull(clientInfo.get("ApplicationName"), "presto-jdbc"); Map<String, String> allProperties; if (sessionPropertiesOverride.isEmpty()) { allProperties = sessionPropertiesOverride; } else { allProperties = new HashMap<>(sessionProperties); allProperties.putAll(sessionPropertiesOverride); } ClientSession session = new ClientSession( httpUri, user, source, clientInfo.get("ClientInfo"), catalog.get(), schema.get(), timeZoneId.get(), locale.get(), ImmutableMap.copyOf(allProperties), transactionId.get(), false, new Duration(2, MINUTES)); return queryExecutor.startQuery(session, sql); }

Target:
StatementClient startQuery(String sql, Map<String, String> sessionPropertiesOverride) { String source = firstNonNull(clientInfo.get("ApplicationName"), "presto-jdbc"); Map<String, String> allProperties = new HashMap<>(sessionProperties); allProperties.putAll(sessionPropertiesOverride); ClientSession session = new ClientSession( httpUri, user, source, clientInfo.get("ClientInfo"), catalog.get(), schema.get(), timeZoneId.get(), locale.get(), ImmutableMap.copyOf(allProperties), transactionId.get(), false, new Duration(2, MINUTES)); return queryExecutor.startQuery(session, sql); }
Source:
public Builder setTableConfig(TableConfig tableConfig) { this.tableConfig = tableConfig; return this; }

Target:
public Builder setTableConfig(TableConfig tableConfig) { _tableConfig = tableConfig; return this; }
Source:
public void updateConfiguration(Configuration config) { copy(resourcesConfiguration, config); config.setInt(LineRecordReader.MAX_LINE_LENGTH, toIntExact(new DataSize(100, DataSize.Unit.MEGABYTE).toBytes())); config.setClass(NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY, NoOpDNSToSwitchMapping.class, DNSToSwitchMapping.class); if (socksProxy != null) { config.setClass(HADOOP_RPC_SOCKET_FACTORY_CLASS_DEFAULT_KEY, SocksSocketFactory.class, SocketFactory.class); config.set(HADOOP_SOCKS_SERVER_KEY, socksProxy.toString()); } if (domainSocketPath != null) { config.setStrings(DFS_DOMAIN_SOCKET_PATH_KEY, domainSocketPath); } if (!config.get(DFS_DOMAIN_SOCKET_PATH_KEY, "").trim().isEmpty()) { config.setBooleanIfUnset(DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true); } config.setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, toIntExact(dfsTimeout.toMillis())); config.setInt(IPC_PING_INTERVAL_KEY, toIntExact(ipcPingInterval.toMillis())); config.setInt(IPC_CLIENT_CONNECT_TIMEOUT_KEY, toIntExact(dfsConnectTimeout.toMillis())); config.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY, dfsConnectMaxRetries); if (isHdfsWireEncryptionEnabled) { config.set(HADOOP_RPC_PROTECTION, "privacy"); config.setBoolean("dfs.encrypt.data.transfer", true); } config.setInt("fs.cache.max-size", fileSystemMaxCacheSize); configureCompression(config, compressionCodec); s3ConfigurationUpdater.updateConfiguration(config); }

Target:
public void updateConfiguration(Configuration config) { copy(resourcesConfiguration, config); config.setClass(NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY, NoOpDNSToSwitchMapping.class, DNSToSwitchMapping.class); if (socksProxy != null) { config.setClass(HADOOP_RPC_SOCKET_FACTORY_CLASS_DEFAULT_KEY, SocksSocketFactory.class, SocketFactory.class); config.set(HADOOP_SOCKS_SERVER_KEY, socksProxy.toString()); } if (domainSocketPath != null) { config.setStrings(DFS_DOMAIN_SOCKET_PATH_KEY, domainSocketPath); } if (!config.get(DFS_DOMAIN_SOCKET_PATH_KEY, "").trim().isEmpty()) { config.setBooleanIfUnset(DFS_CLIENT_READ_SHORTCIRCUIT_KEY, true); } config.setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, toIntExact(dfsTimeout.toMillis())); config.setInt(IPC_PING_INTERVAL_KEY, toIntExact(ipcPingInterval.toMillis())); config.setInt(IPC_CLIENT_CONNECT_TIMEOUT_KEY, toIntExact(dfsConnectTimeout.toMillis())); config.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY, dfsConnectMaxRetries); if (isHdfsWireEncryptionEnabled) { config.set(HADOOP_RPC_PROTECTION, "privacy"); config.setBoolean("dfs.encrypt.data.transfer", true); } config.setInt("fs.cache.max-size", fileSystemMaxCacheSize); config.setInt(LineRecordReader.MAX_LINE_LENGTH, textMaxLineLength); configureCompression(config, compressionCodec); s3ConfigurationUpdater.updateConfiguration(config); }
Source:
private void addSecretService(OperationContext context, ModelNode secret, String realmName, ServiceTarget serviceTarget, ServiceBuilder<?> realmBuilder, Injector<CallbackHandlerFactory> injector) throws OperationFailedException { ServiceName secretServiceName = SecretIdentityService.ServiceUtil.createServiceName(realmName); ModelNode resolvedValueNode = SecretServerIdentityResourceDefinition.VALUE.resolveModelAttribute(context, secret); boolean base64 = true; SecretIdentityService sis; if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) { sis = new SecretIdentityService(resolvedValueNode.asString(), false); } else { sis = new SecretIdentityService(resolvedValueNode.asString(), base64); } final ServiceBuilder<CallbackHandlerFactory> serviceBuilder = serviceTarget.addService(secretServiceName, sis) .setInitialMode(ON_DEMAND); if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) { sis.getCredentialSourceSupplierInjector() .inject(CredentialReference.getCredentialSourceSupplier(context, SecretServerIdentityResourceDefinition.CREDENTIAL_REFERENCE, secret, serviceBuilder)); } serviceBuilder.install(); CallbackHandlerFactory.ServiceUtil.addDependency(realmBuilder, injector, secretServiceName); }

Target:
private void addSecretService(OperationContext context, ModelNode secret, String realmName, ServiceTarget serviceTarget, ServiceBuilder<?> realmBuilder, Injector<CallbackHandlerFactory> injector) throws OperationFailedException { ServiceName secretServiceName = SecretIdentityService.ServiceUtil.createServiceName(realmName); ModelNode resolvedValueNode = SecretServerIdentityResourceDefinition.VALUE.resolveModelAttribute(context, secret); boolean base64=true; if(secret.get(SecretServerIdentityResourceDefinition.VALUE.getName()).getType() == ModelType.EXPRESSION) { String pattern = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(resolvedValueNode.asString()); base64 =(m.find())?true:false; } SecretIdentityService sis; if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) { sis = new SecretIdentityService(resolvedValueNode.asString(), false); } else { sis = new SecretIdentityService(resolvedValueNode.asString(), base64); } final ServiceBuilder<CallbackHandlerFactory> serviceBuilder = serviceTarget.addService(secretServiceName, sis) .setInitialMode(ON_DEMAND); if (secret.hasDefined(CredentialReference.CREDENTIAL_REFERENCE)) { sis.getCredentialSourceSupplierInjector() .inject(CredentialReference.getCredentialSourceSupplier(context, SecretServerIdentityResourceDefinition.CREDENTIAL_REFERENCE, secret, serviceBuilder)); } serviceBuilder.install(); CallbackHandlerFactory.ServiceUtil.addDependency(realmBuilder, injector, secretServiceName); }
Source:
private Edge(Node child, Node parent) { Preconditions.checkState(!Objects.equals(child, parent)); this.child = child; this.parent = parent; hashcode = Objects.hash(child, parent); }

Target:
private Edge(Node child, Node parent) { Preconditions.checkState(!child.equals(parent)); this.child = child; this.parent = parent; hashcode = Objects.hash(child, parent); }
Source:
@Override public <T> T serviceProxy(String name, Class<? super T> svcItf, long timeout) { A.notNullOrEmpty(name, "name"); A.notNull(svcItf, "svcItf"); Collection<UUID> nodeIds = grp.nodeIds(); if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); return (T)Proxy.newProxyInstance(svcItf.getClassLoader(), new Class[] {svcItf}, new ServiceInvocationHandler<>(name, timeout, nodeIds)); }

Target:
@Override public <T> T serviceProxy(String name, Class<? super T> svcItf, long timeout) { A.notNullOrEmpty(name, "name"); A.notNull(svcItf, "svcItf"); return (T)Proxy.newProxyInstance(svcItf.getClassLoader(), new Class[] {svcItf}, new ServiceInvocationHandler<>(name, timeout, grp)); }
Source:
public void insert(List<Sample> samples) { if (!m_ringBuffer.tryPublishEvent(TRANSLATOR, samples)) { String uniqueResourceIds = samples.stream() .map(s -> s.getResource().getId()) .distinct() .collect(Collectors.joining(", ")); RATE_LIMITED_LOGGER.error("The ring buffer is full. samples associated with resource ids will be dropped.", samples.size(), uniqueResourceIds); m_droppedSamples.mark(samples.size()); return; } m_numEntriesOnRingBuffer.incrementAndGet(); }

Target:
public void insert(List<Sample> samples) { pushToRingBuffer(samples, TRANSLATOR); }
Source:
@Test public void testExhaustionClosesSourceIterator() { iterator.setCallback(new Callback() { @Override public void call() { } }); Context context = new Context() ; ExecutionContext ec = new ExecutionContext(context, (Graph) null, (DatasetGraph) null, (OpExecutorFactory) null); QueryIterSort qis = new QueryIterSort(iterator, comparator, ec); while (qis.hasNext()) qis.next(); assertTrue("source iterator should have been closed", iterator.isClosed()); }

Target:
public void testExhaustionClosesSourceIterator() { iterator.setCallback(() -> {}); Context context = new Context() ; ExecutionContext ec = new ExecutionContext(context, (Graph) null, (DatasetGraph) null, (OpExecutorFactory) null); QueryIterSort qis = new QueryIterSort(iterator, comparator, ec); while (qis.hasNext()) qis.next(); assertTrue("source iterator should have been closed", iterator.isClosed()); }
Source:
public void persistState(String checkpointId) { if (!isTopologyStateful) { throw new RuntimeException("Could not save a non-stateful topology's state"); } if (bolt instanceof IStatefulComponent) { ((IStatefulComponent) bolt).preSave(checkpointId); } else { LOG.info("Trying to checkpoint a non stateful component. Send empty state"); } collector.sendOutState(instanceState, checkpointId); }

Target:
public void persistState(String checkpointId) { LOG.info("Persisting state for checkpoint: " + checkpointId); if (!isTopologyStateful) { throw new RuntimeException("Could not save a non-stateful topology's state"); } if (bolt instanceof IStatefulComponent) { ((IStatefulComponent) bolt).preSave(checkpointId); } collector.sendOutState(instanceState, checkpointId); }
Source:
private void reportClusterError() { log.error("AddVdsCommand: No default or valid cluster was found, host registration failed."); AuditLogableBase logableBase = new AuditLogableBase(); AuditLogDirector.log(logableBase, AuditLogType.HOST_FAILED_REGISTRATION_INVALID_CLUSTER); }

Target:
private void reportClusterError() { log.error("No default or valid cluster was found, host registration failed."); AuditLogableBase logableBase = new AuditLogableBase(); logableBase.setVdsId(getParameters().getVdsId()); AuditLogDirector.log(logableBase, AuditLogType.HOST_REGISTRATION_FAILED_INVALID_CLUSTER); }
Source:
private void resetPlot(ExtSed sed, boolean fixed, boolean dataMayChange) { PlaneAspect existingAspect = null; if (display != null) { display.removeAll(); remove(display); if (this.preferences.getSedPreferences(currentSed) != null) { this.preferences.getSedPreferences(currentSed).getPlotPreferences().setAspect(display.getAspect()); existingAspect = this.preferences.getSedPreferences(currentSed).getPlotPreferences().getAspect(); if (existingAspect == null) existingAspect = display.getAspect(); } else { existingAspect = display.getAspect(); } } if (sed == null) { sed = sedManager.getSelected(); } this.currentSed = sed; boolean cached = !dataMayChange; display = createPlotComponent(currentSed, cached); if (fixed) { if (this.preferences.getSedPreferences(currentSed) != null) { existingAspect = this.preferences.getSedPreferences(currentSed).getPlotPreferences().getAspect(); display.setAspect(existingAspect); } else { display.setAspect(existingAspect); } } add(display, BorderLayout.CENTER); display.revalidate(); display.repaint(); }

Target:
private void resetPlot(ExtSed sed, boolean fixed, boolean dataMayChange) { setupForPlotDisplayChange(); if (sed == null) { sed = sedManager.getSelected(); } this.currentSed = sed; boolean cached = !dataMayChange; display = createPlotComponent(currentSed, cached); if (fixed) { PlaneAspect existingAspect = this.getPlotPreferences().getAspect(); display.setAspect(existingAspect); } updatePlotDisplay(); }
Source:
public String getQueryString() { String jsonQueryString = null; try { jsonQueryString = getJSONParameters().toString(4).replace("\\/", "/"); } catch (JSONException e) { e.printStackTrace(); } return jsonQueryString; }

Target:
public String getQueryString() { String jsonQueryString = null; try { jsonQueryString = getJSONParameters().toString(4).replace("\\/", "/"); } catch (JSONException e) { log.error("Error parsing query string.", e); } return jsonQueryString; }
Source:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Set<EObject> detachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_DETACHMENT), null, false); Iterator<EObject> iterator = detachedObjects.iterator(); while (iterator.hasNext()) { EObject detachedEObject = iterator.next(); if (detachedEObject.eContainer() != null) { iterator.remove(); } } if (detachedObjects.size() > 0) { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); if (!detachedObjects.isEmpty()) { EReferencePredicate refToIgnore = new EReferencePredicate() { @Override public boolean apply(EReference ref) { return DSEMANTICDECORATOR_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || NOTATION_VIEW_ELEMENT_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || EPACKAGE_EFACTORYINSTANCE_REFERENCE_TO_IGNORE_PREDICATE.apply(ref); } }; Command removeDangling = new RemoveDanglingReferencesCommand(domain, accessor, xRef, detachedObjects, refToIgnore); DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); return Options.newSome(removeDangling); } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); } return Options.newNone(); }

Target:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { final Set<EObject> allDetachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_DETACHMENT), null); if (allDetachedObjects.size() > 0) { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); Predicate<EObject> ignoreNotifierInDetachedObjects = Predicates.in(allDetachedObjects); final Set<EObject> allAttachedObjects = getChangedEObjectsAndChildren(Iterables.filter(notifications, IS_ATTACHMENT), ignoreNotifierInDetachedObjects); final Set<EObject> toRemoveXRefFrom = Sets.difference(allDetachedObjects, allAttachedObjects); if (toRemoveXRefFrom.size() > 0) { EReferencePredicate refToIgnore = new EReferencePredicate() { @Override public boolean apply(EReference ref) { return DSEMANTICDECORATOR_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || NOTATION_VIEW_ELEMENT_REFERENCE_TO_IGNORE_PREDICATE.apply(ref) || EPACKAGE_EFACTORYINSTANCE_REFERENCE_TO_IGNORE_PREDICATE.apply(ref); } }; Command removeDangling = new RemoveDanglingReferencesCommand(domain, accessor, xRef, toRemoveXRefFrom, refToIgnore); DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); return Options.newSome(removeDangling); } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); } return Options.newNone(); }
Source:
public static void assertSwappedIngredientsMatch(ObjectInstance ing, State s, List<String> ings) { Set<String> swappedIngredients = IngredientFactory.getRecursiveContentsAndSwapped(s, ing); Boolean match = true; assertEquals(swappedIngredients.size(), ings.size()); for (String i : ings) { if (!swappedIngredients.contains(i)) { match = false; break; } } assertTrue(match); }

Target:
public static void assertSwappedIngredientsMatch(ObjectInstance ing, State s, List<String> ings) { Set<String> swappedIngredients = IngredientFactory.getRecursiveContentsAndSwapped(s, ing); Boolean match = true; Assert.assertEquals(swappedIngredients.size(), ings.size()); for (String i : ings) { if (!swappedIngredients.contains(i)) { match = false; break; } } Assert.assertTrue(match); }
Source:
public String getDocType() { if (Objects.isNull(docType)) { List<SelectItem> allDocTypes = getAllDoctypes(); for (SelectItem item : allDocTypes) { if ("Monograph".equals(item.getValue())) { setDocType((String) item.getValue()); return docType; } } setDocType((String) allDocTypes.get(0).getValue()); } return docType; }

Target:
public String getDocType() { if (Objects.isNull(docType) && !allDocTypes.isEmpty()) { setDocType((String) allDocTypes.get(0).getValue()); } return docType; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Comment)) return false; Comment comment = (Comment) o; return getId().equals(comment.getId()); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Comment)) { return false; } Comment comment = (Comment) o; return getId().equals(comment.getId()); }
Source:
public DotTempFile createTempFileFromUrl(final String incomingFileName, final HttpServletRequest request, final URL url, final int timeoutSeconds, final long maxLength) throws DotSecurityException, IOException { if (!validUrl(url)) { throw new BadRequestException("Invalid url attempted for tempFile : " + url); } final String fileName = resolveFileName(incomingFileName, url); final DotTempFile dotTempFile = createEmptyTempFile(fileName, request); final File tempFile = dotTempFile.file; final OutputStream out = new BoundedOutputStream(maxFileSize(request), new FileOutputStream(tempFile)); final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url.toString()) .setTimeout(timeoutSeconds * 1000).build(); urlGetter.doOut(out); return dotTempFile; }

Target:
public DotTempFile createTempFileFromUrl(final String incomingFileName, final HttpServletRequest request, final URL url, final int timeoutSeconds, final long maxLength) throws DotSecurityException, IOException { final String fileName = resolveFileName(incomingFileName, url); final DotTempFile dotTempFile = createEmptyTempFile(fileName, request); final File tempFile = dotTempFile.file; final OutputStream out = new BoundedOutputStream(maxFileSize(request), new FileOutputStream(tempFile)); final CircuitBreakerUrl urlGetter = CircuitBreakerUrl.builder().setMethod(Method.GET).setUrl(url.toString()) .setTimeout(timeoutSeconds * 1000).build(); urlGetter.doOut(out); return dotTempFile; }
Source:
public static <T,TT extends Iterable<T>> Predicate<TT> all(Predicate<T> attributeSatisfies) { return new QuorumSatisfies<T, TT>(QuorumChecks.all(), attributeSatisfies); }

Target:
public static <T,TT extends Iterable<T>> Predicate<TT> all(Predicate<T> attributeSatisfies) { return quorum(QuorumChecks.all(), attributeSatisfies); }
Source:
public String generateToken(JwtPayload payload, TokenType tokenType) { long maxAge = tokenType.equals(TokenType.ACCESS) ? accessTokenMaxAge : refreshTokenMaxAge; Date expiration = payload.getExpiration() != null ? payload.getExpiration() : new Date(System.currentTimeMillis() + maxAge); payload.setExpiration(expiration); payload.setTokenType(tokenType); Map<String, Object> jwtMap = new HashMap<>(); jwtMap.put(JwtPayload.JWT_CLAIM_KEY, payload); Claims claims = Jwts.claims(jwtMap); return Jwts.builder() .setClaims(claims) .signWith(SignatureAlgorithm.HS256, JwtSecretHolder.INSTANCE.getJwtSecret()) .compact(); }

Target:
public String generateToken(JwtPayload payload, TokenType tokenType) { long maxAge = tokenType.equals(TokenType.ACCESS) ? accessTokenMaxAge : refreshTokenMaxAge; Date expiration = payload.getExpiration() != null ? payload.getExpiration() : timestampService.getDate(System.currentTimeMillis() + maxAge); payload.setExpiration(expiration); payload.setTokenType(tokenType); Map<String, Object> jwtMap = new HashMap<>(); jwtMap.put(JwtPayload.JWT_CLAIM_KEY, payload); Claims claims = Jwts.claims(jwtMap); return Jwts.builder() .setClaims(claims) .signWith(SignatureAlgorithm.HS256, JwtSecretHolder.INSTANCE.getJwtSecret()) .compact(); }
Source:
public boolean isCountQuery() { return getName().startsWith("count"); }

Target:
public boolean isCountQuery() { return getName().toLowerCase().startsWith("count"); }
Source:
public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); this.dataDirectory = dataDirectory; if (IOUtils.isSymbolicLink(dataDirectory)) { throw new IOException("unable to use a symbolic link: " + dataDirectory); } if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } setPermissionsToOwnerOnly(dataDirectory); }

Target:
public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); if (IOUtils.isSymbolicLink(dataDirectory)) { throw new IOException("unable to use a symbolic link: " + dataDirectory); } if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } this.dataDirectory = dataDirectory; setPermissionsToOwnerOnly(dataDirectory); }
Source:
public static String gunzip(byte[] value) throws IOException { StringBuilder stringBuilder = new StringBuilder(); byte[] buffer = new byte[1024]; GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(value)); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); int length; while ((length = inputStream.read(buffer)) > 0) { stringBuilder.append(Charset.forName("UTF-8").decode(ByteBuffer.wrap(buffer)), 0, length); } return stringBuilder.toString(); }

Target:
public static String gunzip(byte[] value) throws IOException { StringBuilder stringBuilder = new StringBuilder(); byte[] buffer = new byte[1024]; GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(value)); int length; while ((length = inputStream.read(buffer)) > 0) { stringBuilder.append(Charset.forName("UTF-8").decode(ByteBuffer.wrap(buffer)), 0, length); } return stringBuilder.toString(); }
Source:
public boolean isStartOfSegment() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Cannot call isReadFirstObjectOfSegment: PBD has been closed"); } assertions(); moveToValidSegment(); long lastSegmentId = peekLastSegment().segmentIndex(); while (!m_segment.file().exists()) { if (m_segment.segmentIndex() == lastSegmentId) { throw new IOException("Tail segment file " + m_segment.file().getName() + " doesn't exist! "); } m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); } PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { return false; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } } if (segmentReader.readIndex() == 0) { return true; } return false; } }

Target:
public boolean isStartOfSegment() throws IOException { synchronized(PersistentBinaryDeque.this) { if (m_closed) { throw new IOException("Cannot call isStartOfSegment: PBD has been closed"); } assertions(); moveToValidSegment(); PBDSegmentReader segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } long lastSegmentId = peekLastSegment().segmentIndex(); while (!segmentReader.hasMoreEntries()) { if (m_segment.segmentIndex() == lastSegmentId) { return false; } segmentReader.close(); m_segment = m_segments.higherEntry(m_segment.segmentIndex()).getValue(); segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } } if (segmentReader.readIndex() == 0) { return true; } return false; } }
Source:
public static void createDefaultStorage() { final Storage storage = new Storage(); storage.setId("default"); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration(null, null, ZOOKEEPER_URL, "")); try { STORAGE_DB_REPOSITORY.createStorage(storage); } catch (final Exception ignore) { } }

Target:
public static void createDefaultStorage() { final Storage storage = new Storage(); storage.setId("default"); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration(null, null, ZOOKEEPER_URL, "")); try { STORAGE_DB_REPOSITORY.createStorage(storage); } catch (final DuplicatedStorageException ignore) { } }
Source:
private void addOrUpdateAttributeInstance(final Case autopsyCase, Map<UniquePathKey,CorrelationAttributeInstance> artifactInstances, AbstractFile newFile) throws TskCoreException, EamDbException { TskData.FileKnown localKnown = newFile.getKnown(); if (localKnown != TskData.FileKnown.BAD) { List<ContentTag> fileMatchTags = autopsyCase.getServices().getTagsManager().getContentTagsByContent(newFile); for (ContentTag tag : fileMatchTags) { TskData.FileKnown tagKnownStatus = tag.getName().getKnownStatus(); if (tagKnownStatus.equals(TskData.FileKnown.BAD)) { localKnown = TskData.FileKnown.BAD; break; } } } CorrelationCase correlationCase = EamDb.getInstance().getCase(autopsyCase); CorrelationDataSource correlationDataSource = CorrelationDataSource.fromTSKDataSource(correlationCase, newFile.getDataSource()); String filePath = newFile.getParentPath() + newFile.getName(); UniquePathKey uniquePathKey = new UniquePathKey(correlationDataSource.getDeviceID(), filePath); if (localKnown == TskData.FileKnown.BAD || !artifactInstances.containsKey(uniquePathKey)) { String crComment = ""; if (artifactInstances.containsKey(uniquePathKey)) { crComment = artifactInstances.get(uniquePathKey).getComment(); } CorrelationAttributeInstance caseDbInstance = new CorrelationAttributeInstance(correlationCase, correlationDataSource, filePath, crComment, localKnown); artifactInstances.put(uniquePathKey, caseDbInstance); } }

Target:
private void addOrUpdateAttributeInstance(final Case autopsyCase, Map<UniquePathKey,CorrelationAttributeInstance> artifactInstances, AbstractFile newFile) throws TskCoreException, EamDbException { TskData.FileKnown localKnown = newFile.getKnown(); if (localKnown != TskData.FileKnown.BAD) { List<ContentTag> fileMatchTags = autopsyCase.getServices().getTagsManager().getContentTagsByContent(newFile); for (ContentTag tag : fileMatchTags) { TskData.FileKnown tagKnownStatus = tag.getName().getKnownStatus(); if (tagKnownStatus.equals(TskData.FileKnown.BAD)) { localKnown = TskData.FileKnown.BAD; break; } } } String filePath = newFile.getParentPath() + newFile.getName(); String deviceId; try { deviceId = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId()).getDeviceId(); } catch (TskDataException | TskCoreException ex) { LOGGER.log(Level.WARNING, "Error getting data source info: " + ex); return; } UniquePathKey uniquePathKey = new UniquePathKey(deviceId, filePath); if (artifactInstances.containsKey(uniquePathKey)) { if (localKnown == TskData.FileKnown.BAD) { CorrelationAttributeInstance prevInstance = artifactInstances.get(uniquePathKey); prevInstance.setKnownStatus(localKnown); } } else { CorrelationCase correlationCase = new CorrelationCase(autopsyCase.getName(), autopsyCase.getDisplayName()); CorrelationDataSource correlationDataSource = CorrelationDataSource.fromTSKDataSource(correlationCase, newFile.getDataSource()); CorrelationAttributeInstance caseDbInstance = new CorrelationAttributeInstance(correlationCase, correlationDataSource, filePath, "", localKnown); artifactInstances.put(uniquePathKey, caseDbInstance); } }