Skip to content

Commit 64d9696

Browse files
committed
misc very minor consistency fixes for logging
1 parent a277548 commit 64d9696

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

hibernate-core/src/main/java/org/hibernate/boot/jaxb/internal/XmlSources.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616

1717
import org.hibernate.boot.MappingNotFoundException;
1818
import org.hibernate.boot.archive.spi.InputStreamAccess;
19-
import org.hibernate.boot.jaxb.JaxbLogger;
2019
import org.hibernate.boot.jaxb.Origin;
2120
import org.hibernate.boot.jaxb.SourceType;
2221
import org.hibernate.boot.jaxb.spi.XmlSource;
2322
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
2423

2524
import org.w3c.dom.Document;
2625

26+
import static org.hibernate.boot.jaxb.JaxbLogger.JAXB_LOGGER;
27+
2728
/**
2829
* Helper for building and handling {@link XmlSource} references.
2930
* <p>
@@ -38,7 +39,7 @@ public class XmlSources {
3839
* Create an {@link XmlSource} from a named resource
3940
*/
4041
public static XmlSource fromResource(String resourceName, ClassLoaderService classLoaderService) {
41-
JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from resource : %s", resourceName );
42+
JAXB_LOGGER.tracef( "Reading mappings from resource: %s", resourceName );
4243

4344
final Origin origin = new Origin( SourceType.RESOURCE, resourceName );
4445
final URL url = classLoaderService.locateResource( resourceName );
@@ -54,15 +55,15 @@ public static XmlSource fromResource(String resourceName, ClassLoaderService cla
5455
*/
5556
public static XmlSource fromUrl(URL url) {
5657
final String urlExternalForm = url.toExternalForm();
57-
JaxbLogger.JAXB_LOGGER.tracef( "Reading mapping document from URL : %s", urlExternalForm );
58+
JAXB_LOGGER.tracef( "Reading mapping document from URL: %s", urlExternalForm );
5859

5960
final Origin origin = new Origin( SourceType.URL, urlExternalForm );
6061
return new UrlXmlSource( origin, url );
6162
}
6263

6364
public static XmlSource fromFile(File file) {
6465
final String filePath = file.getPath();
65-
JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from file : %s", filePath );
66+
JAXB_LOGGER.tracef( "Reading mappings from file: %s", filePath );
6667

6768
final Origin origin = new Origin( SourceType.FILE, filePath );
6869

@@ -87,29 +88,29 @@ public static XmlSource fromCacheableFile(File file, boolean strict) {
8788

8889
public static XmlSource fromCacheableFile(File file, File cacheableDir, boolean strict) {
8990
final String filePath = file.getPath();
90-
JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from cacheable-file : %s", filePath );
91+
JAXB_LOGGER.tracef( "Reading mappings from cacheable file: %s", filePath );
9192

9293
final Origin origin = new Origin( SourceType.FILE, filePath );
9394
return new CacheableFileXmlSource( origin, file, cacheableDir, strict );
9495
}
9596

9697
public static XmlSource fromStream(InputStreamAccess inputStreamAccess) {
9798
final String streamName = inputStreamAccess.getStreamName();
98-
JaxbLogger.JAXB_LOGGER.tracef( "reading mappings from InputStreamAccess : %s", streamName );
99+
JAXB_LOGGER.tracef( "Reading mappings from InputStreamAccess: %s", streamName );
99100

100101
final Origin origin = new Origin( SourceType.INPUT_STREAM, streamName );
101102
return new InputStreamAccessXmlSource( origin, inputStreamAccess );
102103
}
103104

104105
public static XmlSource fromStream(InputStream inputStream) {
105-
JaxbLogger.JAXB_LOGGER.trace( "reading mappings from InputStream" );
106+
JAXB_LOGGER.trace( "reading mappings from InputStream" );
106107

107108
final Origin origin = new Origin( SourceType.INPUT_STREAM, null );
108109
return new InputStreamXmlSource( origin, inputStream, false );
109110
}
110111

111112
public static XmlSource fromDocument(Document document) {
112-
JaxbLogger.JAXB_LOGGER.trace( "reading mappings from DOM" );
113+
JAXB_LOGGER.trace( "reading mappings from DOM" );
113114
final Origin origin = new Origin( SourceType.DOM, Origin.UNKNOWN_FILE_PATH );
114115
return new JaxpSourceXmlSource( origin, new DOMSource( document ) );
115116
}
@@ -125,7 +126,7 @@ public static XmlSource fromDocument(Document document) {
125126
* @param consumer a consumer of the resulting {@linkplain XmlSource XML sources}
126127
*/
127128
public static void fromJar(File jar, Consumer<XmlSource> consumer) {
128-
JaxbLogger.JAXB_LOGGER.tracef( "Seeking mapping documents in jar file : %s", jar.getName() );
129+
JAXB_LOGGER.tracef( "Seeking mapping documents in jar file: %s", jar.getName() );
129130

130131
final Origin origin = new Origin( SourceType.JAR, jar.getAbsolutePath() );
131132

@@ -134,7 +135,7 @@ public static void fromJar(File jar, Consumer<XmlSource> consumer) {
134135
while ( entries.hasMoreElements() ) {
135136
final JarEntry jarEntry = entries.nextElement();
136137
if ( jarEntry.getName().endsWith(".hbm.xml") ) {
137-
JaxbLogger.JAXB_LOGGER.tracef( "Found hbm.xml mapping in jar : %s", jarEntry.getName() );
138+
JAXB_LOGGER.tracef( "Found 'hbm.xml' mapping in jar: %s", jarEntry.getName() );
138139
consumer.accept( new JarFileEntryXmlSource( origin, jarFile, jarEntry ) );
139140
}
140141
}

hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public HbmResultSetMappingDescriptor(
105105

106106
if ( hbmValueMapping == null ) {
107107
throw new IllegalStateException(
108-
"ValueMappingSources contained null reference(s)"
108+
"ValueMappingSources contained null reference"
109109
);
110110
}
111111

@@ -138,7 +138,7 @@ else if ( hbmValueMapping instanceof JaxbHbmNativeQueryScalarReturnType hbmScala
138138
}
139139
else {
140140
throw new IllegalArgumentException(
141-
"Unknown NativeQueryReturn type : " + hbmValueMapping.getClass().getName()
141+
"Unknown NativeQueryReturn type: " + hbmValueMapping.getClass().getName()
142142
);
143143
}
144144
}
@@ -158,13 +158,13 @@ public static void collectJoinFetch(
158158
Map<String, HbmFetchParent> fetchParentByAlias,
159159
String registrationName,
160160
MetadataBuildingContext context) {
161-
// property path is in the form `{ownerAlias}.{joinedPath}`. Split it into the 2 parts
161+
// property path is in the form {ownerAlias}.{joinedPath}. Split it into the 2 parts.
162162
final String fullPropertyPath = jaxbHbmJoin.getProperty();
163163
final int firstDot = fullPropertyPath.indexOf( '.' );
164164
if ( firstDot < 1 ) {
165165
throw new MappingException(
166-
"Illegal <return-join/> property attribute: `" + fullPropertyPath + "`. Should"
167-
+ "be in the form `{ownerAlias.joinedPropertyPath}` (" + registrationName + ")"
166+
"Illegal <return-join/> property attribute: '" + fullPropertyPath + "' - "
167+
+ " - should be in the form '{ownerAlias.joinedPropertyPath}' (" + registrationName + ")"
168168
);
169169
}
170170

@@ -182,8 +182,8 @@ public static void collectJoinFetch(
182182
final JoinDescriptor existing = joinDescriptorsForAlias.get( propertyPath );
183183
if ( existing != null ) {
184184
throw new MappingException(
185-
"Property join specified twice for join-return `" + ownerTableAlias + "." + propertyPath
186-
+ "` (" + registrationName + ")"
185+
"Property join specified twice for join-return '" + ownerTableAlias + "." + propertyPath
186+
+ "' (" + registrationName + ")"
187187
);
188188
}
189189

@@ -200,8 +200,8 @@ public static void collectJoinFetch(
200200

201201

202202
/**
203-
* Constructor for an implicit resultset mapping defined inline as part of a `&lt;sql-query/&gt;`
204-
* stanza
203+
* Constructor for an implicit resultset mapping defined inline
204+
* as part of a '&lt;sql-query/&gt;' stanza.
205205
*/
206206
public HbmResultSetMappingDescriptor(
207207
String registrationName,
@@ -269,7 +269,7 @@ public NamedResultSetMappingMemento resolve(ResultSetMappingResolutionContext re
269269

270270

271271
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272-
// `hbm.xml` returns
272+
// hbm.xml returns
273273

274274
public interface HbmFetchDescriptor extends FetchDescriptor {
275275
String getFetchablePath();
@@ -722,8 +722,8 @@ public JoinDescriptor(
722722
final int firstDot = fullPropertyPath.indexOf( '.' );
723723
if ( firstDot < 1 ) {
724724
throw new MappingException(
725-
"Illegal <return-join/> property attribute: `" + fullPropertyPath + "`. Should"
726-
+ "be in the form `{ownerAlias.joinedPropertyPath}`"
725+
"Illegal <return-join/> property attribute: '" + fullPropertyPath + "'"
726+
+ " - should be in the form '{ownerAlias.joinedPropertyPath}'"
727727
);
728728
}
729729

hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/LobCreationHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private static boolean canCreateClob(Connection jdbcConnection) {
8686
clob.free();
8787
}
8888
catch (Throwable e) {
89-
LOB_LOGGER.tracef( "Unable to free CLOB created to test createClob() implementation : %s", e );
89+
LOB_LOGGER.tracef( "Unable to free CLOB created to test createClob() implementation: %s", e );
9090
}
9191
return true;
9292
}
@@ -104,7 +104,7 @@ private static boolean canCreateNClob(Connection jdbcConnection) {
104104
clob.free();
105105
}
106106
catch (Throwable e) {
107-
LOB_LOGGER.tracef( "Unable to free NCLOB created to test createNClob() implementation : %s", e );
107+
LOB_LOGGER.tracef( "Unable to free NCLOB created to test createNClob() implementation: %s", e );
108108
}
109109
return true;
110110
}

0 commit comments

Comments
 (0)