- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.springframework.batch.item.WriteFailedException.<init>()
方法的一些代码示例,展示了WriteFailedException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WriteFailedException.<init>()
方法的具体详情如下:
包路径:org.springframework.batch.item.WriteFailedException
类名称:WriteFailedException
方法名:<init>
[英]Create a new WriteFailedException based on a message.
[中]基于消息创建新的WriteFailedException。
代码示例来源:origin: spring-projects/spring-batch
@Override
public void write(List<? extends Trade> trades) {
for (Trade trade : trades) {
log.debug(trade);
dao.writeTrade(trade);
Assert.notNull(trade.getPrice(), "price must not be null"); // There must be a price to total
if (this.failingCustomers.contains(trade.getCustomer())) {
throw new WriteFailedException("Something unexpected happened!");
}
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Convenience method for clients to determine if there is any unflushed
* data.
*
* @return the current size (in bytes) of unflushed buffered data
*/
public long getBufferSize() {
if (!transactionActive()) {
return 0L;
}
try {
return getCurrentBuffer().toString().getBytes(encoding).length;
} catch (UnsupportedEncodingException e) {
throw new WriteFailedException("Could not determine buffer size because of unsupported encoding: " + encoding, e);
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Write the value objects and flush them to the file.
*
* @param items the value object
*
* @throws IOException thrown if general error occurs.
* @throws XmlMappingException thrown if error occurs during XML Mapping.
*/
@Override
public void write(List<? extends T> items) throws XmlMappingException, IOException {
if(!this.initialized) {
throw new WriterNotOpenException("Writer must be open before it can be written to");
}
currentRecordCount += items.size();
for (Object object : items) {
Assert.state(marshaller.supports(object.getClass()),
"Marshaller must support the class of the marshalled object");
Result result = createStaxResult();
marshaller.marshal(object, result);
}
try {
eventWriter.flush();
if (forceSync) {
channel.force(false);
}
}
catch (XMLStreamException | IOException e) {
throw new WriteFailedException("Failed to flush the events", e);
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Writes out a string followed by a "new line", where the format of the new
* line separator is determined by the underlying operating system.
*
* @param items list of items to be written to output stream
* @throws Exception if an error occurs while writing items to the output stream
*/
@Override
public void write(List<? extends T> items) throws Exception {
if (!getOutputState().isInitialized()) {
throw new WriterNotOpenException("Writer must be open before it can be written to");
}
if (logger.isDebugEnabled()) {
logger.debug("Writing to file with " + items.size() + " items.");
}
OutputState state = getOutputState();
String lines = doWrite(items);
try {
state.write(lines);
}
catch (IOException e) {
throw new WriteFailedException("Could not write data. The file may be corrupt.", e);
}
state.setLinesWritten(state.getLinesWritten() + items.size());
}
代码示例来源:origin: spring-projects/spring-batch
/**
* condition: skippable < fatal; exception is skippable
*
* expected: true
*/
@Test
public void testSkippableSubset_skippable() throws Exception {
assertTrue(getSkippableSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}
代码示例来源:origin: spring-projects/spring-batch
/**
* condition: skippable < fatal; exception is skippable
*
* expected: true
*/
@Test
public void testSkippableSubset_skippable() {
assertTrue(getSkippableSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}
代码示例来源:origin: spring-projects/spring-batch
/**
* condition: fatal < skippable; exception is fatal
*
* expected: false
*/
@Test
public void testFatalSubsetFatal() throws Exception {
assertFalse(getFatalSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}
代码示例来源:origin: spring-projects/spring-batch
/**
* condition: fatal < skippable; exception is fatal
*
* expected: false
*/
@Test
public void testFatalSubset_fatal() {
assertFalse(getFatalSubsetSkipPolicy().shouldSkip(new WriteFailedException(""), 0));
}
}
代码示例来源:origin: spring-projects/spring-hadoop-samples-old
/**
* Extracts the payload as a byte array.
* @param message
* @return
*/
private byte[] getItemsAsBytes(List<? extends T> items) {
StringBuilder lines = new StringBuilder();
for (T item: items) {
lines.append(lineAggregator.aggregate(item) + lineSeparator);
}
try {
return lines.toString().getBytes(this.charset);
} catch (UnsupportedEncodingException e) {
throw new WriteFailedException("Could not write data.", e);
}
}
代码示例来源:origin: spring-projects/spring-hadoop-samples-old
/**
* Extracts the payload as a byte array.
* @param message
* @return
*/
private byte[] getItemsAsBytes(List<? extends T> items) {
StringBuilder lines = new StringBuilder();
for (T item: items) {
lines.append(lineAggregator.aggregate(item) + lineSeparator);
}
try {
return lines.toString().getBytes(this.charset);
} catch (UnsupportedEncodingException e) {
throw new WriteFailedException("Could not write data.", e);
}
}
代码示例来源:origin: com.github.almex/raildelays-batch
@Override
public boolean doWrite(T item) throws Exception {
T previousRow = null;
if (item != null) {
try {
previousRow = rowAggregator.aggregate(item, workbook, sheetIndex, getCurrentItemIndex());
LOGGER.trace("Previous row={}", previousRow);
} catch (Exception e) {
throw new WriteFailedException("We were not able to write in the Excel file", e);
}
}
return previousRow == null;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Convenience method for clients to determine if there is any unflushed
* data.
*
* @return the current size (in bytes) of unflushed buffered data
*/
public long getBufferSize() {
if (!transactionActive()) {
return 0L;
}
try {
return getCurrentBuffer().toString().getBytes(encoding).length;
} catch (UnsupportedEncodingException e) {
throw new WriteFailedException("Could not determine buffer size because of unsupported encoding: " + encoding, e);
}
}
代码示例来源:origin: uk.ac.ebi.intact.dataexchange/intact-tasks
throw new WriteFailedException("You must open the writer before writing files.");
代码示例来源:origin: apache/servicemix-bundles
/**
* Write the value objects and flush them to the file.
*
* @param items the value object
*
* @throws IOException thrown if general error occurs.
* @throws XmlMappingException thrown if error occurs during XML Mapping.
*/
@Override
public void write(List<? extends T> items) throws XmlMappingException, IOException {
if(!this.initialized) {
throw new WriterNotOpenException("Writer must be open before it can be written to");
}
currentRecordCount += items.size();
for (Object object : items) {
Assert.state(marshaller.supports(object.getClass()),
"Marshaller must support the class of the marshalled object");
Result result = createStaxResult();
marshaller.marshal(object, result);
}
try {
eventWriter.flush();
if (forceSync) {
channel.force(false);
}
}
catch (XMLStreamException | IOException e) {
throw new WriteFailedException("Failed to flush the events", e);
}
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Writes out a string followed by a "new line", where the format of the new
* line separator is determined by the underlying operating system.
*
* @param items list of items to be written to output stream
* @throws Exception if an error occurs while writing items to the output stream
*/
@Override
public void write(List<? extends T> items) throws Exception {
if (!getOutputState().isInitialized()) {
throw new WriterNotOpenException("Writer must be open before it can be written to");
}
if (logger.isDebugEnabled()) {
logger.debug("Writing to file with " + items.size() + " items.");
}
OutputState state = getOutputState();
String lines = doWrite(items);
try {
state.write(lines);
}
catch (IOException e) {
throw new WriteFailedException("Could not write data. The file may be corrupt.", e);
}
state.setLinesWritten(state.getLinesWritten() + items.size());
}
这里我试图在 FlatList 中显示一个名为“posts”的数组。 render() { console.log(this.props.posts); return (
这是我的代码: {{day(list)}} {{list.weather[0].description}}
我是 Mahout 的新手,并且仍在使用它。 我的问题是,将 Item-Item 和 User-Item 结合起来是否合适? 我的用例是,一个社交网络应用会尝试根据用户历史数据(优先级较高)为当前用户
下午好, 我按数据库搜索以测试特定类测试,当我放置一个新项目时,如果列表包含该项目。 @Test public void insertAndDeleteTask() throws Interrupte
我有一个关于 ionic 框架的问题,我希望有人能帮助我...我有一个带有“ion-item-right”的 ionic 列表。这一切都可以,按钮在右边。现在我需要其他三个居中的图标,这样我就有了:文
我经常遇到类似下面的代码: if ( items != null) { foreach(T item in items) { //... } } 基本上,if 条件确
我最近问了a question about LocalStorage .使用 JSON.parse(localStorage.item) 和 JSON.parse(localStorage['item
我最近问了a question about LocalStorage .使用 JSON.parse(localStorage.item) 和 JSON.parse(localStorage['item
这个问题已经有答案了: Type mismatch: cannot convert from Item to Item (1 个回答) 已关闭 7 年前。 我很困惑。我无法将外部类的实例变量 Node
我目前正在使用 MUI Grid(但我对替代解决方案持开放态度)并且我想要并排放置两个组件:最右边的组件占 400px宽度和左侧组件占据其余部分。 || || || 当页面宽度缩小时: | | ||
我最近问过a question about LocalStorage 。使用 JSON.parse(localStorage.item) 和 JSON.parse(localStorage['item
public class Document extends Model { ... @ManyToMany public Set accessors; ... } 我想选择访问者包含某个用户的所有文档
我正在使用 selenium webdriver 为单页 Web 应用程序开发一个 Java 框架,使用以下模式:PageObject、SlowLoadableComponent(责任链)、PageF
最近在学习C,在网上发现了一个问题。问题是: What is the problem with this function in terms of memory allocation? What is
我有这个代码 ( -1 ? true : false} /> {genre.item.name}
在ASP.Net中使用DataGrid时真的没有快捷方法吗 (e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.A
我正在使用工作流程根据数据和一组要求将大量 pdf 从一个位置复制到其他大坝位置。我正在使用以下代码 Assets damAsset = manager.createAsset(path, is, m
我是 PowerShell 的新手。 我正在尝试自动将 dll 组件从源服务器上的文件夹部署到目标服务器上的多个文件夹。这看起来应该很简单:将组件从源服务器上的源(部署)文件夹复制到目标服务器上的文件
我的代码: for column_name, column_data in summary_words.iteritems(): if column_name != "summary" and
我的代码: for column_name, column_data in summary_words.iteritems(): if column_name != "summary" and
我是一名优秀的程序员,十分优秀!