auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public String bowlingPrep (@Sender EntityRef sender, @CommandParam("blockName") String blockName) { <END> ClientComponent clientComponent = sender.getComponent(ClientComponent.class); LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = characterLocation.getWorldDirection(); offset.scale(5); spawnPos.add(offset); BlockFamily block = blockManager.getBlockFamily(blockName); if (block == null) { return "Sorry, your block is not found"; } BlockItemFactory blockItemFactory = new BlockItemFactory(entityManager); Vector3f startPos = new Vector3f(spawnPos); float deltax = .2f; float deltaz = .3f; float vectorY = 1.0f; for (int rownumber = 0; rownumber < 4; rownumber++) { startPos.add(deltax * (4 - rownumber), vectorY, deltaz); for (int pinPosx = 0; pinPosx <= rownumber; pinPosx++) { EntityRef blockItem = blockItemFactory.newInstance(block); blockItem.send(new DropItemEvent(startPos)); if (pinPosx < rownumber) { startPos.add(2 * deltax, 0, 0); } } startPos.add(-deltax * (rownumber + 4), 0, 0); } return "prepared 10 " + blockName + " in a bowling pin pattern :)"; }</code><technical_language>some mystery extra spaces lines bowlingPrep (@..</technical_language>

Target:
public String bowlingPrep(@Sender EntityRef sender, @CommandParam("blockName") String blockName) { ClientComponent clientComponent = sender.getComponent(ClientComponent.class); LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = characterLocation.getWorldDirection(); offset.scale(5); spawnPos.add(offset); BlockFamily block = blockManager.getBlockFamily(blockName); if (block == null) { return "Sorry, your block is not found"; } BlockItemFactory blockItemFactory = new BlockItemFactory(entityManager); Vector3f startPos = new Vector3f(spawnPos); float deltax = 0.5f; float deltaz = 1.0f; float vectorY = 0.0f; for (int rownumber = 0; rownumber < 4; rownumber++) { startPos.add(deltax * (4 - rownumber), vectorY, deltaz); for (int pinPosx = 0; pinPosx <= rownumber; pinPosx++) { EntityRef blockItem = blockItemFactory.newInstance(block); blockItem.send(new DropItemEvent(startPos)); if (pinPosx < rownumber) { startPos.add(2 * deltax, 0, 0); } } startPos.add(-deltax * (rownumber + 4), 0, 0); } return "prepared 10 " + blockName + " in a bowling pin pattern :)"; }
Source:
<code>public void testValidateCodeFoundByCodingWithUrlNotMatch() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("url").setValue(new UriType(CS_ACMS_URL)); inParams.addParameter().setName("coding").setValue((new Coding().setCode("8452-5").setSystem("http://url2"))); try { <START> myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); <END> } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Coding.system 'http://url2' does not equal with CodeSystem.url '<LINK_0>'. Unable to validate.",e.getMessage()); } }</code><technical_language>Suggestion: include a JUnit fail() statement this statement, in case exception is thrown expected</technical_language>

Target:
public void testValidateCodeFoundByCodingWithUrlNotMatch() throws Exception { Parameters inParams = new Parameters(); inParams.addParameter().setName("url").setValue(new UriType(CS_ACMS_URL)); inParams.addParameter().setName("coding").setValue((new Coding().setCode("8452-5").setSystem("http://url2"))); try { myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute(); fail(); } catch (InvalidRequestException e) { assertEquals("HTTP 400 Bad Request: Coding.system 'http://url2' does not equal with CodeSystem.url '<LINK_0>'. Unable to validate.",e.getMessage()); } }
Source:
<code>private void storeAll() { try { File temp = File.createTempFile("caches", null, new File(globalConfiguration.globalState().persistentLocation())); Map<String, Configuration> configurationMap = new HashMap<>(); for (String cacheName : persistentCaches) { configurationMap.put(cacheName, cacheManager.getCacheConfiguration(cacheName)); } try (FileOutputStream f = new FileOutputStream(temp)) { parserRegistry.serialize(f, null, configurationMap); } FileLock lock = null; try (FileOutputStream lockFile = new FileOutputStream(getPersistentFileLock())) { lock = lockFile.getChannel().lock(); temp.renameTo(getPersistentFile()); } finally { if (lock != null && lock.isValid()) <START> lock.release(); <END> getPersistentFileLock().delete(); } } catch (Exception e) { throw log.errorPersistingGlobalConfiguration(e); } }</code><technical_language>IMO, "warn" if rename (delete below) fails</technical_language>

Target:
private void storeAll() { try { File temp = File.createTempFile("caches", null, new File(globalConfiguration.globalState().persistentLocation())); Map<String, Configuration> configurationMap = new HashMap<>(); for (String cacheName : persistentCaches) { configurationMap.put(cacheName, cacheManager.getCacheConfiguration(cacheName)); } try (FileOutputStream f = new FileOutputStream(temp)) { parserRegistry.serialize(f, null, configurationMap); } FileLock lock = null; try (FileOutputStream lockFile = new FileOutputStream(getPersistentFileLock())) { lock = lockFile.getChannel().lock(); if (!temp.renameTo(getPersistentFile())) { throw log.cannotRenamePersistentFile(temp.getAbsolutePath(), getPersistentFile()); } } finally { if (lock != null && lock.isValid()) lock.release(); getPersistentFileLock().delete(); } } catch (Exception e) { throw log.errorPersistingGlobalConfiguration(e); } }
Source:
<code>private void refreshSnapshotsInCluster(VDSGroup cluster) { if (!supportsGlusterSnapshotFeature(cluster)) { return; } final VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); <START> if (upServer == null) { <END> return; } try { List<GlusterVolumeSnapshotEntity> snapshotsList = (ArrayList<GlusterVolumeSnapshotEntity>) runVdsCommand(VDSCommandType.GetGlusterVolumeSnapshotInfo, new GlusterVolumeSnapshotVDSParameters(upServer.getId(), null, cluster.getId())).getReturnValue(); addOrUpdateSnapshots(cluster.getId(), snapshotsList); } catch (VdcBLLException e) { throw e; } }</code><technical_language>log sync run this time</technical_language>

Target:
private void refreshSnapshotsInCluster(VDSGroup cluster) { if (!supportsGlusterSnapshotFeature(cluster)) { return; } final VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.info("No UP server found in cluster '{}' for snapshot monitoring", cluster.getName()); return; } VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeSnapshotInfo, new GlusterVolumeSnapshotVDSParameters(upServer.getId(), cluster.getId(), null)); if (returnValue.getSucceeded()) { addOrUpdateSnapshots(cluster.getId(), (ArrayList<GlusterVolumeSnapshotEntity>) returnValue.getReturnValue()); } else { log.error("VDS Error {}", returnValue.getVdsError().getMessage()); log.debug("VDS Error {}", returnValue.getVdsError()); } }
Source:
<code>private boolean isIdentifierDerivationNecessary(Object value) { <START> return value != null && value.getClass().isAnnotationPresent(Entity.class); <END> }</code><technical_language>I need ask Metamodel for this is a managed type all. a class unknown persistence context</technical_language>

Target:
private boolean isIdentifierDerivationNecessary(Object value) { if (value == null) { return false; } try { ManagedType<? extends Object> managedType = this.metamodel.managedType(value.getClass()); return managedType != null && managedType.getPersistenceType() == PersistenceType.ENTITY; } catch (IllegalArgumentException iae) { return false; } }
Source:
<code>public void execute(TaskListener listener) { for (JCloudsCloud cloud : JCloudsCloud.getClouds()) { for (JCloudsSlaveTemplate template : cloud.getTemplates()) { SlaveOptions slaveOptions = template.getEffectiveSlaveOptions(); int instancesMin = slaveOptions.getInstancesMin(); int retentionTime = slaveOptions.getRetentionTime(); if (instancesMin > 0) { int globalMaxInstances = cloud.getEffectiveSlaveOptions().getInstanceCap(); int templateMaxInstances = slaveOptions.getInstanceCap(); int maxNodes = Math.min(templateMaxInstances, globalMaxInstances); <START> int runningNodeTotal = template.getActiveNodesTotal(retentionTime == 0); <END> int desiredNewInstances = Math.min(instancesMin, maxNodes) - runningNodeTotal; if (desiredNewInstances > 0) { LOGGER.log(Level.INFO, "Pre-creating " + desiredNewInstances + " instance(s) for template " + template.name + " in cloud " + cloud.name); for (int i = 0; i < desiredNewInstances; i++) { try { cloud.doProvisionSlave(template); } catch (Throwable ex) { LOGGER.log(Level.SEVERE, "Failed to pre-create instance from template " + template.name, ex); } } } } } } }</code><technical_language>NIT: information retention time extracted node's SlaveOptions template configuration changed node provisioned</technical_language>

Target:
public void execute(TaskListener listener) { for (JCloudsCloud cloud : JCloudsCloud.getClouds()) { for (JCloudsSlaveTemplate template : cloud.getTemplates()) { SlaveOptions slaveOptions = template.getEffectiveSlaveOptions(); int instancesMin = slaveOptions.getInstancesMin(); int retentionTime = slaveOptions.getRetentionTime(); if (instancesMin > 0) { int globalMaxInstances = cloud.getEffectiveSlaveOptions().getInstanceCap(); int templateMaxInstances = slaveOptions.getInstanceCap(); int maxNodes = Math.min(templateMaxInstances, globalMaxInstances); int reusableRunningNodeTotal = template.getActiveNodesTotal(retentionTime == 0); int runningNodeTotal = template.getActiveNodesTotal(false); int desiredNewInstances = Math.min(instancesMin - reusableRunningNodeTotal, maxNodes - runningNodeTotal); if (desiredNewInstances > 0) { LOGGER.log(Level.INFO, "Pre-creating " + desiredNewInstances + " instance(s) for template " + template.name + " in cloud " + cloud.name); for (int i = 0; i < desiredNewInstances; i++) { try { cloud.provisionSlave(template); } catch (Throwable ex) { LOGGER.log(Level.SEVERE, "Failed to pre-create instance from template " + template.name, ex); } } } } } } }
Source:
<code>private boolean migrateSyncthingOptions () { boolean changed = false; int iConfigVersion = Integer.parseInt(mConfig.getDocumentElement().getAttribute("version")); Log.i(TAG, "Found existing config version " + Integer.toString(iConfigVersion)); if (iConfigVersion == 27) { Log.i(TAG, "Migrating config version " + Integer.toString(iConfigVersion) + " to 28 ..."); NodeList folders = mConfig.getDocumentElement().getElementsByTagName("folder"); for (int i = 0; i < folders.getLength(); i++) { Element r = (Element) folders.item(i); Log.i(TAG, "Set 'fsWatcherEnabled' on folder " + r.getAttribute("id")); r.setAttribute("fsWatcherEnabled", Boolean.toString(true)); changed = true; } iConfigVersion = 28; mConfig.getDocumentElement().setAttribute("version", Integer.toString(iConfigVersion)); <START> Log.i(TAG, "Config version " + Integer.toString(iConfigVersion) + " reached."); <END> } return changed; }</code><technical_language>want move attribute setting logging juist return, more migration, point setting version attribute in migration, adjust stack variable in individual migration</technical_language>

Target:
private boolean migrateSyncthingOptions () { int iConfigVersion = Integer.parseInt(mConfig.getDocumentElement().getAttribute("version")); int iOldConfigVersion = iConfigVersion; Log.i(TAG, "Found existing config version " + Integer.toString(iConfigVersion)); if (iConfigVersion == 27) { Log.i(TAG, "Migrating config version " + Integer.toString(iConfigVersion) + " to 28 ..."); NodeList folders = mConfig.getDocumentElement().getElementsByTagName("folder"); for (int i = 0; i < folders.getLength(); i++) { Element r = (Element) folders.item(i); Log.i(TAG, "Set 'fsWatcherEnabled', 'fsWatcherDelayS' on folder " + r.getAttribute("id")); r.setAttribute("fsWatcherEnabled", "true"); r.setAttribute("fsWatcherDelayS", "10"); } iConfigVersion = 28; } if (iConfigVersion != iOldConfigVersion) { mConfig.getDocumentElement().setAttribute("version", Integer.toString(iConfigVersion)); Log.i(TAG, "New config version is " + Integer.toString(iConfigVersion)); return true; } else { return false; } }
Source:
<code>public int compare(Object o1, Object o2) { if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if (o1.equals(o2)) { return 0; } Class<?> inf = findSpi(o1.getClass()); ActivateInfo a1 = parseActivate(o1.getClass()); ActivateInfo a2 = parseActivate(o2.getClass()); <START> if ((a1.before.length > 0 || a1.after.length > 0 || a2.before.length > 0 || a2.after.length > 0) && inf != null) { <END> ExtensionLoader<?> extensionLoader = ExtensionLoader.getExtensionLoader(inf); if (a1.before.length > 0 || a1.after.length > 0) { String n2 = extensionLoader.getExtensionName(o2.getClass()); for (String before : a1.before) { if (before.equals(n2)) { return -1; } } for (String after : a1.after) { if (after.equals(n2)) { return 1; } } } if (a2.before.length > 0 || a2.after.length > 0) { String n1 = extensionLoader.getExtensionName(o1.getClass()); for (String before : a2.before) { if (before.equals(n1)) { return 1; } } for (String after : a2.after) { if (after.equals(n1)) { return -1; } } } } int n1 = a1 == null ? 0 : a1.order; int n2 = a2 == null ? 0 : a2.order; return n1 > n2 ? 1 : -1; }</code><technical_language>refactore extractive new util method e.g. if( inf !=null && (isValidActiveInfo(a1) || isValidActiveInfo(a2)) { ... } private boolean isValidActiveInfo(ActiveInfo activeInfo) { return activeInfo.before.length > 0 || activeInfo.after.length > 0 } increase readability. do say</technical_language>

Target:
public int compare(Object o1, Object o2) { if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if (o1.equals(o2)) { return 0; } Class<?> inf = findSpi(o1.getClass()); ActivateInfo a1 = parseActivate(o1.getClass()); ActivateInfo a2 = parseActivate(o2.getClass()); if ((a1.applicableToCompare() || a2.applicableToCompare()) && inf != null) { ExtensionLoader<?> extensionLoader = ExtensionLoader.getExtensionLoader(inf); if (a1.applicableToCompare()) { String n2 = extensionLoader.getExtensionName(o2.getClass()); if (a1.isLess(n2)) { return -1; } if (a1.isMore(n2)) { return 1; } } if (a2.applicableToCompare()) { String n1 = extensionLoader.getExtensionName(o1.getClass()); if (a2.isLess(n1)) { return 1; } if (a2.isMore(n1)) { return -1; } } } int n1 = a1 == null ? 0 : a1.order; int n2 = a2 == null ? 0 : a2.order; return n1 > n2 ? 1 : -1; }
Source:
<code>public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if <START> (!refactoringStatus.isOK()) <END> { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } return refactoringStatus; }</code><technical_language>I refactoringStatus null in org.eclipse.ltk.core.refactoring.RefactoringStatus.merge(RefactoringStatus)</technical_language>

Target:
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { RefactoringStatus refactoringStatus = RefactoringStatus.create(Resources.checkInSync(fResource)); if (refactoringStatus != null && !refactoringStatus.isOK()) { boolean autoRefresh= Platform.getPreferencesService().getBoolean(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false, null); if (autoRefresh) { fResource.refreshLocal(IResource.DEPTH_INFINITE, pm); refactoringStatus= RefactoringStatus.create(Resources.checkInSync(fResource)); } } return refactoringStatus; }
Source:
<code>public void addServer(String serverName, String url, String username, String password) { <START> RemoteServerData serverData = new RemoteServerDataImpl(url, serverName, username, password); <END> addRemoteData(serverData); if(RemoteDescriptorProvider.DATACLOUD_SERVER_NAME.equals(serverName)){ configWriter.addRemoteServer(serverName, null, username, password); }else{ configWriter.addRemoteServer(serverName, url, username, password); } }</code><technical_language>this PR, this final :)</technical_language>

Target:
public void addServer(String serverName, String url, String username, String password) { final RemoteServerData serverData = new RemoteServerDataImpl(url, serverName, username, password); addRemoteData(serverData); if(RemoteDescriptorProvider.DATACLOUD_SERVER_NAME.equals(serverName)){ configWriter.addRemoteServer(serverName, null, username, password); }else{ configWriter.addRemoteServer(serverName, url, username, password); } }
Source:
<code>private void registerCompositeDataStore() { <START> if (delegateDataStores.isEmpty()) { <END> log.info("Composite Data Store registration is deferred until there is an active delegate data store"); return; } if (null == dataStore) { Properties properties = new Properties(); if (null != config) { properties.putAll(config); } dataStore = new CompositeDataStore(properties); } for (CompositeDataStoreDelegate delegate : delegateDataStores) { dataStore.addDelegate(delegate); } if (isRegistered) { return; } BundleContext bundleContext = context.getBundleContext(); Dictionary<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_PID, dataStore.getClass().getName()); props.put(DESCRIPTION, getDescription()); closer.register(asCloseable(bundleContext.registerService( new String[] { DataStore.class.getName(), CompositeDataStore.class.getName() }, dataStore, props ))); isRegistered = true; }</code><technical_language>IMO this is simplistic a condition i.e based roles configured satisfied delegate datastores. a situation for e.g. a read-only DataStore configured writable DataStore CompositeDataStore is initialized application store blob</technical_language>

Target:
private void registerCompositeDataStore() { if (null == dataStore) { Properties properties = null; new Properties(); if (null != config) { properties = new Properties(); properties.putAll(config); } if (null == properties) { log.error("Composite Data Store configuration missing"); return; } Set<String> configuredRoles = CompositeDataStore.getRolesFromConfig(properties); if (0 == configuredRoles.size()) { log.error("No roles configured for Composite Data Store"); return; } if (registeredRoles.size() != configuredRoles.size() || ! configuredRoles.containsAll(registeredRoles)) { log.info("Composite Data Store registration is deferred until all delegate data stores are active"); return; } dataStore = new CompositeDataStore(properties, configuredRoles); } else { if (delegateDataStores.size() != dataStore.getRoles().size()) { log.info("Composite Data Store registration is deferred until all delegate data stores are active"); return; } } for (DataStoreProvider dsp : delegateDataStores) { dataStore.addDelegate(dsp); } if (! isServiceRegistered) { log.info("Registering Composite Data Store"); BundleContext bundleContext = context.getBundleContext(); Dictionary<String, Object> props = new Hashtable<>(); props.put(Constants.SERVICE_PID, dataStore.getClass().getName()); props.put(DESCRIPTION, getDescription()); closer.register(asCloseable(bundleContext.registerService( new String[] { DataStore.class.getName(), CompositeDataStore.class.getName() }, dataStore, props ))); isServiceRegistered = true; } try { initializeDataStore(context, config, dataStore); registerDataStore(context, config, dataStore, getStatisticsProvider(), getDescription(), closer); } catch (RepositoryException e) { log.error("Unable to register CompositeDataStore as a data store", e); } }
Source:
<code>private List<Edit> adaptDiffContent(DiffInfo diffInfo, PatchScriptX patchScriptX, IProgressMonitor monitor) throws GerritException { List<DiffContent> diffContent = diffInfo.getContent(); List<Edit> editsInFile = new ArrayList<>(); int contentSize = 0; <START> for (int i = 0; i < diffContent.size(); i++) { <END> if (diffContent.get(i).getAb() != null) { contentSize += diffContent.get(i).getAb().size(); } else if (diffContent.get(i).getA() != null && diffContent.get(i).getB() != null) { Edit edit = new Edit(contentSize, contentSize + diffContent.get(i).getA().size() - 1, contentSize, contentSize + diffContent.get(i).getB().size() - 1); editsInFile.add(edit); contentSize += diffContent.get(i).getA().size(); patchScriptX.setIntralineDifference(true); } else if (diffContent.get(i).getA() != null) { Edit edit = new Edit(contentSize, contentSize + diffContent.get(i).getA().size() - 1, contentSize, contentSize); editsInFile.add(edit); contentSize += diffContent.get(i).getA().size(); } else if (diffContent.get(i).getB() != null) { Edit edit = new Edit(contentSize, contentSize, contentSize, contentSize + diffContent.get(i).getB().size() - 1); editsInFile.add(edit); contentSize += diffContent.get(i).getB().size(); } } return editsInFile; }</code><technical_language>if need index, do "for (DiffContent diff : diffContent)" "diffContent.get(i).getA()" "diff.getA()"</technical_language>

Target:
private List<Edit> adaptDiffContent(DiffInfo diffInfo, PatchScriptX patchScriptX, IProgressMonitor monitor) throws GerritException { List<DiffContent> diffContent = diffInfo.getContent(); List<Edit> editsInFile = new ArrayList<>(); int contentSize = 0; for (DiffContent diff : diffContent) { if (diff.getAb() != null) { contentSize += diff.getAb().size(); } else if (diff.getA() != null && diff.getB() != null) { Edit edit = new Edit(contentSize, contentSize + diff.getA().size() - 1, contentSize, contentSize + diff.getB().size() - 1); editsInFile.add(edit); contentSize += diff.getA().size(); patchScriptX.setIntralineDifference(true); } else if (diff.getA() != null) { Edit edit = new Edit(contentSize, contentSize + diff.getA().size() - 1, contentSize, contentSize); editsInFile.add(edit); contentSize += diff.getA().size(); } else if (diff.getB() != null) { Edit edit = new Edit(contentSize, contentSize, contentSize, contentSize + diff.getB().size() - 1); editsInFile.add(edit); contentSize += diff.getB().size(); } } return editsInFile; }
Source:
<code>public void saveModifications(MaterialInstance materialInstance, List<Modification> newChanges) { ArrayList<Modification> list = new ArrayList<Modification>(newChanges); Collections.reverse(list); for (Modification modification : list) { modification.setMaterialInstance(materialInstance); } try { getHibernateTemplate().saveOrUpdateAll(list); } catch (Exception e) { String message = "Cannot save modification"; LOGGER.error(message, e); throw new RuntimeException(message, e); } for (Modification modification : list) { removeLatestCachedModification(materialInstance, modification); <START> removeCachedModificationCountFor(materialInstance); <END> removeCachedModificationsFor(materialInstance); } }</code><technical_language>loop invariants. loop? I mean, need call for modification. enough if is called for materialInstance once. Right</technical_language>

Target:
public void saveModifications(MaterialInstance materialInstance, List<Modification> newChanges) { ArrayList<Modification> list = new ArrayList<Modification>(newChanges); Collections.reverse(list); for (Modification modification : list) { modification.setMaterialInstance(materialInstance); } try { getHibernateTemplate().saveOrUpdateAll(list); } catch (Exception e) { String message = "Cannot save modification"; LOGGER.error(message, e); throw new RuntimeException(message, e); } for (Modification modification : list) { removeLatestCachedModification(materialInstance, modification); } removeCachedModificationCountFor(materialInstance); removeCachedModificationsFor(materialInstance); }
Source:
<code>public String getDescription() { <START> return "Create an ISO surface contouring of the provided spatial table, use Z value of triangles if you not provide the name of vertices level columns."; <END> }</code><technical_language>..if do provide..</technical_language>

Target:
public String getDescription() { return "Create an ISO surface contouring of the provided spatial table, use Z value of triangles if you do not provide the name of vertices level columns."; }
Source:
<code>public void testRemoveValueUnequalStoreEntryCacheAccessExceptionNoCacheWriter() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final Ehcache<String, String> ehcache = this.getEhcache(null); <START> assertFalse(ehcache.remove("key", "value")); END> verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }</code><technical_language>I assert result of op, resilience strategy called</technical_language>

Target:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionNoCacheWriter() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final Ehcache<String, String> ehcache = this.getEhcache(null); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
<code>private static void getArgumentsFromPropertyFile(Map<String, String> argMap) throws IOException { if (argMap.containsKey(PROPERTY_FILE)) { Properties props = new Properties(); props.keySet(); String value = argMap.get(PROPERTY_FILE); if (value.startsWith("\"") && value.endsWith("\"")) { value= value.substring(1, value.length()-1); } FileInputStream in = new FileInputStream(argMap.get(PROPERTY_FILE)); props.load(in); <START> in.close(); <END> for (Object propertyKeyObject : props.keySet() ){ String key =(String)propertyKeyObject; if(argMap.get(key)==null){ argMap.put(key, props.getProperty(key)); } } } }</code><technical_language>close finally</technical_language>

Target:
private static void getArgumentsFromPropertyFile(Map<String, String> argMap) throws IOException { if (argMap.containsKey(PROPERTY_FILE)) { Properties props = new Properties(); props.keySet(); String value = argMap.get(PROPERTY_FILE); if (value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); } FileInputStream in = null; try { in = new FileInputStream(argMap.get(PROPERTY_FILE)); props.load(in); } catch (IOException e) { LOGGER.error("Unable to read file "+argMap.get("propertyfilepath")); exitVM(1); } finally { if (in != null) { in.close(); } } for (Object propertyKeyObject : props.keySet() ) { String key = (String) propertyKeyObject; if (argMap.get(key) == null) { argMap.put(key, props.getProperty(key)); } } } }
Source:
<code>public CtfTmfEventType(String eventName, ITmfTrace trace, ITmfEventField content) { <START> super(CONTEXT_ID + "/" + (trace != null ? trace.getPath() : CONTEXT_ID), eventName, content); END> }</code><technical_language>I a bit of string concatenating logic is in get method. extract a static private method for extra safety? computeContext()</technical_language>

Target:
public CtfTmfEventType(String eventName, ITmfTrace trace, ITmfEventField content) { super(computeContextName(trace), eventName, content); }
Source:
<code>String parse(String markdown) <START> { <END> String[] lines = markdown.split("\n"); StringBuilder result = new StringBuilder(); boolean activeList = false; for (int i = 0; i < lines.length; i++) { String lineResult = parseLine(lines[i]); if(lineResult.matches(".*(<li>).*") && !activeList){ activeList = true; result.append("<ul>"); result.append(lineResult); } else if(!lineResult.matches(".*(<li>).*") && activeList){ activeList = false; result.append("</ul>"); result.append(lineResult); } else { result.append(lineResult); } } if(activeList){ result.append("</ul>"); } return result.toString(); }</code><technical_language>Please put opening curly bracket line above: String parse(String markdown) { for else in file well. common code style for Java good consistent in exercise :)</technical_language>

Target:
String parse(String markdown) { String[] lines = markdown.split("\n"); StringBuilder result = new StringBuilder(); boolean activeList = false; for (int i = 0; i < lines.length; i++) { String lineResult = parseLine(lines[i]); if (lineResult.matches("(<li>).*") && !activeList) { activeList = true; result.append("<ul>"); result.append(lineResult); } else if (!lineResult.matches("(<li>).*") && activeList) { activeList = false; result.append("</ul>"); result.append(lineResult); } else { result.append(lineResult); } } if (activeList) { result.append("</ul>"); } return result.toString(); }
Source:
<code>public int createUploadNotification(Context context, String programName) { if (context == null || programName == null) { return -1; } initNotificationManager(context); Intent uploadIntent = new Intent(context, MainMenuActivity.class); uploadIntent.setAction(Intent.ACTION_MAIN); uploadIntent = uploadIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); <START> PendingIntent pendingIntent = PendingIntent.getActivity(context, getId(), uploadIntent, <END> PendingIntent.FLAG_CANCEL_CURRENT); NotificationData data = new NotificationData(context, pendingIntent, R.drawable.ic_stat, programName, R.string.notification_upload_title_pending, R.string.notification_upload_title_finished, R.string.notification_upload_pending, R.string.notification_upload_finished); int id = createNotification(context, data); showOrUpdateNotification(id, 0); return id; }</code><technical_language>getId() != notificationId, notificationId = ATOMIC_INTEGER.get() careful change behavior</technical_language>

Target:
public int createUploadNotification(Context context, String programName) { if (context == null || programName == null) { return -1; } initNotificationManager(context); Intent uploadIntent = new Intent(context, MainMenuActivity.class); uploadIntent.setAction(Intent.ACTION_MAIN); uploadIntent = uploadIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationId, uploadIntent, PendingIntent.FLAG_CANCEL_CURRENT); NotificationData data = new NotificationData(context, pendingIntent, R.drawable.ic_stat, programName, R.string.notification_upload_title_pending, R.string.notification_upload_title_finished, R.string.notification_upload_pending, R.string.notification_upload_finished); int id = createNotification(context, data); showOrUpdateNotification(id, 0); return id; }
Source:
<code>public AdaptiveSubmissionResult parseFromJson(final String json) { if (json.trim().isEmpty()) { logger.info("Attempted to parse empty string as JSON"); throw new IllegalArgumentException("Empty input"); } try { <START> <END> Gson gson = new GsonBuilder() .registerTypeAdapter( SubmissionResult.Status.class, new SubmissionResultParser.StatusDeserializer()) .registerTypeAdapter( StackTraceElement.class, new StackTraceSerializer()) .registerTypeAdapter( ImmutableList.class, new SubmissionResultParser.ImmutableListJsonDeserializer()) .create(); AdaptiveSubmissionResult result = gson.fromJson(json, AdaptiveSubmissionResult.class); JsonObject output = new JsonParser().parse(json).getAsJsonObject(); JsonElement validationElement = output.get("validations"); return result; } catch (RuntimeException runtimeException) { logger.warn("Failed to parse adaptive submission result", runtimeException); throw new RuntimeException( "Failed to parse adaptive submission result: " + runtimeException.getMessage(), runtimeException); } }</code><technical_language>Unnecessary new line</technical_language>

Target:
public AdaptiveSubmissionResult parseFromJson(final String json) { if (json.trim().isEmpty()) { logger.info("Attempted to parse empty string as JSON"); throw new IllegalArgumentException("Empty input"); } try { Gson gson = new GsonBuilder() .registerTypeAdapter( SubmissionResult.Status.class, new SubmissionResultParser.StatusDeserializer()) .registerTypeAdapter( StackTraceElement.class, new StackTraceSerializer()) .registerTypeAdapter( ImmutableList.class, new SubmissionResultParser.ImmutableListJsonDeserializer()) .create(); AdaptiveSubmissionResult result = gson.fromJson(json, AdaptiveSubmissionResult.class); return result; } catch (RuntimeException runtimeException) { logger.warn("Failed to parse adaptive submission result", runtimeException); throw new RuntimeException( "Failed to parse adaptive submission result: " + runtimeException.getMessage(), runtimeException); } }
Source:
<code>private void iccLockChanged(boolean success, int attemptsRemaining) { <START> if(DBG) Log.d(TAG, "iccLockChanged success: "+success); <END> if (success) { mPinToggle.setChecked(mToState); } else { setRemainingAttempts(true, attemptsRemaining); createCustomTextToast(getPinPasswordErrorMessage(attemptsRemaining)).show(); } mPinToggle.setEnabled(true); resetDialogState(); }</code><technical_language>remove debug log wrap in add space before/after + sign for other log statement</technical_language>

Target:
private void iccLockChanged(boolean success, int attemptsRemaining) { if(DBG) Log.d(TAG, "iccLockChanged success: "+success); if (success) { mPinToggle.setChecked(mToState); } else { showCustomTextToast(getPinPasswordErrorMessage(attemptsRemaining)); } mPinToggle.setEnabled(true); resetDialogState(); }
Source:
<code>private String getShortName(Concept concept) { User authenticatedUser = Context.getAuthenticatedUser(); String shortName = null; if(authenticatedUser != null) { String userDefaultLocale = authenticatedUser.getUserProperty(OpenmrsConstants.USER_PROPERTY_DEFAULT_LOCALE); Locale locale = LocaleUtility.fromSpecification(userDefaultLocale); ConceptName shortNameInLocale = concept.getShortNameInLocale(locale); if(shortNameInLocale != null) { shortName = shortNameInLocale.getName(); } else { ConceptName fullySpecifiedName = concept.getFullySpecifiedName(locale); if (fullySpecifiedName != null) { shortName = fullySpecifiedName.getName(); } else { <START> String systemDefaultLocale = Context.getAdministrationService().getGlobalProperty("default_locale"); <END> if (systemDefaultLocale != null) { Locale defLocale = LocaleUtility.fromSpecification(systemDefaultLocale); shortName = concept.getFullySpecifiedName(defLocale).getName(); } } } } return shortName; }</code><technical_language>OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE "default_locale" :)</technical_language>

Target:
private String getShortName(Concept concept) { User authenticatedUser = Context.getAuthenticatedUser(); String shortName = null; if (authenticatedUser != null) { Locale userDefaultLocale = getUserDefaultLocale(authenticatedUser); shortName = getAnAvailableName(concept, userDefaultLocale); if (shortName == null) { Locale systemDefaultLocale = getSystemDefaultLocale(); shortName = getAnAvailableName(concept, systemDefaultLocale); } } if (shortName == null) { shortName = concept.getName().getName(); } return shortName; }
Source:
<code>public void visit(ClazzNode clazzNode) { cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("java/lang/Object", "org/twnc/runtime/Core", "Object", ACC_PUBLIC + ACC_STATIC); mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); <START> mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()L" + OBJ, false); <END> mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } super.visit(clazzNode); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>This results in "()LLjava/lang/Object;", is double L intended</technical_language>

Target:
public void visit(ClazzNode clazzNode) { cn = clazzNode; blockCount = 0; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); cw.visit(52, ACC_PUBLIC + ACC_SUPER, clazzNode.getName(), null, clazzNode.getSuperclass(), null); cw.visitInnerClass("java/lang/Object", "org/twnc/runtime/Core", "Object", ACC_PUBLIC + ACC_STATIC); mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getSuperclass(), "<init>", "()V", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); if (clazzNode.hasMain()) { mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, clazzNode.getName()); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, clazzNode.getName(), "<init>", "()V", false); mv.visitMethodInsn(INVOKEVIRTUAL, clazzNode.getName(), "_main", "()" + OBJ, false); mv.visitInsn(POP); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } super.visit(clazzNode); cw.visitEnd(); String path = outDir + clazzNode.getName() + ".class"; try (OutputStream out = new FileOutputStream(path)) { out.write(cw.toByteArray()); } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>public static boolean softenLanding(final Player player) { if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { return false; } final Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return false; } else if (bPlayer.canMetalbend() && ElementalAbility.isMetalBlock(block)) { return true; } <START> if ((player.getLocation().getY() % 1) != 0) <END> player.teleport(player.getLocation().add(0, 0.1, 0)); if (ElementalAbility.isEarth(block)) { for (final Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) { if (ElementalAbility.isEarth(affectedBlock)) { if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) { Material sand = Material.SAND; if (affectedBlock.getType() == Material.RED_SANDSTONE) { sand = Material.RED_SAND; } final TempBlock tb = new TempBlock(affectedBlock, sand); if (!SAND_BLOCKS.contains(tb)) { SAND_BLOCKS.add(tb); tb.setRevertTime(getDuration()); tb.setRevertTask(() -> SAND_BLOCKS.remove(tb)); } } } } return true; } return (TempBlock.isTempBlock(block) && EarthAbility.isEarthbendable(TempBlock.get(block).getBlock().getType(), true, true, false)) || EarthAbility.isEarthbendable(block.getType(), true, true, false) || ElementalAbility.isTransparent(player, block); }</code><technical_language>This check run? Dividing 1 a remainder, right?</technical_language>

Target:
public static boolean softenLanding(final Player player) { if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { return false; } final Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return false; } else if (bPlayer.canMetalbend() && ElementalAbility.isMetalBlock(block)) { return true; } if (ElementalAbility.isEarth(block)) { for (final Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) { if (ElementalAbility.isEarth(affectedBlock)) { if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) { Material sand = Material.SAND; if (affectedBlock.getType() == Material.RED_SANDSTONE) { sand = Material.RED_SAND; } final TempBlock tb = new TempBlock(affectedBlock, sand); if (!SAND_BLOCKS.contains(tb)) { SAND_BLOCKS.add(tb); tb.setRevertTime(getDuration()); tb.setRevertTask(() -> SAND_BLOCKS.remove(tb)); } } } } if ((player.getLocation().getY() % 1) != 0) { player.setVelocity(new Vector(0, 0.07, 0)); } return true; } return (TempBlock.isTempBlock(block) && EarthAbility.isEarthbendable(TempBlock.get(block).getBlock().getType(), true, true, false)) || EarthAbility.isEarthbendable(block.getType(), true, true, false) || ElementalAbility.isTransparent(player, block); }
Source:
<code>public void throwsWithTooLargeContentLength() { SupportedCipherDetails cipherDetails = AesGcmCipherDetails.INSTANCE_128_BIT; byte[] keyBytes = SecretKeyUtils.generate(cipherDetails).getEncoded(); <START> SecretKey key = SecretKeyUtils.loadKey(ByteUtils.subArray(keyBytes, 2), cipherDetails); <END> ExposedStringEntity stringEntity = new ExposedStringEntity("boo", Charsets.US_ASCII); EncryptingEntity entity = new EncryptingEntity(key, cipherDetails, stringEntity); }</code><technical_language>method java.util.Arrays.copyOfRange() instead of library Bouncy Castle</technical_language>

Target:
public void throwsWithTooLargeContentLength() { SupportedCipherDetails cipherDetails = AesGcmCipherDetails.INSTANCE_128_BIT; byte[] keyBytes = SecretKeyUtils.generate(cipherDetails).getEncoded(); SecretKey key = SecretKeyUtils.loadKey(Arrays.copyOfRange(keyBytes, 2, 10), cipherDetails); ExposedStringEntity stringEntity = new ExposedStringEntity("boo", Charsets.US_ASCII); EncryptingEntity entity = new EncryptingEntity(key, cipherDetails, stringEntity); }
Source:
<code><START> default boolean startsWith(Iterable<? extends T> that, int offset) { <END> if(offset < 0) return false; if(that instanceof IndexedSeq) { IndexedSeq<? extends T> dhat = (IndexedSeq<? extends T>) that; int i = offset; int j = 0; int thisLen = length(); int thatLen = dhat.length(); while(i < thisLen && j < thatLen && Objects.equals(this.get(i), dhat.get(j))) { i++; j++; } return j == thatLen; } else { int i = offset; int thisLen = length(); java.util.Iterator<? extends T> thatElems = that.iterator(); while(i < thisLen && thatElems.hasNext()) { if(!Objects.equals(this.get(i), thatElems.next())) return false; i++; } return !thatElems.hasNext(); } }</code><technical_language>null-check</technical_language>

Target:
default boolean startsWith(Iterable<? extends T> that, int offset) { Objects.requireNonNull(that, "that is null"); if(offset < 0) return false; if(that instanceof IndexedSeq) { IndexedSeq<? extends T> dhat = (IndexedSeq<? extends T>) that; int i = offset; int j = 0; int thisLen = length(); int thatLen = dhat.length(); while(i < thisLen && j < thatLen && Objects.equals(this.get(i), dhat.get(j))) { i++; j++; } return j == thatLen; } else { int i = offset; int thisLen = length(); java.util.Iterator<? extends T> thatElems = that.iterator(); while(i < thisLen && thatElems.hasNext()) { if(!Objects.equals(this.get(i), thatElems.next())){ return false; } i++; } return !thatElems.hasNext(); } }
Source:
<code>private void testChannelDelete() { channelService.delete(fromFileChannel.getModuleName()); <START> boolean doesModuleExistsAfterDeletion = channelService.channelExists(fromFileChannel.getModuleName()); <END> assertFalse(doesModuleExistsAfterDeletion); }</code><technical_language>verify this returns true deleting</technical_language>

Target:
private void testChannelDelete() { boolean moduleExistsBeforeDeletion = channelService.channelExists(fromFileChannel.getModuleName()); assertTrue(moduleExistsBeforeDeletion); channelService.delete(fromFileChannel.getModuleName()); boolean moduleExistsAfterDeletion = channelService.channelExists(fromFileChannel.getModuleName()); assertFalse(moduleExistsAfterDeletion); }
Source:
<code>public void setup(Context.OperatorContext context) { this.context = context; LOG.info("Initial Partition Count: {}", currentpartitionCount()); inFlightRecoveryMessages.clear(); inFlightRecoveryMessagesPartition.clear(); inFlightRecoveryMessagesDR.clear(); super.setConnectRetries(this.connectRetries); <START> super.setReconnectRetries(this.reconnectRetries); <END> super.setup(context); LOG.info("Operator ID = " + context.getId()); windowTime = context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(DAGContext.STREAMING_WINDOW_SIZE_MILLIS); arrivedMessagesToProcess = new ArrayBlockingQueue<BytesXMLMessage>(Integer.parseInt(this.unackedMessageLimit)); unackedMessages = new ArrayBlockingQueue<BytesXMLMessage>((Integer.parseInt(this.unackedMessageLimit)) * (context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT)) * 2); endpoint = factory.createQueue(this.endpointName); if (windowId > idempotentStorageManager.getLargestRecoveryWindow()) { super.startConsumer(); } try { operatorRecoveredWindows = idempotentStorageManager.getWindowIds(context.getId()); if (operatorRecoveredWindows != null) { Arrays.sort(operatorRecoveredWindows); } } catch (IOException e) { DTThrowable.rethrow(e); } }</code><technical_language>Similar above, redundant calls</technical_language>

Target:
public void setup(Context.OperatorContext context) { super.setup(context); flowHandler = new MessageHandler(arrivedMessagesToProcess); calculatePartitionCount(context); LOG.info("Initial Partition Count: {}", partitionCount); inFlightRecoveryMessages.clear(); inFlightRecoveryMessagesPartition.clear(); inFlightRecoveryMessagesDR.clear(); LOG.info("Operator ID = " + context.getId()); windowTime = context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(DAGContext.STREAMING_WINDOW_SIZE_MILLIS); arrivedMessagesToProcess = new ArrayBlockingQueue<BytesXMLMessage>(unackedMessageLimit); unackedMessages = new ArrayBlockingQueue<BytesXMLMessage>(unackedMessageLimit * (context.getValue(OperatorContext.APPLICATION_WINDOW_COUNT)) * 2); endpoint = factory.createQueue(this.endpointName); }
Source:
<code>static public void init(File extractDir) throws NativeIntegrationUnavailableException, NativeException { synchronized (Native.class) { if (loader == null) { Platform platform = Platform.current(); try { loader = new NativeLibraryLoader(platform, new NativeLibraryLocator(extractDir)); loader.load(platform.getLibraryName(), platform.getLibraryVariants()); long nativeVersion = NativeLibraryFunctions.getVersion(); if (nativeVersion != NativeVersion.VERSION) { throw new NativeException(String.format("Unexpected native library version loaded. Expected %s, was %s.", NativeVersion.VERSION, nativeVersion)); } <START> NativeLogger.initLogging(Native.class); <END> } catch (NativeException e) { throw e; } catch (Throwable t) { throw new NativeException("Failed to initialise native integration.", t); } } } }</code><technical_language>I if setting log level this point is a good idea. For Gradle, is is a Global service, logging initialized, yet, right? Especially initialized builds, if I run build --debug --quiet, log level of native part change I suppose. I understanding wrong here</technical_language>

Target:
static public void init(File extractDir) throws NativeIntegrationUnavailableException, NativeException { synchronized (Native.class) { if (loader == null) { Platform platform = Platform.current(); try { loader = new NativeLibraryLoader(platform, new NativeLibraryLocator(extractDir)); loader.load(platform.getLibraryName(), platform.getLibraryVariants()); String nativeVersion = NativeLibraryFunctions.getVersion(); if (!nativeVersion.equals(NativeVersion.VERSION)) { throw new NativeException(String.format("Unexpected native library version loaded. Expected %s, was %s.", NativeVersion.VERSION, nativeVersion)); } NativeLogger.initLogging(Native.class); } catch (NativeException e) { throw e; } catch (Throwable t) { throw new NativeException("Failed to initialise native integration.", t); } } } }