小编Pra*_*ara的帖子

DynamoDbException:条件的长度只能为 1 或 2

我有 SQL 背景,对 Dynamodb 非常陌生。我有一个像这样的表:

-----------------------------------------------------------
 | dbId | genId | colData | deviceId | updateOn | params |
-----------------------------------------------------------
 |      |       |         |          |          |        |
 ----------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

dbId是主键,genId是排序键。deviceId我在和中创建了两个本地二级索引updateOn。在 SQL 中我可以从表中查询:

String dbId  = "151/2020-21";
int deviceId = 1001;
long updOn   = 1608456211308;
String query = "select * from tableName where dbId = '"+dbId+"' and deviceId != "+deviceId+" and updateOn > " + updOn;
Run Code Online (Sandbox Code Playgroud)

在 DynamoDb 中,我的 keyConditionExpression 是dbId = :dbId …

amazon-web-services amazon-dynamodb

11
推荐指数
2
解决办法
9060
查看次数

java.lang.IllegalArgumentException:类java.text.DecimalFormat声明多个名为maximumIntegerDigits的JSON字段

我正在对servlet进行ajax调用。我希望数据从servlet返回到jsp:

PrintWriter out = response.getWriter();
    String isbn = (String) request.getParameter("isbn");
    BookDetail bd = new BookDetail();
    if(bd.ISBNFound(isbn)){
    ArrayList<KitapData> Books = bd.LoadBooksByISBN(isbn);

    Gson gson = new Gson();
    String json = gson.toJson(Books);
    response.setContentType("application/json");
    System.out.print(json);      
    out.print(json);
}
Run Code Online (Sandbox Code Playgroud)

我在类路径中添加了GSon.jar。但是我遇到了一些错误:完整列表如下:我在这里缺少什么?

WARNING:   StandardWrapperValve[Book_CheckISBN]: Servlet.service() for servlet Book_CheckISBN threw exception
java.lang.IllegalArgumentException: class java.text.DecimalFormat declares multiple JSON fields named maximumIntegerDigits
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:122)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
    at com.google.gson.Gson.getAdapter(Gson.java:356)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.<init>(ReflectiveTypeAdapterFactory.java:82)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:81)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:118)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72)
    at com.google.gson.Gson.getAdapter(Gson.java:356)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:55)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:96)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:60)
    at com.google.gson.Gson.toJson(Gson.java:593)
    at com.google.gson.Gson.toJson(Gson.java:572)
    at com.google.gson.Gson.toJson(Gson.java:527)
    at …
Run Code Online (Sandbox Code Playgroud)

java illegalargumentexception decimalformat gson

4
推荐指数
2
解决办法
7668
查看次数

OpenCSV解析不显示特殊字符

我正在尝试在jTable中加载.csv文件。在记事本中,该文件显示为OK,但是在jTable中,某些字符(如“£”,“ $”)变为一个框。

private void parseUsingOpenCSV(String filename){

DefaultTableModel model = (DefaultTableModel) empTbl.getModel();
int rows = model.getRowCount();
if (rows>0){
for(int i=0 ; i<rows; i++)
{model.removeRow(0);}
}   

    try {
        CSVReader reader = new CSVReader(new FileReader(filename));
        String [] nextLine;
        int rowNumber = 0;

        while ((nextLine = reader.readNext()) != null) {
            rowNumber++;
                model.addRow(new Object[]{nextLine[0], nextLine[1], nextLine[2], nextLine[3], nextLine[4], nextLine[5], nextLine[6], nextLine[7]});
        }
    } catch (IOException e) {
    System.out.println(e);
    }
}
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题 ?

java swing jtable opencsv

3
推荐指数
1
解决办法
2750
查看次数

从java中的服务器下载文件

在我的java应用程序中,我使用以下方法从服务器下载文件.

public void kitapJar(){
    File f = new File("C:/PubApp_2.0/update/lib/kitap.jar");
    try{

    URL kitap = new URL("http://example.com/update/PubApp_2.0.jar");
    org.apache.commons.io.FileUtils.copyURLToFile(kitap, f);   
    }
    catch(IOException ex){
    System.out.println("Error...!!");}
    }
   } 
Run Code Online (Sandbox Code Playgroud)

但是这个下载非常慢.我怎样才能让它快速?

java download

2
推荐指数
1
解决办法
3万
查看次数

Thread.sleep(1000)无法在Swing中工作

我在java swing中有一个简单的动画程序.但它没有用.

    try{
    for(int i = 1; i<=500; i++){    
    ImageIcon icon = new ImageIcon("img\\COVERFront.jpg");
    Image image = icon.getImage();
    Image scaled =  image.getScaledInstance(400, i, 0);
    jLabel2.setIcon(new ImageIcon(scaled));
    Thread.sleep(1000);
    }
    }
    catch(InterruptedException ie){}
Run Code Online (Sandbox Code Playgroud)

我在netbeans 7.1工作.

java animation swing multithreading

1
推荐指数
1
解决办法
1370
查看次数