Skip to content

Commit 9955a22

Browse files
committed
Ignore container encoding when checking if an encoding is already set
If the container encoding is not ignored it can happen that for example a project's encoding is not set if the workspace preference matches the encoding defined in the pom.xml. Follow-up on #1758
1 parent 76387da commit 9955a22

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ private void updateProjectConfiguration(ProjectConfigurationRequest request, IPr
489489
MavenProject mavenProject = request.mavenProject();
490490
Properties mavenProperties = mavenProject.getProperties();
491491
String sourceEncoding = mavenProperties.getProperty("project.build.sourceEncoding");
492-
if(!Objects.equals(project.getDefaultCharset(), sourceEncoding)) {
492+
if(!Objects.equals(project.getDefaultCharset(false), sourceEncoding)) {
493493
log.debug("Setting encoding for project {}: {}", project.getName(), sourceEncoding); //$NON-NLS-1$
494494
project.setDefaultCharset(sourceEncoding, monitor);
495495
}

org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ protected void addSourceDirs(IClasspathDescriptor classpath, IProject project, L
478478
}
479479

480480
// Set folder encoding (null = platform/container default)
481-
if(sourceFolder.exists() && !Objects.equals(sourceFolder.getDefaultCharset(), sourceEncoding)) {
481+
if(sourceFolder.exists() && !Objects.equals(sourceFolder.getDefaultCharset(false), sourceEncoding)) {
482482
sourceFolder.setDefaultCharset(sourceEncoding, monitor);
483483
}
484484

@@ -573,7 +573,7 @@ private void addResourceDirs(IClasspathDescriptor classpath, IProject project, M
573573
addResourceFolder(classpath, path, outputPath, addTestFlag);
574574
}
575575
// Set folder encoding (null = platform default)
576-
if(r.exists() && !Objects.equals(r.getDefaultCharset(), resourceEncoding)) {
576+
if(r.exists() && !Objects.equals(r.getDefaultCharset(false), resourceEncoding)) {
577577
r.setDefaultCharset(resourceEncoding, monitor);
578578
}
579579
} else {

0 commit comments

Comments
 (0)