File tree Expand file tree Collapse file tree
core-java-modules/core-java-exceptions-3
src/main/java/com/baeldung/unknownsourcestacktrace Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424 </dependency >
2525 </dependencies >
2626
27+ <build >
28+ <plugins >
29+ <plugin >
30+ <groupId >org.apache.maven.plugins</groupId >
31+ <artifactId >maven-compiler-plugin</artifactId >
32+ <version >3.8.1</version >
33+ <configuration >
34+ <compilerArgs >
35+ <!-- Comment the arg below to print complete stack trace information -->
36+ <!-- <arg>-g:none</arg>-->
37+ </compilerArgs >
38+ </configuration >
39+ </plugin >
40+ </plugins >
41+ </build >
42+
2743 <properties >
2844 <h2 .version>1.4.191</h2 .version>
2945 </properties >
Original file line number Diff line number Diff line change 1+ package com .baeldung .unknownsourcestacktrace ;
2+
3+ import com .baeldung .unknownsourcestacktrace .dto .User ;
4+ import org .slf4j .Logger ;
5+ import org .slf4j .LoggerFactory ;
6+
7+ public class Main {
8+ private static final Logger logger = LoggerFactory .getLogger (Main .class );
9+ private static final int SHORT_NAME_LIMIT = 10 ;
10+
11+ public static void main (String [] args ) {
12+ User user = new User ();
13+ user .setName ("Tom" );
14+
15+ logger .info (getGreetingMessage (user .getName ()));
16+ }
17+
18+ private static String getGreetingMessage (String name ) {
19+ return "Welcome " + getShortenedName (name ) + "!" ;
20+ }
21+
22+ private static String getShortenedName (String name ) {
23+ return name .substring (0 , SHORT_NAME_LIMIT );
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .unknownsourcestacktrace .dto ;
2+
3+ public class User {
4+ private String name ;
5+
6+ public String getName () {
7+ return name ;
8+ }
9+
10+ public void setName (String name ) {
11+ this .name = name ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments