java.lang.UnsupportedOperationException

Jenkins JIRA | rpo | 6 years ago
  1. 0

    Note: I was able to workaround this issue, and the workaround code is enclosed below. When trying to build a Java project (any Java project) using an Ant build step from within Hudson, the build fails with the following error: -------------------------------------------------- Started by user anonymous [workspace] $ cvsnt -q update -PdC -D "Saturday, March 27, 2010 4:11:43 AM UTC" ? ${build.dir} ? ${dist.dir} $ no changes detected Deleting old artifacts from #36 FATAL: null java.lang.UnsupportedOperationException at java.util.AbstractMap$SimpleImmutableEntry.setValue(AbstractMap.java:726) at hudson.EnvVars.resolve(EnvVars.java:156) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:689) at hudson.tasks.Ant.perform(Ant.java:134) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582) at hudson.model.Build$RunnerImpl.build(Build.java:165) at hudson.model.Build$RunnerImpl.doRun(Build.java:132) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122) -------------------------------------------------- This makes Hudson virtually useless, as Ant is obviously required to compile my Java applications. After many hours of troubleshooting, I was able to get build 1281 to work, but when I migrated to GlassFish 3, the security broke. After many more hours of troubleshooting, I was able to determine that the issue resides in the hudson/main/core/src/main/java/hudson/EnvVars.java file, with the resolve(Map<String, String> env) method. The workaround I developed was to eliminate the entry.setValue() from processing. The workaround code is: -------------------------------------------------- //JLV Software Development Workaround Code public static void resolve(Map<String, String> env) { java.util.logging.Logger jLog = java.util.logging.Logger.getLogger("hudson.tasks"); //Get a logger to help debug code jLog.fine("EnvVars.java // resolve // env.size()=\"" + env.size() + "\""); //Log the size of the Map for (Map.Entry<String,String> entry: env.entrySet()) { jLog.fine("EnvVars.java // resolve // entry.getValue()=\"" + entry.getValue() + "\"" + " .getKey() =\"" + entry.getKey() + "\""); //Log each Key/Value pair // entry.setValue(entry.getValue()); //Commented out as workaround. } } -------------------------------------------------- Reviewing the exception, I believe (and it's just a guess) that this is due to the fact that two of my system variables ("NODE_NAME", "CLASSPATH") are currently reported as empty values ("") when logged. If this is true, I recommend that the code be modified to check for empty values, and then only try to perform a .setValue on non-empty entries.

    Jenkins JIRA | 7 years ago | jlvsd
    java.lang.UnsupportedOperationException
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Note: I was able to workaround this issue, and the workaround code is enclosed below. When trying to build a Java project (any Java project) using an Ant build step from within Hudson, the build fails with the following error: -------------------------------------------------- Started by user anonymous [workspace] $ cvsnt -q update -PdC -D "Saturday, March 27, 2010 4:11:43 AM UTC" ? ${build.dir} ? ${dist.dir} $ no changes detected Deleting old artifacts from #36 FATAL: null java.lang.UnsupportedOperationException at java.util.AbstractMap$SimpleImmutableEntry.setValue(AbstractMap.java:726) at hudson.EnvVars.resolve(EnvVars.java:156) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:689) at hudson.tasks.Ant.perform(Ant.java:134) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582) at hudson.model.Build$RunnerImpl.build(Build.java:165) at hudson.model.Build$RunnerImpl.doRun(Build.java:132) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416) at hudson.model.Run.run(Run.java:1243) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:122) -------------------------------------------------- This makes Hudson virtually useless, as Ant is obviously required to compile my Java applications. After many hours of troubleshooting, I was able to get build 1281 to work, but when I migrated to GlassFish 3, the security broke. After many more hours of troubleshooting, I was able to determine that the issue resides in the hudson/main/core/src/main/java/hudson/EnvVars.java file, with the resolve(Map<String, String> env) method. The workaround I developed was to eliminate the entry.setValue() from processing. The workaround code is: -------------------------------------------------- //JLV Software Development Workaround Code public static void resolve(Map<String, String> env) { java.util.logging.Logger jLog = java.util.logging.Logger.getLogger("hudson.tasks"); //Get a logger to help debug code jLog.fine("EnvVars.java // resolve // env.size()=\"" + env.size() + "\""); //Log the size of the Map for (Map.Entry<String,String> entry: env.entrySet()) { jLog.fine("EnvVars.java // resolve // entry.getValue()=\"" + entry.getValue() + "\"" + " .getKey() =\"" + entry.getKey() + "\""); //Log each Key/Value pair // entry.setValue(entry.getValue()); //Commented out as workaround. } } -------------------------------------------------- Reviewing the exception, I believe (and it's just a guess) that this is due to the fact that two of my system variables ("NODE_NAME", "CLASSPATH") are currently reported as empty values ("") when logged. If this is true, I recommend that the code be modified to check for empty values, and then only try to perform a .setValue on non-empty entries.

    Jenkins JIRA | 7 years ago | jlvsd
    java.lang.UnsupportedOperationException
  4. 0

    java.lang.UnsupportedOperationException

    Google Groups | 6 years ago | sebglon
    java.lang.UnsupportedOperationException

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      No message provided

      at java.util.AbstractMap$SimpleImmutableEntry.setValue()
    2. Java RT
      AbstractMap$SimpleImmutableEntry.setValue
      1. java.util.AbstractMap$SimpleImmutableEntry.setValue(AbstractMap.java:726)
      1 frame
    3. Hudson
      Executor.run
      1. hudson.EnvVars.resolve(EnvVars.java:156)
      2. hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:708)
      3. hudson.tasks.Ant.perform(Ant.java:134)
      4. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      5. hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
      6. hudson.model.Build$RunnerImpl.build(Build.java:174)
      7. hudson.model.Build$RunnerImpl.doRun(Build.java:138)
      8. hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:416)
      9. hudson.model.Run.run(Run.java:1248)
      10. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      11. hudson.model.ResourceController.execute(ResourceController.java:88)
      12. hudson.model.Executor.run(Executor.java:129)
      12 frames