-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-18455 - Change Binder.bind(InputStream, Origin) method signature …
…to bind(InputStreamAccess, Origin) to allow repeatable access to the InputStream, needed for strict Jpa XML validation HHH-18455 - Implement option to run strict JPA compliance validation Signed-off-by: Jan Schatteman <[email protected]>
- Loading branch information
Showing
34 changed files
with
511 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...e-core/src/main/java/org/hibernate/boot/archive/internal/RepeatableInputStreamAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.boot.archive.internal; | ||
|
||
|
||
import org.hibernate.HibernateException; | ||
import org.hibernate.boot.archive.spi.InputStreamAccess; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
/** | ||
* @author Jan Schatteman | ||
*/ | ||
public class RepeatableInputStreamAccess implements InputStreamAccess { | ||
|
||
private final String resourceName; | ||
private byte[] bytes = new byte[0]; | ||
|
||
public RepeatableInputStreamAccess(String resourceName, InputStream inputStream) { | ||
this.resourceName = resourceName; | ||
try { | ||
bytes = inputStream.readAllBytes(); | ||
} | ||
catch (IOException | OutOfMemoryError e) { | ||
throw new HibernateException( "Could not read resource " + resourceName, e ); | ||
} | ||
} | ||
|
||
@Override | ||
public String getStreamName() { | ||
return resourceName; | ||
} | ||
|
||
@Override | ||
public InputStream accessInputStream() { | ||
return new ByteArrayInputStream( bytes ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.