auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TmfSimpleTableViewer(TableViewer table) { super(table.getControl().getParent()); fTableViewer = table; final Table tableControl = fTableViewer.getTable(); tableControl.setHeaderVisible(true); tableControl.setLinesVisible(true); fDirection = SWT.DOWN; fTableViewer.setUseHashlookup(true); fTableViewer.getControl().addMouseListener(new MouseColumnListener()); fTablePopupMenuManager = new MenuManager(); fTablePopupMenuManager.setRemoveAllWhenShown(true); fTablePopupMenuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final @Nullable IMenuManager manager) { TableViewer viewer = getTableViewer(); ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; if (manager != null) { appendToTablePopupMenu(manager, sel); } } } }); Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTableViewer().getTable()); getTableViewer().getTable().setMenu(tablePopup); tableControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { internalDispose(); } }); }

Target:
public TmfSimpleTableViewer(TableViewer table) { super(table.getControl().getParent()); fTableViewer = table; final Table tableControl = fTableViewer.getTable(); tableControl.setHeaderVisible(true); tableControl.setLinesVisible(true); fDirection = SWT.DOWN; fTableViewer.setUseHashlookup(true); fTableViewer.getControl().addMouseListener(new MouseColumnListener()); fTablePopupMenuManager = new MenuManager(); fTablePopupMenuManager.setRemoveAllWhenShown(true); fTablePopupMenuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final @Nullable IMenuManager manager) { TableViewer viewer = getTableViewer(); ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; if (manager != null) { appendToTablePopupMenu(manager, sel); } } } }); Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTableViewer().getTable()); getTableViewer().getTable().setMenu(tablePopup); tableControl.addDisposeListener((e) -> { internalDispose(); }); }
Source:
protected TreePath getTreePathFromItem(BreadcrumbItem item) { List<Object> elements = new ArrayList<>(fBreadcrumbItems.size()); for (BreadcrumbItem fBreadcrumbItem : fBreadcrumbItems) { elements.add( fBreadcrumbItem.getData() ); if (fBreadcrumbItem.equals(item)) { return new TreePath(elements.toArray()); } } return null; }

Target:
protected TreePath getTreePathFromItem(BreadcrumbItem item) { List<Object> elements = new ArrayList<>(fBreadcrumbItems.size()); for (BreadcrumbItem currItem : fBreadcrumbItems) { elements.add( currItem.getData() ); if (currItem.equals(item)) { return new TreePath(elements.toArray()); } } return null; }
Source:
protected Image createBlankImage() { final int width = (getWidth() == 0) ? 75 : getWidth(); final int height = (getHeight() == 0) ? 75 : getHeight(); BufferedImage blankImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = blankImage.createGraphics(); graphics.setComposite(AlphaComposite.Clear); graphics.fillRect(0, 0, width, height); return blankImage; }

Target:
protected Image createBlankImage() { final int width = (getWidth() == 0) ? DEFAULT_IMAGE_SCALE : getWidth(); final int height = (getHeight() == 0) ? DEFAULT_IMAGE_SCALE : getHeight(); BufferedImage blankImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = blankImage.createGraphics(); graphics.setComposite(AlphaComposite.Clear); graphics.fillRect(0, 0, width, height); return blankImage; }
Source:
public Server(String clusterName, String mainDirectory, String languages, String transportAddresses, boolean isTest) { try { if (SystemUtils.IS_OS_WINDOWS) { setupDirectories(new URL("file:/ } else { setupDirectories(new URL("file://" + mainDirectory)); } } catch (Exception e) { log.error("Can't create directories: ", e); } this.clusterName = clusterName; this.languages = languages.split(","); this.transportAddresses = transportAddresses; this.isTest = isTest; }

Target:
public Server(String clusterName, String mainDirectory, String languages, String transportAddresses, boolean isTest) throws Exception { try { if (SystemUtils.IS_OS_WINDOWS) { setupDirectories(new URL("file:/ } else { setupDirectories(new URL("file://" + mainDirectory)); } } catch (Exception e) { log.error("Can't create directories: ", e); throw e; } this.clusterName = clusterName; this.languages = languages.split(","); this.transportAddresses = transportAddresses; this.isTest = isTest; }
Source:
public static ObjectMapper getMapper() { return MAPPER; }

Target:
static ObjectMapper getMapper() { return MAPPER; }
Source:
public boolean hasDefaultValue() { return getDefaultValue() != null; }

Target:
public boolean hasDefaultValue() { return hasFlag(FLAG_DEFAULT_VALUE, false, FLAGS); }
Source:
public static List<ObaSituation> getAllSituations(final ObaArrivalInfoResponse response, List<String> filter) { List<ObaSituation> allSituations = new ArrayList<>(); allSituations.addAll(response.getSituations()); HashSet<String> allIds = new HashSet<>(); for (ObaSituation s : allSituations) { allIds.add(s.getId()); } HashSet<String> filterIds = new HashSet<>(); if (filter != null) { for (String routeId : filter) { filterIds.add(routeId); } } ObaArrivalInfo[] info = response.getArrivalInfo(); for (ObaArrivalInfo i : info) { if (filterIds.isEmpty() || filterIds.contains(i.getRouteId())) { for (String situationId : i.getSituationIds()) { if (!allIds.contains(situationId)) { allIds.add(situationId); allSituations.add(response.getSituation(situationId)); } } } } return allSituations; }

Target:
public static List<ObaSituation> getAllSituations(final ObaArrivalInfoResponse response, List<String> filter) { List<ObaSituation> allSituations = new ArrayList<>(); allSituations.addAll(response.getSituations()); HashSet<String> allIds = new HashSet<>(); for (ObaSituation s : allSituations) { allIds.add(s.getId()); } HashSet<String> filterIds = new HashSet<>(); if (filter != null && !filter.isEmpty()) { for (String routeId : filter) { filterIds.add(routeId); } } ObaArrivalInfo[] info = response.getArrivalInfo(); for (ObaArrivalInfo i : info) { if (filterIds.isEmpty() || filterIds.contains(i.getRouteId())) { for (String situationId : i.getSituationIds()) { if (!allIds.contains(situationId)) { allIds.add(situationId); allSituations.add(response.getSituation(situationId)); } } } } return allSituations; }
Source:
public List<? extends TargetBuilder<?, ?>> createBuilders() { return Arrays.asList(new ErlangPrepareDependenciesBuilder(), new ErlangBuilder(), new RebarBuilder()); }

Target:
public List<? extends TargetBuilder<?, ?>> createBuilders() { return ContainerUtil.newArrayList(new ErlangModuleBuildOrderBuilder(), new ErlangBuilder(), new RebarBuilder()); }
Source:
public static boolean isContainerLifecycleObserverMethod(ObserverMethod<?> method) { return CONTAINER_LIFECYCLE_EVENT_TYPES.contains(Reflections.getRawType(method.getObservedType())) || (Object.class.equals(method.getObservedType()) && method.getObservedQualifiers().size() == 1 && method.getObservedQualifiers().contains(Any.Literal.INSTANCE) && method instanceof ContainerLifecycleEventObserverMethod); }

Target:
public static boolean isContainerLifecycleObserverMethod(ObserverMethod<?> method) { if (CONTAINER_LIFECYCLE_EVENT_TYPES.contains(Reflections.getRawType(method.getObservedType()))) { return true; } if (Object.class.equals(method.getObservedType()) && method instanceof ContainerLifecycleEventObserverMethod) { if (method.getObservedQualifiers().isEmpty()) { return true; } if (method.getObservedQualifiers().size() == 1 && method.getObservedQualifiers().contains(Any.Literal.INSTANCE)) { return true; } } return false; }
Source:
public Promise<List<SearchResult>> search(QueryExpression expression) { final String url = encodeAllowEscapes(getBaseUrl() + SEARCH + (isNullOrEmpty(expression.getPath()) ? Path.ROOT : path(expression.getPath()))); StringBuilder queryParameters = new StringBuilder(); if (expression.getName() != null && !expression.getName().isEmpty()) { queryParameters.append("&name=").append(expression.getName()); } if (expression.getText() != null && !expression.getText().isEmpty()) { queryParameters.append("&text=").append(expression.getText()); } if (expression.getMaxItems() != 0) { queryParameters.append("&maxItems=").append(expression.getMaxItems()); } if (expression.getSkipCount() != 0) { queryParameters.append("&skipCount=").append(expression.getSkipCount()); } return reqFactory.createGetRequest(url + queryParameters.toString().replaceFirst("&", "?")) .header(ACCEPT, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Searching...")) .send(unmarshaller.newListUnmarshaller(SearchResultDto.class)).then( (Function<List<SearchResultDto>, List<SearchResult>>)arg -> { if (arg.isEmpty()) { return Collections.emptyList(); } return arg.stream().map(SearchResult::new).collect(Collectors.toList()); }); }

Target:
public Promise<List<SearchResult>> search(QueryExpression expression) { final String url = encodeAllowEscapes(getBaseUrl() + SEARCH + (isNullOrEmpty(expression.getPath()) ? Path.ROOT : path(expression.getPath()))); StringBuilder queryParameters = new StringBuilder(); if (expression.getName() != null && !expression.getName().isEmpty()) { queryParameters.append("&name=").append(expression.getName()); } if (expression.getText() != null && !expression.getText().isEmpty()) { queryParameters.append("&text=").append(expression.getText()); } if (expression.getMaxItems() != 0) { queryParameters.append("&maxItems=").append(expression.getMaxItems()); } if (expression.getSkipCount() != 0) { queryParameters.append("&skipCount=").append(expression.getSkipCount()); } return reqFactory.createGetRequest(url + queryParameters.toString().replaceFirst("&", "?")) .header(ACCEPT, MimeType.APPLICATION_JSON) .loader(loaderFactory.newLoader("Searching...")) .send(unmarshaller.newListUnmarshaller(SearchResultDto.class)).then( (Function<List<SearchResultDto>, List<SearchResult>>)searchResultDtos -> { if (searchResultDtos.isEmpty()) { return Collections.emptyList(); } return searchResultDtos.stream().map(SearchResult::new).collect(Collectors.toList()); }); }
Source:
public void initMigrationPolicies(boolean isEdit) { List<MigrationPolicy> policies = AsyncDataProvider.getInstance().getMigrationPolicies(); getMigrationPolicies().setItems(policies); for (MigrationPolicy policy : policies) { boolean editFoundPrevSelected = isEdit && Objects.equals(policy.getId(), getEntity().getMigrationPolicyId()); boolean newFoundNonEmpty = !isEdit && !Objects.equals(policy.getId(), NoMigrationPolicy.ID); if (editFoundPrevSelected || newFoundNonEmpty) { getMigrationPolicies().setSelectedItem(policy); break; } } }

Target:
public void initMigrationPolicies(boolean isEdit) { List<MigrationPolicy> policies = AsyncDataProvider.getInstance().getMigrationPolicies(); getMigrationPolicies().setItems(policies); MigrationPolicy migrationPolicy = isEdit ? findMigrationPolicyById(getEntity().getMigrationPolicyId(), policies) : findFirstNonEmptyMigrationPolicy(policies); getMigrationPolicies().setSelectedItem(migrationPolicy != null ? migrationPolicy : findMigrationPolicyById(NoMigrationPolicy.ID, policies)); }
Source:
public void testDeleteAll() throws Throwable { this.testMarkAll(); Assert.assertTrue(this.solo.waitForView(R.id.delete_menu)); View deleteMenu = this.activity.findViewById(R.id.delete_menu); Assert.assertNotNull(deleteMenu); TouchUtils.clickView(this, deleteMenu); BBCTTestUtil.waitForToast(this.solo, BBCTTestUtil.DELETE_MESSAGE); ListView listView = (ListView) this.solo.getCurrentActivity().findViewById(android.R.id.list); Assert.assertNotNull(listView); Assert.assertEquals(1, listView.getAdapter().getCount()); this.solo.waitForView(android.R.id.empty); }

Target:
public void testDeleteAll() throws Throwable { this.markAll(); deleteCards(); ListView listView = (ListView) this.solo.getCurrentActivity().findViewById(android.R.id.list); Assert.assertNotNull(listView); Assert.assertEquals(1, listView.getAdapter().getCount()); this.solo.waitForView(android.R.id.empty); }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree blockTree = methodTree.block(); if (blockTree == null) { return; } if (!CHECK_CLIENT_TRUSTED_MATCHER.matches(methodTree) && !CHECK_SERVER_TRUSTED_MATCHER.matches(methodTree)) { return; } if (!ThrowExceptionVisitor.throwsException(blockTree)) { reportIssue(methodTree.simpleName(), "Change this method so it throws exceptions."); } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; BlockTree blockTree = methodTree.block(); if (blockTree == null) { return; } if ((CHECK_CLIENT_TRUSTED_MATCHER.matches(methodTree) || CHECK_SERVER_TRUSTED_MATCHER.matches(methodTree)) && !ThrowExceptionVisitor.throwsException(blockTree)) { reportIssue(methodTree.simpleName(), "Change this method so it throws exceptions."); } }
Source:
public JsonToken nextToken() throws IOException { if (depth == 0) { throw new IllegalStateException("The JSON branch is closed"); } JsonToken next = super.nextToken(); maintainDepth(next); return next; }

Target:
public JsonToken nextToken() throws IOException { if (depth == 0) { throw new IllegalStateException("The JSON branch is closed"); } maintainDepth(); return super.getCurrentToken(); }
Source:
public DataTransactionResult remove(DataHolder dataHolder) { if (supports(dataHolder)) { final DataTransactionBuilder builder = DataTransactionBuilder.builder(); final Optional<AuthorData> data = from(dataHolder); if (data.isPresent()) { try { if (((ItemStack) dataHolder).getTagCompound() != null) { ((ItemStack) dataHolder).getTagCompound().setString(NbtDataUtil.ITEM_BOOK_AUTHOR, NbtDataUtil.INVALID_TITLE); } return builder.replace(data.get().getValues()).result(Type.SUCCESS).build(); } catch (Exception e) { Sponge.getLogger().error("There was an issue removing the author of an itemstack!", e); return builder.result(Type.ERROR).build(); } } else { return builder.result(Type.SUCCESS).build(); } } return DataTransactionBuilder.failNoData(); }

Target:
public DataTransactionResult remove(DataHolder dataHolder) { return DataTransactionBuilder.failNoData(); }
Source:
public int getMaxResults() { boolean hasOutParameters = false; for ( ParameterRegistration parameterRegistration : parameterRegistrations ) { if ( parameterRegistration.getMode().equals( ParameterMode.OUT ) ) { hasOutParameters = true; } } int result = 0; if ( hasOutParameters ) { } return result; }

Target:
public int getMaxResults() { int result = 0; for ( ParameterRegistration parameterRegistration : parameterRegistrations ) { switch ( parameterRegistration.getMode() ) { case REF_CURSOR: result = 1; break; case OUT: case INOUT: throw new UnsupportedOperationException( "Out parameters not supported!" ); default: break; } } return result; }
Source:
private void runIterationTest(int numThreads, Executor persistenceExecutor1) { int numEntries = insertData(); final ConcurrentMap<Object, Object> entries = new ConcurrentHashMap<>(); final ConcurrentHashSet<Thread> threads = new ConcurrentHashSet<>(); final AtomicBoolean sameKeyMultipleTimes = new AtomicBoolean(); final CyclicBarrier barrier = new CyclicBarrier(numThreads); final AtomicBoolean brokenBarrier = new AtomicBoolean(false); store.process(null, new AdvancedCacheLoader.CacheLoaderTask() { @Override public void processEntry(MarshalledEntry marshalledEntry, AdvancedCacheLoader.TaskContext taskContext) throws InterruptedException { Object existing = entries.put(marshalledEntry.getKey(), marshalledEntry.getValue()); if (threads.add(Thread.currentThread())) { try { barrier.await(); } catch (BrokenBarrierException e) { brokenBarrier.set(true); } } if (existing != null) { log.warnf("Already a value present for key %s: %s", marshalledEntry.getKey(), existing); sameKeyMultipleTimes.set(true); } } }, persistenceExecutor1, true, true); assertFalse(sameKeyMultipleTimes.get()); assertFalse(brokenBarrier.get()); for (int i = 0; i < numEntries; i++) { assertEquals(entries.get(i), i, "For key" + i); } if (multipleThreads) { assertEquals(threads.size(), numThreads); } }

Target:
private void runIterationTest(int numThreads, Executor persistenceExecutor1) { int numEntries = insertData(); final ConcurrentMap<Object, Object> entries = new ConcurrentHashMap<>(); final ConcurrentHashSet<Thread> threads = new ConcurrentHashSet<>(); final AtomicBoolean sameKeyMultipleTimes = new AtomicBoolean(); final CyclicBarrier barrier = new CyclicBarrier(numThreads); final AtomicBoolean brokenBarrier = new AtomicBoolean(false); store.process(null, new AdvancedCacheLoader.CacheLoaderTask() { @Override public void processEntry(MarshalledEntry marshalledEntry, AdvancedCacheLoader.TaskContext taskContext) throws InterruptedException { Object existing = entries.put(marshalledEntry.getKey(), marshalledEntry.getValue()); if (threads.add(Thread.currentThread())) { try { barrier.await(1, TimeUnit.MINUTES); } catch (BrokenBarrierException | TimeoutException e) { log.warn("Exception occurred while waiting for barrier", e); brokenBarrier.set(true); } } if (existing != null) { log.warnf("Already a value present for key %s: %s", marshalledEntry.getKey(), existing); sameKeyMultipleTimes.set(true); } } }, persistenceExecutor1, true, true); assertFalse(sameKeyMultipleTimes.get()); assertFalse(brokenBarrier.get()); for (int i = 0; i < numEntries; i++) { assertEquals(entries.get(i), i, "For key" + i); } assertEquals(threads.size(), numThreads); }
Source:
public final void createNonCoreComponents(ISarosSession session, MutablePicoContainer container) { container.addComponent(ServerEditorManager.class); container.addComponent(FileActivityExecutor.class); container.addComponent(FolderActivityExecutor.class); container.addComponent(TextEditActivityExecutor.class); container.addComponent(NegotiationHandler.class); }

Target:
public final void createNonCoreComponents(ISarosSession session, MutablePicoContainer container) { container.addComponent(ServerEditorManager.class); container.addComponent(FileActivityExecutor.class); container.addComponent(FolderActivityExecutor.class); container.addComponent(TextEditActivityExecutor.class); }
Source:
public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> semanticObjects, Point newLocation) { List children = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; dropObjectsRequest.setLocation(newLocation); dropObjectsRequest.setObjects(semanticObjects); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }

Target:
public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> semanticObjects, Point newLocation) { List<?> children = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; dropObjectsRequest.setLocation(newLocation); dropObjectsRequest.setObjects(semanticObjects); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }
Source:
public GraphMLTopologyProvider(final GraphMLMetaTopologyProvider metaTopologyProvider, final GraphMLGraph graph, final GraphMLServiceAccessor serviceAccessor) { super(graph.getProperty(GraphMLProperties.NAMESPACE)); this.metaTopologyProvider = metaTopologyProvider; m_serviceAccessor = serviceAccessor; for (GraphMLNode graphMLNode : graph.getNodes()) { GraphMLVertex newVertex = new GraphMLVertex(this.getVertexNamespace(), graphMLNode); setNodeIdForVertex(newVertex); addVertices(newVertex); } for (org.opennms.features.graphml.model.GraphMLEdge eachEdge : graph.getEdges()) { GraphMLVertex sourceVertex = (GraphMLVertex) getVertex(getVertexNamespace(), eachEdge.getSource().getId()); GraphMLVertex targetVertex = (GraphMLVertex) getVertex(getVertexNamespace(), eachEdge.getTarget().getId()); if (sourceVertex == null || targetVertex == null) { continue; } GraphMLEdge newEdge = new GraphMLEdge(getEdgeNamespace(), eachEdge, sourceVertex, targetVertex); addEdges(newEdge); } setTopologyProviderInfo(createTopologyProviderInfo(graph)); defaultSzl = getDefaultSzl(graph); focusStrategy = getFocusStrategy(graph); focusIds = getFocusIds(graph); preferredLayout = graph.getProperty(GraphMLProperties.PREFERRED_LAYOUT); vertexStatusProvider = graph.<Object>getProperty(GraphMLProperties.VERTEX_STATUS_PROVIDER, Boolean.FALSE); if (focusStrategy != FocusStrategy.SPECIFIC && !focusIds.isEmpty()) { LOG.warn("Focus ids is defined, but strategy is {}. Did you mean to specify {}={}. Ignoring focusIds.", GraphMLProperties.FOCUS_STRATEGY, FocusStrategy.SPECIFIC.name()); } }

Target:
public GraphMLTopologyProvider(final GraphMLMetaTopologyProvider metaTopologyProvider, final GraphMLGraph graph, final GraphMLServiceAccessor serviceAccessor) { super(graph.getProperty(GraphMLProperties.NAMESPACE)); this.metaTopologyProvider = metaTopologyProvider; m_serviceAccessor = serviceAccessor; for (GraphMLNode graphMLNode : graph.getNodes()) { GraphMLVertex newVertex = new GraphMLVertex(this.getVertexNamespace(), graphMLNode); setNodeIdForVertex(newVertex); addVertices(newVertex); } for (org.opennms.features.graphml.model.GraphMLEdge eachEdge : graph.getEdges()) { GraphMLVertex sourceVertex = (GraphMLVertex) getVertex(getVertexNamespace(), eachEdge.getSource().getId()); GraphMLVertex targetVertex = (GraphMLVertex) getVertex(getVertexNamespace(), eachEdge.getTarget().getId()); if (sourceVertex == null || targetVertex == null) { continue; } GraphMLEdge newEdge = new GraphMLEdge(getEdgeNamespace(), eachEdge, sourceVertex, targetVertex); addEdges(newEdge); } setTopologyProviderInfo(createTopologyProviderInfo(graph)); defaultSzl = getDefaultSzl(graph); focusStrategy = getFocusStrategy(graph); focusIds = getFocusIds(graph); preferredLayout = graph.getProperty(GraphMLProperties.PREFERRED_LAYOUT); this.vertexStatusProviderType = getVertexProviderTypeFromGraph(graph); if (focusStrategy != FocusStrategy.SPECIFIC && !focusIds.isEmpty()) { LOG.warn("Focus ids is defined, but strategy is {}. Did you mean to specify {}={}. Ignoring focusIds.", GraphMLProperties.FOCUS_STRATEGY, FocusStrategy.SPECIFIC.name()); } }
Source:
public static OrcReader createOrcReader(OrcDataSource dataSource, ReaderAttributes attributes) throws IOException { return new OrcReader(dataSource, ORC, attributes.getMaxMergeDistance(), attributes.getMaxReadSize(), attributes.getTinyStripeThreshold(), new DataSize(1, PETABYTE)); }

Target:
public static OrcReader createOrcReader(OrcDataSource dataSource, ReaderAttributes attributes) throws IOException { return new OrcReader(dataSource, ORC, attributes.getMaxMergeDistance(), attributes.getMaxReadSize(), attributes.getTinyStripeThreshold(), new DataSize(16, MEGABYTE)); }
Source:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { buffer = new TupleBatchBuffer(getSchema()); try { source.setStartRange(startByteRange); source.setEndRange(endByteRange); parser = new CSVParser(new BufferedReader(new InputStreamReader(source.getInputStream())), CSVFormat.newFormat( delimiter).withQuote(quote).withEscape(escape)); iterator = parser.iterator(); for (int i = 0; i < numberOfSkippedLines; i++) { iterator.next(); } } catch (IOException e) { throw new DbException(e); } lineNumber = 0; }

Target:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { buffer = new TupleBatchBuffer(getSchema()); try { adjustedStartByteRange = partitionStartByteRange; if (partitionStartByteRange != 0) { adjustedStartByteRange -= 1; } partitionInputStream = source.getInputStream(adjustedStartByteRange, partitionEndByteRange); if (maxByteRange == 0) { flagAsIncomplete = true; } if (partitionStartByteRange != 0) { int firstChar = partitionInputStream.read(); int byteOffset = 1; if (firstChar != '\n' && firstChar != '\r') { boolean newLineFound = false; while (!newLineFound) { int currentChar = partitionInputStream.read(); byteOffset++; if (currentChar == '\n' || currentChar == '\r' || currentChar == -1) { newLineFound = true; if (currentChar == -1) { flagAsIncomplete = true; } else if (currentChar == '\r') { currentChar = partitionInputStream.read(); if (currentChar != '\n') { partitionInputStream = source.getInputStream( adjustedStartByteRange + byteOffset, partitionEndByteRange); } } } } } else if (firstChar == '\r') { int currentChar = partitionInputStream.read(); if (currentChar != '\n') { partitionInputStream = source.getInputStream(adjustedStartByteRange + byteOffset, partitionEndByteRange); } } } if (!flagAsIncomplete) { parser = new CSVParser( new BufferedReader(new InputStreamReader(partitionInputStream)), CSVFormat.newFormat(delimiter).withQuote(quote).withEscape(escape)); iterator = parser.iterator(); for (int i = 0; i < numberOfSkippedLines; i++) { iterator.next(); } } } catch (IOException e) { throw new DbException(e); } }
Source:
public void testGetIncompleteTriggerInstancesReturnsEmpty() { final List<TriggerInstance> all = new ArrayList<>(); for (int i = 0; i < 5; i++) { all.add(this.createTriggerInstance(this.flowTrigger, this .flow_id, this.flow_version, this.submitUser, this.project, System.currentTimeMillis())); if (i <= 2) { finalizeTriggerInstanceWithCancelled(all.get(i)); } else { finalizeTriggerInstanceWithSuccess(all.get(i), 1000); } } final List<TriggerInstance> shuffled = new ArrayList<>(all); shuffled.forEach(triggerInst -> this.triggerInstLoader.uploadTriggerInstance(triggerInst)); final List<TriggerInstance> actual = new ArrayList<>(this.triggerInstLoader .getIncompleteTriggerInstances()); all.sort(Comparator.comparing(TriggerInstance::getId)); actual.sort(Comparator.comparing(TriggerInstance::getId)); assertThat(actual).isEmpty(); }

Target:
public void testGetIncompleteTriggerInstancesReturnsEmpty() { final List<TriggerInstance> all = new ArrayList<>(); for (int i = 0; i < 5; i++) { all.add(this.createTriggerInstance(this.flowTrigger, this .flow_id, this.flow_version, this.submitUser, this.project, System.currentTimeMillis())); if (i <= 2) { finalizeTriggerInstanceWithCancelled(all.get(i)); } else { finalizeTriggerInstanceWithSuccess(all.get(i), 1000); } } this.shuffleAndUpload(all); final List<TriggerInstance> actual = new ArrayList<>(this.triggerInstLoader .getIncompleteTriggerInstances()); all.sort(Comparator.comparing(TriggerInstance::getId)); actual.sort(Comparator.comparing(TriggerInstance::getId)); assertThat(actual).isEmpty(); }
Source:
public void setupDrawer() { leftDrawer = (DrawerLayout) findViewById(R.id.main_drawer); rightDrawer = (DrawerLayout) findViewById(R.id.nick_drawer); if (leftDrawer!=null) { leftDrawer.setStatusBarBackgroundColor(getResources().getColor(R.color.primary_dark)); extensibleDrawerToggle = new ExtensibleDrawerToggle(leftDrawer, new ActionBarDrawerToggle( MainActivity.this, leftDrawer, actionbar.getWrappedToolbar(), R.string.hint_drawer_open, R.string.hint_drawer_close ) { public void onDrawerClosed(View drawerView) { updateBufferRead(); updateBufferRead(); ((BufferFragment) manager.bufferFragment).finishActionMode(); setTitleAndMenu(); } public void onDrawerOpened(View drawerView) { manager.closeDrawer(Side.RIGHT); setTitleAndMenu(); } public void onDrawerSlide(View drawerView, float slideOffset) { if (manager.isDrawerVisible(Side.RIGHT)) manager.closeDrawer(Side.RIGHT); super.onDrawerSlide(drawerView,0); } }); leftDrawer.setDrawerListener((extensibleDrawerToggle.getDrawerListener())); } else if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark)); } }

Target:
public void setupDrawer() { leftDrawer = (DrawerLayout) findViewById(R.id.main_drawer); rightDrawer = (DrawerLayout) findViewById(R.id.nick_drawer); if (leftDrawer!=null) { leftDrawer.setStatusBarBackgroundColor(getResources().getColor(R.color.primary_dark)); if (extensibleDrawerToggle==null) { extensibleDrawerToggle = new ExtensibleDrawerToggle(leftDrawer, new ActionBarDrawerToggle( MainActivity.this, leftDrawer, actionbar.getWrappedToolbar(), R.string.hint_drawer_open, R.string.hint_drawer_close ) { @Override public void onDrawerClosed(View drawerView) { updateBufferRead(); ((BufferFragment) manager.bufferFragment).finishActionMode(); setTitleAndMenu(); } @Override public void onDrawerOpened(View drawerView) { manager.closeDrawer(Side.RIGHT); setTitleAndMenu(); manager.hideKeyboard(); } @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, 0); } }); leftDrawer.setDrawerListener((extensibleDrawerToggle.getDrawerListener())); } } }
Source:
public LfsRepositoryReadOnly(String name) { super("repository " + name + " is read-only"); }

Target:
public LfsRepositoryReadOnly(String name) { super(MessageFormat.format(LfsText.get().repositoryReadOnly, name)); }
Source:
public AnnotatedTypeWrapper(AnnotatedType<X> annotatedType) { this.delegate = annotatedType; replaceDeprecatedAnnotatedMethods(); if (delegate.isAnnotationPresent(ActivateThreadScope.class)) { replaceDeprecatedAnnotations(); } }

Target:
public AnnotatedTypeWrapper(AnnotatedType<X> annotatedType) { this.delegate = annotatedType; this.annotatedMethods = replaceDeprecatedAnnotatedMethods(delegate.getMethods()); this.annotations = replaceDeprecatedAnnotations(delegate.getAnnotations()); }
Source:
public Boolean setEndOffsets(final String id, final Map<Integer, Long> endOffsets) { return setEndOffsets(id, endOffsets, false); }

Target:
public boolean setEndOffsets(final String id, final Map<Integer, Long> endOffsets) { return setEndOffsets(id, endOffsets, false); }
Source:
public JobId submitFromCatalog(String catalogRestURL, String bucketName, String workflowName, Map<String, String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException { JobIdData jobIdData = null; CloseableHttpClient httpclient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(catalogRestURL + "/buckets/" + bucketName + "/resources/" + workflowName + "/raw"); httpPost.addHeader("sessionid", sid); try (CloseableHttpResponse response = httpclient.execute(httpPost)) { jobIdData = restApiClient().submitXml(sid, response.getEntity().getContent(), variables); } catch (Exception e) { throwNCEOrPEOrSCEOrJCE(e); } return jobId(jobIdData); }

Target:
public JobId submitFromCatalog(String catalogRestURL, String bucketName, String workflowName, Map<String, String> variables) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException { JobIdData jobIdData = null; HttpPost httpPost = new HttpPost(catalogRestURL + "/buckets/" + bucketName + "/resources/" + workflowName + "/raw"); httpPost.addHeader("sessionid", sid); try (CloseableHttpClient httpclient = HttpClients.createDefault(); CloseableHttpResponse response = httpclient.execute(httpPost)) { jobIdData = restApiClient().submitXml(sid, response.getEntity().getContent(), variables); } catch (Exception e) { throwNCEOrPEOrSCEOrJCE(e); } return jobId(jobIdData); }
Source:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { final List<AccountGroup> allGroups = db.accountGroups().all().toList(); for(final AccountGroup group : allGroups) { group.setVisibleToAll(false); } db.accountGroups().update(allGroups); }

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { db.approvalCategoryValues().insert( Collections.singleton(new ApprovalCategoryValue( new ApprovalCategoryValue.Id(ApprovalCategory.READ, (short) 3), "Upload merges permission"))); Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); try { stmt.execute("UPDATE ref_rights SET max_value = 3" + " WHERE category_id = '" + ApprovalCategory.READ.get() + "' AND max_value = 2"); } finally { stmt.close(); } }
Source:
public void setIsLastPage(boolean b) { }

Target:
public void setIsLastPage(boolean b) { hasMoreImages = !b; }
Source:
public void close() throws IOException { try { writer.close(); } catch (InterruptedException e) { throw new IOException(e); } codecFactory.release(); }

Target:
public void close() throws IOException { try { writer.close(); } catch (InterruptedException e) { throw new IOException(e); } finally { codecFactory.release(); } }
Source:
public void edit(ConfirmationModel object) { driver.edit(object); object.getLatch().getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("IsAvailable".equals(((PropertyChangedEventArgs) args).PropertyName)) { EntityModel entity = (EntityModel) sender; if (entity.getIsAvailable()) { latch.setVisible(true); } } } }); force.setLabel(object.getForceLabel()); force.asCheckBox().setValue((Boolean) object.getForce().getEntity()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("ForceLabel".equals(((PropertyChangedEventArgs) args).PropertyName)) { ConfirmationModel entity = (ConfirmationModel) sender; force.setLabel(entity.getForceLabel()); } } }); setNote(object.getNote()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("Note".equals(((PropertyChangedEventArgs) args).PropertyName)) { ConfirmationModel entity = (ConfirmationModel) sender; setNote(entity.getNote()); } } }); }

Target:
public void edit(ConfirmationModel object) { driver.edit(object); object.getLatch().getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("IsAvailable".equals(((PropertyChangedEventArgs) args).PropertyName)) { EntityModel entity = (EntityModel) sender; if (entity.getIsAvailable()) { latch.setVisible(true); } } } }); if (object.getForceLabel() != null) { force.setLabel(object.getForceLabel()); } force.asCheckBox().setValue((Boolean) object.getForce().getEntity()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("ForceLabel".equals(((PropertyChangedEventArgs) args).PropertyName)) { ConfirmationModel entity = (ConfirmationModel) sender; force.setLabel(entity.getForceLabel()); } } }); setNote(object.getNote()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { if ("Note".equals(((PropertyChangedEventArgs) args).PropertyName)) { ConfirmationModel entity = (ConfirmationModel) sender; setNote(entity.getNote()); } } }); }
Source:
public void handleDaysSpentInputChange( ChangeEvent event ) { try { Long value = daysSpentInput.getValue().isEmpty() ? null : Long.parseLong( daysSpentInput.getValue() ); presenter.onDaysSpentChange( value ); } catch ( NumberFormatException e ) { } }

Target:
public void handleDaysSpentInputChange( ChangeEvent event ) { boolean isNumeric = daysSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onDaysSpentChange( Long.parseLong( daysSpentInput.getValue() ) ); } else { presenter.onDaysSpentChange( 0l ); daysSpentInput.setValue( "0" ); } }
Source:
private final Object createValue() { switch (typeSignature) { case "boolean": return random.nextBoolean(); case "tinyint": return Long.valueOf(random.nextLong()).byteValue(); case "smallint": return (short) random.nextInt(); case "integer": return random.nextInt(); case "bigint": return random.nextLong(); case "decimal(10,5)": return new SqlDecimal(BigInteger.valueOf(random.nextLong() % 10_000_000_000L), SHORT_DECIMAL_TYPE.getPrecision(), SHORT_DECIMAL_TYPE.getScale()); case "decimal(30,10)": return new SqlDecimal(BigInteger.valueOf(random.nextLong() % 10_000_000_000L), LONG_DECIMAL_TYPE.getPrecision(), LONG_DECIMAL_TYPE.getScale()); case "timestamp": return new SqlTimestamp((random.nextLong()), UTC_KEY); case "real": return random.nextFloat(); case "double": return random.nextDouble(); case "varchar_dictionary": return Strings.repeat("0", MAX_STRING); case "varchar_direct": return randomAsciiString(random); } throw new UnsupportedOperationException("Unsupported type: " + typeSignature); }

Target:
private Object createValue() { switch (typeSignature) { case "boolean": return random.nextBoolean(); case "tinyint": return Long.valueOf(random.nextLong()).byteValue(); case "smallint": return (short) random.nextInt(); case "integer": return random.nextInt(); case "bigint": return random.nextLong(); case "decimal(10,5)": return new SqlDecimal(BigInteger.valueOf(random.nextLong() % 10_000_000_000L), SHORT_DECIMAL_TYPE.getPrecision(), SHORT_DECIMAL_TYPE.getScale()); case "decimal(30,10)": return new SqlDecimal(BigInteger.valueOf(random.nextLong() % 10_000_000_000L), LONG_DECIMAL_TYPE.getPrecision(), LONG_DECIMAL_TYPE.getScale()); case "timestamp": return new SqlTimestamp((random.nextLong()), UTC_KEY); case "real": return random.nextFloat(); case "double": return random.nextDouble(); case "varchar_dictionary": return Strings.repeat("0", MAX_STRING); case "varchar_direct": return randomAsciiString(random); } throw new UnsupportedOperationException("Unsupported type: " + typeSignature); }
Source:
private MacPool.ReUsableMac getReUseableMacInstance() { if (this.currentCredentialKey != this.credential.getKey()) { synchronized (this.credential) { if (this.currentCredentialKey != this.credential.getKey()) { byte[] masterKeyBytes = this.credential.getKey().getBytes(StandardCharsets.UTF_8); byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes); SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); try { Mac macInstance = Mac.getInstance("HMACSHA256"); macInstance.init(signingKey); this.currentCredentialKey = this.credential.getKey(); this.macPool = new MacPool(macInstance); } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new IllegalStateException(e); } } } } return macPool.take(); }

Target:
private MacPool.ReUsableMac getReUseableMacInstance() { reInitializeIfPossible(); return macPool.take(); }
Source:
public void getInstanceAsync_nullConfigShouldThrow() { thrown.expect(IllegalArgumentException.class); DynamicRealm.getInstanceAsync(null, new DynamicRealm.Callback() { @Override public void onSuccess(DynamicRealm realm) { } }); }

Target:
public void getInstanceAsync_nullConfigShouldThrow() { thrown.expect(IllegalArgumentException.class); DynamicRealm.getInstanceAsync(null, new DynamicRealm.Callback() { @Override public void onSuccess(DynamicRealm realm) { fail(); } }); }
Source:
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { return getEntityCache(repository).getAll(ids) .values() .stream() .filter(Optional::isPresent) .map(Optional::get) .map(e -> entityHydration.hydrate(e, repository.getEntityType())) .collect(Collectors.toList()); } catch (ExecutionException exception) { throw new RuntimeException(exception); } }

Target:
public List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids) { try { return getEntityCache(repository).getAll(ids) .values() .stream() .filter(Optional::isPresent) .map(Optional::get) .map(e -> entityHydration.hydrate(e, repository.getEntityType())) .collect(Collectors.toList()); } catch (ExecutionException exception) { if (exception.getCause() != null && exception.getCause() instanceof RuntimeException) { throw (RuntimeException) exception.getCause(); } throw new RuntimeException(exception); } }
Source:
default int lastIndexOf(T element, int end) { int result = -1, index = 0; for (Stream<T> stream = this; !stream.isEmpty(); stream = stream.tail(), index++) { if (index <= end && Objects.equals(stream.head(), element)) { result = index; } } return result; }

Target:
default int lastIndexOf(T element, int end) { int result = -1, index = 0; for (Stream<T> stream = this; index <= end && !stream.isEmpty(); stream = stream.tail(), index++) { if (Objects.equals(stream.head(), element)) { result = index; } } return result; }
Source:
public VmDevice createSysprepPayloadDevice(String sysPrepContent, VM vm) { boolean cdromPayload = vm.getCompatibilityVersion().greaterOrEquals(Version.v4_4); VmPayload vmPayload = new VmPayload(); if (cdromPayload) { vmPayload.setDeviceType(VmDeviceType.CDROM); } else { vmPayload.setDeviceType(VmDeviceType.FLOPPY); } vmPayload.getFiles().put( osRepository.getSysprepFileName(vm.getOs(), vm.getCompatibilityVersion()), new String(BASE_64.encode(sysPrepContent.getBytes()), StandardCharsets.UTF_8)); return new VmDevice(new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.DISK, cdromPayload ? VmDeviceType.CDROM.getName() : VmDeviceType.FLOPPY.getName(), "", vmPayload.getSpecParams(), true, true, true, "", null, null, null); }

Target:
public VmDevice createSysprepPayloadDevice(String sysPrepContent, VM vm) { boolean cdromPayload = !osRepository.isFloppySupported(vm.getOs(), vm.getCompatibilityVersion()); VmPayload vmPayload = new VmPayload(); if (cdromPayload) { vmPayload.setDeviceType(VmDeviceType.CDROM); } else { vmPayload.setDeviceType(VmDeviceType.FLOPPY); } vmPayload.getFiles().put( osRepository.getSysprepFileName(vm.getOs(), vm.getCompatibilityVersion()), new String(BASE_64.encode(sysPrepContent.getBytes()), StandardCharsets.UTF_8)); return new VmDevice(new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.DISK, cdromPayload ? VmDeviceType.CDROM.getName() : VmDeviceType.FLOPPY.getName(), "", vmPayload.getSpecParams(), true, true, true, "", null, null, null); }
Source:
private void validateNetworkExclusiveOnIface(VdsNetworkInterface iface, NetworkType networkType) { String ifaceName = NetworkUtils.stripVlan(iface); List<NetworkType> networksOnIface = ifacesWithExclusiveNetwork.get(ifaceName); if (networksOnIface == null) { networksOnIface = new ArrayList<>(); ifacesWithExclusiveNetwork.put(ifaceName, networksOnIface); } if ((networkType == NetworkType.VLAN && networksOnIface.contains(NetworkType.VM)) || (networkType == NetworkType.VM && !networksOnIface.isEmpty())) { addViolation(EngineMessage.NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK, ifaceName); } networksOnIface.add(networkType); }

Target:
private void validateNetworkExclusiveOnIface(VdsNetworkInterface iface, NetworkType networkType) { String ifaceName = NetworkUtils.stripVlan(iface); List<NetworkType> networksOnIface = ifacesWithExclusiveNetwork.get(ifaceName); if (networksOnIface == null) { networksOnIface = new ArrayList<>(); ifacesWithExclusiveNetwork.put(ifaceName, networksOnIface); } networksOnIface.add(networkType); if (!networkExclusivenessValidator.isNetworkExclusive(networksOnIface)) { addViolation(networkExclusivenessValidator.getViolationMessage(), ifaceName); } }
Source:
public void assertValueAtIndexNoMatch() { TestObserver<Integer> ts = new TestObserver<Integer>(); Observable.just(1, 2, 3).subscribe(ts); thrown.expect(AssertionError.class); thrown.expectMessage("Expected: 2 (class: Integer), Actual: 3 (class: Integer) (latch = 0, values = 3, errors = 0, completions = 1)"); ts.assertValueAt(2, 2); }

Target:
public void assertValueAtIndexNoMatch() { TestObserver<String> ts = new TestObserver<String>(); Observable.just("a", "b", "c").subscribe(ts); thrown.expect(AssertionError.class); thrown.expectMessage("Expected: b (class: String), Actual: c (class: String) (latch = 0, values = 3, errors = 0, completions = 1)"); ts.assertValueAt(2, "b"); }
Source:
public RegistryAuth authForSwarm() throws DockerException { final AuthorizationData accessToken; try { accessToken = getAccessToken(); } catch (IOException e) { log.warn("unable to get access token for Google Container Registry due to exception, " + "configuration for Swarm will not contain RegistryAuth for GCR", e); return null; } return authForAuthorizationData(accessToken); }

Target:
public RegistryAuth authForSwarm() throws DockerException { final AuthorizationData accessToken; try { accessToken = getAccessToken(); } catch (IOException e) { log.warn("unable to get access token for AWS Elastic Container Registry due to exception, " + "configuration for Swarm will not contain RegistryAuth for ECR", e); return null; } return authForAuthorizationData(accessToken); }
Source:
public String updateFilter(Request request, Response response) throws IOException { long id = getIdFromRequest(request.params("id")); NotificationFilter notificationFilter = buildEntityFromRequestBody(request); User user = userService.findUserByName(currentUsernameString()); Optional<NotificationFilter> optionalFilter = user.getNotificationFilters().stream() .filter(filter -> filter.getId() == id) .findFirst(); if (optionalFilter.isEmpty()) { throw new RecordNotFoundException(EntityType.NotificationFilter, id); } try { notificationFilter.setId(id); user.getNotificationFilters().remove(optionalFilter.get()); user.addNotificationFilter(notificationFilter); userService.saveOrUpdate(user); setEtagHeader(response, etagFor(notificationFilter)); return writerForTopLevelObject(request, response, writer -> NotificationFilterRepresenter.toJSON(writer, notificationFilter)); } catch (ValidationException e) { throw new UnprocessableEntityException(e.getMessage()); } }

Target:
public String updateFilter(Request request, Response response) throws IOException { long id = parseIdToLong(request.params("id")); NotificationFilter notificationFilter = buildEntityFromRequestBody(request); notificationFilter.setId(id); try { userService.updateNotificationFilter(currentUserId(request), notificationFilter); setEtagHeader(response, etagFor(notificationFilter)); return writerForTopLevelObject(request, response, writer -> NotificationFilterRepresenter.toJSON(writer, notificationFilter)); } catch (UncheckedValidationException e) { throw new UnprocessableEntityException(e.getMessage()); } }
Source:
public void testIndexProperlySetAfterLoad() throws Exception { File directory = folder.newFolder("testIndexAfterLoad"); String holderName = "myHolder"; try (FileOutputStream fos = new FileOutputStream(new File(directory, HOLDER_FILE_NAME))) { try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(holderName); oos.writeObject(new FileBasedStateRepository.Tuple(0, new TransientStateHolder<Long, String>())); } } FileBasedStateRepository stateRepository = new FileBasedStateRepository(directory); stateRepository.getPersistentStateHolder("otherHolder", Long.class, Long.class); stateRepository.close(); File[] files = directory.listFiles((dir, name) -> name.contains("otherHolder") && name.contains("-1-")); assertThat(files.length, is(1)); }

Target:
public void testIndexProperlySetAfterLoad() throws Exception { File directory = folder.newFolder("testIndexAfterLoad"); String holderName = "myHolder"; try (FileOutputStream fos = new FileOutputStream(new File(directory, HOLDER_FILE_NAME)); ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(holderName); oos.writeObject(new FileBasedStateRepository.Tuple(0, new TransientStateHolder<Long, String>())); } FileBasedStateRepository stateRepository = new FileBasedStateRepository(directory); stateRepository.getPersistentStateHolder("otherHolder", Long.class, Long.class); stateRepository.close(); File[] files = directory.listFiles((dir, name) -> name.contains("otherHolder") && name.contains("-1-")); assertThat(files.length, is(1)); }