Skip to content

Series Import: DataIntegrityViolationException for a long URL #990

Closed
@php-coder

Description

@php-coder

We have mismatched length for the following fields:

  • series_import_requests.url varchar(767)
  • series_sales.transaction_url varchar(255)
    And when we import a series with a URL longer than 255 characters, we get DataIntegrityViolationException.

Steps to reproduce:

  1. run wiremock server: mvn wiremock:run -DkeepRunning=true
  2. login as admin
  3. go to import series page (http://localhost:8080/series/import/request)
  4. import a page with a URL longer than 255 characters:
    http://127.0.0.1:8888/series/import/request-logic/new-seller.html?test=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
  5. on the next page, submit a form with provided data

Actual result:

  • "Internal server error" page is shown
  • the server outputs the error:
Caused by: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO series_sales ( series_id , date , seller_id , transaction_url , first_price , first_currency , second_price , second_currency , buyer_id , created_at , created_by ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )]; Value too long for column "TRANSACTION_URL VARCHAR(255)": "'http://127.0.0.1:8888/series/import/request-logic/new-seller.html?test=01234567890123456789012345678901234567890123456789012345... (261)"; SQL statement:
INSERT INTO series_sales ( series_id , date , seller_id , transaction_url , first_price , first_currency , second_price , second_currency , buyer_id , created_at , created_by ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) [22001-197]; nested exception is org.h2.jdbc.JdbcSQLException: Value too long for column "TRANSACTION_URL VARCHAR(255)": "'http://127.0.0.1:8888/series/import/request-logic/new-seller.html?test=01234567890123456789012345678901234567890123456789012345... (261)"; SQL statement:
INSERT INTO series_sales ( series_id , date , seller_id , transaction_url , first_price , first_currency , second_price , second_currency , buyer_id , created_at , created_by ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) [22001-197]

Expected result:

  • Page should be imported successfully

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions