Skip to content

Conversation

nburnwal09
Copy link

This is to provide a quick fix for situations when no space is added after the colon in the MANIFEST.MF file, and the value is entered by the user.

For example, in line 12, there is no space after the colon before the value 'test'. To address this, we are providing a quick fix to add a space there, as shown below:

Attaching the screenshot before and after applying the quick fix.

image image

Copy link

github-actions bot commented Feb 27, 2025

Test Results

   765 files  +  147     765 suites  +147   56m 46s ⏱️ + 5m 52s
 3 611 tests ±    0   3 557 ✅ +    1   54 💤 ± 0  0 ❌  - 1 
10 833 runs  +2 650  10 670 ✅ +2 627  163 💤 +24  0 ❌  - 1 

Results for commit 0b900f2. ± Comparison against base commit 09b7f61.

♻️ This comment has been updated with latest results.

@nburnwal09
Copy link
Author

Can anyone please review this PR?
It is a small quick fix, but quite useful for developers.

Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It generally looks quite fine to me. I've not had time to actually try it in the IDE. Maybe later today or tomorrow. Sorry no one has looked that is so far.

public static final int M_EXEC_ENV_TOO_LOW = 0x1029; // other problem
public static final int M_CONFLICTING_AUTOMATIC_MODULE = 0x1030; // other
// problem
public static final int M_NO_SPACE_AFTER_COLON = 0x1032; // other problem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this is 1032 and not 1031?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have raised PR for a few other quick fixes too. Still in review.
Adding the 1031 PR here: https://github.com/eclipse-pde/eclipse.pde/pull/1625/files

@nburnwal09
Copy link
Author

nburnwal09 commented May 12, 2025

Hi @merks ,
Could you please review this PR's when you have some time.

@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch from bc5e11b to c006664 Compare May 27, 2025 10:19
@eclipse-pde-bot
Copy link
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 321f59708ea10a530d5ea2635a322a89313ca37c Mon Sep 17 00:00:00 2001
From: Eclipse PDE Bot <[email protected]>
Date: Thu, 5 Jun 2025 08:40:23 +0000
Subject: [PATCH] Version bump(s) for 4.37 stream


diff --git a/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
index 0d96f8a730..61b5e3c6e3 100644
--- a/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
+++ b/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %name
 Bundle-SymbolicName: org.eclipse.pde.core; singleton:=true
-Bundle-Version: 3.20.200.qualifier
+Bundle-Version: 3.20.300.qualifier
 Bundle-Activator: org.eclipse.pde.internal.core.PDECore
 Bundle-Vendor: %provider-name
 Bundle-Localization: plugin
diff --git a/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF
index 645e581c4d..69ac002d3d 100644
--- a/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF
+++ b/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %name
 Bundle-SymbolicName: org.eclipse.pde.ui; singleton:=true
-Bundle-Version: 3.16.100.qualifier
+Bundle-Version: 3.16.200.qualifier
 Bundle-Activator: org.eclipse.pde.internal.ui.PDEPlugin
 Bundle-Vendor: %provider-name
 Bundle-Localization: plugin
-- 
2.49.0

Further information are available in Common Build Issues - Missing version increments.

@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch from e115ec2 to baddcfa Compare June 9, 2025 07:25
return;
}
if (line.length() < colon + 2 || line.charAt(colon + 1) != ' ') {
report(PDECoreMessages.BundleErrorReporter_noSpaceValue, lineNumber, CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does BundleErrorReporter_noSpaceValue become unused as a result of this change?

It's defined as

BundleErrorReporter_noSpaceValue = Single space and a value is required after the header name

But the new property doesn't sound like a description of the error but rare a description of what the quick fix will do:

AddSpaceAfterColon_add=Add a space after the colon

report(PDECoreMessages.BundleErrorReporter_invalidHeaderName, lineNumber, CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL);
return;
}
if (line.length() >= colon + 2 && line.charAt(colon + 1) != ' ') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear why you changing the condition under which an error is generated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is added to check if there is a space after the ':' and just before the value part.
If not, error is thrown saying 'Single space is required after the
colon' via PDECoreMessages.BundleErrorReporter_noSpaceAfterColon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, silly me. It's an addition. Sorry.

@merks merks requested a review from HannesWell June 9, 2025 07:43
@nburnwal09 nburnwal09 requested a review from merks June 9, 2025 08:33
}

} catch (Exception e) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to just catch any exception and then just ignore it. What exception might be of concern here? I guess BadLocationException, which shouldn't be possible given the guards, but better that's more clear.

@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch 2 times, most recently from ea36cfd to a8f0994 Compare June 10, 2025 09:33
@nburnwal09 nburnwal09 requested a review from merks June 10, 2025 09:34
try {
IDocument doc = model.getDocument();
int lineNum;
lineNum = (int) marker.getAttribute(IMarker.LINE_NUMBER);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to figure out where the CoreException comes, and it's here. Probably better to use org.eclipse.core.resources.IMarker.getAttribute(String, int)` which doesn't throw an exception and returns an int.

I'm also not sure why you split the variable declaration from the variable initialization. That doesn't look so nice.

doc.replace(offset, colonInd + 1, userHeader);
}
} catch (BadLocationException e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack trace printing is almost always a bad idea because unless one monitoring the running IDE with a console, you want see this and then the operation quietly does nothing with no logged details about why.

@merks
Copy link
Contributor

merks commented Jun 10, 2025

BTW, what I find often very useful is to search the SDK workspace for similar things.

image

image

I have a feeling from all the failures that this need to be rebased.

If you properly test that the location cannot be bad, then it's okay to have just a comment saying the location has been checked to ensure that it cannot be a bad location.

@nburnwal09
Copy link
Author

@merks
| have addressed all the suggestions. Please have a look.

@nburnwal09 nburnwal09 requested a review from merks June 10, 2025 17:30
@nburnwal09
Copy link
Author

Hi @merks
I have addressed all your suggestion. Can you please review it?

} catch (BadLocationException e) {
// the location has been checked to ensure that it cannot be a bad
// location
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this can never happen because guards or it should be logged, but not just printed to the console.

@nburnwal09
Copy link
Author

Hi @merks
Can you review the PR? I have made all the necessary changes

@nburnwal09 nburnwal09 requested a review from merks June 23, 2025 09:30
@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch from ca6863f to 7aedfb6 Compare July 3, 2025 06:49
@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch 2 times, most recently from 03a64a3 to f51785a Compare July 31, 2025 06:00
@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch 2 times, most recently from 60ea554 to 6f46999 Compare August 5, 2025 08:20
@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch 3 times, most recently from ee3bde3 to 011febc Compare August 8, 2025 08:47
@nburnwal09
Copy link
Author

@merks kindly review this PR.

Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good. Needs the copyright/license header for the new file.

@@ -0,0 +1,50 @@
package org.eclipse.pde.internal.ui.correction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright/license header.

@nburnwal09 nburnwal09 force-pushed the QuickFix_addSpace branch 2 times, most recently from ee3bde3 to fc9cc6b Compare August 13, 2025 00:47
@nburnwal09 nburnwal09 requested a review from merks August 19, 2025 08:26
Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It generally looks fine, but I didn't have time to test it.

@gireeshpunathil gireeshpunathil merged commit 9213517 into eclipse-pde:master Sep 17, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants