auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response doSetLocaleProperties( @PathParam ( "pathId" ) String pathId, @QueryParam ( "locale" ) String locale, List<StringKeyStringValueDto> properties ) { boolean success = true; String responseMsg = ""; try { String[] pathSplit = pathId.split( ":" ); boolean isFileTitleFound = false; StringKeyStringValueDto fileTitle = null; for ( StringKeyStringValueDto property : properties ) { if ( property.getKey().equals( "file.title" ) ) { responseMsg = "Unable to rename File/Folder"; isFileTitleFound = true; fileTitle = property; properties.remove( fileTitle ); break; } } fileService.doSetLocaleProperties( pathId, locale, properties ); if ( isFileTitleFound && fileTitle != null && !pathSplit[ pathSplit.length - 1 ].equals( fileTitle.getValue() ) ) { success = fileService.doRename( pathId, fileTitle.getValue() ); } if ( success ) { return buildOkResponse(); } else { return buildOkResponse( responseMsg ); } } catch ( Throwable t ) { return Response.serverError().entity( t.getMessage() ).build(); } }

Target:
public Response doSetLocaleProperties( @PathParam ( "pathId" ) String pathId, @QueryParam ( "locale" ) String locale, List<StringKeyStringValueDto> properties ) { boolean success = true; String responseMsg = ""; try { String[] pathSplit = pathId.split( ":" ); String originalFilename = pathSplit[ pathSplit.length - 1 ]; StringKeyStringValueDto fileTitle = null; for ( StringKeyStringValueDto property : properties ) { if ( property.getKey().equals( "file.title" ) ) { responseMsg = Messages.getInstance().getString( "FileResource.FILE_RENAME_FAILED", originalFilename ); fileTitle = property; properties.remove( fileTitle ); break; } } fileService.doSetLocaleProperties( pathId, locale, properties ); if ( fileTitle != null && !originalFilename.equals( fileTitle.getValue() ) ) { success = fileService.doRename( pathId, fileTitle.getValue() ); } if ( success ) { return buildOkNoContentResponse(); } else { return buildOkResponse( responseMsg ); } } catch ( Throwable t ) { return Response.serverError().entity( t.getMessage() ).build(); } }
Source:
public Iterator<String> getGcCandidates(DataLevel level, String continuePoint) { if (level == DataLevel.ROOT) { byte[] json = context.getZooCache() .get(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_GC_CANDIDATES); Stream<String> candidates = RootGcCandidates.fromJson(json).stream().sorted(); if (continuePoint != null && !continuePoint.isEmpty()) { candidates = candidates.dropWhile(candidate -> candidate.compareTo(continuePoint) <= 0); } return candidates.iterator(); } else if (level == DataLevel.METADATA || level == DataLevel.USER) { Range range = DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = DeletesSection.encodeRow(continuePoint); range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner; try { scanner = context.createScanner(level.metaTable(), Authorizations.EMPTY); } catch (TableNotFoundException e) { throw new RuntimeException(e); } scanner.setRange(range); return Iterators.transform( Iterators.filter(scanner.iterator(), entry -> entry.getValue().equals(DeletesSection.SkewedKeyValue.NAME)), entry -> DeletesSection.decodeRow(entry.getKey().getRow().toString())); } else { throw new IllegalArgumentException(); } }

Target:
public Iterator<String> getGcCandidates(DataLevel level, String continuePoint) { if (level == DataLevel.ROOT) { byte[] json = context.getZooCache() .get(context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_GC_CANDIDATES); Stream<String> candidates = RootGcCandidates.fromJson(json).stream().sorted(); if (continuePoint != null && !continuePoint.isEmpty()) { candidates = candidates.dropWhile(candidate -> candidate.compareTo(continuePoint) <= 0); } return candidates.iterator(); } else if (level == DataLevel.METADATA || level == DataLevel.USER) { Range range = DeletesSection.getRange(); if (continuePoint != null && !continuePoint.isEmpty()) { String continueRow = DeletesSection.encodeRow(continuePoint); range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()); } Scanner scanner; try { scanner = context.createScanner(level.metaTable(), Authorizations.EMPTY); } catch (TableNotFoundException e) { throw new RuntimeException(e); } scanner.setRange(range); return StreamSupport.stream(scanner.spliterator(), false) .filter(entry -> entry.getValue().equals(DeletesSection.SkewedKeyValue.NAME)) .map(entry -> DeletesSection.decodeRow(entry.getKey().getRow().toString())).iterator(); } else { throw new IllegalArgumentException(); } }
Source:
public void regenerateCertificatesOf(Collection<Owner> owners, Collection<Product> products, boolean lazy) { List<Pool> pools = new LinkedList<Pool>(); Set<String> productIds = new HashSet<String>(); Date now = new Date(); for (Product product : products) { productIds.add(product.getId()); } for (Owner owner : owners) { if (lazy) { for (Product product : products) { poolCurator.markCertificatesDirtyForOwnerProductId(owner, product.getId()); } } else { pools.addAll( this.poolCurator.listAvailableEntitlementPools(null, owner, productIds, now) ); } } for (Pool pool : pools) { this.regenerateCertificatesOf(pool.getEntitlements(), lazy); } }

Target:
public void regenerateCertificatesOf(Collection<Owner> owners, Collection<Product> products, boolean lazy) { List<Pool> pools = new LinkedList<Pool>(); Set<String> productIds = new HashSet<String>(); Date now = new Date(); for (Product product : products) { productIds.add(product.getId()); } for (Owner owner : owners) { if (lazy) { poolCurator.markCertificatesDirtyForPoolsWithProducts(owner, productIds); } else { pools.addAll( this.poolCurator.listAvailableEntitlementPools(null, owner, productIds, now) ); } } for (Pool pool : pools) { this.regenerateCertificatesOf(pool.getEntitlements(), lazy); } }
Source:
default boolean containsStream(UUID stream) { return getBackpointerMap().keySet().contains(stream); }

Target:
default boolean containsStream(UUID stream) { return getBackpointerMap().containsKey(stream); }
Source:
public <D> D getDocumentAsType(Class<D> docType) { D doc = null; if(row.has("doc") && !row.has("error")) { doc = gson.fromJson(row.get("doc"), docType); } return doc; }

Target:
public <D> D getDocumentAsType(Class<D> docType) { D doc = null; if(row.has("doc")) { doc = gson.fromJson(row.get("doc"), docType); } return doc; }
Source:
public FilterMultiJoinMergeRule(RelBuilderFactory relBuilderFactory) { super( operand(LogicalFilter.class, operand(MultiJoin.class, any())), relBuilderFactory, null); }

Target:
public FilterMultiJoinMergeRule(RelBuilderFactory relBuilderFactory) { this(LogicalFilter.class, relBuilderFactory); }
Source:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (Constant.isLowMemoryOptionSet()) { return; } if (EventQueue.isDispatchThread()) { updateAlertInTreeEventHandler(originalAlert, alert); } else { try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { updateAlertInTreeEventHandler(originalAlert, alert); } }); } catch (Exception e) { logger.error(e.getMessage(), e); } } }

Target:
public void updateAlertInTree(Alert originalAlert, Alert alert) { if (Constant.isLowMemoryOptionSet()) { return; } this.getTreeModel().updatePath(originalAlert, alert); if (isInFilter(alert)) { this.getFilteredTreeModel().updatePath(originalAlert, alert); } this.recalcAlerts(); if (View.isInitialised()) { JTree alertTree = this.getAlertPanel().getTreeAlert(); TreePath alertPath = new TreePath(getTreeModel().getAlertNode(alert).getPath()); alertTree.setSelectionPath(alertPath); alertTree.scrollPathToVisible(alertPath); } }
Source:
public void run() { try { Injector injector = makeInjector(); try { final Lifecycle lifecycle = initLifecycle(injector); Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() { @Override public void run() { log.info("Running shutdown hook"); lifecycle.stop(); } } ) ); injector.getInstance(ExecutorLifecycle.class).join(); final Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); for (Thread thread : threadSet) { if (!thread.isDaemon() && thread != Thread.currentThread()) { log.error("Thread [%s] is non daemon and would prevent shutdown! ", thread); } } lifecycle.stop(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } log.info("Finished peon task"); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public void run() { try { Injector injector = makeInjector(); try { final Lifecycle lifecycle = initLifecycle(injector); Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() { @Override public void run() { log.info("Running shutdown hook"); lifecycle.stop(); } } ) ); injector.getInstance(ExecutorLifecycle.class).join(); final Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); for (Thread thread : threadSet) { if (!thread.isDaemon() && thread != Thread.currentThread()) { log.info("Thread [%s] is non daemon.", thread); } } lifecycle.stop(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } log.info("Finished peon task"); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
private String createPage(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append( "<!DOCTYPE html PUBLIC \"- sb.append("<html xmlns=\"<LINK_0>\" xml:lang=\"en\" lang=\"en\">"); sb.append("<head>"); sb.append("<title>"); sb.append("Query Result"); sb.append("</title>"); sb.append("</head>"); sb.append("<body>"); sb.append("<h1>"); sb.append("Query Request:"); sb.append("</h1>"); sb.append("<p>"); String metacardId = request.getParameter(QUERY_REQUEST_PARAM); sb.append(metacardId); sb.append("</p>"); sb.append("<h1>"); sb.append("Query Result:"); sb.append("</h1>"); sb.append("<p>"); sb.append("<textarea name=\"queryresult\" id=\"queryresult\" rows=\"40\" cols=\"80\">"); sb.append(getMetacardForId(metacardId, getProxyTicket(request))); sb.append("</textarea>"); sb.append("</p>"); sb.append("<p>"); sb.append("<form method=\"post\" action=\"" + QUERY_FORM_SERVLET + "\">"); sb.append("<input type=\"submit\" value=\"New Query\" />"); sb.append("</form>"); sb.append("</p>"); sb.append("</body>"); sb.append("</html>"); StringBuilder message = new StringBuilder(); message.append("\n########################################################################\n"); message.append(" Query result html:\n"); message.append(sb.toString()); message.append("\n########################################################################\n"); if (LOGGER.isDebugEnabled()) { LOGGER.debug(message.toString()); } return sb.toString(); }

Target:
private String createPage(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append( "<!DOCTYPE html PUBLIC \"- sb.append("<html xmlns=\"<LINK_0>\" xml:lang=\"en\" lang=\"en\">"); sb.append("<head>"); sb.append("<title>"); sb.append("Query Result"); sb.append("</title>"); sb.append("</head>"); sb.append("<body>"); sb.append("<h1>"); sb.append("Query Request:"); sb.append("</h1>"); sb.append("<p>"); String metacardId = request.getParameter(QUERY_REQUEST_PARAM); sb.append(metacardId); sb.append("</p>"); sb.append("<h1>"); sb.append("Query Result:"); sb.append("</h1>"); sb.append("<p>"); sb.append("<textarea name=\"queryresult\" id=\"queryresult\" rows=\"40\" cols=\"80\">"); sb.append(getMetacardForId(metacardId, getProxyTicket(request))); sb.append("</textarea>"); sb.append("</p>"); sb.append("<p>"); sb.append("<form method=\"post\" action=\"" + QUERY_FORM_SERVLET + "\">"); sb.append("<input type=\"submit\" value=\"New Query\" />"); sb.append("</form>"); sb.append("</p>"); sb.append("</body>"); sb.append("</html>"); if (LOGGER.isDebugEnabled()) { StringBuilder message = new StringBuilder(); message.append( "\n########################################################################\n"); message.append(" Query result html:\n"); message.append(sb.toString()); message.append( "\n########################################################################\n"); LOGGER.debug(message.toString()); } return sb.toString(); }
Source:
private Mac getMacInstance() { int masterKeyLatestHashCode = this.cosmosKeyCredential.getMasterKey().hashCode(); if (masterKeyLatestHashCode != this.masterKeyHashCode) { byte[] masterKeyBytes = this.cosmosKeyCredential.getMasterKey().getBytes(); byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes); SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); try { Mac macInstance = Mac.getInstance("HMACSHA256"); macInstance.init(signingKey); this.masterKeyHashCode = masterKeyLatestHashCode; return macInstance; } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new IllegalStateException(e); } } else { try { return (Mac)this.macInstance.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } } }

Target:
private Mac getMacInstance() { int masterKeyLatestHashCode = this.cosmosKeyCredential.keyHashCode(); if (masterKeyLatestHashCode != this.masterKeyHashCode) { byte[] masterKeyBytes = this.cosmosKeyCredential.key().getBytes(); byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes); SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); try { Mac macInstance = Mac.getInstance("HMACSHA256"); macInstance.init(signingKey); this.masterKeyHashCode = masterKeyLatestHashCode; return macInstance; } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new IllegalStateException(e); } } else { try { return (Mac)this.macInstance.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException(e); } } }
Source:
public void touch() { log.debug("Stateless bean instance has been touched"); }

Target:
public void touch() { log.trace("Stateless bean instance has been touched"); }
Source:
public void testRenderPage() { final String page1Content = "Page 1 content."; Page p1 = createPage("/a/b", page1Content); final String page2Content = "Page 2 content."; Page p2 = createPage("/x/y", page2Content); Component cmp = new Component("cmp", null, "/cmp", ImmutableSortedSet.of(p1, p2), emptySet(), emptySet(), emptySet(), null); Component rootComponent = new Component("root", null, Component.ROOT_COMPONENT_CONTEXT_PATH, emptySortedSet(), emptySet(), emptySet(), singleton(cmp), null); Configuration configuration = createConfiguration(); PluginProvider pluginProvider = mock(PluginProvider.class); when(pluginProvider.getPluginInstance(SessionManager.class, configuration.getSessionManager(), this.getClass().getClassLoader())).thenReturn(new InMemorySessionManager()); App app = new App(null, "/test", ImmutableSet.of(cmp, rootComponent), emptySet(), createConfiguration(), null, null, pluginProvider); String html = app.renderPage(createRequest(app.getContextPath(), "/cmp/a/b"), null); Assert.assertEquals(html, page1Content); html = app.renderPage(createRequest(app.getContextPath(), "/cmp/x/y"), null); Assert.assertEquals(html, page2Content); }

Target:
public void testRenderPage() { final String page1Content = "Page 1 content."; Page p1 = createPage("/a/b", page1Content); final String page2Content = "Page 2 content."; Page p2 = createPage("/x/y", page2Content); Component cmp = new Component("cmp", null, "/cmp", ImmutableSortedSet.of(p1, p2), emptySet(), emptySet(), emptySet(), null); Component rootComponent = new Component("root", null, Component.ROOT_COMPONENT_CONTEXT_PATH, emptySortedSet(), emptySet(), emptySet(), singleton(cmp), null); Configuration configuration = createConfiguration(); SessionManager sessionManager = mock(SessionManager.class); App app = new App(null, "/test", ImmutableSet.of(cmp, rootComponent), emptySet(), configuration, null, null, sessionManager); String html = app.renderPage(createRequest(app.getContextPath(), "/cmp/a/b"), null); Assert.assertEquals(html, page1Content); html = app.renderPage(createRequest(app.getContextPath(), "/cmp/x/y"), null); Assert.assertEquals(html, page2Content); }
Source:
public void fireErrors(String fileName, SortedSet<LocalizedMessage> errors) { final String stripped = CommonUtils.relativizeAndNormalizePath(basedir, fileName); boolean removeCache = false; for (final LocalizedMessage element : errors) { final AuditEvent event = new AuditEvent(this, stripped, element); if (filters.accept(event)) { removeCache = true; for (final AuditListener listener : listeners) { listener.addError(event); } } } if (removeCache && cache != null) { cache.remove(fileName); } }

Target:
public void fireErrors(String fileName, SortedSet<LocalizedMessage> errors) { final String stripped = CommonUtils.relativizeAndNormalizePath(basedir, fileName); boolean hasNonFilteredViolations = false; for (final LocalizedMessage element : errors) { final AuditEvent event = new AuditEvent(this, stripped, element); if (filters.accept(event)) { hasNonFilteredViolations = true; for (final AuditListener listener : listeners) { listener.addError(event); } } } if (hasNonFilteredViolations && cache != null) { cache.remove(fileName); } }
Source:
public void setupContext() { super.setupContext(); final String tag = toTag(IMAGE_REPOSITORY, IMAGE_TAG_1); BuildOptions options = BuildOptions.Builder.tag(tag).verbose(false).nocache(false); InputStream buildImageStream; try { buildImageStream = api().getMiscApi().build(BaseDockerApiLiveTest.tarredDockerfile(), options); consumeStreamSilently(buildImageStream); } catch (IOException e) { e.printStackTrace(); } image = api().getImageApi().inspectImage(tag); api().getImageApi().tagImage(image.id(), IMAGE_REPOSITORY, IMAGE_TAG_2, true); }

Target:
public void setupContext() { super.setupContext(); final String tag = toTag(IMAGE_REPOSITORY, IMAGE_TAG_1); BuildOptions options = BuildOptions.Builder.tag(tag).verbose(false).nocache(false); InputStream buildImageStream; try { buildImageStream = api().getMiscApi().build(BaseDockerApiLiveTest.tarredDockerfile(), options); consumeStreamSilently(buildImageStream); } catch (IOException e) { throw new RuntimeException("Error occured during building Docker image.", e); } image = api().getImageApi().inspectImage(tag); api().getImageApi().tagImage(image.id(), IMAGE_REPOSITORY, IMAGE_TAG_2, true); }
Source:
public GdbTerminalConnector(Process process) { fProcess = process; new OutputReadJob(process.getInputStream()).schedule(); new OutputReadJob(process.getErrorStream()).schedule(); }

Target:
public GdbTerminalConnector(Process process) { fProcess = process; fOutputStreamJob = new OutputReadJob(process.getInputStream()); fOutputStreamJob.schedule(); fErrorStreamJob = new OutputReadJob(process.getErrorStream()); fErrorStreamJob.schedule(); }
Source:
private void ackImpl(long uso) { if (uso > 0) { try { releaseExportBytes(uso); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error attempting to release export bytes", true, e); return; } if (m_retiredMaster && uso >= m_usoToDrain) { unacceptMastership(); m_generation.migrateDataSource(this); } if (m_anarchy && uso >= m_usoToDrain) { m_anarchy = false; m_usoToDrain = -1L; } } }

Target:
private void ackImpl(long uso) { if (uso > 0) { try { releaseExportBytes(uso); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error attempting to release export bytes", true, e); return; } if (m_newLeaderHostId != null && uso >= m_usoToDrain) { unacceptMastership(); sendTakeMastershipEvent(uso); } } }
Source:
public Future<ReadableStreamChannel> getBlob(String blobId, Callback<ReadableStreamChannel> callback) { FutureResult<ReadableStreamChannel> futureResult = new FutureResult<ReadableStreamChannel>(); if (isRunning.get()) { getOperationController().getBlob(blobId, futureResult, null); } else { completeOperation(futureResult, null, callback, new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed)); } return futureResult; }

Target:
public Future<ReadableStreamChannel> getBlob(String blobId, Callback<ReadableStreamChannel> callback) { FutureResult<ReadableStreamChannel> futureResult = new FutureResult<ReadableStreamChannel>(); if (isOpen.get()) { getOperationController().getBlob(blobId, futureResult, callback); } else { completeOperation(futureResult, null, callback, new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed)); } return futureResult; }
Source:
public static Relation wbFromDMN(final JSITRelation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = IdPropertyConverter.wbFromDMN(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); final List<InformationItem> convertedColumns = new ArrayList<>(); final List<JSITInformationItem> jsiColumns = dmn.getColumn(); for (int i = 0; i < jsiColumns.size(); i++) { final JSITInformationItem jsiColumn = Js.uncheckedCast(jsiColumns.get(i)); convertedColumns.add(InformationItemPropertyConverter.wbFromDMN(jsiColumn)); } final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRows = new ArrayList<>(); final List<JSITList> jsiRows = dmn.getRow(); for (int i = 0; i < jsiRows.size(); i++) { final JSITList jsiRow = Js.uncheckedCast(jsiRows.get(i)); convertedRows.add(ListPropertyConverter.wbFromDMN(jsiRow, hasComponentWidthsConsumer)); } final Relation result = new Relation(id, description, typeRef, convertedColumns, convertedRows); for (InformationItem c : convertedColumns) { if (c != null) { c.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRows) { if (r != null) { r.setParent(result); } } return result; }

Target:
public static Relation wbFromDMN(final JSITRelation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) { final Id id = IdPropertyConverter.wbFromDMN(dmn.getId()); final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); final List<InformationItem> convertedColumns = new ArrayList<>(); final List<JSITInformationItem> jsiColumns = dmn.getColumn(); for (int i = 0; i < jsiColumns.size(); i++) { final JSITInformationItem jsiColumn = Js.uncheckedCast(jsiColumns.get(i)); convertedColumns.add(InformationItemPropertyConverter.wbFromDMN(jsiColumn)); } final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRows = new ArrayList<>(); final List<JSITList> jsiRows = dmn.getRow(); for (int i = 0; i < jsiRows.size(); i++) { final JSITList jsiRow = Js.uncheckedCast(jsiRows.get(i)); convertedRows.add(ListPropertyConverter.wbFromDMN(jsiRow, hasComponentWidthsConsumer)); } final Relation result = new Relation(id, description, typeRef, convertedColumns, convertedRows); for (InformationItem column : convertedColumns) { if (Objects.nonNull(column)) { column.setParent(result); } } for (org.kie.workbench.common.dmn.api.definition.model.List row : convertedRows) { if (Objects.nonNull(row)) { row.setParent(result); } } return result; }
Source:
private void validateNewFolderName() { String newFolderName = fNewFolderNameText.getText(); IWorkspace workspace = fFolder.getResource().getWorkspace(); IStatus nameStatus = workspace.validateName(newFolderName, IResource.FOLDER); if ("".equals(newFolderName)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } IPath newPath = new Path(newFolderName); IContainer parentFolder = fFolder.getResource().getParent(); if (parentFolder.getFolder(newPath).exists() || parentFolder.getFile(newPath).exists()) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }

Target:
private void validateNewFolderName() { String newFolderName = fNewFolderNameText.getText(); IWorkspace workspace = fFolder.getResource().getWorkspace(); IStatus nameStatus = workspace.validateName(newFolderName, IResource.FOLDER); if ("".equals(newFolderName)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } IContainer parentFolder = fFolder.getResource().getParent(); if (parentFolder.findMember(newFolderName) != null) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }
Source:
private String readFromInputStream(InputStream inputStream) throws IOException { InputStreamReader isr = new InputStreamReader((inputStream)); BufferedReader br = new BufferedReader(isr); StringBuilder out = new StringBuilder(""); String line; while ((line = br.readLine()) != null) { out.append(line); } return out.toString(); }

Target:
private String readFromInputStream(InputStream inputStream) throws IOException { InputStreamReader isr = new InputStreamReader((inputStream)); BufferedReader br = new BufferedReader(isr); StringBuilder out = new StringBuilder(""); String line; try { while ((line = br.readLine()) != null) { out.append(line); } } finally { br.close(); isr.close(); } return out.toString(); }
Source:
private StreamOperatorSpec(FlatMapFunction<M, OM> transformFn, OperatorSpec.OpCode opCode, String opId) { super(opCode, opId); this.transformFn = transformFn; this.userFn = transformFn; }

Target:
protected StreamOperatorSpec(FlatMapFunction<M, OM> transformFn, OperatorSpec.OpCode opCode, String opId) { super(opCode, opId); this.transformFn = transformFn; }
Source:
public boolean onCreateOptionsMenu(Menu menu) { MenuItem overflowItem = menu.add(0, MENU_OVERFLOW, 0, null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) overflowItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); overflowItem.setIcon(R.drawable.ic_menu_moreoverflow_normal_holo_light); return true; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuItem overflowItem = menu.add(0, MENU_OVERFLOW, 0, null); MenuItemCompat.setShowAsAction(overflowItem, MenuItem.SHOW_AS_ACTION_ALWAYS); overflowItem.setIcon(R.drawable.ic_menu_moreoverflow_normal_holo_light); return true; }
Source:
protected void executeCommand() { StoragePoolIsoMap map = getStoragePoolIsoMapDAO().get (new StoragePoolIsoMapId(getParameters().getStorageDomainId(), getParameters().getStoragePoolId())); changeDomainStatusWithCompensation(map, StorageDomainStatus.Unknown, StorageDomainStatus.Locked); if (shouldPerformOvfUpdate()) { Backend.getInstance().runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new StoragePoolParametersBase(getStoragePoolId())); VdcReturnValueBase tmpRetValue = runInternalActionWithTasksContext(VdcActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams(), getLock()); getReturnValue().getVdsmTaskIdList().addAll(tmpRetValue.getInternalVdsmTaskIdList()); } if (getReturnValue().getVdsmTaskIdList().isEmpty()) { executeDeactivateCommnad(); } else { setCommandShouldBeLogged(false); } setSucceeded(true); }

Target:
protected void executeCommand() { StoragePoolIsoMap map = getStoragePoolIsoMapDAO().get (new StoragePoolIsoMapId(getParameters().getStorageDomainId(), getParameters().getStoragePoolId())); changeDomainStatusWithCompensation(map, StorageDomainStatus.Unknown, StorageDomainStatus.Locked); if (shouldPerformOvfUpdate()) { runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new StoragePoolParametersBase(getStoragePoolId())); VdcReturnValueBase tmpRetValue = runInternalActionWithTasksContext(VdcActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams(), getLock()); getReturnValue().getVdsmTaskIdList().addAll(tmpRetValue.getInternalVdsmTaskIdList()); } if (getReturnValue().getVdsmTaskIdList().isEmpty()) { executeDeactivateCommnad(); } else { setCommandShouldBeLogged(false); } setSucceeded(true); }
Source:
public void testStringConcatenationWithMacroCPP() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, false); IASTProblem[] problems = tu.getPreprocessorProblems(); assertEquals(1, problems.length); assertEquals(IProblem.PREPROCESS_INVALID_USER_DEFINED_SUFFIX, problems[0].getID()); }

Target:
public void testStringConcatenationWithMacroCPP() throws Exception { IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), CPP); IASTFunctionDefinition testFn = (IASTFunctionDefinition) tu.getDeclarations()[1]; IASTCompoundStatement fnBody = (IASTCompoundStatement) testFn.getBody(); IASTFunctionCallExpression fnCall = (IASTFunctionCallExpression) ((IASTExpressionStatement)fnBody.getStatements()[0]).getExpression(); IASTLiteralExpression arg = (IASTLiteralExpression) fnCall.getArguments()[0]; assertEquals("\"aaamacro\"", arg.toString()); }
Source:
public AsyncTasks mapRow(ResultSet rs, int rowNum) throws SQLException { AsyncTasks entity = new AsyncTasks(); entity.setaction_type(VdcActionType.forValue(rs.getInt("action_type"))); entity.setresult(AsyncTaskResultEnum.forValue(rs.getInt("result"))); entity.setstatus(AsyncTaskStatusEnum.forValue(rs.getInt("status"))); entity.setTaskId(Guid.createGuidFromStringDefaultEmpty(rs.getString("task_id"))); entity.setVdsmTaskId(Guid.createGuidFromString(rs.getString("vdsm_task_id"))); entity.setActionParameters(deserializeParameters(rs.getString("action_parameters"), rs.getString("action_params_class"))); entity.setTaskParameters(deserializeParameters(rs.getString("task_parameters"), rs.getString("task_params_class"))); entity.setStepId(Guid.createGuidFromString(rs.getString("step_id"))); entity.setCommandId(Guid.createGuidFromStringDefaultEmpty(rs.getString("command_id"))); entity.setRootCommandId(Guid.createGuidFromStringDefaultEmpty(rs.getString("root_command_id"))); entity.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("started_at"))); entity.setTaskType(AsyncTaskType.forValue(rs.getInt("task_type"))); entity.setStoragePoolId(getGuidDefaultEmpty(rs, "storage_pool_id")); return entity; }

Target:
public AsyncTasks mapRow(ResultSet rs, int rowNum) throws SQLException { AsyncTasks entity = new AsyncTasks(); entity.setaction_type(VdcActionType.forValue(rs.getInt("action_type"))); entity.setresult(AsyncTaskResultEnum.forValue(rs.getInt("result"))); entity.setstatus(AsyncTaskStatusEnum.forValue(rs.getInt("status"))); entity.setTaskId(getGuidDefaultEmpty(rs, "task_id")); entity.setVdsmTaskId(getGuid(rs, "vdsm_task_id")); entity.setActionParameters(deserializeParameters(rs.getString("action_parameters"),rs.getString("action_params_class"))); entity.setTaskParameters(deserializeParameters(rs.getString("task_parameters"),rs.getString("task_params_class"))); entity.setStepId(getGuid(rs, "step_id")); entity.setCommandId(getGuidDefaultEmpty(rs, "command_id")); entity.setRootCommandId(getGuidDefaultEmpty(rs, "root_command_id")); entity.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("started_at"))); entity.setTaskType(AsyncTaskType.forValue(rs.getInt("task_type"))); entity.setStoragePoolId(getGuidDefaultEmpty(rs, "storage_pool_id")); return entity; }
Source:
public void remove(Map<String, Object> input ){ if(!(input instanceof Map)) throw new SpecException("Expected a map. Got input of type: " + input.getClass().getName()); List<String> keysToBeRemoved = getKeysToBeRemoved(input); for (String key :keysToBeRemoved){ removeByKey(input, key); } }

Target:
public void remove(Map<String, Object> input ){ if(!(input instanceof Map)) return; List<String> keysToBeRemoved = findKeysToBeRemoved(input); for (String key : keysToBeRemoved){ removeByKey(input, key); } }
Source:
public AsyncBlobStore getAsyncBlobStore(String regionId) { checkRegionId(regionId); return new org.jclouds.openstack.swift.v1.blobstore.internal.SubmissionAsyncBlobStore( blobStoreInRegion(regionId), executor); }

Target:
public AsyncBlobStore getAsyncBlobStore(String regionId) { checkRegionId(regionId); return new SubmissionAsyncBlobStore(blobStoreInRegion(regionId), executor); }
Source:
public FormController(ControllerConfigResolver configResolver) { super(configResolver.getNextUri(), configResolver.getView(), configResolver.getUri(), configResolver.getMessageSource(), configResolver.getLocaleResolver() ); this.csrfTokenManager = configResolver.getCsrfTokenManager(); this.fieldValueResolver = new ContentNegotiatingFieldValueResolver(); Assert.notNull(this.csrfTokenManager, "csrfTokenManager cannot be null."); Assert.notNull(this.fieldValueResolver, "fieldValueResolver cannot be null."); }

Target:
public FormController(ControllerConfigResolver configResolver) { super(configResolver); this.csrfTokenManager = configResolver.getCsrfTokenManager(); this.formFields = configResolver.getFormFields(); this.fieldValueResolver = new ContentNegotiatingFieldValueResolver(); Assert.notNull(this.csrfTokenManager, "csrfTokenManager cannot be null."); Assert.notNull(this.fieldValueResolver, "fieldValueResolver cannot be null."); }
Source:
private void configureProActiveDefaultConfigurationFile() { if (System.getProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName()) == null) { File defaultProActiveConfiguration = new File(System.getProperty(PAResourceManagerProperties.RM_HOME.getKey()), "config/network/node.ini"); if (defaultProActiveConfiguration.exists()) { System.setProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName(), defaultProActiveConfiguration.getAbsolutePath()); } else { System.setProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName(), RMNodeStarter.class.getResource("/config/network/node.ini").toString()); } } }

Target:
private void configureProActiveDefaultConfigurationFile() { if (System.getProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName()) == null) { File defaultProActiveConfiguration = new File(System.getProperty(PAResourceManagerProperties.RM_HOME.getKey()), CONFIG_NETWORK_NODE_PATH_RELATIVE); if (defaultProActiveConfiguration.exists()) { System.setProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName(), defaultProActiveConfiguration.getAbsolutePath()); } else { System.setProperty(CentralPAPropertyRepository.PA_CONFIGURATION_FILE.getName(), RMNodeStarter.class.getResource("/" + CONFIG_NETWORK_NODE_PATH_RELATIVE).toString()); } } }
Source:
public String resolve(IFile file, String baseLocation, String publicId, String systemId) { ICatalog catalog = JSONCorePlugin.getDefault().getDefaultJSONCatalog(); if (catalog == null) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_null_catalog); return null; } if (publicId != null || systemId != null) { return null; } if (file == null) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_malformed_url); return null; } try { return catalog.resolveSchema(file.getName()); } catch (MalformedURLException me) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_malformed_url); return null; } catch (IOException ie) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_io_exception); return null; } }

Target:
public String resolve(IFile file, String baseLocation, String publicId, String systemId) { if (publicId != null || systemId != null) { return null; } if (file == null) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_malformed_url); return null; } ICatalog catalog = JSONCorePlugin.getDefault().getDefaultJSONCatalog(); if (catalog == null) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_null_catalog); return null; } try { return catalog.resolveSchema(file.getName()); } catch (MalformedURLException me) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_malformed_url); } catch (IOException ie) { Logger.log(Logger.ERROR_DEBUG, JSONCoreMessages.Catalog_resolution_io_exception); } return null; }
Source:
private void push(DataComplex dataComplex, boolean isList) { if (_currObjSize >= 0) { _currObjSizeStack.push(_currObjSize); } if (_currObjSize == 0) { addValue(dataComplex); return; } if (!(_isCurrList || _stack.isEmpty())) { _currFieldStack.push(_currField); _currField = null; } _stack.push(dataComplex); _isCurrList = isList; updateExpected(); }

Target:
private void push(DataComplex dataComplex, boolean isList) { if (!(_isCurrList || _stack.isEmpty())) { _currFieldStack.push(_currField); _currField = null; } _stack.push(dataComplex); _isCurrList = isList; updateExpected(); }
Source:
protected List<String> updateJVMOptions() throws Exception { File jvmOptionsFile = new File(config.getJVMOptionsFileLocation()); validate(jvmOptionsFile); final GCType configuredGC = config.getGCType(); final Map<String, JVMOption> excludeSet = config.getJVMExcludeSet(); Map<String, JVMOption> upsertSet = config.getJVMUpsertSet(); List<String> optionsFromFile = Files.lines(jvmOptionsFile.toPath()).collect(Collectors.toList()); List<String> configuredOptions = new LinkedList<>(); for (String line: optionsFromFile) { configuredOptions.add(updateConfigurationValue(line, configuredGC, upsertSet, excludeSet)); } if (upsertSet != null && !upsertSet.isEmpty()) { configuredOptions.add("#################"); configuredOptions.add("# USER PROVIDED CUSTOM JVM CONFIGURATIONS #"); configuredOptions.add("#################"); configuredOptions.addAll(upsertSet.values().stream() .map(jvmOption -> jvmOption.toString()).collect(Collectors.toList())); } return configuredOptions; }

Target:
protected List<String> updateJVMOptions() throws Exception { File jvmOptionsFile = new File(config.getJVMOptionsFileLocation()); validate(jvmOptionsFile); final GCType configuredGC = config.getGCType(); final Map<String, JVMOption> excludeSet = config.getJVMExcludeSet(); Map<String, JVMOption> upsertSet = config.getJVMUpsertSet(); List<String> optionsFromFile = Files.lines(jvmOptionsFile.toPath()).collect(Collectors.toList()); List<String> configuredOptions = new LinkedList<>(); for (String line : optionsFromFile) { configuredOptions.add(updateConfigurationValue(line, configuredGC, upsertSet, excludeSet)); } if (upsertSet != null && !upsertSet.isEmpty()) { configuredOptions.add("#################"); configuredOptions.add("# USER PROVIDED CUSTOM JVM CONFIGURATIONS #"); configuredOptions.add("#################"); configuredOptions.addAll(upsertSet.values().stream() .map(jvmOption -> jvmOption.toJVMOptionString()).collect(Collectors.toList())); } return configuredOptions; }
Source:
public void testCostOfRootFileStatus() throws Throwable { Path root = path("/"); S3AFileStatus rootStatus = verifyRawInnerGetFileStatus( root, false, StatusProbeEnum.ALL, ROOT_FILE_STATUS_PROBE); Assertions.assertThat(rootStatus.isDirectory()) .describedAs("Status returned should be a directory") .isEqualTo(true); Assertions.assertThat(rootStatus.isEmptyDirectory()) .isEqualTo(Tristate.UNKNOWN); rootStatus = verifyRawInnerGetFileStatus( root, true, StatusProbeEnum.ALL, FILE_STATUS_DIR_PROBE); Assertions.assertThat(rootStatus.isDirectory()) .describedAs("Status returned should be a directory") .isEqualTo(true); Assertions.assertThat(rootStatus.isEmptyDirectory()) .isNotEqualByComparingTo(Tristate.UNKNOWN); }

Target:
public void testCostOfRootFileStatus() throws Throwable { Path root = path("/"); S3AFileStatus rootStatus = verifyRawInnerGetFileStatus( root, false, StatusProbeEnum.ALL, ROOT_FILE_STATUS_PROBE); String rootStatusContent = rootStatus.toString(); Assertions.assertThat(rootStatus.isDirectory()) .describedAs("Status returned should be a directory " + rootStatusContent) .isEqualTo(true); Assertions.assertThat(rootStatus.isEmptyDirectory()) .isEqualTo(Tristate.UNKNOWN); rootStatus = verifyRawInnerGetFileStatus( root, true, StatusProbeEnum.ALL, FILE_STATUS_DIR_PROBE); Assertions.assertThat(rootStatus.isDirectory()) .describedAs("Status returned should be a directory " + rootStatusContent) .isEqualTo(true); Assertions.assertThat(rootStatus.isEmptyDirectory()) .isNotEqualByComparingTo(Tristate.UNKNOWN); }
Source:
public void finish() { if (finished) { return; } if (indexNotNeeded == null) { PagesSpatialIndex spatialIndex = index.createPagesSpatialIndex(operatorContext.getSession(), indexChannel, spatialRelationshipTest, filterFunctionFactory, outputChannels); localUserMemoryContext.setBytes(spatialIndex.getEstimatedMemorySizeInBytes()); indexNotNeeded = pagesSpatialIndexFactory.lendPagesSpatialIndex(spatialIndex); } else if (indexNotNeeded.isDone()) { index.clear(); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes()); finished = true; } }

Target:
public void finish() { if (finishing) { return; } finishing = true; PagesSpatialIndexSupplier spatialIndex = index.createPagesSpatialIndex(operatorContext.getSession(), indexChannel, spatialRelationshipTest, filterFunctionFactory, outputChannels); localUserMemoryContext.setBytes(index.getEstimatedSize().toBytes() + spatialIndex.getEstimatedSize().toBytes()); indexNotNeeded = pagesSpatialIndexFactory.lendPagesSpatialIndex(spatialIndex); }
Source:
private static boolean isAbsolute(String url) { String pattern = "^https?://.*"; return url.matches(pattern); }

Target:
private static boolean isAbsolute(String url) { return url.matches("^https?://.*"); }
Source:
public void setData( String key, Object value ) { if( RWT.BADGE.equals( key ) && ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) { return; } else if( RWT.MARKUP_ENABLED.equals( key ) && isMarkupEnabledFor( this ) ) { return; } super.setData( key, value ); }

Target:
public void setData( String key, Object value ) { if( RWT.BADGE.equals( key ) && ( style & SWT.PUSH ) == 0 ) { return; } else if( RWT.MARKUP_ENABLED.equals( key ) && isMarkupEnabledFor( this ) ) { return; } super.setData( key, value ); }
Source:
public String removeServiceTask(ServiceTaskSummary serviceTaskSummary) { repoService.removeServiceTask(serviceTaskSummary.getId(), serviceTaskSummary.getInstalledOn().size() > 0 ? false : true); return serviceTaskSummary.getName(); }

Target:
public String removeServiceTask(ServiceTaskSummary serviceTaskSummary) { repoService.removeServiceTask(serviceTaskSummary.getId()); return serviceTaskSummary.getName(); }
Source:
public void start() throws Exception { subscriptionsCache.start(emptyList()); workTracker.start(ImmutableList.of(this)); supervisor.start(); consumersRegistry.start(); consumersRegistry.register(new BalancingJob( consumersRegistry, subscriptionsCache, new SelectiveWorkBalancer(configFactory.getIntProperty(CONSUMER_WORKLOAD_CONSUMERS_PER_SUBSCRIPTION), configFactory.getIntProperty(CONSUMER_WORKLOAD_MAX_SUBSCRIPTIONS_PER_CONSUMER)), workTracker, metrics, configFactory.getIntProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL))); logger.info("Consumer boot complete. Workload config: [{}]", configFactory.print( CONSUMER_WORKLOAD_NODE_ID, CONSUMER_WORKLOAD_ALGORITHM, CONSUMER_WORKLOAD_REBALANCE_INTERVAL, CONSUMER_WORKLOAD_CONSUMERS_PER_SUBSCRIPTION, CONSUMER_WORKLOAD_MAX_SUBSCRIPTIONS_PER_CONSUMER)); }

Target:
public void start() throws Exception { adminCache.start(); adminCache.addCallback(this); subscriptionsCache.start(emptyList()); workTracker.start(ImmutableList.of(this)); supervisor.start(); consumersRegistry.start(); consumersRegistry.registerLeaderLatchListener(new BalancingJob( consumersRegistry, subscriptionsCache, new SelectiveWorkBalancer(configFactory.getIntProperty(CONSUMER_WORKLOAD_CONSUMERS_PER_SUBSCRIPTION), configFactory.getIntProperty(CONSUMER_WORKLOAD_MAX_SUBSCRIPTIONS_PER_CONSUMER)), workTracker, metrics, configFactory.getIntProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL), configFactory.getStringProperty(KAFKA_CLUSTER_NAME))); logger.info("Consumer boot complete. Workload config: [{}]", configFactory.print( CONSUMER_WORKLOAD_NODE_ID, CONSUMER_WORKLOAD_ALGORITHM, CONSUMER_WORKLOAD_REBALANCE_INTERVAL, CONSUMER_WORKLOAD_CONSUMERS_PER_SUBSCRIPTION, CONSUMER_WORKLOAD_MAX_SUBSCRIPTIONS_PER_CONSUMER)); }
Source:
public void testMappingExclude() throws Exception { String localTable = createTable("sourcefieldexclude"); String load = loadData("sourcefieldexclude"); String ddl = "CREATE EXTERNAL TABLE fieldexclude (" + "id BIGINT, " + "name STRING)" + tableProps(resource("hive-fieldexclude", "data"), "'es.mapping.id'='id'", "'es.mapping.exclude'='id'"); String selectTest = "SELECT s.id, s.name FROM sourcefieldexclude s"; String insert = "INSERT OVERWRITE TABLE fieldexclude " + "SELECT id, name FROM sourcefieldexclude "; System.out.println(ddl); System.out.println(server.execute(ddl)); System.out.println(server.execute(localTable)); System.out.println(server.execute(load)); System.out.println(server.execute(selectTest)); System.out.println(server.execute(insert)); String docEndpoint = resource("hive-fieldexclude", "data"); if (TestUtils.isTypelessVersion(targetVersion)) { docEndpoint = docEndpoint + "/_doc"; } String string = RestUtils.get(docEndpoint + "/1"); assertThat(string, containsString("MALICE")); string = RestUtils.get(docEndpoint + "/7"); assertThat(string, containsString("Manson")); assertFalse(RestUtils.getMappings("hive-fieldexclude").getResolvedView().toString().contains("id=")); }

Target:
public void testMappingExclude() throws Exception { String localTable = createTable("sourcefieldexclude"); String load = loadData("sourcefieldexclude"); String ddl = "CREATE EXTERNAL TABLE fieldexclude (" + "id BIGINT, " + "name STRING)" + tableProps(resource("hive-fieldexclude", "data", targetVersion), "'es.mapping.id'='id'", "'es.mapping.exclude'='id'"); String selectTest = "SELECT s.id, s.name FROM sourcefieldexclude s"; String insert = "INSERT OVERWRITE TABLE fieldexclude " + "SELECT id, name FROM sourcefieldexclude "; System.out.println(ddl); System.out.println(server.execute(ddl)); System.out.println(server.execute(localTable)); System.out.println(server.execute(load)); System.out.println(server.execute(selectTest)); System.out.println(server.execute(insert)); String docEndpoint = docEndpoint("hive-fieldexclude", "data", targetVersion); String string = RestUtils.get(docEndpoint + "/1"); assertThat(string, containsString("MALICE")); string = RestUtils.get(docEndpoint + "/7"); assertThat(string, containsString("Manson")); assertFalse(RestUtils.getMappings("hive-fieldexclude").getResolvedView().toString().contains("id=")); }