auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void deleteProjectDirsIfNecessary(final long newProjectSizeInBytes) { final long cachePartitionSize = this.projectCacheDir.getTotalSpace(); final long availablePartitionSize = this.projectCacheDir.getUsableSpace(); final long start = System.currentTimeMillis(); loadAllProjects(); log.info("Loading project dirs metadata completed in msecs", cachedProjects.size(), System.currentTimeMillis() - start); long currentCacheSize = getProjectDirsTotalSizeInBytes(); long projectCacheDirCapacity = currentCacheSize + availablePartitionSize; boolean throttleAfterDeletion = false; final long highWatermark = (long) (projectCacheDirCapacity * this.percentageOfDisk); final long throttleWatermark = (long) (projectCacheDirCapacity * throttlePercentage); long projectedCacheSize = currentCacheSize + newProjectSizeInBytes; log.info("Partition = MB, Total Capacity = MB, Cache Size = MB, Projected Size = MB", bytesToMB(cachePartitionSize), bytesToMB(projectCacheDirCapacity), bytesToMB(currentCacheSize), bytesToMB(projectedCacheSize)); log.info("High Watermark = MB, Throttle Watermark = MB", bytesToMB(highWatermark), bytesToMB(throttleWatermark)); if (projectedCacheSize >= throttleWatermark) { throttleAfterDeletion = true; } if (projectedCacheSize >= highWatermark) { log.info("Projected cache size exceeds High Watermark. LRU Eviction will kick in"); deleteLeastRecentlyUsedProjects(projectedCacheSize - highWatermark); } if (throttleAfterDeletion) { log.info("Throttle Watermark was hit. Blocking till LRU eviction is complete."); finishPendingCleanup(); } }

Target:
public void deleteProjectDirsIfNecessary(final long newProjectSizeInBytes) { final long cachePartitionSize = this.projectCacheDir.getTotalSpace(); final long availablePartitionSize = this.projectCacheDir.getUsableSpace(); final long start = System.currentTimeMillis(); loadAllProjects(); log.info("Loading project dirs metadata completed in msecs", cachedProjects.size(), System.currentTimeMillis() - start); final long currentCacheSize = getProjectDirsTotalSizeInBytes(); final long projectCacheDirCapacity = currentCacheSize + availablePartitionSize; boolean throttleAfterDeletion = false; final long highWatermark = (long) (projectCacheDirCapacity * this.percentageOfDisk); final long throttleWatermark = (long) (projectCacheDirCapacity * this.throttlePercentage); long projectedCacheSize = currentCacheSize + newProjectSizeInBytes; log.info("Partition = MB, Total Capacity = MB, Cache Size = MB, Projected Size = MB", bytesToMB(cachePartitionSize), bytesToMB(projectCacheDirCapacity), bytesToMB(currentCacheSize), bytesToMB(projectedCacheSize)); log.info("High Watermark = MB, Throttle Watermark = MB", bytesToMB(highWatermark), bytesToMB(throttleWatermark)); if (projectedCacheSize >= throttleWatermark) { throttleAfterDeletion = true; } if (projectedCacheSize >= highWatermark) { log.info("Projected cache size exceeds High Watermark. LRU Eviction will kick in"); deleteLeastRecentlyUsedProjects(projectedCacheSize - highWatermark); } if (throttleAfterDeletion) { log.info("Throttle Watermark was hit. Blocking till LRU eviction is complete."); finishPendingCleanup(); } }
Source:
public void testRenameProcessVariableForInitColumns(){ ProcessInstanceListViewImpl processInstanceListView = view; GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test",processInstanceListView.getInitColumns(),processInstanceListView.getBannedColumns()); ListTable<ProcessInstanceSummary> extendedPagedTable = new ListTable<ProcessInstanceSummary>(gridPreferences); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Name",-1,"")); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Id",-1,"")); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("performance",-1,"")); processInstanceListView.initColumns(extendedPagedTable); assertEquals(2, extendedPagedTable.getColumnMetaList().stream() .filter(column -> column.getCaption().equals("Var_Name") || column.getCaption().equals("Var_Id")) .collect(Collectors.toList()).size()); }

Target:
public void testRenameProcessVariableForInitColumns(){ GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test",view.getInitColumns(),view.getBannedColumns()); ListTable<ProcessInstanceSummary> extendedPagedTable = new ListTable<ProcessInstanceSummary>(gridPreferences); List<GridColumnPreference> gridColumnPreferenceList = extendedPagedTable.getGridPreferencesStore().getColumnPreferences(); gridColumnPreferenceList.add(new GridColumnPreference("Name",-1,"")); gridColumnPreferenceList.add(new GridColumnPreference("Id",-1,"")); gridColumnPreferenceList.add(new GridColumnPreference("performance",-1,"")); final ColumnMeta checkColumnMeta = view.initChecksColumn(extendedPagedTable); ColumnMeta<ProcessInstanceSummary> actionsColumnMeta = view.initActionsColumn(); Column<ProcessInstanceSummary, ?> errorCountColumn = view.initErrorCountColumn(); extendedPagedTable.addSelectionIgnoreColumn(checkColumnMeta.getColumn()); extendedPagedTable.addSelectionIgnoreColumn(actionsColumnMeta.getColumn()); extendedPagedTable.addSelectionIgnoreColumn(errorCountColumn); final Column<ProcessInstanceSummary, String> startColumn = view.createTextColumn(COLUMN_START, process -> DateUtils.getDateTimeStr(process.getStartTime())); List<ColumnMeta<ProcessInstanceSummary>> columnMetas = view.getGeneralColumnMetas(extendedPagedTable, startColumn, checkColumnMeta, actionsColumnMeta, errorCountColumn); assertThat(columnMetas.stream()).extracting(columnMeta -> columnMeta.getCaption()).hasSize(14).doesNotContain("Var_Name") .doesNotContain("Var_Id"); columnMetas.addAll(view.renameVariables(extendedPagedTable, columnMetas)); assertThat(columnMetas.stream()).extracting(columnMeta -> columnMeta.getCaption()).hasSize(17).containsOnlyOnce( "Var_Name") .containsOnlyOnce("Var_Id"); }
Source:
public void selectLines(int fromLine, int numberOfLine) { Actions action = actionsFactory.createAction(seleniumWebDriver); setCursorToLine(fromLine); action.keyDown(SHIFT).perform(); for (int i = 0; i < numberOfLine; i++) { typeTextIntoEditor(Keys.ARROW_DOWN.toString()); } action.keyUp(SHIFT).perform(); }

Target:
public void selectLines(int fromLine, int numberOfLine) { Actions action = seleniumWebDriverHelper.getAction(seleniumWebDriver); setCursorToLine(fromLine); action.keyDown(SHIFT).perform(); for (int i = 0; i < numberOfLine; i++) { typeTextIntoEditor(Keys.ARROW_DOWN.toString()); } action.keyUp(SHIFT).perform(); action.sendKeys(Keys.END.toString()).keyUp(SHIFT).perform(); }
Source:
private boolean hasIgnoredModifiers(DetailAST modifiers) { final boolean isStatic = modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isFinal = modifiers.findFirstToken(TokenTypes.FINAL) != null; final boolean ignoredStatic = ignoreStatic && isStatic; final boolean ignoredFinal = ignoreFinal && isFinal; final boolean result; if (ignoreStaticFinal) { result = isStatic && isFinal || ignoredFinal || ignoredStatic; } else { result = ignoredFinal && !isStatic || ignoredStatic && !isFinal; } return result; }

Target:
private boolean hasIgnoredModifiers(DetailAST modifiers) { final boolean isStatic = modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isFinal = modifiers.findFirstToken(TokenTypes.FINAL) != null; final boolean result; if (isStatic && isFinal) { result = ignoreStaticFinal; } else { result = ignoreStatic && isStatic || ignoreFinal && isFinal; } return result; }
Source:
public void testConnectOnStartup() throws Exception { GerritServer gerritServerOne = new GerritServer(gerritServerOneName, true); PluginImpl.getInstance().addServer(gerritServerOne); gerritServerOne.start(); assertEquals(true, gerritServerOne.isNoConnectionOnBootup()); }

Target:
public void testConnectOnStartup() throws Exception { GerritServer gerritServerOne = new GerritServer(gerritServerOneName, true); PluginImpl.getInstance().addServer(gerritServerOne); gerritServerOne.start(); assertEquals(true, gerritServerOne.isNoConnectionOnStartup()); }
Source:
public void toggleTrackIndividualEndpoints() throws Exception { ModelNodeResult originalValue = operations.readAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, TRACK_INDIVIDUAL_ENDPOINTS, ReadAttributeOption.INCLUDE_DEFAULTS); originalValue.assertSuccess(); boolean originalValueBool = originalValue.booleanValue(); try { new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, TRACK_INDIVIDUAL_ENDPOINTS, !originalValueBool) .verifyFormSaved() .verifyAttribute(TRACK_INDIVIDUAL_ENDPOINTS, !originalValueBool); new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, TRACK_INDIVIDUAL_ENDPOINTS, originalValueBool) .verifyFormSaved() .verifyAttribute(TRACK_INDIVIDUAL_ENDPOINTS, originalValueBool); } finally { operations.writeAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, TRACK_INDIVIDUAL_ENDPOINTS, originalValue.value()).assertSuccess(); } }

Target:
public void toggleTrackIndividualEndpoints() throws Exception { ModelNodeResult originalValue = operations.readAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, TRACK_INDIVIDUAL_ENDPOINTS, ReadAttributeOption.NOT_INCLUDE_DEFAULTS); originalValue.assertSuccess(); boolean originalValueBool = originalValue.booleanValue(); try { new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, TRACK_INDIVIDUAL_ENDPOINTS, !originalValueBool) .verifyFormSaved() .verifyAttribute(TRACK_INDIVIDUAL_ENDPOINTS, !originalValueBool); new ConfigChecker.Builder(client, REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, TRACK_INDIVIDUAL_ENDPOINTS, originalValueBool) .verifyFormSaved() .verifyAttribute(TRACK_INDIVIDUAL_ENDPOINTS, originalValueBool); } finally { operations.writeAttribute(REQUEST_CONTROLLER_SUBSYSTEM_ADDRESS, TRACK_INDIVIDUAL_ENDPOINTS, originalValue.value()).assertSuccess(); } }
Source:
public Feign build() { if (library == null) { throw new IllegalStateException("A Reactive Streams Library has not been specified"); } super.contract(new ReactiveDelegatingContract(this.contract)); super.invocationHandlerFactory(new ReactiveInvocationHandlerFactory(this.library)); return super.build(); }

Target:
public Feign build() { if (!(this.contract instanceof ReactiveDelegatingContract)) { super.contract(new ReactiveDelegatingContract(this.contract)); } else { super.contract(this.contract); } return super.build(); }
Source:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return tsb.append("id", getId()) .append("name", getName()) .append("vdsId", getVdsId()) .append("networkName", getNetworkName()) .append("ipv4BootProtocol", getIpv4BootProtocol()) .append("ipv4Address", getIpv4Address()) .append("ipv4Subnet", getIpv4Subnet()) .append("ipv4Gateway", getIpv4Gateway()) .append("ipv6BootProtocol", getIpv6BootProtocol()) .append("ipv6Address", getIpv6Address()) .append("ipv6Prefix", getIpv6Prefix()) .append("ipv6Gateway", getIpv6Gateway()) .append("mtu", getMtu()) .append("bridged", isBridged()) .append("reportedSwitchType", getReportedSwitchType()) .append("type", getType()) .append("networkImplementationDetails", getNetworkImplementationDetails()) .append("qos", getQos()) .append("adPartnerMac", getAdPartnerMac()); }

Target:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return tsb.append("id", getId()) .append("name", getName()) .append("vdsId", getVdsId()) .append("networkName", getNetworkName()) .append("ipv4BootProtocol", getIpv4BootProtocol()) .append("ipv4Address", getIpv4Address()) .append("ipv4Subnet", getIpv4Subnet()) .append("ipv4Gateway", getIpv4Gateway()) .append("ipv6BootProtocol", getIpv6BootProtocol()) .append("ipv6Address", getIpv6Address()) .append("ipv6Prefix", getIpv6Prefix()) .append("ipv6Gateway", getIpv6Gateway()) .append("mtu", getMtu()) .append("bridged", isBridged()) .append("reportedSwitchType", getReportedSwitchType()) .append("type", getType()) .append("networkImplementationDetails", getNetworkImplementationDetails()) .append("qos", getQos()) .append("adPartnerMac", getAdPartnerMac()) .append("adAggregatorId", adAggregatorId); }
Source:
static void validateVersion(short version) { if (version < Replica_Metadata_Request_Version_V1 || version > Replica_Metadata_Request_Version_V2) { throw new IllegalArgumentException("Invalid version"); } }

Target:
static void validateVersion(short version) { if (version < Replica_Metadata_Request_Version_V1 || version > Replica_Metadata_Request_Version_V2) { throw new IllegalArgumentException("Invalid replicametadata request version: " + version); } }
Source:
public SessionKey getSessionKey() { return new SessionKey() { private volatile boolean active = true; private void updateActive() { active = sender.getBlock().getType() == Material.COMMAND_BLOCK || sender.getBlock().getType() == Material.CHAIN_COMMAND_BLOCK || sender.getBlock().getType() == Material.REPEATING_COMMAND_BLOCK; } @Override public String getName() { return sender.getName(); } @Override public boolean isActive() { if (Bukkit.isPrimaryThread()) { updateActive(); } else { Bukkit.getScheduler().callSyncMethod(plugin, () -> { updateActive(); return null; }); } return active; } @Override public boolean isPersistent() { return true; } @Override public UUID getUniqueId() { return uuid; } }; }

Target:
public SessionKey getSessionKey() { return new SessionKey() { private volatile boolean active = true; private void updateActive() { Block block = sender.getBlock(); if (!block.getWorld().isChunkLoaded(block.getX() >> 4, block.getZ() >> 4)) { active = false; return; } Material type = block.getType(); active = type == Material.COMMAND_BLOCK || type == Material.CHAIN_COMMAND_BLOCK || type == Material.REPEATING_COMMAND_BLOCK; } @Override public String getName() { return sender.getName(); } @Override public boolean isActive() { if (Bukkit.isPrimaryThread()) { updateActive(); } else { Bukkit.getScheduler().callSyncMethod(plugin, () -> { updateActive(); return null; }); } return active; } @Override public boolean isPersistent() { return true; } @Override public UUID getUniqueId() { return uuid; } }; }
Source:
public KafkaIndexTaskClient( HttpClient httpClient, ObjectMapper jsonMapper, TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries ) { this.httpClient = httpClient; this.jsonMapper = jsonMapper; this.taskInfoProvider = taskInfoProvider; this.httpTimeout = httpTimeout; this.numRetries = numRetries; this.retryPolicyFactory = createRetryPolicyFactory(); String threadId = String.format("KafkaIndexTaskClient-%s", dataSource); this.executorService = MoreExecutors.listeningDecorator(Execs.multiThreaded(numThreads, threadId + "-%d")); }

Target:
public KafkaIndexTaskClient( HttpClient httpClient, ObjectMapper jsonMapper, TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries ) { this.httpClient = httpClient; this.jsonMapper = jsonMapper; this.taskInfoProvider = taskInfoProvider; this.httpTimeout = httpTimeout; this.numRetries = numRetries; this.retryPolicyFactory = createRetryPolicyFactory(); this.executorService = MoreExecutors.listeningDecorator( Execs.multiThreaded( numThreads, String.format( "KafkaIndexTaskClient-%s-%%d", dataSource ) ) ); }
Source:
protected String getModelFilename(final Blob zipContent) throws IOException { ZipEntry zipEntry; String threeDFilename = null; try (ZipInputStream zipInputStream = new ZipInputStream(zipContent.getStream())) { while ((zipEntry = zipInputStream.getNextEntry()) != null) { boolean isSupported = SUPPORTED_EXTENSIONS.contains(lowerCaseFileExtension(zipEntry.getName())); if (zipEntry.isDirectory() || !isSupported || zipEntry.getName().startsWith(".")) { continue; } threeDFilename = FileManagerUtils.fetchTitle(zipEntry.getName()); break; } } return threeDFilename; }

Target:
protected String getModelFilename(final Blob zipContent) throws IOException { ZipEntry zipEntry; String threeDFilename = null; try (ZipInputStream zipInputStream = new ZipInputStream(zipContent.getStream())) { while ((zipEntry = zipInputStream.getNextEntry()) != null) { String ext = FilenameUtils.getExtension(zipEntry.getName()).toLowerCase(); boolean isSupported = SUPPORTED_EXTENSIONS.contains(ext); if (zipEntry.isDirectory() || !isSupported || zipEntry.getName().startsWith(".")) { continue; } threeDFilename = FileManagerUtils.fetchTitle(zipEntry.getName()); break; } } return threeDFilename; }
Source:
public static ILttngRelaydConnector getNewConnector(Socket myConnection) throws IOException { DataOutputStream outNet = new DataOutputStream(myConnection.getOutputStream()); DataInputStream inNet = new DataInputStream(myConnection.getInputStream()); ViewerCommand connectCommand = new ViewerCommand(); ConnectResponse connectPayload = new ConnectResponse(0, 2, 4, ConnectionType.VIEWER_CLIENT_COMMAND); connectCommand.setCommand(Command.VIEWER_CONNECT); connectCommand.setDataSize(connectPayload.size()); outNet.write(connectCommand.serialize()); outNet.flush(); ConnectResponse connectReply = new ConnectResponse(inNet); switch (connectReply.getMajor()) { case 2: switch (connectReply.getMinor()) { case 0: case 1: case 2: case 3: return new LttngRelaydConnector_Unsupported(); case 4: default: return new LttngRelaydConnector_2_4(inNet, outNet); } default: return new LttngRelaydConnector_Unsupported(); } }

Target:
public static ILttngRelaydConnector getNewConnector(Socket myConnection) throws IOException { DataOutputStream outNet = new DataOutputStream(myConnection.getOutputStream()); DataInputStream inNet = new DataInputStream(myConnection.getInputStream()); ConnectResponse connectPayload = new ConnectResponse(0, MAJOR_VERSION, MINOR_VERSION, ConnectionType.VIEWER_CLIENT_COMMAND); ViewerCommand connectCommand = new ViewerCommand(Command.VIEWER_CONNECT, connectPayload.size(), 0); outNet.write(connectCommand.serialize()); outNet.flush(); ConnectResponse connectReply = new ConnectResponse(inNet); switch (connectReply.getMajor()) { case 2: switch (connectReply.getMinor()) { case 0: case 1: case 2: case 3: return new LttngRelaydConnector_Unsupported(); case 4: default: return new LttngRelaydConnector_2_4(inNet, outNet); } default: return new LttngRelaydConnector_Unsupported(); } }
Source:
public void nextImage() { int size = images.size(); int prevIndex = index; if (size > 0) { if (index == size - 1) { if (infinite) { index = 0; } else { stop(); } } else { index++; } if (prevIndex != index) { currentImage.set(images.get(index)); } } }

Target:
public void nextImage() { int size = images.size(); if (size > 0) { if (index == size - 1) { if (infinite) { index = 0; } else { stop(); } } else { index++; } } }
Source:
public void toStream(@NonNull JsonStream writer) throws IOException { exception.setProjectPackages(projectPackages); exception.toStream(writer); }

Target:
public void toStream(@NonNull JsonStream writer) throws IOException { writer.beginArray(); Throwable currentEx = exception; while (currentEx != null) { if (currentEx instanceof JsonStream.Streamable) { ((JsonStream.Streamable) currentEx).toStream(writer); } else { String exceptionName = currentEx.getClass().getName(); String localizedMessage = currentEx.getLocalizedMessage(); StackTraceElement[] stackTrace = currentEx.getStackTrace(); exceptionToStream(writer, exceptionName, localizedMessage, stackTrace); } currentEx = currentEx.getCause(); } writer.endArray(); }
Source:
public boolean isAttachable() { return attachable == null ? false : attachable; }

Target:
public Boolean isAttachable() { return attachable; }
Source:
public void run() { if (!fStateSystemAssigned) { Activator.logError("Cannot run event manager without assigning a target state system first!"); return; } @NonNull ITmfEvent event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; fLatestTime = event.getTimestamp().toNanos(); eventHandle(event); event = fEventsQueue.take(); } closeStateSystem(); }

Target:
public void run() { if (!fStateSystemAssigned) { Activator.logError("Cannot run event manager without assigning a target state system first!"); return; } @NonNull ITmfEvent event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; fSafeTime = event.getTimestamp().toNanos() - 1; eventHandle(event); event = fEventsQueue.take(); } closeStateSystem(); }
Source:
public final Observable<Message> listen() { checkState(!stopped, "Transport is stopped"); return incomingMessagesSubject.onBackpressureBuffer().asObservable(); }

Target:
public final Observable<Message> listen() { checkState(!stopped, "Transport is stopped"); return incomingMessagesSubject.onBackpressureBuffer(DEFAULT_BUFFER_LIMIT).asObservable(); }
Source:
private void doThreadedTasks() { Thread httpsInfoThread = new Thread("ZAP-httpsinfo") { @Override public void run() { try { initSession(getTarget()); } catch (DVException e) { String warnMsg = Constant.messages.getString( "httpsinfo.init.warning", getTarget() == null ? Constant.messages.getString( "httpsinfo.init.warning.missing") : getTarget().toString(), e.getCause()); LOGGER.warn(warnMsg); View.getSingleton().showWarningDialog(warnMsg); return; } try { setDvEng(getSession()); } catch (DVException e) { LOGGER.warn(e.getMessage(), e); } showGeneral(); showCipherSuites(); } }; httpsInfoThread.start(); }

Target:
private void doThreadedTasks() { Thread httpsInfoThread = new Thread("ZAP-httpsinfo") { @Override public void run() { if (getTarget() == null) { String missingMsg = Constant.messages.getString("httpsinfo.init.warning.missing"); LOGGER.warn(missingMsg); View.getSingleton().showWarningDialog(missingMsg); return; } try { initSession(getTarget()); } catch (DVException e) { String warnMsg = Constant.messages.getString( "httpsinfo.init.warning", getTarget().toString(), e.getCause()); LOGGER.warn(warnMsg); View.getSingleton().showWarningDialog(warnMsg); return; } try { setDvEng(getSession()); } catch (DVException e) { LOGGER.warn(e.getMessage(), e); } showGeneral(); showCipherSuites(); } }; httpsInfoThread.start(); }
Source:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if (isError(result) && result.getErrorOutput().length > 0) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } throw new ExecutionException(Messages.TraceControl_CommandError + toCommandString(command)); } Document document = getDocumentFromStrings(result.getOutput()); NodeList rawEvents = document.getElementsByTagName(MIStrings.EVENT); getBaseEventInfo(rawEvents, events); return events; }

Target:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if (isError(result)) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } throw new ExecutionException(Messages.TraceControl_CommandError + toCommandString(command)); } Document document = getDocumentFromStrings(result.getOutput()); NodeList rawEvents = document.getElementsByTagName(MIStrings.EVENT); getBaseEventInfo(rawEvents, events); return events; }
Source:
public void killMessage(SimpleString nodeID) throws Exception { if (clientVersion < DisconnectConsumerWithKillMessage.VERSION_INTRODUCED) { throw new Exception(String.valueOf(clientVersion)); } Channel clientChannel = getChannel(1, -1); DisconnectConsumerWithKillMessage response = new DisconnectConsumerWithKillMessage(nodeID); clientChannel.send(response, -1); }

Target:
public void killMessage(SimpleString nodeID) { if (clientVersion < DisconnectConsumerWithKillMessage.VERSION_INTRODUCED) { return; } Channel clientChannel = getChannel(1, -1); DisconnectConsumerWithKillMessage response = new DisconnectConsumerWithKillMessage(nodeID); clientChannel.send(response, -1); }
Source:
public void testConcatMultiple() throws Throwable { int numFiles = GoogleHadoopFileSystemBase.MAX_COMPOSE_OBJECTS * 3 / 2; Path testPath = path("test"); byte[][] blocks = new byte[numFiles][0]; Path[] srcs = new Path[numFiles]; for (int i = 0; i < numFiles; i++) { Path srcFile = new Path(testPath, "" + i); blocks[i] = dataset(TEST_FILE_LEN, i, 255); createFile(getFileSystem(), srcFile, true, blocks[i]); srcs[i] = srcFile; } Path target = new Path(testPath, "target"); createFile(getFileSystem(), target, false, new byte[0]); getFileSystem().concat(target, srcs); assertFileHasLength(getFileSystem(), target, TEST_FILE_LEN * numFiles); ContractTestUtils.validateFileContent( ContractTestUtils.readDataset(getFileSystem(), target, TEST_FILE_LEN * numFiles), blocks); }

Target:
public void testConcatMultiple() throws Throwable { int numFiles = GoogleCloudStorage.MAX_COMPOSE_OBJECTS * 3 / 2; Path testPath = path("test"); byte[][] blocks = new byte[numFiles][0]; Path[] srcs = new Path[numFiles]; for (int i = 0; i < numFiles; i++) { Path srcFile = new Path(testPath, "" + i); blocks[i] = dataset(TEST_FILE_LEN, i, 255); createFile(getFileSystem(), srcFile, true, blocks[i]); srcs[i] = srcFile; } Path target = new Path(testPath, "target"); createFile(getFileSystem(), target, false, new byte[0]); getFileSystem().concat(target, srcs); assertFileHasLength(getFileSystem(), target, TEST_FILE_LEN * numFiles); ContractTestUtils.validateFileContent( ContractTestUtils.readDataset(getFileSystem(), target, TEST_FILE_LEN * numFiles), blocks); }
Source:
public BaseDialectNamingAdaptor() { }

Target:
protected BaseDialectNamingAdaptor() { }
Source:
private void restart() { if(state.get() == State.STARTING) { Trace.debug("Resturning early from restart. Already staring for project {0} and kind {1}", project.getName(), kind); return; } Trace.debug("Rescheduling watch job for project {0} and kind {1}", project.getName(), kind); startWatch(project, backoff, lastConnect, this); }

Target:
private void restart() { if(state.get() == State.STARTING) { Trace.debug("Returning early from restart. Already starting for project {0} and kind {1}", project.getName(), kind); return; } Trace.debug("Rescheduling watch job for project {0} and kind {1}", project.getName(), kind); startWatch(project, backoff, lastConnect, this); }
Source:
public <T> T deserialize(String value, final Type type, SerializerEncoding encoding) throws IOException { if (CoreUtils.isNullOrEmpty(value) || value.equals(BOM) || value.equals(BOM_STRING)) { return null; } if (encoding == SerializerEncoding.XML) { if (value.startsWith(BOM)) { value = value.replaceFirst(BOM, ""); } else if (value.startsWith(BOM_STRING)) { value = value.replaceFirst(BOM_STRING, ""); } } final JavaType javaType = createJavaType(type); try { if (encoding == SerializerEncoding.XML) { return (T) xmlMapper.readValue(value, javaType); } else { return (T) serializer().readValue(value, javaType); } } catch (JsonParseException jpe) { throw logger.logExceptionAsError(new MalformedValueException(jpe.getMessage(), jpe)); } }

Target:
public <T> T deserialize(String value, final Type type, SerializerEncoding encoding) throws IOException { if (CoreUtils.isNullOrEmpty(value) || value.equals(BOM) || value.equals(BOM_STRING)) { return null; } if (value.startsWith(BOM)) { value = value.replaceFirst(BOM, ""); } else if (value.startsWith(BOM_STRING)) { value = value.replaceFirst(BOM_STRING, ""); } final JavaType javaType = createJavaType(type); try { if (encoding == SerializerEncoding.XML) { return (T) xmlMapper.readValue(value, javaType); } else { return (T) serializer().readValue(value, javaType); } } catch (JsonParseException jpe) { throw logger.logExceptionAsError(new MalformedValueException(jpe.getMessage(), jpe)); } }
Source:
public void run() { for (BlobStore store : stores) { if (store.isStarted()) { try { store.maybeResumeCompaction(); } catch (Exception e) { logger.error("Compaction of store failed on resume. Continuing with the next store", store, e); storesToSkip.add(store); } } } while (enabled.get()) { try { long startTimeMs = time.milliseconds(); for (BlobStore store : stores) { try { if (!enabled.get()) { break; } if (store.isStarted() && !storesToSkip.contains(store)) { CompactionDetails details = getCompactionDetails(store); if (details != null) { store.compact(details); } } } catch (Exception e) { logger.error("Compaction of store failed. Continuing with the next store", store, e); storesToSkip.add(store); } } long timeElapsed = time.milliseconds() - startTimeMs; lock.lock(); try { time.await(waitCondition, waitTimeMs - timeElapsed); } finally { lock.unlock(); } } catch (Exception e) { logger.error("Compaction execution encountered an error either during wait. Continuing", e); } } }

Target:
public void run() { for (BlobStore store : stores) { if (store.isStarted()) { try { store.maybeResumeCompaction(); } catch (Exception e) { logger.error("Compaction of store failed on resume. Continuing with the next store", store, e); storesToSkip.add(store); } } } while (enabled) { try { long startTimeMs = time.milliseconds(); for (BlobStore store : stores) { try { if (!enabled) { break; } if (store.isStarted() && !storesToSkip.contains(store)) { CompactionDetails details = getCompactionDetails(store); if (details != null) { store.compact(details); } } } catch (Exception e) { logger.error("Compaction of store failed. Continuing with the next store", store, e); storesToSkip.add(store); } } lock.lock(); try { if (enabled) { long timeElapsed = time.milliseconds() - startTimeMs; time.await(waitCondition, waitTimeMs - timeElapsed); } } finally { lock.unlock(); } } catch (Exception e) { logger.error("Compaction execution encountered an error either during wait. Continuing", e); } } }
Source:
public void insert(ExecRow inputRow) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(state != STATE_DRAIN, "you cannot insert rows after starting to drain"); } state = STATE_INSERT; if(uniqueIndexCreated) { if(isRowAlreadyExist(inputRow)) return; } numRowsIn++; if (lastArraySlot + 1 < rowArray.length) { rowArray[++lastArraySlot] = cloneRow(inputRow); return; } if (!conglomCreated) { TransactionController tc = activation.getTransactionController(); int collation_ids[] = null; CID = tc.createConglomerate(false, "heap", inputRow.getRowArray(), null, collation_ids, properties, TransactionController.IS_TEMPORARY | TransactionController.IS_KEPT, 0); conglomCreated = true; cc = tc.openConglomerate(CID, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE); } int status = 0; status = cc.insert(inputRow); if (SanityManager.DEBUG) { if (status != 0) { SanityManager.THROWASSERT("got funky status ("+status+") back from "+ "ConglomerateConstroller.insert()"); } } }

Target:
public void insert(ExecRow inputRow) throws StandardException { if (SanityManager.DEBUG) { SanityManager.ASSERT(state != STATE_DRAIN, "you cannot insert rows after starting to drain"); } state = STATE_INSERT; if(uniqueIndexCreated) { if(isRowAlreadyExist(inputRow)) return; } numRowsIn++; if (lastArraySlot + 1 < rowArray.length) { rowArray[++lastArraySlot] = cloneRow(inputRow); return; } if (!conglomCreated) { TransactionController tc = activation.getTransactionController(); int collation_ids[] = null; CID = tc.createConglomerate(false, "heap", inputRow.getRowArray(), null, collation_ids, properties, TransactionController.IS_TEMPORARY | TransactionController.IS_KEPT, Conglomerate.Priority.NORMAL); conglomCreated = true; cc = tc.openConglomerate(CID, false, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE); } int status = 0; status = cc.insert(inputRow); if (SanityManager.DEBUG) { if (status != 0) { SanityManager.THROWASSERT("got funky status ("+status+") back from "+ "ConglomerateConstroller.insert()"); } } }
Source:
public StorageRequestAuthorizer( Class<? extends AuthorizationHandler> handlerClass, Map<String, String> properties) throws ReflectiveOperationException { checkNotNull(handlerClass, NULL_HANDLER_MSG); authorizationHandler = handlerClass.getDeclaredConstructor().newInstance(); authorizationHandler.setProperties(properties); }

Target:
public StorageRequestAuthorizer( Class<? extends AuthorizationHandler> handlerClass, Map<String, String> properties) { checkNotNull(handlerClass, NULL_HANDLER_MSG); try { authorizationHandler = handlerClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new RuntimeException("Can not instantiate authorization handler.", e); } authorizationHandler.setProperties(properties); }
Source:
private static Model readPom( File file ) throws Exception { MavenXpp3Reader reader = new MavenXpp3Reader(); return reader.read( new FileReader( file ) ); }

Target:
private static Model readPom( File file ) throws Exception { MavenXpp3Reader reader = new MavenXpp3Reader(); return reader.read( new FileInputStream( file ) ); }
Source:
public MockAssignmentMetadataStore() { super(Mockito.mock(BucketDataAccessor.class), ""); }

Target:
MockAssignmentMetadataStore() { super(Mockito.mock(BucketDataAccessor.class), ""); }
Source:
public void close() { if (TRACK_CURSOR_PROVIDER_CLOSE) { closerResponsible = new Exception("Responsible for closing the stream."); } closed.set(true); }

Target:
public void close() { closed.set(true); if (trackCursorProviderClose) { closerResponsible = new Exception("Responsible for closing the stream."); } }
Source:
public boolean isInternal() { return getParentNode() .filter(parent -> parent instanceof Name) .map(parent -> (Name) parent) .flatMap(Name::getQualifier) .map(parentNameQualifier -> parentNameQualifier == this) .orElse(false); }

Target:
public boolean isInternal() { return getParentNode() .filter(parent -> parent instanceof Name) .isPresent(); }
Source:
protected void setHeaders(HttpUriRequest httpUriRequest) throws IOException { setTokenHeader(httpUriRequest); setContentTypeHeader(httpUriRequest); setAcceptHeader(httpUriRequest); Map<String, String> headers = this.configuration.getHeaders(); for (Map.Entry<String, String> header : headers.entrySet()) { Header authHeader = new BasicHeader(header.getKey(), header.getValue()); httpUriRequest.setHeader(authHeader); } }

Target:
protected void setHeaders(HttpUriRequest httpUriRequest) throws IOException { setTokenHeader(httpUriRequest); setContentTypeHeader(httpUriRequest); setAcceptHeader(httpUriRequest); Map<String, String> headers = this.configuration.getHeaders(); if (headers != null) { for (Map.Entry<String, String> header : headers.entrySet()) { Header extraHeader = new BasicHeader(header.getKey(), header.getValue()); httpUriRequest.setHeader(extraHeader); } } }
Source:
@Override protected void beforeTestsStarted() throws Exception { startGridsMultiThreaded(3); startGrid(); }

Target:
@Override protected void beforeTestsStarted() throws Exception { startGridsMultiThreaded(3); startClientGrid(); }
Source:
protected boolean isReady() { return IronSource.isRewardedVideoAvailable(); }

Target:
protected boolean isReady() { return IronSource.isISDemandOnlyRewardedVideoAvailable(mInstanceId); }
Source:
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = null; if (serverCnxnClassCtr != null) { try { cnxn = serverCnxnClassCtr.newInstance(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } catch (InstantiationException e1) { LOG.debug("Can not instantiate class for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (IllegalAccessException e1) { LOG.debug("IllegalAccessException for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (InvocationTargetException e1) { LOG.debug("InvocationTargetException for " + serverCnxnClassCtr.getName() + ". Using NettyServerCnxn"); } catch (Throwable t) { LOG.debug("Unknown Exception while dealing with: . Using NettyServerCnxn", serverCnxnClassCtr.getName()); } } if (cnxn == null) { cnxn = new NettyServerCnxn(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } ctx.setAttachment(cnxn); if (secure) { SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }

Target:
public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = null; try { cnxn = serverCnxnClassCtr.newInstance(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); } catch (Throwable t) { throw new IOException("Exception while trying to instantiate " + serverCnxnClassCtr.getName(), t); } ctx.setAttachment(cnxn); if (secure) { SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }
Source:
protected boolean verifyConnectionLost(MIOutput output) { boolean shouldTerminate = false; for (MIOOBRecord oobr : output.getMIOOBRecords()) { if (oobr instanceof MIConsoleStreamOutput) { MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr; String str = out.getString(); if (str != null && str.startsWith("Ending remote debugging")) { shouldTerminate = true; break; } } else if (oobr instanceof MILogStreamOutput) { MILogStreamOutput out = (MILogStreamOutput) oobr; String str = out.getString().trim(); if (str != null && str.startsWith("Remote connection closed")) { shouldTerminate = true; break; } } } if (!shouldTerminate) { MIResultRecord rr = output.getMIResultRecord(); if (rr != null) { String state = rr.getResultClass(); if ("error".equals(state)) { MIResult[] results = rr.getMIResults(); for (MIResult result : results) { String var = result.getVariable(); if (var.equals("msg")) { MIValue value = result.getMIValue(); if (value instanceof MIConst) { String str = ((MIConst)value).getCString(); if (str != null && str.startsWith("Remote connection closed")) { shouldTerminate = true; } } } } } } } if (shouldTerminate) { terminate(new ImmediateRequestMonitor() { @Override protected void handleErrorOrWarning() { GdbPlugin.getDefault().getLog().log(getStatus()); super.handleErrorOrWarning(); }; }); } return false; }

Target:
protected boolean verifyConnectionLost(MIOutput output) { boolean connectionLost = false; for (MIOOBRecord oobr : output.getMIOOBRecords()) { if (oobr instanceof MIConsoleStreamOutput) { MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr; String str = out.getString(); if (str != null && str.startsWith("Ending remote debugging")) { connectionLost = true; break; } } else if (oobr instanceof MILogStreamOutput) { MILogStreamOutput out = (MILogStreamOutput) oobr; String str = out.getString().trim(); if (str != null && str.startsWith("Remote connection closed")) { connectionLost = true; break; } } } if (!connectionLost) { MIResultRecord rr = output.getMIResultRecord(); if (rr != null) { String state = rr.getResultClass(); if ("error".equals(state)) { MIResult[] results = rr.getMIResults(); for (MIResult result : results) { String var = result.getVariable(); if (var.equals("msg")) { MIValue value = result.getMIValue(); if (value instanceof MIConst) { String str = ((MIConst)value).getCString(); if (str != null && str.startsWith("Remote connection closed")) { connectionLost = true; } } } } } } } if (connectionLost) { connectionLost(); return true; } return false; }
Source:
private void validate() throws UnloggedFailure { if (active && inactive) { throw new UnloggedFailure(1, "--active and --inactive options are mutually exclusive."); } if (clearHttpPassword && !Strings.isNullOrEmpty(httpPassword)) { throw new UnloggedFailure(1, "--http-password and --clear-http-password options are mutually " + "exclusive."); } if (addSshKeys.contains("-") && deleteSshKeys.contains("-")) { throw new UnloggedFailure(1, "Only one option may use the stdin"); } if (deleteSshKeys.contains("ALL")) { deleteSshKeys = Collections.singletonList("ALL"); } if (deleteEmails.contains("ALL")) { deleteEmails = Collections.singletonList("ALL"); } if (!Strings.isNullOrEmpty(preferredEmail) && !deleteEmails.isEmpty()) { if (deleteEmails.contains(preferredEmail)) { throw new UnloggedFailure(1, "--preferred-email and --delete-email options are mutually " + "exclusive for the same email address."); } } }

Target:
private void validate() throws UnloggedFailure { if (active && inactive) { throw new UnloggedFailure(1, "--active and --inactive options are mutually exclusive."); } if (clearHttpPassword && !Strings.isNullOrEmpty(httpPassword)) { throw new UnloggedFailure(1, "--http-password and --clear-http-password options are mutually " + "exclusive."); } if (addSshKeys.contains("-") && deleteSshKeys.contains("-")) { throw new UnloggedFailure(1, "Only one option may use the stdin"); } if (deleteSshKeys.contains("ALL")) { deleteSshKeys = Collections.singletonList("ALL"); } if (deleteEmails.contains("ALL")) { deleteEmails = Collections.singletonList("ALL"); } if (deleteEmails.contains(preferredEmail)) { throw new UnloggedFailure(1, "--preferred-email and --delete-email options are mutually " + "exclusive for the same email address."); } }
Source:
public void tearDown() throws UserStoreException { clearTestUsers(); testDirectoryServer.stopLdapService(); }

Target:
public void tearDown() throws UserStoreException { try { clearTestUsers(); } finally { testDirectoryServer.stopLdapService(); } }
Source:
public void run(String... strings) throws Exception { System.out.println(">>> Starting Audit App... "); }

Target:
public void run(String... strings) throws Exception { }
Source:
public void testConstructor_defaultConstructor_fieldsShouldHaveCorrectDefaultValues() { FeedbackRankOptionsQuestionDetails rankDetails = new FeedbackRankOptionsQuestionDetails(); assertEquals(FeedbackQuestionType.RANK_OPTIONS, rankDetails.getQuestionType()); assertTrue(rankDetails.getMinOptionsToBeRanked() == FeedbackRankQuestionDetails.NO_VALUE); assertTrue(rankDetails.getMaxOptionsToBeRanked() == FeedbackRankQuestionDetails.NO_VALUE); assertFalse(rankDetails.areDuplicatesAllowed()); }

Target:
public void testConstructor_defaultConstructor_fieldsShouldHaveCorrectDefaultValues() { FeedbackRankOptionsQuestionDetails rankDetails = new FeedbackRankOptionsQuestionDetails(); assertEquals(FeedbackQuestionType.RANK_OPTIONS, rankDetails.getQuestionType()); assertEquals(rankDetails.getMinOptionsToBeRanked(), FeedbackRankQuestionDetails.NO_VALUE); assertEquals(rankDetails.getMaxOptionsToBeRanked(), FeedbackRankQuestionDetails.NO_VALUE); assertFalse(rankDetails.areDuplicatesAllowed()); }
Source:
private String notLocalizedKey(Enum<?> key, MissingResourceException e) { String logString = "Missing Enum resource '" + key + "'."; if (e != null) { logString += " " + e.getLocalizedMessage(); } logger.info(logString); return key.name(); }

Target:
private String notLocalizedKey(Enum<?> key, MissingResourceException e) { String logString = "Missing Enum resource '" + key + "'."; if (e != null) { logString += " " + e.getLocalizedMessage(); } logger.warning(logString); return key.name(); }
Source:
private RestRequest buildSoapRequest(String sessionId, String body) throws UnsupportedEncodingException { Map<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("SOAPAction", "\"\""); RequestBody requestBody = RequestBody.create(MEDIA_TYPE_XML, String.format(REQUEST_TEMPLATE, sessionId, body)); return new RestRequest(RestRequest.RestMethod.POST, "/services/Soap/u/36.0", requestBody, customHeaders); }

Target:
private RestRequest buildSoapRequest(String sessionId, String body) throws UnsupportedEncodingException { Map<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("SOAPAction", "\"\""); RequestBody requestBody = RequestBody.create(MEDIA_TYPE_XML, String.format(REQUEST_TEMPLATE, sessionId, body)); String version = ApiVersionStrings.getVersionNumber(SalesforceSDKManager.getInstance().getAppContext()).substring(1); ; return new RestRequest(RestRequest.RestMethod.POST, "/services/Soap/u/" + version, requestBody, customHeaders); }
Source:
public void cleanup() { if(this.streamEstimator != null) { this.streamEstimator.reset(); } }

Target:
public void cleanup() { this.streamEstimator.reset(); }
Source:
public void prepareFromRequest(PlaceRequest request) { super.prepareFromRequest(request); name = request.getParameter("value", "noSelection"); getView().setName(name); }

Target:
public void prepareFromRequest(PlaceRequest request) { super.prepareFromRequest(request); name = request.getParameter(NameTokens.VALUE_PARAM, "noSelection"); getView().setName(name); }
Source:
public synchronized InternalIndex addOrGetIndex(IndexConfig indexConfig, StoreAdapter partitionStoreAdapter) { String name = indexConfig.getName(); assert name != null; assert !name.isEmpty(); InternalIndex index = indexesByName.get(name); if (index != null) { return index; } index = indexProvider.createIndex( indexConfig, extractors, serializationService, indexCopyBehavior, stats.createPerIndexStats(indexConfig.getType() == IndexType.SORTED, usesCachedQueryableEntries), partitionStoreAdapter ); indexesByName.put(name, index); attributeIndexRegistry.register(index); converterCache.invalidate(index); indexes = indexesByName.values().toArray(EMPTY_INDEXES); if (index.getComponents().length > 0) { InternalIndex[] oldCompositeIndexes = compositeIndexes; InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1); newCompositeIndexes[oldCompositeIndexes.length] = index; compositeIndexes = newCompositeIndexes; } return index; }

Target:
public synchronized InternalIndex addOrGetIndex(IndexConfig indexConfig, StoreAdapter partitionStoreAdapter) { String name = indexConfig.getName(); assert name != null; assert !name.isEmpty(); InternalIndex index = indexesByName.get(name); if (index != null) { return index; } index = indexProvider.createIndex( indexConfig, extractors, serializationService, indexCopyBehavior, stats.createPerIndexStats(indexConfig.getType() == IndexType.SORTED, usesCachedQueryableEntries), partitionStoreAdapter ); indexesByName.put(name, index); attributeIndexRegistry.register(index); converterCache.invalidate(index); indexes = indexesByName.values().toArray(EMPTY_INDEXES); if (index.getComponents().length > 1) { InternalIndex[] oldCompositeIndexes = compositeIndexes; InternalIndex[] newCompositeIndexes = Arrays.copyOf(oldCompositeIndexes, oldCompositeIndexes.length + 1); newCompositeIndexes[oldCompositeIndexes.length] = index; compositeIndexes = newCompositeIndexes; } return index; }