You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/04/28 04:37:45 UTC

[GitHub] [commons-bcel] timboudreau opened a new pull request, #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

timboudreau opened a new pull request, #125:
URL: https://github.com/apache/commons-bcel/pull/125

   Attempting to create a visitor over a `module-info.class` created on JDK 17.0.2, and
   visit Module and ModuleRequires instances, calling `toString(ConstantPool)` on them
   results in an `IllegalArgumentException` 100% of the time due to
   `String ConstantPool.getConstantString(int index, byte tag)` not anticipating a
   tag value of `0x01`.
   
   This patch simply adds a test if we already have a `ConstantUtf8` and if so, uses it
   as-is, which results in the correct value being returned.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1114259680

   Updated the PR branch to no longer call `StringBuilder.isEmpty()` in tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1112866491

   Updated this PR with a test which fails if you comment out the fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
garydgregory commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1112033456

   Hello @timboudreau ,
   Thank you for the PR.
   Is the instance of test really needed? 
   It would be best to have test as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1112686082

   I don't think I understand the question.
   
   Are you asking me to write a test and add it to the PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau closed pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau closed pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`
URL: https://github.com/apache/commons-bcel/pull/125


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1114260729

   I see a change that blindly casts to ConstantUtf8 has been made in the trunk, now creating a conflict with this PR.
   
   I have no idea if the blind cast is safe (it does not look like it), but regardless you may want to pick up the unit test from this PR so there is a way to detect regression.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] timboudreau commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
timboudreau commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1114302035

   The module info file in the test I provided _is_ a real module info file - just base-64 encoded.  But whatever.  Closing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
garydgregory commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1113740147

   Hi @timboudreau 
   Thank you for this PR but it does not compile, see the GitHub build failures. In the future, you should build with Java 8 to make sure code is compatible. See git master for a fix and better tests. Close this PR or rebase to provide more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [commons-bcel] garydgregory commented on pull request #125: Fix IAE when calling `toString(ConstantPool)` on a `Module` or `ModuleRequires`

Posted by GitBox <gi...@apache.org>.
garydgregory commented on PR #125:
URL: https://github.com/apache/commons-bcel/pull/125#issuecomment-1114286993

   Hi @timboudreau
   I appologize for not being clearer in my comment https://github.com/apache/commons-bcel/pull/125#issuecomment-1113740147
   
   There is now a fix and a test in git master. If you think the change and/or the test in git master is incomplete, then feel free to update this PR or create a new one, whatever is simpler for you. I did not include a typecast because it was not required for this use case and none of the other cases in the switch of the affected method use a cast. Note that the test in git master include real module-info class files.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org