auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testCloseShouldTearDownZkConnectionOnInterruptedException() throws Exception { CountDownLatch latch = new CountDownLatch(1); ZkClient zkClient = new ZkClient("127.0.0.1:" + zkServer.getPort()); ZkUtils zkUtils = new ZkUtils(KEY_BUILDER, zkClient, SESSION_TIMEOUT_MS, new NoOpMetricsRegistry()); Thread threadToInterrupt = new Thread(() -> { try { latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } zkUtils.close(); }); threadToInterrupt.start(); threadToInterrupt.interrupt(); <START> threadToInterrupt.join(); <END> Field field = ZkClient.class.getDeclaredField("_closed"); field.setAccessible(true); Assert.assertTrue(field.getBoolean(zkClient)); }</code><technical_language>assert client connection is closed .. assert "connected" prior invoking interrupt()</technical_language>

Target:
public void testCloseShouldTearDownZkConnectionOnInterruptedException() throws Exception { CountDownLatch latch = new CountDownLatch(1); ZkClient zkClient = new ZkClient("127.0.0.1:" + zkServer.getPort()); ZkUtils zkUtils = new ZkUtils(KEY_BUILDER, zkClient, SESSION_TIMEOUT_MS, new NoOpMetricsRegistry()); Thread threadToInterrupt = new Thread(() -> { try { latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } zkUtils.close(); }); threadToInterrupt.start(); Field field = ZkClient.class.getDeclaredField("_closed"); field.setAccessible(true); Assert.assertFalse(field.getBoolean(zkClient)); threadToInterrupt.interrupt(); threadToInterrupt.join(); Assert.assertTrue(field.getBoolean(zkClient)); }
Source:
<code>private void startPlugins() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_STARTUP); final IExtension[] extensions = point.getExtensions(); if (extensions.length == 0) { return; } int numProcessors = Runtime.getRuntime().availableProcessors(); <START> final JobGroup jobGroup = new JobGroup("Early startup job group", numProcessors, 1); END> Job job = new Job("Workbench early startup") { @Override protected IStatus run(IProgressMonitor monitor) { HashSet disabledPlugins = new HashSet(Arrays .asList(getDisabledEarlyActivatedPlugins())); monitor.beginTask(WorkbenchMessages.Workbench_startingPlugins, extensions.length); for (int i = 0; i < extensions.length; ++i) { if (monitor.isCanceled() || !isRunning()) { return Status.CANCEL_STATUS; } final IExtension extension = extensions[i]; if (!disabledPlugins.contains(extension.getNamespace())) { monitor.subTask(extension.getNamespace()); Job extensionJob = new Job("Early stattup job") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(extension.getNamespaceIdentifier(), 1); SafeRunner.run(new EarlyStartupRunnable(extension)); monitor.done(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return EARLY_STARTUP_FAMILY.equals(family); } }; extensionJob.setSystem(true); extensionJob.setJobGroup(jobGroup); extensionJob.schedule(); } monitor.worked(1); } monitor.done(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return EARLY_STARTUP_FAMILY.equals(family); } }; job.setSystem(true); job.setJobGroup(jobGroup); job.schedule(); }</code><technical_language>If assume early startup is a 50-50 mixture of CPU IO, concurrency level numProcessors * 2</technical_language>

Target:
private void startPlugins() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchRegistryConstants.PL_STARTUP); final IExtension[] extensions = point.getExtensions(); if (extensions.length == 0) { return; } int numProcessors = Runtime.getRuntime().availableProcessors(); final JobGroup jobGroup = new JobGroup("Workbench early startup job group", numProcessors * 2, 1); new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { HashSet<String> disabledPlugins = new HashSet<String>(Arrays .asList(getDisabledEarlyActivatedPlugins())); monitor.beginTask(WorkbenchMessages.Workbench_startingPlugins, extensions.length); for (int i = 0; i < extensions.length; ++i) { if (monitor.isCanceled() || !isRunning()) { return Status.CANCEL_STATUS; } final IExtension extension = extensions[i]; if (!disabledPlugins.contains(extension.getNamespace())) { new EarlyStartupJob(jobGroup) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(extension.getNamespaceIdentifier(), 1); SafeRunner.run(new EarlyStartupRunnable(extension)); monitor.done(); return Status.OK_STATUS; } }.schedule(); } monitor.worked(1); } monitor.done(); return Status.OK_STATUS; } }.schedule(); }
Source:
<code><START> private void initializeLags() { <END> Map<TopicPartition, Long> endOffsets = kafkaConsumer.endOffsets(topicPartitions2SSP.keySet()); endOffsets.forEach((tp, offset) -> { SystemStreamPartition ssp = topicPartitions2SSP.get(tp); long startingOffset = nextOffsets.get(ssp); long initialLag = endOffsets.get(tp) - startingOffset; LOG.info("Initial lag for SSP is (end={}, startOffset={})", ssp, initialLag, endOffsets.get(tp), startingOffset); latestLags.put(ssp, initialLag); sink.setIsAtHighWatermark(ssp, initialLag == 0); }); refreshLatencyMetrics(); }</code><technical_language>Move private methods end of class. Prefer order: Constructors, public, protected, package private, private, classes</technical_language>

Target:
private void initializeLags() { Map<TopicPartition, Long> endOffsets = kafkaConsumer.endOffsets(topicPartitionToSSP.keySet()); endOffsets.forEach((tp, offset) -> { SystemStreamPartition ssp = topicPartitionToSSP.get(tp); long startingOffset = nextOffsets.get(ssp); long initialLag = endOffsets.get(tp) - startingOffset; LOG.info("Initial lag for SSP is (end={}, startOffset={})", ssp, initialLag, endOffsets.get(tp), startingOffset); latestLags.put(ssp, initialLag); sink.setIsAtHighWatermark(ssp, initialLag == 0); }); refreshLagMetrics(); }
Source:
<code>private void viewAnnotation(JSONObject op, StringBuilder sb){ JSONObject config = (JSONObject)op.get("config"); if(config == null) return; JSONObject viewConfig = (JSONObject)config.get("viewConfig"); if(viewConfig == null) return; String name = (String)viewConfig.get("name"); String port = (String)viewConfig.get("port"); <START> Double bufferTime = (Double)viewConfig.get("bufferTime"); <END> Long sampleSize = (Long)viewConfig.get("sampleSize"); sb.append("@view(name = \""); sb.append(splBasename(name)); sb.append("\", port = " + port); sb.append(", bufferTime = " + bufferTime + ", "); sb.append("sampleSize = " + sampleSize + ", "); sb.append("activateOption = firstAccess)\n"); }</code><technical_language>assume this is a Double? if app developer passes in 4? get a Number call doubleValue() it. Similar for sampleSize</technical_language>

Target:
private void viewAnnotation(JSONObject op, StringBuilder sb){ JSONObject config = (JSONObject)op.get("config"); if(config == null) return; JSONArray viewConfigs = (JSONArray) config.get("viewConfigs"); if (viewConfigs == null || viewConfigs.isEmpty()) { return; } for (int i = 0; i < viewConfigs.size(); i++) { JSONObject viewConfig = (JSONObject) viewConfigs.get(i); String name = (String)viewConfig.get("name"); String port = (String)viewConfig.get("port"); Double bufferTime = ((Number)viewConfig.get("bufferTime")).doubleValue(); Long sampleSize = ((Number)viewConfig.get("sampleSize")).longValue(); sb.append("@view(name = \""); sb.append(splBasename(name)); sb.append("\", port = " + port); sb.append(", bufferTime = " + bufferTime + ", "); sb.append("sampleSize = " + sampleSize + ", "); sb.append("activateOption = firstAccess)\n"); } }
Source:
<code>protected Node visitShowSchemas(ShowSchemas node, Void context) { if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set"); } String catalog = node.getCatalog().map(Identifier::getValue).orElseGet(() -> session.getCatalog().get()); accessControl.checkCanShowSchemas(session.getRequiredTransactionId(), session.getIdentity(), catalog); Optional<Expression> predicate = Optional.empty(); Optional<String> likePattern = node.getLikePattern(); if (likePattern.isPresent()) { Optional<String> escape = node.getEscape(); if (escape.isPresent()) { predicate = Optional.of(new LikePredicate(identifier("schema_name"), new StringLiteral(likePattern.get()), new StringLiteral(escape.get()))); } else { <START> predicate = Optional.of(new LikePredicate(identifier("schema_name"), new StringLiteral(likePattern.get()), null)); <END> } } return simpleQuery( selectList(aliasedName("schema_name", "Schema")), from(catalog, TABLE_SCHEMATA), predicate, Optional.of(ordering(ascending("schema_name")))); }</code><technical_language>above, constructor Optional<Expression> escape</technical_language>

Target:
protected Node visitShowSchemas(ShowSchemas node, Void context) { if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set"); } String catalog = node.getCatalog().map(Identifier::getValue).orElseGet(() -> session.getCatalog().get()); accessControl.checkCanShowSchemas(session.getRequiredTransactionId(), session.getIdentity(), catalog); Optional<Expression> predicate = Optional.empty(); Optional<String> likePattern = node.getLikePattern(); if (likePattern.isPresent()) { predicate = Optional.of(new LikePredicate(identifier("schema_name"), new StringLiteral(likePattern.get()), null)); } return simpleQuery( selectList(aliasedName("schema_name", "Schema")), from(catalog, TABLE_SCHEMATA), predicate, Optional.of(ordering(ascending("schema_name")))); }
Source:
<code>private void parseMenuURI(String menuURI) throws URISyntaxException { if (menuId != null) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_OnlyOneLocationURIPerScheme, MENU_SCHEME)); } if <START> (menuURI.substring(MENU_SCHEME.length()).startsWith(SEPARATOR)) <END> { String id = menuURI.substring(MENU_SCHEME.length() + SEPARATOR.length()).trim(); if (id.length() == 0) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_NoId, MENU_SCHEME + SEPARATOR)); } menuId = id; } else if (menuURI.length() == MENU_SCHEME.length()) { menuId = ROOT_MENU_ID; } else { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_WrongFormat, MENU_SCHEME + SEPARATOR + "menuId", menuURI)); } }</code><technical_language>trim(). allow tolerant scheme : id</technical_language>

Target:
private void parseMenuURI(String menuURI) throws URISyntaxException { if (menuId != null) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_OnlyOneLocationURIPerScheme, MENU_SCHEME)); } if (menuURI.substring(MENU_SCHEME.length()).trim().startsWith(SEPARATOR)) { String id = menuURI.substring(MENU_SCHEME.length()).trim().substring(SEPARATOR.length()).trim(); if (id.length() == 0) { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_NoId, MENU_SCHEME + SEPARATOR)); } menuId = id; } else if (menuURI.length() == MENU_SCHEME.length()) { menuId = ROOT_MENU_ID; } else { throw new URISyntaxException(string, MessageFormat.format(Messages.LocationURI_ParsePb_WrongFormat, MENU_SCHEME + SEPARATOR + "menuId", menuURI)); } }
Source:
<code>protected Endpoint createEndpoint( String uri, String remaining, Map<String, Object> parameters ) throws Exception { <START> KieConfiguration kieConfiguration = new KieConfiguration(); <END> kieConfiguration.configure( new URI( uri ) ); setProperties(kieConfiguration, parameters); KieServicesConfiguration config = remaining.startsWith( "jms" ) ? KieServicesFactory.newJMSConfiguration( (InitialContext)null, null, null ) : KieServicesFactory.newRestConfiguration( remaining, null, null ); config.setUserName( kieConfiguration.getUsername() ); config.setPassword( kieConfiguration.getPassword() ); return new KieEndpoint(uri, this, config); }</code><technical_language>declare kieConfiguration a local variable, a setter/getter pair. This allow Camel generate code allow users configure username/password of uris. default configuration (i.e. if overridden in endpoint uri, parameters present in local variables used). Then, in createEndpoint, "clone" default kieConfiguration override settings parameters/remaining-uri. This is uri parameters configured environment variables, while component fields can</technical_language>

Target:
protected Endpoint createEndpoint( String uri, String remaining, Map<String, Object> parameters ) throws Exception { KieConfiguration kieConfiguration = getConfiguration().copy(); kieConfiguration.configure( remaining ); setProperties(kieConfiguration, parameters); KieServicesConfiguration config = remaining.startsWith( "jms" ) ? KieServicesFactory.newJMSConfiguration( (InitialContext)null, null, null ) : KieServicesFactory.newRestConfiguration( remaining, null, null ); config.setUserName( kieConfiguration.getUsername() ); config.setPassword( kieConfiguration.getPassword() ); return new KieEndpoint(uri, this, config); }
Source:
<code>private boolean evaluateDefaultLocale() { if (mCurrentDefaultLocale == null || mAvailableStrLocals == null) { return false; } boolean notInAvailableLangauges = true; try { String defaultLocaleStr = mCurrentDefaultLocale.getISO3Language(); if (!TextUtils.isEmpty(mCurrentDefaultLocale.getISO3Country())) { defaultLocaleStr += "-" + mCurrentDefaultLocale.getISO3Country(); } if (!TextUtils.isEmpty(mCurrentDefaultLocale.getVariant())) { defaultLocaleStr += "-" + mCurrentDefaultLocale.getVariant(); } for (String loc : mAvailableStrLocals) { if (loc.equalsIgnoreCase(defaultLocaleStr)) { notInAvailableLangauges = false; break; } } } catch (MissingResourceException e) { if (DBG) Log.wtf(TAG, "MissingResourceException", e); <START> updateWidgetState(false); <END> return false; } int defaultAvailable = mTts.setLanguage(mCurrentDefaultLocale); if (defaultAvailable == TextToSpeech.LANG_NOT_SUPPORTED || defaultAvailable == TextToSpeech.LANG_MISSING_DATA || notInAvailableLangauges) { if (DBG) Log.d(TAG, "Default locale for this TTS engine is not supported."); updateEngineStatus(R.string.tts_status_not_supported); updateWidgetState(false); return false; } else { if (isNetworkRequiredForSynthesis()) { updateEngineStatus(R.string.tts_status_requires_network); } else { updateEngineStatus(R.string.tts_status_ok); } updateWidgetState(true); return true; } }</code><technical_language>Hmm, call updateEngineStatus(R.string.tts_status_not_supported) in this case</technical_language>

Target:
private boolean evaluateDefaultLocale() { if (mCurrentDefaultLocale == null || mAvailableStrLocals == null) { return false; } boolean notInAvailableLangauges = true; try { String defaultLocaleStr = mCurrentDefaultLocale.getISO3Language(); if (!TextUtils.isEmpty(mCurrentDefaultLocale.getISO3Country())) { defaultLocaleStr += "-" + mCurrentDefaultLocale.getISO3Country(); } if (!TextUtils.isEmpty(mCurrentDefaultLocale.getVariant())) { defaultLocaleStr += "-" + mCurrentDefaultLocale.getVariant(); } for (String loc : mAvailableStrLocals) { if (loc.equalsIgnoreCase(defaultLocaleStr)) { notInAvailableLangauges = false; break; } } } catch (MissingResourceException e) { if (DBG) Log.wtf(TAG, "MissingResourceException", e); updateEngineStatus(R.string.tts_status_not_supported); updateWidgetState(false); return false; } int defaultAvailable = mTts.setLanguage(mCurrentDefaultLocale); if (defaultAvailable == TextToSpeech.LANG_NOT_SUPPORTED || defaultAvailable == TextToSpeech.LANG_MISSING_DATA || notInAvailableLangauges) { if (DBG) Log.d(TAG, "Default locale for this TTS engine is not supported."); updateEngineStatus(R.string.tts_status_not_supported); updateWidgetState(false); return false; } else { if (isNetworkRequiredForSynthesis()) { updateEngineStatus(R.string.tts_status_requires_network); } else { updateEngineStatus(R.string.tts_status_ok); } updateWidgetState(true); return true; } }
Source:
<code>public ExtendedModifiedSinceTerm(final long modSeq) { <START> this(modSeq, null, null); <END> }</code><technical_language>Do nulls avoid nullable annotations for parameters of constructors/methods... Instead annotate fields of class nonnull/nullable. do this</technical_language>

Target:
public ExtendedModifiedSinceTerm(final long modSeq) { this.entryName = null; this.entryType = null; this.modSeq = modSeq; }
Source:
<code>private static Slice stUnion(Iterable<Slice> slices) { ListeningGeometryCursor[] cursorsByDimension = new ListeningGeometryCursor[NUMBER_OF_DIMENSIONS]; GeometryCursor[] operatorsByDimension = new GeometryCursor[NUMBER_OF_DIMENSIONS]; setAll(cursorsByDimension, i -> new ListeningGeometryCursor()); setAll(operatorsByDimension, i -> OperatorUnion.local().execute(cursorsByDimension[i], null, null)); for (Slice slice : slices) { if (slice.getInput().available() == 0) { continue; } for (OGCGeometry geometry : flattenCollection(deserialize(slice))) { int dimension = geometry.dimension(); cursorsByDimension[dimension].tick(geometry.getEsriGeometry()); operatorsByDimension[dimension].tock(); } } List<OGCGeometry> outputs = new ArrayList<>(); for (GeometryCursor operator : operatorsByDimension) { OGCGeometry unionedGeometry = createFromEsriGeometry(operator.next(), null); if (unionedGeometry != null) { outputs.add(unionedGeometry); } } <START> if (outputs.isEmpty()) { <END> return null; } if (outputs.size() == 1) { return serialize(outputs.get(0)); } return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti()); }</code><technical_language>this happen geometries empty? If so, this appears a change in semantics. version of code do: if (rightGeometry.isEmpty()) { return left; }</technical_language>

Target:
private static Slice stUnion(Iterable<Slice> slices) { ListeningGeometryCursor[] cursorsByDimension = new ListeningGeometryCursor[NUMBER_OF_DIMENSIONS]; GeometryCursor[] operatorsByDimension = new GeometryCursor[NUMBER_OF_DIMENSIONS]; setAll(cursorsByDimension, i -> new ListeningGeometryCursor()); setAll(operatorsByDimension, i -> OperatorUnion.local().execute(cursorsByDimension[i], null, null)); Iterator<Slice> slicesIterator = slices.iterator(); if (!slicesIterator.hasNext()) { return null; } while (slicesIterator.hasNext()) { Slice slice = slicesIterator.next(); if (slice.getInput().available() == 0) { continue; } for (OGCGeometry geometry : flattenCollection(deserialize(slice))) { int dimension = geometry.dimension(); cursorsByDimension[dimension].tick(geometry.getEsriGeometry()); operatorsByDimension[dimension].tock(); } } List<OGCGeometry> outputs = new ArrayList<>(); for (GeometryCursor operator : operatorsByDimension) { OGCGeometry unionedGeometry = createFromEsriGeometry(operator.next(), null); if (unionedGeometry != null) { outputs.add(unionedGeometry); } } if (outputs.size() == 1) { return serialize(outputs.get(0)); } return serialize(new OGCConcreteGeometryCollection(outputs, null).flattenAndRemoveOverlaps().reduceFromMulti()); }
Source:
<code>public void testIndenting() throws Exception { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); ITargetDefinition targetDefinition = service.newTarget(); targetDefinition.setOS("test_os"); ByteArrayOutputStream actualOutput = new ByteArrayOutputStream(); TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput); try (Scanner s = new Scanner(FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/IndentingTestCaseTarget.txt").openStream()).useDelimiter("\\A")) { String result = s.hasNext() ? s.next() : ""; IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode("org.eclipse.ui.editors"); boolean spacesForTabs = preferences.getBoolean("spacesForTabs", false); if (spacesForTabs) { char[] chars = new char[preferences.getInt("tabWidth", 4)]; Arrays.fill(chars, ' '); result.replace("\t", new String(chars)); } assertEquals(result, actualOutput.toString(StandardCharsets.UTF_8.toString())); <START> } catch (Exception e) { <END> } }</code><technical_language>I more specific exception IOException catched</technical_language>

Target:
public void testIndenting() throws Exception { ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class); ITargetDefinition targetDefinition = service.newTarget(); targetDefinition.setOS("test_os"); ByteArrayOutputStream actualOutput = new ByteArrayOutputStream(); TargetDefinitionPersistenceHelper.persistXML(targetDefinition, actualOutput); try (Scanner s = new Scanner(FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/IndentingTestCaseTarget.txt").openStream()).useDelimiter("\\A")) { String result = s.hasNext() ? s.next() : ""; IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode("org.eclipse.ui.editors"); boolean spacesForTabs = preferences.getBoolean("spacesForTabs", false); if (spacesForTabs) { char[] chars = new char[preferences.getInt("tabWidth", 4)]; Arrays.fill(chars, ' '); result.replace("\t", new String(chars)); } assertEquals(result, actualOutput.toString(StandardCharsets.UTF_8.toString())); } catch (IOException e) { } }
Source:
<code>public void shouldThrowOnV0IfNotLiteral() { <START> DescribeAclsResponse.prepareResponse(10, ApiError.NONE, aclBindings(PREFIXED_ACL1)).toStruct(V0); <END> }</code><technical_language>I convert tests rely AclBinding testing prepareResponse specifically</technical_language>

Target:
public void shouldThrowOnV0IfNotLiteral() { buildResponse(10, Errors.NONE, Collections.singletonList(PREFIXED_ACL1)).toStruct(V0); }
Source:
<code>public void allTests() throws Exception { testEditPage(); <START> testStudentSubmitPage(); <END> }</code><technical_language>This done here. StudentFeedbackSubmitPageUiTest test this</technical_language>

Target:
public void allTests() throws Exception { testEditPage(); }
Source:
<code><START> public static ResultFactory configureResultFactory(String resultType, String resultFactoryName,BeanFactory beanFactory) { <END> boolean bothHaveText = StringUtils.hasText(resultFactoryName) && StringUtils.hasText(resultType); ResultFactory resultFactory=null; Assert.state(!bothHaveText, "Only one of 'result-factory' or 'result-type' should be specified."); if (StringUtils.hasText(resultType)) { Assert.state(resultType.equals(DOM_RESULT) || resultType.equals(STRING_RESULT), "Result type must be either 'DOMResult' or 'StringResult'"); } if (StringUtils.hasText(resultFactoryName)) { resultFactory=(ResultFactory) beanFactory.getBean(resultFactoryName); } else if (STRING_RESULT.equals(resultType)) { resultFactory=new StringResultFactory(); } else if (DOM_RESULT.equals(resultType)) { resultFactory=new DomResultFactory(); } return resultFactory; }</code><technical_language>change non-static end code. of this method private</technical_language>

Target:
private ResultFactory configureResultFactory(String resultType, String resultFactoryName,BeanFactory beanFactory) { boolean bothHaveText = StringUtils.hasText(resultFactoryName) && StringUtils.hasText(resultType); ResultFactory resultFactory=null; Assert.state(!bothHaveText, "Only one of 'result-factory' or 'result-type' should be specified."); if (StringUtils.hasText(resultType)) { Assert.state(resultType.equals(DOM_RESULT) || resultType.equals(STRING_RESULT), "Result type must be either 'DOMResult' or 'StringResult'"); } if (StringUtils.hasText(resultFactoryName)) { resultFactory=(ResultFactory) beanFactory.getBean(resultFactoryName); } else if (STRING_RESULT.equals(resultType)) { resultFactory=new StringResultFactory(); } else if (DOM_RESULT.equals(resultType)) { resultFactory=new DomResultFactory(); } return resultFactory; }
Source:
<code>public void setAcceptableValues(Collection<K> values) { buttons.clear(); panels.clear(); wrapperPanel.clear(); <START> for (final K value : values) { <END> addValue(value); } updateButtons(); }</code><technical_language>add null check</technical_language>

Target:
public void setAcceptableValues(Collection<K> values) { buttons.clear(); panels.clear(); wrapperPanel.clear(); if (values != null) { for (final K value : values) { addValue(value); } } updateButtons(); }
Source:
<code>public void run() { log.info("Elf Kingdom"); <START> createKingdom(Kingdom.FactoryMaker.makeFactory(Kingdom.FactoryMaker.KingdomType.ELF)); <END> log.info(kingdom.getArmy().getDescription()); log.info(kingdom.getCastle().getDescription()); log.info(kingdom.getKing().getDescription()); log.info("Orc Kingdom"); createKingdom(Kingdom.FactoryMaker.makeFactory(Kingdom.FactoryMaker.KingdomType.ORC)); log.info(kingdom.getArmy().getDescription()); log.info(kingdom.getCastle().getDescription()); log.info(kingdom.getKing().getDescription()); }</code><technical_language>more clear if createKingdom race a parameter handle factory making internally</technical_language>

Target:
public void run() { log.info("Elf Kingdom"); createKingdom(Kingdom.FactoryMaker.KingdomType.ELF); log.info(kingdom.getArmy().getDescription()); log.info(kingdom.getCastle().getDescription()); log.info(kingdom.getKing().getDescription()); log.info("Orc Kingdom"); createKingdom(Kingdom.FactoryMaker.KingdomType.ORC); log.info(kingdom.getArmy().getDescription()); log.info(kingdom.getCastle().getDescription()); log.info(kingdom.getKing().getDescription()); }
Source:
<code>private static void assertStartsWithExpectedWarnings(SQLWarning warning, SQLWarning expected) { if (warning == null) { <START> assertNull(expected); <END> return; } assertNotNull(expected); while (true) { assertWarningsEqual(warning, expected); warning = warning.getNextWarning(); expected = expected.getNextWarning(); if (expected == null) { return; } else { assertNotNull(warning); } } }</code><technical_language>assertNull(expected) fail expected is called non-null values</technical_language>

Target:
private static void assertStartsWithExpectedWarnings(SQLWarning warning, SQLWarning expected) { assertNotNull(expected); assertNotNull(warning); while (true) { assertWarningsEqual(warning, expected); warning = warning.getNextWarning(); expected = expected.getNextWarning(); if (expected == null) { return; } assertNotNull(warning); } }
Source:
<code>private void startContainer() throws Exception { this.servletContainer .withNetwork(Network.SHARED) .withNetworkAliases(this.testConfiguration.getServletEngine().getInternalIP()) .withExposedPorts(this.testConfiguration.getServletEngine().getInternalPort()) .waitingFor( Wait.forHttp("/xwiki/bin/get/Main/WebHome") .forStatusCode(200).withStartupTimeout(Duration.of(480, SECONDS))); File testResoucesDirectory = new File("./target/", "test-classes"); if (testResoucesDirectory.exists()) { <START> mountFromHostToContainer(testResoucesDirectory, <END> this.testConfiguration.getServletEngine().getTestResourcesPath()); } if (this.testConfiguration.isOffline()) { String repoLocation = this.repositoryResolver.getSession().getLocalRepository().getBasedir().toString(); this.servletContainer.withFileSystemBind(repoLocation, "/root/.m2/repository"); } start(this.servletContainer, this.testConfiguration); }</code><technical_language>I thought test resources longer bound in servlet engine container</technical_language>

Target:
private void startContainer() throws Exception { this.servletContainer .withNetwork(Network.SHARED) .withNetworkAliases(this.testConfiguration.getServletEngine().getInternalIP()) .withExposedPorts(this.testConfiguration.getServletEngine().getInternalPort()) .waitingFor( Wait.forHttp("/xwiki/bin/get/Main/WebHome") .forStatusCode(200).withStartupTimeout(Duration.of(480, SECONDS))); if (this.testConfiguration.isOffline()) { String repoLocation = this.repositoryResolver.getSession().getLocalRepository().getBasedir().toString(); this.servletContainer.withFileSystemBind(repoLocation, "/root/.m2/repository"); } start(this.servletContainer, this.testConfiguration); }
Source:
<code>protected void executeVmCommand() { this.setVmName(getVmStaticDao().get(getParameters().getVmId()).getName()); VmNic iface = getVmNicDao().get(getParameters().getInterfaceId()); if (iface != null) { interfaceName = iface.getName(); String interType = VmInterfaceType.forValue(iface.getType()).getDescription(); if (interType != null) { addCustomValue("InterfaceType", interType); } new ExternalNetworkManager(iface).deallocateIfExternal(); getMacPool().freeMac(iface.getMacAddress()); } TransactionSupport.executeInNewTransaction(() -> { <START> vmStaticDao.incrementDbGeneration(getVm().getId()); <END> getVmNicDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmNetworkStatisticsDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmDeviceDao().remove(new VmDeviceId(getParameters().getInterfaceId(), getParameters().getVmId())); setSucceeded(true); return null; }); }</code><technical_language>db for that. vm id parameters. Besides, vm in db stage</technical_language>

Target:
protected void executeVmCommand() { this.setVmName(getVmStaticDao().get(getParameters().getVmId()).getName()); VmNic iface = getVmNicDao().get(getParameters().getInterfaceId()); if (iface != null) { interfaceName = iface.getName(); String interType = VmInterfaceType.forValue(iface.getType()).getDescription(); if (interType != null) { addCustomValue("InterfaceType", interType); } new ExternalNetworkManager(iface).deallocateIfExternal(); getMacPool().freeMac(iface.getMacAddress()); } TransactionSupport.executeInNewTransaction(() -> { vmStaticDao.incrementDbGeneration(getParameters().getVmId()); getVmNicDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmNetworkStatisticsDao().remove(getParameters().getInterfaceId()); getDbFacade().getVmDeviceDao().remove(new VmDeviceId(getParameters().getInterfaceId(), getParameters().getVmId())); setSucceeded(true); return null; }); }
Source:
<code>public final Result process(Conveyor conveyor) { Map<DispatchingId, InboxMessage> dispatchToCatchUp = new HashMap<>(); for (InboxMessage message : conveyor) { for (CatchUp job : jobs) { CatchUpStatus jobStatus = job.getStatus(); if (job.matches(message)) { DispatchingId dispatchingId = new DispatchingId(message); <START> if (jobStatus == IN_PROGRESS) { <END> if (message.getStatus() == TO_CATCH_UP) { if (dispatchToCatchUp.containsKey(dispatchingId)) { conveyor.remove(message); } else { dispatchToCatchUp.put(dispatchingId, message); } } else if (message.getStatus() == TO_DELIVER) { conveyor.remove(message); } } else if (jobStatus == FINALIZING) { if (message.getStatus() == TO_DELIVER) { conveyor.markCatchUp(message); } } else if (jobStatus == COMPLETED) { if (message.getStatus() == TO_CATCH_UP) { if (!dispatchToCatchUp.containsKey(dispatchingId)) { dispatchToCatchUp.put(dispatchingId, message); conveyor.keepForLonger(message, HOW_LONG_TO_KEEP); } else { conveyor.remove(message); } } else if (message.getStatus() == TO_DELIVER && dispatchToCatchUp.containsKey(dispatchingId)) { conveyor.remove(message); } } } } } return dispatch(conveyor, dispatchToCatchUp); }</code><technical_language>Consider switch/case here. easier grasp branches alternatives</technical_language>

Target:
public final Result process(Conveyor conveyor) { JobFilter jobFilter = new JobFilter(jobs, conveyor); Collection<InboxMessage> toDispatch = jobFilter.messagesToDispatch(); return dispatch(toDispatch, conveyor); }
Source:
<code>private long getRetainedSizeOf(Object object) { Class type = object.getClass(); if (type == PageBuilder.class) { return ((PageBuilder) object).getRetainedSizeInBytes(); } else if (type.isArray()) { if (type == int[].class) { return sizeOf((int[]) object); } else if (type == boolean[].class) { return sizeOf((boolean[]) object); } else if (type == byte[].class) { return sizeOf((byte[]) object); } else if (type == long[].class) { return sizeOf((long[]) object); } else if (type == short[].class) { return sizeOf((short[]) object); } else if (type == Block[].class) { Object[] objects = (Object[]) object; return Arrays.stream(objects) .mapToLong(this::getRetainedSizeOf) .sum(); } else { <START> throw new UnsupportedOperationException(format("Unknown type encountered: %s", type)); <END> } } else { long retainedSize = ClassLayout.parseClass(type).instanceSize(); Field[] fields = type.getDeclaredFields(); for (Field field : fields) { try { if (field.getType().isPrimitive()) { continue; } field.setAccessible(true); retainedSize += getRetainedSizeOf(field.get(object)); } catch (IllegalAccessException | IllegalArgumentException t) { throw new RuntimeException(t); } } return retainedSize; } }</code><technical_language>Throwing IllegalArgumentException a fit here, do think</technical_language>

Target:
private long getRetainedSizeOf(Object object) { if (object instanceof PageBuilder) { return ((PageBuilder) object).getRetainedSizeInBytes(); } if (object instanceof Block) { return ((Block) object).getRetainedSizeInBytes(); } Class type = object.getClass(); if (type.isArray()) { if (type == int[].class) { return sizeOf((int[]) object); } else if (type == boolean[].class) { return sizeOf((boolean[]) object); } else if (type == byte[].class) { return sizeOf((byte[]) object); } else if (type == long[].class) { return sizeOf((long[]) object); } else if (type == short[].class) { return sizeOf((short[]) object); } else if (type == Block[].class) { Object[] objects = (Object[]) object; return Arrays.stream(objects) .mapToLong(this::getRetainedSizeOf) .sum(); } else { throw new IllegalArgumentException(format("Unknown type encountered: %s", type)); } } long retainedSize = ClassLayout.parseClass(type).instanceSize(); Field[] fields = type.getDeclaredFields(); for (Field field : fields) { try { if (field.getType().isPrimitive() || Modifier.isStatic(field.getModifiers())) { continue; } field.setAccessible(true); retainedSize += getRetainedSizeOf(field.get(object)); } catch (IllegalAccessException t) { throw new RuntimeException(t); } } return retainedSize; }
Source:
<code>public void visitEnd() { if (_containsSyntheticLambda) { String classToVisit = _methodInsnOwner.replace('/', '.'); try { SyntheticLambdaAnalyzer syntheticLambdaAnalyzer = new SyntheticLambdaAnalyzer(api, classToVisit, _methodInsnName); ClassReader cr = new ClassReader(classToVisit); cr.accept(syntheticLambdaAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(_methodInsnOpcode, syntheticLambdaAnalyzer.getInferredOperation())); } catch (IOException e) { <START> LOGGER.error("Unable to read class: " + classToVisit, e.getMessage()); <END> } } else { if (_methodInsnOpcode == Opcodes.INVOKESTATIC) { String functionName = Util.extractSimpleName(_methodInsnOwner, "/") + "::" + _methodInsnName; _inferredOperationConsumer.accept(new InferredOperation(Opcodes.INVOKESTATIC, functionName)); } else { String classToVisit = _lambdaSourcePointer._className.replace('/', '.'); try { FindMethodCallAnalyzer methodCallAnalyzer = new FindMethodCallAnalyzer(api, classToVisit, _lambdaSourcePointer, _methodInsnName); ClassReader cr = new ClassReader(classToVisit); cr.accept(methodCallAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(_methodInsnOpcode, methodCallAnalyzer.getInferredOperation())); } catch (IOException e) { LOGGER.error("Unable to read class: " + classToVisit, e.getMessage()); } } } super.visitEnd(); }</code><technical_language>Change DEBUG level</technical_language>

Target:
public void visitEnd() { if (_containsSyntheticLambda) { String classToVisit = _methodInsnOwner.replace('/', '.'); try { SyntheticLambdaAnalyzer syntheticLambdaAnalyzer = new SyntheticLambdaAnalyzer(api, classToVisit, _methodInsnName); ClassReader cr = new ClassReader(classToVisit); cr.accept(syntheticLambdaAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(_methodInsnOpcode, syntheticLambdaAnalyzer.getInferredOperation())); } catch (IOException e) { System.out.println("Unable to read class: " + classToVisit); } } else { if (_methodInsnOpcode == Opcodes.INVOKESTATIC) { String functionName = Util.extractSimpleName(_methodInsnOwner, "/") + "::" + _methodInsnName; _inferredOperationConsumer.accept(new InferredOperation(Opcodes.INVOKESTATIC, functionName)); } else { String classToVisit = _lambdaSourcePointer._className.replace('/', '.'); try { FindMethodCallAnalyzer methodCallAnalyzer = new FindMethodCallAnalyzer(api, classToVisit, _lambdaSourcePointer, _methodInsnName); ClassReader cr = new ClassReader(classToVisit); cr.accept(methodCallAnalyzer, 0); _inferredOperationConsumer.accept(new InferredOperation(_methodInsnOpcode, methodCallAnalyzer.getInferredOperation())); } catch (IOException e) { System.out.println("Unable to read class: " + classToVisit); } } } super.visitEnd(); }
Source:
<code>public boolean perform(AbstractBuild<?, ?> build, BuildListener listener, long effectiveTimeout) { new AbortOperation().perform(build, listener, effectiveTimeout); if (checkMaxRestarts(build)) { ParametersAction action = build.getAction(ParametersAction.class); <START> build.getRootBuild().getProject().scheduleBuild(0, new BuildTimeoutAbortAndRestartCause(build), action); <END> } return true; }</code><technical_language>inheriting CauseAction useful. Please a NaginatorRetryAction#sceduleBuild. <LINK_0></technical_language>

Target:
public boolean perform(AbstractBuild<?, ?> build, BuildListener listener, long effectiveTimeout) { long effectiveTimeoutMinutes = MINUTES.convert(effectiveTimeout,MILLISECONDS); listener.getLogger().println(hudson.plugins.build_timeout.Messages.Timeout_Message( effectiveTimeoutMinutes, hudson.plugins.build_timeout.Messages.Timeout_Aborted()) ); Executor e = build.getExecutor(); if (e != null) { e.interrupt(Result.ABORTED); } if(isPresent()){ FixedDelay sd = new FixedDelay(0); int maxRestarts = 0; try { maxRestarts = Integer.parseInt(build.getEnvironment(listener).expand(this.maxRestarts)); build.addAction(new com.chikli.hudson.plugin.naginator.NaginatorScheduleAction(maxRestarts, sd, false)); } catch (IOException e1) { listener.getLogger().println("Failed to expand environment variables. " + e1); } catch (InterruptedException e1) { listener.getLogger().println("Failed to expand environment variables. " + e1); } } return true; }
Source:
<code>public void initialize(IRecordBuilder rb) throws Exception { this.rootRecordBuilder = rb; this.rootRecordDefinition = rb.getRecordDefinition(); if (this.rootRecordDefinition == null) { throw new Exception("Error initializing BinaryRecordReader. IRecordBuilder provided a null record definition."); } <START> } <END></code><technical_language>if (rb != null)</technical_language>

Target:
public void initialize(IRecordBuilder rb) throws Exception { this.rootRecordBuilder = rb; if (rb == null) { throw new Exception("Error initializing BinaryRecordReader. IRecordBuilder must not be null."); } this.rootRecordDefinition = rb.getRecordDefinition(); if (this.rootRecordDefinition == null) { throw new Exception("Error initializing BinaryRecordReader. IRecordBuilder provided a null record definition."); } }
Source:
<code>protected Set<IEclipsePreferences> getPreferences() { if (prefs == null) { <START> prefs = new HashSet<IEclipsePreferences>(); <END> PlatformAdmin admin = WorkbenchSWTActivator.getDefault() .getPlatformAdmin(); if (admin == null) { return prefs; } State state = admin.getState(false); BundleDescription[] bundles = state.getBundles(); for (BundleDescription desc : bundles) { if (desc.getName() != null) { prefs.add(InstanceScope.INSTANCE.getNode(desc.getName())); } } } return prefs; }</code><technical_language>This Collections.emptySet(). change type of prefs</technical_language>

Target:
protected Set<IEclipsePreferences> getPreferences() { if (prefs == null) { PlatformAdmin admin = WorkbenchSWTActivator.getDefault() .getPlatformAdmin(); if (admin == null) { return Collections.emptySet(); } State state = admin.getState(false); BundleDescription[] bundles = state.getBundles(); prefs = new HashSet<IEclipsePreferences>(); for (BundleDescription desc : bundles) { if (desc.getName() != null) { prefs.add(InstanceScope.INSTANCE.getNode(desc.getName())); } } } return prefs; }
Source:
<code>public String toString() { <START> return String.format("vdsId = %s vmId = %s volumeId = %s", getVdsId(), getVmId(), diskImage.getId()); <END> }</code><technical_language>super? like: return String.format("%s, volumeId=%s", super.toString(), diskImage.getId())</technical_language>

Target:
public String toString() { return String.format("%s, volumeId = %s", super.toString(), diskImage.getId()); }
Source:
<code>public void testGetClosestTopLevelDataType() { final DataType dataType0 = makeDataType("name", "Text", false); final DataType dataType1 = makeDataType("name", "Text", false); final DataType dataType2 = makeDataType("name", "Text", false); final DataType dataType3 = makeDataType("city", "tCity", false); final DataType dataType5 = makeDataType("street", "Structure", false, dataType1); final DataType dataType4 = makeDataType("tCity", "Structure", true, dataType0, dataType5); final DataType dataType6 = makeDataType("tPerson", "Structure", true, dataType2, dataType3); doReturn(dataType4).when(handler).parent(dataType0); doReturn(dataType4).when(handler).parent(dataType5); doReturn(dataType5).when(handler).parent(dataType1); doReturn(dataType6).when(handler).parent(dataType2); doReturn(dataType6).when(handler).parent(dataType3); when(dataTypeStore.getTopLevelDataTypes()).thenReturn(asList(dataType4, dataType6)); final Optional<DataType> closestTopLevelDataType = handler.getClosestTopLevelDataType(dataType1); final DataType actualDataType = closestTopLevelDataType.orElseThrow(UnsupportedOperationException::new); <START> assertEquals(dataType4, actualDataType); <END> }</code><technical_language>mind check if closest top level data type for dataType3 is dataType6</technical_language>

Target:
public void testGetClosestTopLevelDataType() { final DataType dataType0 = makeDataType("name", "Text", false); final DataType dataType1 = makeDataType("name", "Text", false); final DataType dataType2 = makeDataType("name", "Text", false); final DataType dataType3 = makeDataType("city", "tCity", false); final DataType dataType5 = makeDataType("street", "Structure", false, dataType1); final DataType dataType4 = makeDataType("tCity", "Structure", true, dataType0, dataType5); final DataType dataType6 = makeDataType("tPerson", "Structure", true, dataType2, dataType3); doReturn(dataType4).when(handler).parent(dataType0); doReturn(dataType4).when(handler).parent(dataType5); doReturn(dataType5).when(handler).parent(dataType1); doReturn(dataType6).when(handler).parent(dataType2); doReturn(dataType6).when(handler).parent(dataType3); when(dataTypeStore.getTopLevelDataTypes()).thenReturn(asList(dataType4, dataType6)); final DataType closestTopLevelDataTypeForDataType1 = handler.getClosestTopLevelDataType(dataType1).orElseThrow(UnsupportedOperationException::new); final DataType closestTopLevelDataTypeForDataType3 = handler.getClosestTopLevelDataType(dataType3).orElseThrow(UnsupportedOperationException::new); assertEquals(dataType4, closestTopLevelDataTypeForDataType1); assertEquals(dataType6, closestTopLevelDataTypeForDataType3); }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume().getStatus() == GlusterStatus.DOWN) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN, getGlusterVolumeName()); } if (getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VOLUME_OPERATION_IN_PROGRESS, getGlusterVolumeName(), getVdsGroupName()); <START> } <END> return true; }</code><technical_language>geo-rep? restore if geo-rep in progress</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume().getStatus() != GlusterStatus.DOWN) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_UP, getGlusterVolumeName()); } for (GlusterGeoRepSession session : georepSessions) { if (session.getSlaveVolumeId() == null || session.getSlaveNodeUuid() == null) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE); } } return true; }
Source:
<code>public void testCDAVDSDoesNotSupportVirtServices() { vds.setId(Guid.newGuid()); vds.setClusterSupportsVirtService(false); <START> ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on cluster withou virt services", <END> command, EngineMessage.CANNOT_FORCE_SELECT_SPM_CLUSTER_DOES_NOT_SUPPORT_VIRT_SERVICES); }</code><technical_language>*without</technical_language>

Target:
public void testCDAVDSDoesNotSupportVirtServices() { vds.setId(Guid.newGuid()); vds.setClusterSupportsVirtService(false); ValidateTestUtils.runAndAssertValidateFailure("validate did not fail on host without virt services", command, EngineMessage.CANNOT_FORCE_SELECT_SPM_HOST_DOES_NOT_SUPPORT_VIRT_SERVICES); }
Source:
<code>private void fillFieldsFromMetadataFile() throws PreferencesException { if (this.rdf != null) { for (AdditionalField field : this.additionalFields) { if (field.isUghbinding() && field.getShowDependingOnDoctype()) { DocStructInterface myTempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct(); if (field.getDocstruct().equals("firstchild")) { try { myTempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { logger.error(e.getMessage(), e); } } if (field.getDocstruct().equals("boundbook")) { myTempStruct = this.rdf.getDigitalDocument().getPhysicalDocStruct(); } try { if (field.getMetadata().equals("ListOfCreators")) { StringBuilder authors = new StringBuilder(); if (myTempStruct.getAllPersons() != null) { for (PersonInterface p : myTempStruct.getAllPersons()) { authors.append(p.getLastName()); if (StringUtils.isNotBlank(p.getFirstName())) { authors.append(", "); authors.append(p.getFirstName()); } authors.append("; "); } if (authors.toString().endsWith("; ")) { authors.setLength(authors.length() - 2); } } field.setValue(authors.toString()); } else { MetadataTypeInterface mdt = UghHelper.getMetadataType( serviceManager.getRulesetService().getPreferences(this.prozessKopie.getRuleset()), field.getMetadata()); MetadataInterface md = UghHelper.getMetadata(myTempStruct, mdt); if (md != null) { field.setValue(md.getValue()); md.setStringValue(field.getValue().replace("&amp;", "&")); } } } catch (UghHelperException e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung(e.getMessage(), ""); } if (field.getValue() != null && !field.getValue().equals("")) { field.setValue(field.getValue().replace("&amp;", "&")); } } } } }</code><technical_language>setErrorMessage</technical_language>

Target:
private void fillFieldsFromMetadataFile() throws PreferencesException { if (this.rdf != null) { for (AdditionalField field : this.additionalFields) { if (field.isUghbinding() && field.getShowDependingOnDoctype()) { DocStructInterface myTempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct(); if (field.getDocstruct().equals("firstchild")) { try { myTempStruct = this.rdf.getDigitalDocument().getLogicalDocStruct().getAllChildren().get(0); } catch (RuntimeException e) { logger.error(e.getMessage(), e); } } if (field.getDocstruct().equals("boundbook")) { myTempStruct = this.rdf.getDigitalDocument().getPhysicalDocStruct(); } try { if (field.getMetadata().equals("ListOfCreators")) { field.setValue(getAuthors(myTempStruct.getAllPersons())); } else { MetadataTypeInterface mdt = UghHelper.getMetadataType( serviceManager.getRulesetService().getPreferences(this.prozessKopie.getRuleset()), field.getMetadata()); MetadataInterface md = UghHelper.getMetadata(myTempStruct, mdt); if (md != null) { field.setValue(md.getValue()); md.setStringValue(field.getValue().replace("&amp;", "&")); } } } catch (UghHelperException e) { Helper.setErrorMessage(e.getMessage(), logger, e); } if (field.getValue() != null && !field.getValue().equals("")) { field.setValue(field.getValue().replace("&amp;", "&")); } } } } }