auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: '{}':\n{}", ovfEntityData.getOvfData(), e.getMessage()); log.debug("Exception", e); } } }

Target:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: '{}':\n{}", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception", e); } } }
Source:
public void closeAllTestWindows() { Iterator<IWorkbenchWindow> iter = new ArrayList<IWorkbenchWindow>(testWindows).iterator(); while (iter.hasNext()) { IWorkbenchWindow win = iter.next(); win.close(); } testWindows.clear(); }

Target:
public void closeAllTestWindows() { for (IWorkbenchWindow testWindows : testWindows) { testWindows.close(); } testWindows.clear(); }
Source:
HystrixObservableCommandChain<T> createHystrixCommandChain() { List<HystrixObservableCommand<T>> commands = new ArrayList<HystrixObservableCommand<T>>(2); if (cacheProvider != null) { commands.add(new HystrixCacheObservableCommand<T>(cacheProvider.getCacheProvider(), cacheProvider.getKey(), requestProperties, template.hystrixProperties())); } commands.add(new RibbonHystrixObservableCommand<T>(client, httpRequest, hystrixCacheKey, requestProperties, template.fallbackHandler(), template.responseValidator(), template.getClassType(), template.hystrixProperties())); return new HystrixObservableCommandChain<T>(commands); }

Target:
HystrixObservableCommandChain<T> createHystrixCommandChain() { List<HystrixObservableCommand<T>> commands = new ArrayList<HystrixObservableCommand<T>>(2); if (cacheProvider != null) { commands.add(new CacheObservableCommand<T>(cacheProvider.getCacheProvider(), cacheProvider.getKey(), cacheHystrixCacheKey, requestProperties, template.cacheHystrixProperties())); } commands.add(new HttpResourceObservableCommand<T>(client, httpRequest, hystrixCacheKey, requestProperties, template.fallbackHandler(), template.responseValidator(), template.getClassType(), template.hystrixProperties())); return new HystrixObservableCommandChain<T>(commands); }
Source:
public void onEvent(BrokerEvent event) { if (event.getRuntimeId() == null || !workspaceId.equals(event.getRuntimeId().getWorkspaceId())) { return; } switch (event.getStatus()) { case DONE: List<ChePlugin> tooling = event.getTooling(); if (tooling != null) { try { pluginsValidator.validatePluginNames(tooling); } catch (ValidationException e) { brokersResult.error(e); return; } try { brokersResult.brokerResult(tooling); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage(), e); } } else { brokersResult.error( new InternalInfrastructureException( format( "Plugin brokering process for workspace `%s` is finished but plugins list is missing", workspaceId))); } break; case FAILED: brokersResult.error( new InfrastructureException( format( "Plugin broking process for workspace %s failed with error: %s", workspaceId, event.getError()))); break; case STARTED: default: } }

Target:
public void onEvent(BrokerEvent event) { if (event.getRuntimeId() == null || !workspaceId.equals(event.getRuntimeId().getWorkspaceId())) { return; } switch (event.getStatus()) { case DONE: List<ChePlugin> tooling = event.getTooling(); if (tooling != null) { try { pluginsValidator.validatePluginNames(tooling); } catch (ValidationException e) { brokersResult.error(e); return; } try { brokersResult.addResult(tooling); } catch (InfrastructureException e) { LOG.error(e.getLocalizedMessage(), e); } } else { brokersResult.error( new InternalInfrastructureException( format( "Plugin brokering process for workspace `%s` is finished but plugins list is missing", workspaceId))); } break; case FAILED: brokersResult.error( new InfrastructureException( format( "Plugin broking process for workspace %s failed with error: %s", workspaceId, event.getError()))); break; case STARTED: default: } }
Source:
long getUsedCapacity() { long usedCapacity = 0; for (Map.Entry<String, LogSegment> entry : segmentsByName.entrySet()) { LogSegment segment = entry.getValue(); if (segment != activeSegment) { usedCapacity += segment.getCapacityInBytes(); } else { usedCapacity += segment.getEndOffset(); break; } } return usedCapacity; }

Target:
long getUsedCapacity() { return getDifference(getEndOffset(), new Offset(getFirstSegment().getName(), 0)); }
Source:
public void base64EncodedPasswordAfterAlgorithmShouldFail() { ldapUserDetailsService.setUserDetailsMapper(userDetailsMapper); userDetailsMapper.setBase64EncodedPassword(false); UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("base64encoded-issue-1840"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(false); }

Target:
public void base64EncodedPasswordAfterAlgorithmShouldFail() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("issue1840-type-1"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(false); }
Source:
public void cancel(Throwable cause) { if (state.compareAndSet(CheckpointInProgressRequestState.NEW, CheckpointInProgressRequestState.CANCELLED)) { discardAction.accept(cause); } }

Target:
public void cancel(Throwable cause) { if (state.compareAndSet(NEW, CANCELLED) || state.compareAndSet(FAILED, CANCELLED)) { discardAction.accept(cause); } }
Source:
public EntityBinding(EntityDictionary dictionary, Class<?> cls, String type, String name) { entityClass = cls; jsonApiType = type; entityName = name; List<AccessibleObject> fieldOrMethodList = new ArrayList<>(); fieldOrMethodList.addAll(Arrays.asList(cls.getDeclaredFields()) .stream() .filter((field) -> ! Modifier.isStatic(field.getModifiers())) .filter((field) -> ! ((Field) field).isSynthetic()) .collect(Collectors.toList())); if (fieldOrMethodList.stream().anyMatch(field -> field.isAnnotationPresent(Id.class))) { accessType = AccessType.FIELD; fieldOrMethodList.addAll(Arrays.asList(cls.getMethods()) .stream() .filter((method) -> !Modifier.isStatic(method.getModifiers())) .filter((method) -> method.isAnnotationPresent(ComputedAttribute.class) || method.isAnnotationPresent(ComputedRelationship.class)) .collect(Collectors.toList())); fieldOrMethodList.forEach(field -> field.setAccessible(true)); } else { accessType = AccessType.PROPERTY; fieldOrMethodList.clear(); fieldOrMethodList.addAll(Arrays.asList(cls.getFields()) .stream() .filter((field) -> ! Modifier.isStatic(field.getModifiers())) .collect(Collectors.toList())); fieldOrMethodList.addAll(Arrays.asList(cls.getMethods()) .stream() .filter((method) -> !Modifier.isStatic(method.getModifiers())) .collect(Collectors.toList())); } bindEntityFields(cls, type, fieldOrMethodList); attributes = dequeToList(attributesDeque); relationships = dequeToList(relationshipsDeque); inheritedTypes = getInheritedTypes(cls); entityPermissions = new EntityPermissions(dictionary, cls, fieldOrMethodList); }

Target:
public EntityBinding(EntityDictionary dictionary, Class<?> cls, String type, String name) { entityClass = cls; jsonApiType = type; entityName = name; List<AccessibleObject> fieldOrMethodList = new ArrayList<>( getInstanceMembers(cls.getDeclaredFields(), (field) -> !((Field) field).isSynthetic()) ); if (fieldOrMethodList.stream().anyMatch(field -> field.isAnnotationPresent(Id.class))) { accessType = AccessType.FIELD; fieldOrMethodList.addAll( getInstanceMembers(cls.getMethods(), (method) -> method.isAnnotationPresent(ComputedAttribute.class) || method.isAnnotationPresent(ComputedRelationship.class)) ); fieldOrMethodList.forEach(field -> field.setAccessible(true)); } else { accessType = AccessType.PROPERTY; fieldOrMethodList.clear(); fieldOrMethodList.addAll(getInstanceMembers(cls.getFields())); fieldOrMethodList.addAll(getInstanceMembers(cls.getMethods())); } bindEntityFields(cls, type, fieldOrMethodList); attributes = dequeToList(attributesDeque); relationships = dequeToList(relationshipsDeque); inheritedTypes = getInheritedTypes(cls); entityPermissions = new EntityPermissions(dictionary, cls, fieldOrMethodList); }
Source:
public <E> BTreeInsertAndGetFuture<Boolean, E> asyncBopInsertAndGetTrimmed( String key, long bkey, byte[] eFlag, E value, CollectionAttributes attributesForCreate, Transcoder<E> transcoder) { BTreeInsertAndGet<E> get = new BTreeInsertAndGet<E>( BTreeInsertAndGet.Command.INSERT, bkey, eFlag, value, attributesForCreate); return asyncBTreeStoreAndGet(key, get, transcoder); }

Target:
public <E> BTreeStoreAndGetFuture<Boolean, E> asyncBopInsertAndGetTrimmed( String key, long bkey, byte[] eFlag, E value, CollectionAttributes attributesForCreate, Transcoder<E> transcoder) { BTreeInsertAndGet<E> insertAndGet = new BTreeInsertAndGet<E>( BTreeInsertAndGet.Command.INSERT, bkey, eFlag, value, attributesForCreate); return asyncBTreeInsertAndGet(key, insertAndGet, transcoder); }
Source:
public void createIfMissing(final EventTypeBase eventType, final boolean checkAuth) throws AuthorizationSectionException, TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException, DbWriteOperationsBlockedException, EventTypeOptionsValidationException { try { eventTypeRepository.findByName(eventType.getName()); LOG.info("Event-type already exist", eventType.getName()); } catch (final NoSuchEventTypeException noSuchEventTypeException) { LOG.info("Creating event-type as it is missing", eventType.getName()); create(eventType, checkAuth); } }

Target:
public void createIfMissing(final EventTypeBase eventType, final boolean checkAuth) throws AuthorizationSectionException, TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException, DbWriteOperationsBlockedException, EventTypeOptionsValidationException { try { eventTypeRepository.findByName(eventType.getName()); LOG.info("Event-type already exists", eventType.getName()); } catch (final NoSuchEventTypeException noSuchEventTypeException) { LOG.info("Creating event-type as it is missing", eventType.getName()); create(eventType, checkAuth); } }
Source:
public SettableFuture schedule(SourceScheduler scheduler) { checkState(initialScheduled); checkState(failedTasks.size() < nodeByTaskId.size()); synchronized (this) { newDriverGroupReady = SettableFuture.create(); while (!availableTasks.isEmpty()) { if (driverGroupQueue.isEmpty()) { break; } int taskId = availableTasks.dequeueInt(); if (failedTasks.contains(taskId)) { continue; } int nextDriverGroupId = driverGroupQueue.dequeueInt(); InternalNode nodeForCompletedDriverGroup = bucketNodeMap.getAssignedNode(taskId).orElseThrow(IllegalStateException::new); bucketNodeMap.assignOrUpdateBucketToNode(nextDriverGroupId, nodeForCompletedDriverGroup); scheduler.startLifespan(Lifespan.driverGroup(nextDriverGroupId), partitionHandles.get(nextDriverGroupId)); taskByDriverGroup[nextDriverGroupId] = taskId; runningDriverGroupIdsByTask[taskId].add(nextDriverGroupId); } } return newDriverGroupReady; }

Target:
public SettableFuture schedule(SourceScheduler scheduler) { checkState(initialScheduled, "schedule should only be called after initial scheduling finished"); checkState(failedTasks.size() < nodeByTaskId.size(), "All tasks have failed"); synchronized (this) { newDriverGroupReady = SettableFuture.create(); while (!availableTasks.isEmpty() && !driverGroupQueue.isEmpty()) { int taskId = availableTasks.dequeueInt(); if (failedTasks.contains(taskId)) { continue; } int nextDriverGroupId = driverGroupQueue.dequeueInt(); InternalNode nodeForCompletedDriverGroup = nodeByTaskId.get(taskId); bucketNodeMap.assignOrUpdateBucketToNode(nextDriverGroupId, nodeForCompletedDriverGroup); scheduler.startLifespan(Lifespan.driverGroup(nextDriverGroupId), partitionHandles.get(nextDriverGroupId)); taskByDriverGroup[nextDriverGroupId] = taskId; runningDriverGroupIdsByTask[taskId].add(nextDriverGroupId); } } return newDriverGroupReady; }
Source:
public static Throwable deleteWithConfirm(File file, boolean expect, Throwable accumulate, RateLimiter rateLimiter) { if (rateLimiter == null) rateLimiter = RateLimiter.create(Double.MAX_VALUE); boolean exists = file.exists(); assert exists || !expect : "attempted to delete non-existing file " + file.getName(); try { rateLimiter.acquire(); if (exists) Files.delete(file.toPath()); } catch (Throwable t) { try { throw new FSWriteError(t, file); } catch (Throwable t2) { accumulate = merge(accumulate, t2); } } return accumulate; }

Target:
public static Throwable deleteWithConfirm(File file, boolean expect, Throwable accumulate, RateLimiter rateLimiter) { boolean exists = file.exists(); assert exists || !expect : "attempted to delete non-existing file " + file.getName(); try { if (rateLimiter != null) { double throttled = rateLimiter.acquire(); if (throttled > 0.0) nospam1m.warn("Throttling file deletion: waited seconds to delete {}", throttled, file); } if (exists) Files.delete(file.toPath()); } catch (Throwable t) { try { throw new FSWriteError(t, file); } catch (Throwable t2) { accumulate = merge(accumulate, t2); } } return accumulate; }
Source:
private void startReaderThread() { Thread thread = new Thread((Runnable) () -> { byte[] bytes = new byte[1024]; try { while (fStream.read(bytes) >= 0) { } } catch (IOException e) { } try { fStream.close(); } catch (IOException e) { } }, DebugCoreMessages.NullStreamsProxy_0); thread.setDaemon(true); thread.start(); }

Target:
private void startReaderThread() { Thread thread = new Thread((Runnable) () -> { byte[] bytes = new byte[1024]; try (InputStream stream = fStream) { while (stream.read(bytes) >= 0) { } } catch (IOException e) { } }, DebugCoreMessages.NullStreamsProxy_0); thread.setDaemon(true); thread.start(); }
Source:
public static void deleteSnapshot(File snpDir, String folderName) { if (!snpDir.exists()) return; assert snpDir.isDirectory() : snpDir; try { List<Path> dirs = new ArrayList<>(); Files.walkFileTree(snpDir.toPath(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (Files.isDirectory(dir) && Files.exists(dir) && folderName.equals(dir.getFileName().toString())) { dirs.add(dir); } return super.preVisitDirectory(dir, attrs); } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { return FileVisitResult.CONTINUE; } }); dirs.forEach(U::delete); File db = new File(snpDir, DB_DEFAULT_FOLDER); if (!db.exists() || db.list().length == 0) U.delete(snpDir); } catch (IOException e) { throw new IgniteException(e); } }

Target:
public static void deleteSnapshot(File snpDir, String folderName) { if (!snpDir.exists()) return; assert snpDir.isDirectory() : snpDir; try { File binDir = resolveBinaryWorkDir(snpDir.getAbsolutePath(), folderName); File dbDir = U.resolveWorkDirectory(snpDir.getAbsolutePath(), databaseRelativePath(folderName), false); U.delete(binDir); U.delete(dbDir); File marshDir = mappingFileStoreWorkDir(snpDir.getAbsolutePath()); Files.walkFileTree(marshDir.toPath(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { U.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { return FileVisitResult.CONTINUE; } }); File db = new File(snpDir, DB_DEFAULT_FOLDER); if (!db.exists() || db.list().length == 0) U.delete(snpDir); } catch (IOException | IgniteCheckedException e) { throw new IgniteException(e); } }
Source:
public <K, V> void assertAnySatisfy(AssertionInfo info, Map<K, V> actual, BiConsumer<? super K, ? super V> entryRequirements) { checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null"); assertNotNull(info, actual); boolean anyMatch = actual.entrySet().stream().anyMatch(e -> { try { entryRequirements.accept(e.getKey(), e.getValue()); } catch (AssertionError ex) { return false; } return true; }); if (!anyMatch) { throw failures.failure(info, elementsShouldSatisfyAny(actual)); } }

Target:
public <K, V> void assertAnySatisfy(AssertionInfo info, Map<K, V> actual, BiConsumer<? super K, ? super V> entryRequirements) { checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null"); assertNotNull(info, actual); boolean anyMatch = actual.entrySet().stream().anyMatch(e -> { try { entryRequirements.accept(e.getKey(), e.getValue()); } catch (AssertionError ex) { return false; } return true; }); if (!anyMatch) throw failures.failure(info, elementsShouldSatisfyAny(actual)); }
Source:
void handleBody(InputStream payload, MessageMetadata messageMetadata) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData = MessageFormatRecord.deserializeBlob(payload); ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); if (encryptionKey == null) { chunkIndexToBuffer.put(chunkIndex, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved++; blobContentAvailableToProcess = true; } else { state = ChunkState.Decrypting; logger.trace("Marking the chunk's state to and submitting decrypt job for data chunk {}", ChunkState.Decrypting, chunkBlobId); exec.submitJob( new DecryptJob(chunkBlobId, encryptionKey, blobData.getStream().getByteBuffer(), null, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { logger.trace("Handling decrypt job callback for data chunk {}", chunkBlobId); if (chunkBlobId.equals(result.getBlobId())) { decryptCallbackResult = result; decryptCallbackException = exception; decryptCallbackResultAvailable = true; logger.trace("Successfully stored decrypt job results for data chunk {}", chunkBlobId); } else { logger.error("Ignoring decrypt callback response due to blobId mismatch. Expected : actual {}", chunkBlobId, result.getBlobId()); } })); } successfullyDeserialized = true; } else { } }

Target:
void handleBody(InputStream payload, MessageMetadata messageMetadata) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData = MessageFormatRecord.deserializeBlob(payload); ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); if (encryptionKey == null) { chunkIndexToBuffer.put(chunkIndex, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved++; } else { decryptCallbackResultInfo = new DecryptCallBackResultInfo(); progressTracker.initializeDecryptionTracker(); logger.trace("Submitting decrypt job for data chunk {}", chunkBlobId); long startTimeMs = System.currentTimeMillis(); cryptoJobHandler.submitJob( new DecryptJob(chunkBlobId, encryptionKey, blobData.getStream().getByteBuffer(), null, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { routerMetrics.decryptTimeMs.update(System.currentTimeMillis() - startTimeMs); logger.trace("Handling decrypt job callback for data chunk {}", chunkBlobId); decryptCallbackResultInfo.setResultAndException(result, exception); routerCallback.onPollReady(); })); } successfullyDeserialized = true; } else { } }
Source:
@Override public RelDataTypeField getField(String fieldName, boolean caseSensitive, boolean elideRecord) { if (fieldList == null) { throw new IllegalStateException("Requested field " + fieldName + " in a type with null fieldList, type = " + this); } for (RelDataTypeField field : fieldList) { if (Util.matches(caseSensitive, field.getName(), fieldName)) { return field; } } if (elideRecord) { final List<Slot> slots = new ArrayList<>(); getFieldRecurse(slots, this, 0, fieldName, caseSensitive); loop: for (Slot slot : slots) { switch (slot.count) { case 0: break; case 1: return slot.field; default: break loop; } } } if (fieldList.size() > 0) { final RelDataTypeField lastField = Iterables.getLast(fieldList); if (lastField.getName().equals("_extra")) { return new RelDataTypeFieldImpl( fieldName, -1, lastField.getType()); } } for (RelDataTypeField field : fieldList) { if (field.isDynamicStar()) { return field; } } return null; }

Target:
@Override public RelDataTypeField getField(String fieldName, boolean caseSensitive, boolean elideRecord) { if (fieldList == null) { throw new IllegalStateException("Trying to access field " + fieldName + " in a type with no fields: " + this); } for (RelDataTypeField field : fieldList) { if (Util.matches(caseSensitive, field.getName(), fieldName)) { return field; } } if (elideRecord) { final List<Slot> slots = new ArrayList<>(); getFieldRecurse(slots, this, 0, fieldName, caseSensitive); loop: for (Slot slot : slots) { switch (slot.count) { case 0: break; case 1: return slot.field; default: break loop; } } } if (fieldList.size() > 0) { final RelDataTypeField lastField = Iterables.getLast(fieldList); if (lastField.getName().equals("_extra")) { return new RelDataTypeFieldImpl( fieldName, -1, lastField.getType()); } } for (RelDataTypeField field : fieldList) { if (field.isDynamicStar()) { return field; } } return null; }
Source:
private void resetViewState() { mRootView.setVisibility(VISIBLE); setLayoutDirection(View.LAYOUT_DIRECTION_INHERIT); setViewClickable(mRootView, false); setViewClickable(mContent, false); mStartContainer.removeAllViews(); mEndContainer.removeAllViews(); mEndContainer.setVisibility(GONE); mPrimaryText.setText(null); mSecondaryText.setText(null); mLastUpdatedText.setText(null); mLastUpdatedText.setVisibility(GONE); mToggles.clear(); mActions.clear(); mRowAction = null; mBottomDivider.setVisibility(GONE); mActionDivider.setVisibility(GONE); if (mSeeMoreView != null) { mRootView.removeView(mSeeMoreView); mSeeMoreView = null; } mIsRangeSliding = false; mRangeHasPendingUpdate = false; mRangeItem = null; mRangeMinValue = 0; mRangeMaxValue = 0; mRangeValue = 0; mLastSentRangeUpdate = 0; mHandler = null; if (mRangeBar != null) { if (mStartItem == null) { removeView(mRangeBar); } else { mSubContent.removeView(mRangeBar); } mRangeBar = null; } mStartItem = null; mActionSpinner.setVisibility(GONE); if (mSelectionSpinner != null) { removeView(mSelectionSpinner); mSelectionSpinner = null; } mSelectionItem = null; }

Target:
private void resetViewState() { mRootView.setVisibility(VISIBLE); setLayoutDirection(View.LAYOUT_DIRECTION_INHERIT); setViewClickable(mRootView, false); setViewClickable(mContent, false); mStartContainer.removeAllViews(); mEndContainer.removeAllViews(); mEndContainer.setVisibility(GONE); mPrimaryText.setText(null); mSecondaryText.setText(null); mLastUpdatedText.setText(null); mLastUpdatedText.setVisibility(GONE); mToggles.clear(); mActions.clear(); mRowAction = null; mBottomDivider.setVisibility(GONE); mActionDivider.setVisibility(GONE); if (mSeeMoreView != null) { mRootView.removeView(mSeeMoreView); mSeeMoreView = null; } mIsRangeSliding = false; mRangeHasPendingUpdate = false; mRangeItem = null; mRangeMinValue = 0; mRangeMaxValue = 0; mRangeValue = 0; mLastSentRangeUpdate = 0; mHandler = null; if (mRangeBar != null) { if (mStartItem == null) { removeView(mRangeBar); } else { mContent.removeView(mRangeBar); } mRangeBar = null; } mSubContent.setVisibility(VISIBLE); mStartItem = null; mActionSpinner.setVisibility(GONE); if (mSelectionSpinner != null) { removeView(mSelectionSpinner); mSelectionSpinner = null; } mSelectionItem = null; }
Source:
public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { DebuggerState nextState = session.setState(stateNum.orElse(session.getActiveStateId()), configurationNum); if (nextState == null) { System.out.println("Error Selecting State. State unchanged"); return; } System.out.println("Selected State " + session.getActiveStateId()); }

Target:
public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { int requestedState = stateNum.orElse(session.getActiveStateId()); DebuggerState nextState = session.setState(requestedState); if (nextState == null) { System.out.println("State Number specified does not exist"); } else if (!configurationNum.isPresent()) { System.out.println("Selected State " + requestedState); } else { int requestedConfig = configurationNum.orElse(nextState.getStepNum()); DebuggerState finalState = session.jumpTo(requestedState, requestedConfig); if (finalState == null) { System.out.println("Requested Step Number couldn't be selected."); } else if (!stateNum.isPresent()) { System.out.println("Jumped to Step Number " + requestedConfig); } else { System.out.println("Jumped to State Number " + requestedState + " and Step Number " + requestedConfig); } } }
Source:
public void verifyTablePattern(int tableNum, int column, String patternString){ String[] splitString = patternString.split(java.util.regex.Pattern.quote("{*}")); boolean isFirstRowEmpty = (splitString.length >= 0) && splitString[0].isEmpty(); int expectedNumberOfRowsInTable = isFirstRowEmpty ? splitString.length : splitString.length + 1; assertEquals(expectedNumberOfRowsInTable, getNumberOfRowsFromDataTable(tableNum)); for(int row=1;row < splitString.length;row++){ int rowIndex = isFirstRowEmpty ? row : (row - 1); String tableCellString = this.getCellValueFromDataTable(tableNum, row, column); assertEquals(splitString[rowIndex], tableCellString); } }

Target:
public void verifyTablePattern(int tableNum, int column, String patternString){ String[] splitString = patternString.split(java.util.regex.Pattern.quote("{*}")); int expectedNumberOfRowsInTable = splitString.length + 1; assertEquals(expectedNumberOfRowsInTable, getNumberOfRowsFromDataTable(tableNum)); for(int row=1;row < splitString.length;row++){ String tableCellString = this.getCellValueFromDataTable(tableNum, row, column); assertEquals(splitString[row - 1], tableCellString); } }
Source:
public static List<String> readItemsFromClasspathString(Set<String> depsModules) { Set<String> items = new HashSet<>(); if (SystemUtils.IS_OS_LINUX) { items = process(depsModules, ":"); } else if (SystemUtils.IS_OS_WINDOWS) { items = process(depsModules, ";"); } return new ArrayList<>(items); }

Target:
public static List<String> readItemsFromClasspathString(Set<String> depsModules) { Set<String> items = process(depsModules, delimiter); return new ArrayList<>(items); }
Source:
Map<Integer, List<String>> studentsByGradeAlphabetical() { Map<Integer, List<String>> sortedStudents = new HashMap<>(); for (Integer grade : database.keySet()) { List<String> studentsInGrade = fetchGradeFromDatabase(grade); sortedStudents.put(grade, studentsInGrade); } return sortedStudents; }

Target:
private Map<Integer, List<String>> studentsByGradeAlphabetical() { Map<Integer, List<String>> sortedStudents = new HashMap<>(); for (Integer grade : database.keySet()) { List<String> studentsInGrade = fetchGradeFromDatabase(grade); sortedStudents.put(grade, studentsInGrade); } return sortedStudents; }
Source:
public void redoneWithException() { top++; mostRecentCommand = null; Iterator<ICompareCopyCommand> commands = commandList.listIterator(top--); while (commands.hasNext()) { commands.next(); commands.remove(); } }

Target:
public void redoneWithException() { mostRecentCommand = null; commandList.subList(top + 1, commandList.size()).clear(); }
Source:
public ValidationResult validateNetworkAttachmentIpConfiguration(Collection<NetworkAttachment> attachmentsToConfigure) { return validateNetworkAttachmentIpConfiguration(attachmentsToConfigure, null); }

Target:
ValidationResult validateNetworkAttachmentIpConfiguration(Collection<NetworkAttachment> attachmentsToConfigure) { return validateNetworkAttachmentIpConfiguration(attachmentsToConfigure, null); }
Source:
public void addRowsFromPersistedPath(Path persistedDir) throws IOException { FileSystem persistFs = persistedDir.getFileSystem(getConf()); FileStatus[] partFiles = persistFs.listStatus(persistedDir, new PathFilter() { @Override public boolean accept(Path path) { if (path.getName().startsWith("_")) { return false; } return true; } }); TreeMap<PartFile, FileStatus> partFileMap = new TreeMap<PartFile, FileStatus>(); try { for (FileStatus file : partFiles) { partFileMap.put(new PartFile(file.getPath().getName()), file); } for (Map.Entry<PartFile, FileStatus> entry : partFileMap.entrySet()) { BufferedReader in = new BufferedReader(new InputStreamReader( persistFs.open(entry.getValue().getPath()))); String row = in.readLine(); while (row != null) { writeRow(row); numRows++; row = in.readLine(); } } } catch (ParseException e) { throw new IOException(e); } }

Target:
public void addRowsFromPersistedPath(Path persistedDir) throws IOException { FileSystem persistFs = persistedDir.getFileSystem(ctx.getConf()); FileStatus[] partFiles = persistFs.listStatus(persistedDir, new PathFilter() { @Override public boolean accept(Path path) { if (path.getName().startsWith("_")) { return false; } return true; } }); TreeMap<PartFile, FileStatus> partFileMap = new TreeMap<PartFile, FileStatus>(); try { for (FileStatus file : partFiles) { partFileMap.put(new PartFile(file.getPath().getName()), file); } for (Map.Entry<PartFile, FileStatus> entry : partFileMap.entrySet()) { LOG.info("Processing file:" + entry.getValue().getPath()); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader( persistFs.open(entry.getValue().getPath()))); String row = in.readLine(); while (row != null) { writeRow(row); row = in.readLine(); } } finally { if (in != null) { in.close(); } } } } catch (ParseException e) { throw new IOException(e); } }
Source:
public static void scan(AbstractBuild build, PrintStream buildLog) { try { Collection<FailureCause> causes = PluginImpl.getInstance().getKnowledgeBase().getCauses(); List<FoundFailureCause> foundCauseList = findCauses(causes, build, buildLog); if (PluginImpl.isTestResultParsingEnabled()) { foundCauseList.addAll(findFailedTests(build, buildLog)); } FailureCauseBuildAction buildAction = new FailureCauseBuildAction(foundCauseList); buildAction.setBuild(build); build.addAction(buildAction); StatisticsLogger.getInstance().log(build, foundCauseList); } catch (Exception e) { logger.log(Level.SEVERE, "Could not scan build " + build, e); } }

Target:
public static void scan(AbstractBuild build, PrintStream buildLog) { try { Collection<FailureCause> causes = PluginImpl.getInstance().getKnowledgeBase().getCauses(); List<FoundFailureCause> foundCauseListToLog = findCauses(causes, build, buildLog); List<FoundFailureCause> foundCauseList; if (PluginImpl.getInstance().isTestResultParsingEnabled()) { foundCauseList = Collections.synchronizedList( new LinkedList<FoundFailureCause>(foundCauseListToLog)); foundCauseList.addAll(findFailedTests(build, buildLog)); } else { foundCauseList = foundCauseListToLog; } FailureCauseBuildAction buildAction = new FailureCauseBuildAction(foundCauseList); buildAction.setBuild(build); build.addAction(buildAction); StatisticsLogger.getInstance().log(build, foundCauseListToLog); } catch (Exception e) { logger.log(Level.SEVERE, "Could not scan build " + build, e); } }
Source:
public void testEnvironmentVariableReplacement() { ImmutableMap<String, String> original = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "${ENV:GRAPE}") .put("peach", "${ENV:PEACH}") .put("grass", "${ENV:!!!}") .put("pear", "${ENV:X_PEAR}") .put("cherry", "${ENV:X_CHERRY}") .put("orange", "orange-value") .build(); ImmutableMap<String, String> environment = ImmutableMap.<String, String>builder() .put("GRAPE", "env-grape") .put("X_CHERRY", "env-cherry") .build(); List<String> errors = new ArrayList<>(); Map<String, String> actual = replaceEnvironmentVariables(original, environment, (key, error) -> errors.add(error)); ImmutableMap<String, String> expected = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "env-grape") .put("grass", "${ENV:!!!}") .put("cherry", "env-cherry") .put("orange", "orange-value") .build(); assertEquals(actual, expected); assertThat(errors).containsExactly( "Configuration property 'peach' references unset environment variable 'PEACH'", "Configuration property 'pear' references unset environment variable 'X_PEAR'"); }

Target:
public void testEnvironmentVariableReplacement() { Map<String, String> original = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "${ENV:GRAPE}") .put("peach", "${ENV:PEACH}") .put("grass", "${ENV:!!!}") .put("pear", "${ENV:X_PEAR}") .put("cherry", "${ENV:X_CHERRY}") .put("orange", "orange-value") .build(); Map<String, String> environment = ImmutableMap.<String, String>builder() .put("GRAPE", "env-grape") .put("X_CHERRY", "env-cherry") .build(); List<String> errors = new ArrayList<>(); Map<String, String> actual = replaceEnvironmentVariables(original, environment, (key, error) -> errors.add(error)); Map<String, String> expected = ImmutableMap.<String, String>builder() .put("apple", "apple-value") .put("grape", "env-grape") .put("grass", "${ENV:!!!}") .put("cherry", "env-cherry") .put("orange", "orange-value") .build(); assertEquals(actual, expected); assertThat(errors).containsExactly( "Configuration property 'peach' references unset environment variable 'PEACH'", "Configuration property 'pear' references unset environment variable 'X_PEAR'"); }
Source:
public ButtonRs() { this(ButtonRs.DEFAULT_BUILD); final GraphicsEnvironment env = GraphicsEnvironment .getLocalGraphicsEnvironment(); font(env, "<LINK_0>"); font(env, "<LINK_1>"); }

Target:
public ButtonRs() { this(ButtonRs.DEFAULT_BUILD); final GraphicsEnvironment env = GraphicsEnvironment .getLocalGraphicsEnvironment(); this.font(env, "<LINK_0>"); this.font(env, "<LINK_1>"); }
Source:
public static Pair<Integer, Integer> findMatchingLines(String input, String match) { String[] lines = input.split("\n"); String[] matchLines = match.split("\n"); for (int i = 0; i < lines.length - matchLines.length; i++) { boolean isMatch = true; for (int j = 0; j < matchLines.length; j++) { String cLine = lines[i + j]; String fLine = matchLines[j]; if (j == 0 && !cLine.endsWith(fLine) || j != 0 && j != matchLines.length - 1 && !cLine.equals(fLine) || j == matchLines.length - 1 && !cLine.startsWith(fLine)) { isMatch = false; break; } } if (isMatch) { return new Pair<>(i + 1, i + matchLines.length); } } return null; }

Target:
public static int[] findMatchingLines(String input, String match) { int pos = input.indexOf(match); if (pos < 0) { return null; } int start = input.substring(0, pos).split("\n").length; int end = start + match.split("\n").length - 1; return new int[] { start, end }; }
Source:
public void parse(CommandSource source, CommandArgs args, CommandContext context) throws ArgumentParseException { String key = getUntranslatedKey(); if (key != null) { context.addFlag(key); if (valueElement != null) { valueElement.parse(source, args, context); } else { context.putArg(key, true); } } }

Target:
public void parse(CommandSource source, CommandArgs args, CommandContext context) throws ArgumentParseException { String key = getUntranslatedKey(); if (valueElement != null) { valueElement.parse(source, args, context); } else { context.putArg(key, true); } context.addFlag(key); }
Source:
private static boolean isReference(String value) { String trimmedVal = value == null ? null : value.trim(); return trimmedVal != null && trimmedVal.startsWith("${") && trimmedVal.lastIndexOf("${") == 0 && trimmedVal.indexOf('}') == trimmedVal.lastIndexOf('}') && trimmedVal.indexOf('}') == trimmedVal.length() - 1 && trimmedVal.length() > 3; }

Target:
private static boolean isReference(String value) { String trimmedVal = value == null ? null : value.trim(); return trimmedVal != null && trimmedVal.lastIndexOf("${") == 0 && trimmedVal.indexOf('}') == trimmedVal.length() - 1 && trimmedVal.length() > 3; }
Source:
protected Optional<TreeType> getVal(ItemStack stack) { if (stack.getItem() == ItemTypes.LEAVES2 || stack.getItem() == ItemTypes.LOG2) { return Optional.of(getFromMeta(stack.getItemDamage() + 4)); } else if (stack.getItem() == ItemTypes.BOAT) { return Optional.of(TreeTypes.OAK); } else if (stack.getItem() == ItemTypes.ACACIA_BOAT) { return Optional.of(TreeTypes.ACACIA); } else if (stack.getItem() == ItemTypes.BIRCH_BOAT) { return Optional.of(TreeTypes.BIRCH); } else if (stack.getItem() == ItemTypes.DARK_OAK_BOAT) { return Optional.of(TreeTypes.DARK_OAK); } else if (stack.getItem() == ItemTypes.JUNGLE_BOAT) { return Optional.of(TreeTypes.JUNGLE); } else if (stack.getItem() == ItemTypes.SPRUCE_BOAT) { return Optional.of(TreeTypes.SPRUCE); } else { return Optional.of(getFromMeta(stack.getItemDamage())); } }

Target:
protected Optional<TreeType> getVal(ItemStack stack) { if (stack.getItem() == ItemTypes.LEAVES2 || stack.getItem() == ItemTypes.LOG2) { return Optional.of(getFromMeta(stack.getItemDamage() + 4)); } else if (boatMapping.containsKey((ItemType) stack.getItem())) { return Optional.of(boatMapping.get(stack.getItem())); } else { return Optional.of(getFromMeta(stack.getItemDamage())); } }
Source:
HttpResponse head(URI uri) { HttpHead head = new HttpHead(uri); addHttpBasicAuthHeader(head); return executeRequest(head); }

Target:
HttpResponse head(URI uri) { HttpHead head = new HttpHead(uri); return executeRequest(head); }
Source:
private static LocalDate calculatedUnadjustedDateFromAdjusted( LocalDate baseDate, RollConvention rollConvention, BusinessDayAdjustment businessDayAdjustment, ReferenceData refData) { if (rollConvention != null) { int rollDom = rollConvention.getDayOfMonth(); if (rollDom > 0 && baseDate.getDayOfMonth() != rollDom) { int lengthOfMonth = baseDate.lengthOfMonth(); int actualDom = Math.min(rollDom, lengthOfMonth); if (baseDate.getDayOfMonth() != actualDom) { LocalDate rollImpliedDate = baseDate.withDayOfMonth(actualDom); LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } else if (rollDom == 0) { LocalDate unadjustedValidRollDate = rollConvention.adjust(baseDate); if (!unadjustedValidRollDate.equals(baseDate)) { LocalDate adjustedRollDate = businessDayAdjustment.adjust(unadjustedValidRollDate, refData); if (adjustedRollDate.equals(baseDate)) { return unadjustedValidRollDate; } } } } return baseDate; }

Target:
private static LocalDate calculatedUnadjustedDateFromAdjusted( LocalDate baseDate, RollConvention rollConvention, BusinessDayAdjustment businessDayAdjustment, ReferenceData refData) { int rollDom = rollConvention.getDayOfMonth(); if (rollDom > 0 && baseDate.getDayOfMonth() != rollDom) { int lengthOfMonth = baseDate.lengthOfMonth(); int actualDom = Math.min(rollDom, lengthOfMonth); if (baseDate.getDayOfMonth() != actualDom) { LocalDate rollImpliedDate = baseDate.withDayOfMonth(actualDom); LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } else if (rollDom == 0) { LocalDate rollImpliedDate = rollConvention.adjust(baseDate); if (!rollImpliedDate.equals(baseDate)) { LocalDate adjDate = businessDayAdjustment.adjust(rollImpliedDate, refData); if (adjDate.equals(baseDate)) { return rollImpliedDate; } } } return baseDate; }
Source:
public int compareTo(ImmutableBanData o) { return 0; }

Target:
public int compareTo(ImmutableBanData o) { return o.bans().get() == this.bans ? 1 : 0; }
Source:
private static String persist(@SuppressWarnings("rawtypes") HashMap map) { DataBundle bundle = new DataBundle(); int count = 0; @SuppressWarnings("unchecked") Set<String> set = map.keySet(); @SuppressWarnings("rawtypes") Iterator itr = set.iterator(); String type = ""; while (itr.hasNext()) { String key = (String) itr.next(); Object obj = map.get(key); if (obj instanceof AccountAttributes) { type = "AccountData"; AccountAttributes accountData = (AccountAttributes) obj; bundle.accounts.put(key, accountData); } else if (obj instanceof InstructorAttributes) { type = "InstructorData"; InstructorAttributes instructorData = (InstructorAttributes) obj; bundle.instructors.put(key, instructorData); } else if (obj instanceof CourseAttributes) { type = "CourseData"; CourseAttributes courseData = (CourseAttributes) obj; bundle.courses.put(key, courseData); } else if (obj instanceof StudentAttributes) { type = "StudentData"; StudentAttributes studentData = (StudentAttributes) obj; bundle.students.put(key, studentData); } count++; itr.remove(); System.out.print(key + "\n"); if (type.equals("EvaluationData") && count >= MAX_NUMBER_OF_EVALUATION_PER_REQUEST) { break; } if (count >= MAX_NUMBER_OF_ENTITY_PER_REQUEST) { break; } } System.out.print(count + " entities of type " + type + " left " + map.size() + " \n"); String status = BackDoor.persistNewDataBundle(gson.toJson(bundle)); try { Thread.sleep(WAIT_TIME_BETWEEN_REQUEST); } catch (InterruptedException e) { e.printStackTrace(); } return status; }

Target:
private static String persist(@SuppressWarnings("rawtypes") HashMap map) { DataBundle bundle = new DataBundle(); int count = 0; @SuppressWarnings("unchecked") Set<String> set = map.keySet(); @SuppressWarnings("rawtypes") Iterator itr = set.iterator(); String type = ""; while (itr.hasNext()) { String key = (String) itr.next(); Object obj = map.get(key); if (obj instanceof AccountAttributes) { type = "AccountData"; AccountAttributes accountData = (AccountAttributes) obj; bundle.accounts.put(key, accountData); } else if (obj instanceof InstructorAttributes) { type = "InstructorData"; InstructorAttributes instructorData = (InstructorAttributes) obj; bundle.instructors.put(key, instructorData); } else if (obj instanceof CourseAttributes) { type = "CourseData"; CourseAttributes courseData = (CourseAttributes) obj; bundle.courses.put(key, courseData); } else if (obj instanceof StudentAttributes) { type = "StudentData"; StudentAttributes studentData = (StudentAttributes) obj; bundle.students.put(key, studentData); } count++; itr.remove(); System.out.print(key + "\n"); if ("EvaluationData".equals(type) && count >= MAX_NUMBER_OF_EVALUATION_PER_REQUEST || count >= MAX_NUMBER_OF_ENTITY_PER_REQUEST) { break; } } System.out.print(count + " entities of type " + type + " left " + map.size() + " \n"); String status = BackDoor.persistNewDataBundle(gson.toJson(bundle)); try { Thread.sleep(WAIT_TIME_BETWEEN_REQUEST); } catch (InterruptedException e) { e.printStackTrace(); } return status; }
Source:
public void updateProfile(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleProfile> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateProfile: cannot update a profile with ID null"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(new KuzzleProfile(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result"))); } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options); } }

Target:
public void updateProfile(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleProfile> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateProfile: cannot update a profile with ID null"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(new KuzzleProfile(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result").getJSONObject("_source"))); } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateProfile"), data, options); } }
Source:
public synchronized Map<String, DbEntityType> getEntities(final String schemaPattern) throws DatabaseEngineException { final Map<String, DbEntityType> entities = new LinkedHashMap<>(); ResultSet rs = null; try { getConnection(); rs = conn.getMetaData().getTables(schemaPattern, null, "%", null); while (rs.next()) { String entityName = rs.getString("table_name"); String entityType = rs.getString("table_type"); DbEntityType type; if ("TABLE".equals(entityType)) { type = DbEntityType.TABLE; } else if ("VIEW".equals(entityType)) { type = DbEntityType.VIEW; } else if ("SYSTEM TABLE".equals(entityType)) { type = DbEntityType.SYSTEM_TABLE; } else if ("SYSTEM VIEW".equals(entityType)) { type = DbEntityType.SYSTEM_VIEW; } else { type = DbEntityType.UNMAPPED; } entities.put(entityName, type); } return entities; } catch (final Exception e) { throw new DatabaseEngineException("Could not get entities", e); } finally { try { if (rs != null) { rs.close(); } } catch (final Exception a) { logger.trace("Error closing result set.", a); } } }

Target:
public synchronized Map<String, DbEntityType> getEntities(final String schemaPattern) throws DatabaseEngineException { final Map<String, DbEntityType> entities = new LinkedHashMap<>(); ResultSet rs = null; try { getConnection(); rs = this.conn.getMetaData().getTables(schemaPattern, null, "%", null); while (rs.next()) { final String entityName = rs.getString("table_name"); final String entityType = rs.getString("table_type"); final DbEntityType type; if ("TABLE".equals(entityType)) { type = DbEntityType.TABLE; } else if ("VIEW".equals(entityType)) { type = DbEntityType.VIEW; } else if ("SYSTEM TABLE".equals(entityType)) { type = DbEntityType.SYSTEM_TABLE; } else if ("SYSTEM VIEW".equals(entityType)) { type = DbEntityType.SYSTEM_VIEW; } else { type = DbEntityType.UNMAPPED; } entities.put(entityName, type); } return entities; } catch (final Exception e) { throw new DatabaseEngineException("Could not get entities", e); } finally { try { if (rs != null) { rs.close(); } } catch (final Exception a) { logger.trace("Error closing result set.", a); } } }