auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public URLStreamHandler createURLStreamHandler(String protocol) { <START> LOG.debug("createURLStreamHandler("+protocol+")"); <END> removeInvalidRefs(); for(WeakReference<PluginRepository> ref: prs) { PluginRepository pr = ref.get(); if(pr != null) { return pr.createURLStreamHandler(protocol); } } return null; }</code><technical_language>Please improve logging remove... parameterized logging possible</technical_language>

Target:
public URLStreamHandler createURLStreamHandler(String protocol) { LOG.debug("createURLStreamHandler({})", protocol); removeInvalidRefs(); for(WeakReference<PluginRepository> ref: prs) { PluginRepository pr = ref.get(); if(pr != null) { return pr.createURLStreamHandler(protocol); } } return null; }
Source:
<code>public ResultSet executeQuery(String query) { ResultSet result = null; try { <START> Statement s = mConnection.createStatement(); <END> s.execute("Select 1;"); } catch (SQLException e) { reconnection(); } try { Statement statement = mConnection.createStatement(); result = statement.executeQuery(query); } catch (SQLException e) { System.out.println(e.getMessage()); return null; } return result; }</code><technical_language>naming s</technical_language>

Target:
public ResultSet executeQuery(String query) { ResultSet result = null; try { Statement statement = mConnection.createStatement(); statement.execute("Select 1;"); } catch (SQLException e) { reconnect(); } try { Statement statement = mConnection.createStatement(); result = statement.executeQuery(query); } catch (SQLException e) { System.out.println(e.getMessage()); return null; } return result; }
Source:
<code>public boolean matchesSafely(final Response item) { try { final String head = item.head().iterator().next(); <START> return head.contains(String.valueOf(this.expected)); <END> } catch (final IOException exception) { throw new IllegalStateException(exception); } }</code><technical_language>hm... wrong. I split string (by spaces) part only</technical_language>

Target:
public boolean matchesSafely(final Response item) { try { final String head = item.head().iterator().next(); final String[] parts = head.split(" "); return this.expected.equals(parts[1]); } catch (final IOException exception) { throw new IllegalStateException(exception); } }
Source:
<code>public void closeWindow() { if (!shouldClose(programs())) { return; <START> } <END> closeViewer(); }</code><technical_language>argue spreading this out lines code clearer easier read. I guess need rock/paper/scissors a decision else depending touched file</technical_language>

Target:
public void closeWindow() { if (shouldClose(programs())) { closeViewer(); } }
Source:
<code>private static byte[] createRequestBody(String query, String resultFormat, boolean queryHeader) { <START> if (!queryHeader) { <END> return format("{\"query\":\"%s\",\"resultFormat" + "\":\"%s\",\"header\": false }\n", query, resultFormat).getBytes(); } else { return format("{\"query\":\"%s\"}\n", query).getBytes(); } }</code><technical_language>change order: if (queryHeader) { return ... } return ..</technical_language>

Target:
private static byte[] createRequestBody(String query, String resultFormat, boolean queryHeader) { if (queryHeader) { return format("{\"query\":\"%s\"}\n", query).getBytes(); } else { return format("{\"query\":\"%s\",\"resultFormat" + "\":\"%s\",\"header\": false }\n", query, resultFormat).getBytes(); } }
Source:
<code><START> public UserUsage getUsage(String username) { <END> int userId = getUserId(username); try (PreparedStatement search = conn.prepareStatement("SELECT total_bytes, errored FROM userusage WHERE user_id = ?;")) { search.setInt(1, userId); ResultSet resultSet = search.executeQuery(); resultSet.next(); long totalBytes = resultSet.getLong(1); boolean errored = resultSet.getBoolean(2); Map<PublicKeyHash, Long> pending = new HashMap<>(); try (PreparedStatement pendingSearch = conn.prepareStatement("SELECT writer_id, pending_bytes FROM pendingusage WHERE user_id = ?;")) { pendingSearch.setInt(1, userId); ResultSet pendingResults = pendingSearch.executeQuery(); while (pendingResults.next()) pending.put(getWriter(pendingResults.getInt(1)), pendingResults.getLong(2)); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } return new UserUsage(totalBytes, errored, pending); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }</code><technical_language>Ths sql statement is a join userusage pendingusage</technical_language>

Target:
public UserUsage getUsage(String username) { int userId = getUserId(username); try (Connection conn = getNonCommittingConnection(); PreparedStatement search = conn.prepareStatement("SELECT pu.writer_id, pu.pending_bytes, uu.total_bytes, uu.errored " + "FROM userusage uu, pendingusage pu WHERE uu.user_id = pu.user_id AND uu.user_id = ?;"); PreparedStatement writerSearch = conn.prepareStatement("SELECT key_hash FROM writers WHERE id = ?;")) { try { search.setInt(1, userId); ResultSet resultSet = search.executeQuery(); Map<PublicKeyHash, Long> pending = new HashMap<>(); long totalBytes = -1; boolean errored = false; while (resultSet.next()) { writerSearch.setInt(1, resultSet.getInt(1)); ResultSet writerRes = writerSearch.executeQuery(); writerRes.next(); PublicKeyHash writer = PublicKeyHash.decode(writerRes.getBytes(1)); pending.put(writer, resultSet.getLong(2)); if (totalBytes == -1) { totalBytes = resultSet.getLong(3); errored = resultSet.getBoolean(4); } } conn.commit(); return new UserUsage(totalBytes, errored, pending); } catch (SQLException e) { conn.rollback(); throw e; } } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }
Source:
<code>public void handleContainerLaunchFail(String containerID, String resourceID, ContainerAllocator containerAllocator) { if (StandbyTaskUtil.isStandbyContainer(containerID)) { log.info("Handling launch fail for standby-container {}, requesting resource on any host {}", containerID); <START> containerAllocator.requestResource(containerID, ResourceRequestState.ANY_HOST, faultDomainManager.getAllowedFaultDomainsForSchedulingContainer(getActiveContainerHost(containerID))); <END> } else { initiateStandbyAwareAllocation(containerID, resourceID, containerAllocator); } }</code><technical_language>hmm, wondering if place changes a config</technical_language>

Target:
public void handleContainerLaunchFail(String containerID, String resourceID, ContainerAllocator containerAllocator) { if (StandbyTaskUtil.isStandbyContainer(containerID)) { log.info("Handling launch fail for standby-container {}, requesting resource on any host {}", containerID); String activeContainerHost = getActiveContainerHost(containerID) .orElse(null); requestResource(containerAllocator, containerID, ResourceRequestState.ANY_HOST, Duration.ZERO, activeContainerHost); } else { initiateStandbyAwareAllocation(containerID, resourceID, containerAllocator); } }
Source:
<code>private void addMultipleEntries(ListDialogField<String> field) { String title, message; if (isExclusion(field)) { title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description; } else { title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description; } IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true); if (res != null) { for (IPath <START> re : <END> res) { field.addElement(re.toString()); } } }</code><technical_language>rename p</technical_language>

Target:
private void addMultipleEntries(ListDialogField<String> field) { String title, message; if (isExclusion(field)) { title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description; } else { title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title; message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description; } IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true); if (res != null) { for (IPath p : res) { field.addElement(p.toString()); } } }
Source:
<code>public void notification_onCommitModelObject() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<AllJavaTypes> listener = new RealmChangeListener<AllJavaTypes>() { @Override public void onChange(AllJavaTypes object) { counter.incrementAndGet(); } }; child.addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); <START> looperThread.postRunnable( <END> new Runnable() { @Override public void run() { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); looperThread.testComplete(); } } ); }</code><technical_language>careful postRunnable(). This work for async commits handled a background thread, posting runnable notification thread. I this is reason @beeender added a sleep in a cases</technical_language>

Target:
public void notification_onCommitModelObject() { final Realm looperThreadRealm = looperThread.realm; looperThreadRealm.beginTransaction(); AllJavaTypes child = looperThreadRealm.createObject(AllJavaTypes.class, 10); looperThreadRealm.commitTransaction(); final AtomicInteger counter = new AtomicInteger(0); RealmChangeListener<AllJavaTypes> listener = new RealmChangeListener<AllJavaTypes>() { @Override public void onChange(AllJavaTypes object) { counter.incrementAndGet(); } }; child.addChangeListener(listener); looperThreadRealm.beginTransaction(); AllJavaTypes parent = looperThreadRealm.createObject(AllJavaTypes.class, 1); parent.setFieldObject(child); looperThreadRealm.commitTransaction(); verifyPostConditions( looperThreadRealm, new PostConditions() { public void run(Realm realm) { assertEquals(2, looperThreadRealm.where(AllJavaTypes.class).findAll().size()); assertEquals(1, counter.get()); } }, child, parent); }
Source:
<code>public void start(BundleContext context) throws Exception { <START> ArchiveCommand.registerFormat("tar", new TarFormat()); <END> ArchiveCommand.registerFormat("tgz", new TgzFormat()); ArchiveCommand.registerFormat("txz", new TxzFormat()); ArchiveCommand.registerFormat("zip", new ZipFormat()); }</code><technical_language>pull this a static method pgm.Archive invoke a BundleContext. need maintain this list in places</technical_language>

Target:
public void start(BundleContext context) throws Exception { start(); }
Source:
<code>public DifferenceFilterManager(Preferences preferenceStore) { <START> map = new LinkedHashMap<String, DifferenceFilterDefaultConfWrapper>(); <END> this.preferenceStore = preferenceStore; }</code><technical_language>wrap LHM in Collections.synchronizedMap() a registry listener</technical_language>

Target:
public DifferenceFilterManager(Preferences preferenceStore) { map = Collections.synchronizedMap(new LinkedHashMap<String, DifferenceFilterDefaultConfiguration>()); this.preferenceStore = preferenceStore; }
Source:
<code><START> private void appendUnsafe( final Write write, boolean sync ) { <END> index(write); content.putInt(write.size()); write.copyTo(content); inventory.add(write.getRecord().longValue()); if ( sync ) { sync(); exec.execute( new Runnable() { @Override public void run() { BINARY_QUEUE.add( new WriteEvent( write, environment ) ); } } ); } }</code><technical_language>remove extra space parenthesis for consistent styling</technical_language>

Target:
private void appendUnsafe(final Write write, boolean sync) { index(write); content.putInt(write.size()); write.copyTo(content); inventory.add(write.getRecord().longValue()); if(sync) { sync(); } executor.execute(new Runnable() { @Override public void run() { BINARY_QUEUE.add(new WriteEvent(write, environment)); } }); }
Source:
<code>public void deleteUser(PrincipalUser user) { requireNotDisposed(); requireArgument(user != null && user.getId() != null && user.getId().compareTo(ZERO) > 0, "User cannot be null and must have a valid ID."); _logger.debug("Deleting user {}.", user); EntityManager em = emf.get(); deleteEntity(em, user); em.flush(); <START> USERCACHE.invalidate(user.getUserName()); <END> }</code><technical_language>@bsura user1 is deleting user_x. code executed line 146. if user2 is read user_x, user_x object exist in cache returning cache. invalidating cache for user_x user_x is deleted DB</technical_language>

Target:
public void deleteUser(PrincipalUser user) { requireNotDisposed(); requireArgument(user != null && user.getId() != null && user.getId().compareTo(ZERO) > 0, "User cannot be null and must have a valid ID."); _logger.debug("Deleting user {}.", user); USERCACHE.invalidate(user.getUserName()); EntityManager em = emf.get(); deleteEntity(em, user); em.flush(); }
Source:
<code>default HasSettings setSettings(EnumMap<Setting, Object> settings) { Map<String, Object> convertedSettings = settings.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().toString(), Entry::getValue)); <START> CommandExecutionHelper.execute(this, setSettingsCommand(convertedSettings)); <END> return this; }</code><technical_language>this other setSettings method</technical_language>

Target:
default HasSettings setSettings(EnumMap<Setting, Object> settings) { Map<String, Object> convertedSettings = settings.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().toString(), Entry::getValue)); return setSettings(convertedSettings); }
Source:
<code>public void reloadSession(String path, String userName, String botName, Boolean killAimlIf) { loading = true; broadcastState(); if (sessions.containsKey(botName) && sessions.get(botName).containsKey(userName)) { <START> if (sessions.containsKey(botName)) <END> sessions.get(botName).remove(userName); } bot = null; startSession(path, userName, getCurrentBotName()); }</code><technical_language>I great want sessions contains botName key, checked in line 602 : )</technical_language>

Target:
public void reloadSession(String path, String userName, String botName, Boolean killAimlIf) { loading = true; broadcastState(); if (sessions.containsKey(botName) && sessions.get(botName).containsKey(userName)) { sessions.get(botName).remove(userName); } else { log.warn("Reloading an unknown session {}", botName, userName); } bot = null; startSession(path, userName, getCurrentBotName()); }
Source:
<code>void onMouseEnterGameStatus() { <START> if (playerInfoBean.getGameStatus() != GameStatus.NONE) { <END> GameStatusTooltipController gameStatusTooltipController = applicationContext.getBean(GameStatusTooltipController.class); gameStatusTooltipController.setGameInfoBean(gameService.getByUid(playerInfoBean.getGameUID())); Tooltip statusTooltip = new Tooltip(); statusTooltip.setGraphic(gameStatusTooltipController.getRoot()); Tooltip.install(statusImageView, statusTooltip); } }</code><technical_language>Prefer: if(abortCondition) { return; } // lots of code over: if(continueCondition) { // lots of code } adds unnecessary indentation</technical_language>

Target:
void onMouseEnterGameStatus() { if (playerInfoBean.getGameStatus() == GameStatus.NONE) { return; } GameStatusTooltipController gameStatusTooltipController = applicationContext.getBean(GameStatusTooltipController.class); gameStatusTooltipController.setGameInfoBean(gameService.getByUid(playerInfoBean.getGameUid())); Tooltip statusTooltip = new Tooltip(); statusTooltip.setGraphic(gameStatusTooltipController.getRoot()); Tooltip.install(statusImageView, statusTooltip); }
Source:
<code>static void reTryKerberos(boolean enabled) { if (enabled) { log.debug("Try relogin kerberos at first!"); try { if (UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().reloginFromKeytab(); } else if (UserGroupInformation.isLoginTicketBased()) { UserGroupInformation.getLoginUser().reloginFromTicketCache(); } } catch (IOException e) { <START> log.error("Try relogin kerberos failed!"); <END> throw new RuntimeException(e); } } }</code><technical_language>nit: This result in double logging</technical_language>

Target:
static void reTryKerberos(boolean enabled) { if (enabled) { log.debug("Try relogin kerberos at first!"); try { if (UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.getLoginUser().reloginFromKeytab(); } else if (UserGroupInformation.isLoginTicketBased()) { UserGroupInformation.getLoginUser().reloginFromTicketCache(); } } catch (IOException e) { throw new RuntimeException(e); } } }
Source:
<code>public void finishBundle(Context context) { <START> Iterator<Entry<KV<String, String>, KV<Double, Integer>>> it = accumulator.entrySet().iterator(); <END> while (it.hasNext()) { Map.Entry<KV<String, String>, KV<Double, Integer>> entry = it.next(); context.output(KV.of(entry.getKey(), entry.getValue())); } }</code><technical_language>this a plain-jane for-each loop: for (Map.Entry<KV<String, String>, KV<Double, Integer>> entry : accumulator.entrySet()) { context.output(KV.of(entry.getKey(), entry.getValue())); } Also, want consider extracting out a more general pattern do Strings: static <K, V> void output(DoFn<?, KV<K, V>>.Context context, Map<? extends K, ? extends V> map) { for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) { context.output(KV.<K, V>of(entry.getKey(), entry.getValue())); } }</technical_language>

Target:
public void finishBundle(Context context) { output(context, accumulator); }
Source:
<code>public static OrderSubclass parse(String s) { try { return OrderSubclass.valueOf(s); } catch (Exception e) { <START> throw new RuntimeException("Unknown OrderSubclass " + s + "."); <END> } }</code><technical_language>ExchangeException</technical_language>

Target:
public static OrderSubclass parse(String s) { try { return OrderSubclass.valueOf(s); } catch (Exception e) { throw new ExchangeException("Unknown OrderSubclass " + s + "."); } }
Source:
<code>public void testGetOperatorClassesCommandLineInfo() throws Exception { String arg2 = "com.example.mydtapp.Application"; String arg3 = appFile.getAbsolutePath(); ApexCli.GetOperatorClassesCommandLineInfo commandLineOptions = ApexCli.getGetOperatorClassesCommandLineInfo(new String[] {"-parent", arg2, arg3 }); Assert.assertEquals(commandLineOptions.parent, arg2); Assert.assertEquals(commandLineOptions.args.length, 1); <START> if (commandLineOptions.args.length == 1) { <END> Assert.assertEquals(commandLineOptions.args[0], arg3); } }</code><technical_language>Is test necessary? test fail assert commandLineOptions.args.length == 1</technical_language>

Target:
public void testGetOperatorClassesCommandLineInfo() throws Exception { String arg2 = "option value"; String arg3 = "regular parameter"; ApexCli.GetOperatorClassesCommandLineInfo commandLineOptions = ApexCli.getGetOperatorClassesCommandLineInfo(new String[] {"-parent", arg2, arg3}); Assert.assertEquals(commandLineOptions.parent, arg2); Assert.assertEquals(commandLineOptions.args.length, 1); Assert.assertEquals(commandLineOptions.args[0], arg3); }
Source:
<code>public long skip(long n) throws IOException { if (isClosed) { throw new IOException("closed stream"); } if (available <= 0) { throw new EOFException("no more data available"); <START> } <END> if (size - available < n) { n = size - available; available = 0; } else { available -= n; } return n; }</code><technical_language>EOFException is anywhere. retain IOException</technical_language>

Target:
public long skip(long n) throws IOException { if (isClosed) { throw new IOException("closed stream"); } if (available <= 0) { throw new IOException("no more data"); } if (size - available < n) { n = size - available; available = 0; } else { available -= n; } return n; }
Source:
<code>public void writeToXml(PrintWriter pw1, int indent) { pw1.println(MekHqXmlUtil.indentStr(indent) + "<mothballInfo>"); if (tech != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techId", tech.getId()); } if (forceID > 0) { <START> MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "forceID", forceID); <END> } for (Person driver : drivers) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "driverId", driver.getId()); } for (Person gunner : gunners) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "gunnerId", gunner.getId()); } for (Person crew : vesselCrew) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "vesselCrewId", crew.getId()); } if (navigator != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "navigatorId", navigator.getId()); } if (techOfficer != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techOfficerId", techOfficer.getId()); } pw1.println(MekHqXmlUtil.indentStr(indent) + "</mothballInfo>"); }</code><technical_language>suggestion MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "forceID", forceID);</technical_language>

Target:
public void writeToXml(PrintWriter pw1, int indent) { pw1.println(MekHqXmlUtil.indentStr(indent++) + "<mothballInfo>"); if (tech != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techId", tech.getId()); } if (forceID > 0) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "forceID", forceID); } for (Person driver : drivers) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "driverId", driver.getId()); } for (Person gunner : gunners) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "gunnerId", gunner.getId()); } for (Person crew : vesselCrew) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "vesselCrewId", crew.getId()); } if (navigator != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "navigatorId", navigator.getId()); } if (techOfficer != null) { MekHqXmlUtil.writeSimpleXmlTag(pw1, indent, "techOfficerId", techOfficer.getId()); } pw1.println(MekHqXmlUtil.indentStr(--indent) + "</mothballInfo>"); }
Source:
<code>public void testGetBadLazyArgument_shouldThrow() { Lazy<Object> badEvaluatingLazy = Lazy.of(() -> { throw new TestSpecificException(); }); <START> unit.build(new GenericType<Lazy<Integer>>() {}.getType(), badEvaluatingLazy, null); <END> }</code><technical_language>In AssertJ: java assertThatThrownBy(() -> unit.build(...)) .isInstanceOf(TestSpecificException.class);</technical_language>

Target:
public void testGetBadLazyArgument_shouldThrow() { Lazy<Object> badEvaluatingLazy = Lazy.of(() -> { throw new TestSpecificException(); }); assertThatThrownBy(() -> unit.build(new GenericType<Lazy<Integer>>() {}.getType(), badEvaluatingLazy, null)) .isInstanceOf(TestSpecificException.class); }
Source:
<code>public FoundIndication scan(Run build) throws IOException { String currentFile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(build.getLogReader()); List<FailureCause> causes = new ArrayList<>(1); FailureCause fc = new FailureCause("somename", "somedescription"); causes.add(fc); fc.addIndication(indication); List<FoundFailureCause> foundFailureCauses = FailureReader.scanSingleLinePatterns(causes, build, reader, currentFile); if (foundFailureCauses.isEmpty()) { return null; } else { return foundFailureCauses.get(0).getIndications().get(0); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } <START> } <END> }</code><technical_language>I if deletion of override is required</technical_language>

Target:
public FoundIndication scan(Run build) throws IOException { String currentFile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(build.getLogReader()); List<FailureCause> causes = new ArrayList<FailureCause>(1); FailureCause fc = new FailureCause("somename", "somedescription"); causes.add(fc); fc.addIndication(indication); List<FoundFailureCause> foundFailureCauses = FailureReader.scanSingleLinePatterns(causes, build, reader, currentFile); if (foundFailureCauses.isEmpty()) { return null; } else { return foundFailureCauses.get(0).getIndications().get(0); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }
Source:
<code>public void run() throws InterruptedException, IOException { while (!this.shutDown) { final Job job = this.getJob(); if (null == job) { LOGGER.info("empty job list and sleep " + this.intervalInSeconds + " seconds"); <START> Thread.sleep(this.intervalInSeconds * 1000); <END> continue; } this.setCurrentJid(job.getJid()); LOGGER.info("working on " + job.getKlassName() + ":" + this.getCurrentJid()); job.process(); } }</code><technical_language>catching InterruptedException instead of letting pass through</technical_language>

Target:
public void run() throws InterruptedException, IOException { while (!this.shutDown) { final Job job = this.getJob(); if (null == job) { LOGGER.info("empty job list and sleep seconds", this.intervalInSeconds); Thread.sleep(this.intervalInSeconds * 1000); continue; } this.setCurrentJid(job.getJid()); LOGGER.info("working on : {}", job.getKlassName(), this.getCurrentJid()); job.process(); } }
Source:
<code>public void testAsyncWIHExecutedMoreThanOnceOnOracle() throws InterruptedException { KieSession ksession = createKSession(PROCESS); WorkItemManager wim = ksession.getWorkItemManager(); wim.registerWorkItemHandler("async", new AsyncWorkItemHandler(getExecutorService(), CounterCommand.class.getName())); ksession.startProcess(PROCESS_ID); Thread.sleep(10000); <START> Assertions.assertThat(CounterCommand.getCounter()).as("The job has not been executed").isNotEqualTo(0); <END> Assertions.assertThat(CounterCommand.getCounter()).as("The job has been executed multiple times").isEqualTo(1); }</code><technical_language>This redundant, next line is asserting counter equals 1</technical_language>

Target:
public void testAsyncWIHExecutedMoreThanOnceOnOracle() throws Exception { KieSession ksession = createKSession(PROCESS); TrackingProcessEventListener tpel = new TrackingProcessEventListener(); ksession.addEventListener(tpel); WorkItemHandler wih = new AsyncWorkItemHandler(getExecutorService(), CounterCommand.class.getName()); ksession.getWorkItemManager().registerWorkItemHandler("async", wih); ksession.startProcess(PROCESS_ID); boolean completed = tpel.waitForProcessToComplete(10000); Assertions.assertThat(completed).as("The process should have finished in 10s").isTrue(); Assertions.assertThat(CounterCommand.getCounter()).as("The job has not been executed").isNotEqualTo(0); Assertions.assertThat(CounterCommand.getCounter()).as("The job has been executed multiple times").isEqualTo(1); }
Source:
<code>public CompletableFuture<PhysicalSlotRequest.Result> allocatePhysicalSlot(PhysicalSlotRequest physicalSlotRequest) { SlotRequestId slotRequestId = physicalSlotRequest.getSlotRequestId(); requests.put(slotRequestId, physicalSlotRequest); CompletableFuture<TestingPhysicalSlot> resultFuture; <START> try { resultFuture = physicalSlotCreator.apply( taskManagerLocation, taskManagerGateway, physicalSlotRequest.getSlotProfile().getPhysicalSlotResourceProfile()); } catch (Throwable t) { resultFuture = FutureUtils.completedExceptionally(t); <END> } responses.put(slotRequestId, resultFuture); return resultFuture.thenApply(physicalSlot -> new PhysicalSlotRequest.Result( slotRequestId, physicalSlot)); }</code><technical_language>physicalSlotCreator return a CompletableFuture, do need catch exceptions here? creator return exceptionally completed future? If creator returns a TestingPhysicalSlot, this needed</technical_language>

Target:
public CompletableFuture<PhysicalSlotRequest.Result> allocatePhysicalSlot( PhysicalSlotRequest physicalSlotRequest) { SlotRequestId slotRequestId = physicalSlotRequest.getSlotRequestId(); requests.put(slotRequestId, physicalSlotRequest); CompletableFuture<TestingPhysicalSlot> resultFuture; try { resultFuture = physicalSlotCreator.apply( physicalSlotRequest.getSlotProfile().getPhysicalSlotResourceProfile()); } catch (Throwable t) { resultFuture = FutureUtils.completedExceptionally(t); } responses.put(slotRequestId, resultFuture); return resultFuture.thenApply( physicalSlot -> new PhysicalSlotRequest.Result(slotRequestId, physicalSlot)); }
Source:
<code>public void addSearchItem(String item, int index) { List<String> recents = new ArrayList<>(); Query<Search> query = mBucketSearch.query(); try (ObjectCursor<Search> cursor = query.execute()) { Search search = mBucketSearch.get(KEY_SEARCH); if (cursor.moveToNext()) { recents = cursor.getObject().getRecent(); } recents.remove(item); recents.add(index, item); search.setRecent(recents.subList(0, recents.size() > MAX_RECENT_SEARCHES ? MAX_RECENT_SEARCHES : recents.size())); search.save(); } catch (BucketObjectMissingException exception) { try { Search search = mBucketSearch.newObject(KEY_SEARCH); search.save(); } catch (BucketObjectNameInvalid invalid) { Log.e("addSearchItem", "Could not create search object", invalid); } } <START> } <END></code><technical_language>for fun re-familiarize Java I created a version of add/remove Streams <LINK_0> java public static final int MAX_SEARCHES = 5; public static List<String> useSearch(List<String> searches, String search) { return Stream.concat( Stream.of(search), searches.stream().filter(s -> !s.equals(search)) ) .limit(MAX_SEARCHES) .collect(Collectors.toList()); } public static List<String> removeSearch(List<String> searches, String search) { return searches .stream() .filter(s -> !s.equals(search)) .collect(Collectors.toList()); }</technical_language>

Target:
public void addSearchItem(String item, int index) { Preferences preferences = getPreferences(); if (preferences != null) { List<String> recents = preferences.getRecentSearches(); recents.remove(item); recents.add(index, item); preferences.setRecentSearches(recents.subList(0, recents.size() > MAX_RECENT_SEARCHES ? MAX_RECENT_SEARCHES : recents.size())); preferences.save(); } else { Log.e("addSearchItem", "Could not get preferences entity"); } }
Source:
<code>public void testSuperExpression() throws JaxenException { ASTCompilationUnit acu = parseAndTypeResolveForClass15(SuperExpression.class); List<AbstractJavaTypeNode> expressions = convertList( acu.findChildNodesWithXPath(" AbstractJavaTypeNode.class); int index = 0; assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); <START> assertEquals(SuperClass.class, ((TypeNode) expressions.get(index++).jjtGetParent().jjtGetChild(1)).getType()); <END> assertEquals(SuperExpression.class, expressions.get(index++).getType()); assertEquals(SuperExpression.class, expressions.get(index++).getType()); assertEquals("All expressions not tested", index, expressions.size()); }</code><technical_language>love check if expressions.get(index++) is of type SuperExpression too, check qualifying this previous test</technical_language>

Target:
public void testSuperExpression() throws JaxenException { ASTCompilationUnit acu = parseAndTypeResolveForClass15(SuperExpression.class); List<AbstractJavaTypeNode> expressions = convertList( acu.findChildNodesWithXPath(" AbstractJavaTypeNode.class); int index = 0; assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperClass.class, expressions.get(index++).getType()); assertEquals(SuperExpression.class, ((TypeNode) expressions.get(index).jjtGetParent().jjtGetChild(0)).getType()); assertEquals(SuperClass.class, ((TypeNode) expressions.get(index++).jjtGetParent().jjtGetChild(1)).getType()); assertEquals(SuperExpression.class, expressions.get(index++).getType()); assertEquals(SuperExpression.class, expressions.get(index++).getType()); assertEquals("All expressions not tested", index, expressions.size()); }
Source:
<code>public long getNumUserSessions(DbUser user) { return sessionInfoMap.entrySet() .stream() .filter(map -> ((DbUser) map.getValue().contentOfSession.get(USER_PARAMETER_NAME)).getId() .equals(user.getId()) <START> && getSessionValid((String) map.getValue().contentOfSession.get(ENGINE_SESSION_ID), false)) <END> .count(); }</code><technical_language>Please change sessionInfoMap.keySet() .stream() .filter(sessionId -> getUser(sessionId, false).getId().equals(user.getId())) .filter(sessionId -> getSessionValid(sessionId, false)) .count();</technical_language>

Target:
public long getNumUserSessions(DbUser user) { return sessionInfoMap.keySet() .stream() .filter(sessionId -> getUser(sessionId, false).getId().equals(user.getId())) .filter(sessionId -> getSessionValid(sessionId, false)) .count(); }
Source:
<code><START> public void setFilter(EvalNode filter) { <END> }</code><technical_language>exception thrown</technical_language>

Target:
public void setFilter(EvalNode filter) { throw new UnsupportedException(); }
Source:
<code>public boolean isComplete() { <START> return unassigned.size() == 0; <END> }</code><technical_language>return unassigned.isEmpty()</technical_language>

Target:
public boolean isComplete() { return unassigned.isEmpty(); }
Source:
<code>protected void incrementReferences() { ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); writeLock.lock(); try { <START> referenceCount++; <END> } finally { writeLock.unlock(); } }</code><technical_language>out of curiosity: meaningful exception possibly thrown</technical_language>

Target:
private void incrementReferences() { ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock(); writeLock.lock(); referenceCount++; writeLock.unlock(); }
Source:
<code>public List<ConfigMemorySize> getMemorySizeList(String path) { List<ConfigMemorySize> l = new ArrayList<>(); List<? extends ConfigValue> list = getList(path); for (ConfigValue v : list) { if (v.valueType() == ConfigValueType.NUMBER) { l.add(ConfigMemorySize.ofBytes(((Number) v.unwrapped()).longValue())); } else if (v.valueType() == ConfigValueType.STRING) { String s = (String) v.unwrapped(); BigInteger n = parseBytesAsBigInteger(s, v.origin(), path); l.add(ConfigMemorySize.ofBytes(n)); } else { throw new ConfigException.WrongType(v.origin(), path, "memory size string or number of bytes", v.valueType() .name()); } } <START> return l; <END> }</code><technical_language>getBytesList call this map toBytes list</technical_language>

Target:
public List<ConfigMemorySize> getMemorySizeList(String path) { return getBytesListBigInteger(path).stream() .map(ConfigMemorySize::ofBytes) .collect(Collectors.toList()); }
Source:
<code>public Row deserialize(byte[] message) throws IOException { try { inputStream.setBuffer(message); <START> Decoder decoder = DecoderFactory.get().binaryDecoder(inputStream, null); <END> record = datumReader.read(record, decoder); return convertAvroRecordToRow(schema, typeInfo, record); } catch (Exception e) { throw new IOException("Failed to deserialize Avro record.", e); } }</code><technical_language>AvroRowDataDeserializationSchema considered</technical_language>

Target:
public Row deserialize(byte[] message) throws IOException { try { decoder = DecoderFactory.get().binaryDecoder(message, decoder); record = datumReader.read(record, decoder); return convertAvroRecordToRow(schema, typeInfo, record); } catch (Exception e) { throw new IOException("Failed to deserialize Avro record.", e); } }
Source:
<code>public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); if ("digibytefix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } String preferedFiatCurrency = ICurrencies.USD; if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferedFiatCurrency); <START> } else if ("coinmarketcap".equalsIgnoreCase(exchangeType)) { <END> String preferedFiatCurrency = ICurrencies.USD; if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new CoinmarketcapRateSource(preferedFiatCurrency); } } return null; }</code><technical_language>Conflicting name other ratesources</technical_language>

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); if ("digibytefix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } String preferedFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferedFiatCurrency); } else if ("livecoin".equalsIgnoreCase(exchangeType)) { String preferedFiatCurrency = Currencies.USD; if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new LiveCoinRateSource(preferedFiatCurrency); } } return null; }
Source:
<code>private TypedOutput buildBody() { switch (methodInfo.requestType) { case SIMPLE: { int bodyIndex = methodInfo.bodyIndex; if (bodyIndex == RestMethodInfo.NO_BODY) { return null; } Object body = args[bodyIndex]; if (body == null) { throw new IllegalArgumentException("Body must not be null."); } if (body instanceof TypedOutput) { return (TypedOutput) body; } else { return converter.toBody(body); } } case FORM_URL_ENCODED: { FormUrlEncodedTypedOutput body = new FormUrlEncodedTypedOutput(); String[] requestFormFields = methodInfo.requestFormFields; for (int i = 0; i < requestFormFields.length; i++) { String name = requestFormFields[i]; if (name != null) { Object value = args[i]; if (value != null) { body.addField(name, String.valueOf(value)); } } } return body; } case MULTIPART: { MultipartTypedOutput body = new MultipartTypedOutput(); String[] requestMultipartPart = methodInfo.requestMultipartPart; for (int i = 0; i < requestMultipartPart.length; i++) { String name = requestMultipartPart[i]; if (name != null) { Object value = args[i]; <START> if (value != null) { END> if (value instanceof TypedOutput) { body.addPart(name, (TypedOutput) value); } else { body.addPart(name, converter.toBody(value)); } } } } return body; } default: throw new IllegalArgumentException("Unknown request type " + methodInfo.requestType); } }</code><technical_language>Do bad happen if parts null? Test case for that</technical_language>

Target:
private TypedOutput buildBody() { switch (methodInfo.requestType) { case SIMPLE: { int bodyIndex = methodInfo.bodyIndex; if (bodyIndex == RestMethodInfo.NO_BODY) { return null; } Object body = args[bodyIndex]; if (body == null) { throw new IllegalArgumentException("Body must not be null."); } if (body instanceof TypedOutput) { return (TypedOutput) body; } else { return converter.toBody(body); } } case FORM_URL_ENCODED: { FormUrlEncodedTypedOutput body = new FormUrlEncodedTypedOutput(); String[] requestFormFields = methodInfo.requestFormFields; for (int i = 0; i < requestFormFields.length; i++) { String name = requestFormFields[i]; if (name != null) { Object value = args[i]; if (value != null) { body.addField(name, String.valueOf(value)); } } } return body; } case MULTIPART: { MultipartTypedOutput body = new MultipartTypedOutput(); String[] requestMultipartPart = methodInfo.requestMultipartPart; for (int i = 0; i < requestMultipartPart.length; i++) { String name = requestMultipartPart[i]; if (name != null) { Object value = args[i]; if (value == null) { throw new IllegalArgumentException("Multipart part must not be null: " + name + "."); } if (value instanceof TypedOutput) { body.addPart(name, (TypedOutput) value); } else { body.addPart(name, converter.toBody(value)); } } } return body; } default: throw new IllegalArgumentException("Unknown request type " + methodInfo.requestType); } }
Source:
<code>public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { <START> if (!operation.hasDefined(CommonAttributes.JGROUPS_CLUSTER.getName()) && operation.hasDefined(CommonAttributes.LEGACY_JGROUPS_CLUSTER.getName())) { <END> operation.get(CommonAttributes.JGROUPS_CLUSTER.getName()).set(operation.get(CommonAttributes.LEGACY_JGROUPS_CLUSTER.getName())); operation.remove(CommonAttributes.LEGACY_JGROUPS_CLUSTER.getName()); } if (operation.hasDefined(JGROUPS_CLUSTER.getName())) { if (operation.hasDefined(JGROUPS_CHANNEL_FACTORY.getName()) && !operation.hasDefined(JGROUPS_CHANNEL.getName())) { String channel = operation.get(JGROUPS_CLUSTER.getName()).asString(); operation.get(JGROUPS_CHANNEL.getName()).set(channel); PathAddress channelAddress = context.getCurrentAddress().getParent().getParent().getParent().append(ModelDescriptionConstants.SUBSYSTEM, "jgroups").append("channel", channel); ModelNode addChannelOperation = Util.createAddOperation(channelAddress); addChannelOperation.get("stack").set(operation.get(JGROUPS_CHANNEL_FACTORY.getName())); context.addStep(addChannelOperation, AddIfAbsentStepHandler.INSTANCE, OperationContext.Stage.MODEL); } } super.execute(context, operation); }</code><technical_language>this code duplicate BroadcastGroupAdd ? case, put in in a single place</technical_language>

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { CommonAttributes.renameChannelToCluster(operation); if (operation.hasDefined(JGROUPS_CLUSTER.getName())) { if (operation.hasDefined(JGROUPS_CHANNEL_FACTORY.getName()) && !operation.hasDefined(JGROUPS_CHANNEL.getName())) { String channel = operation.get(JGROUPS_CLUSTER.getName()).asString(); operation.get(JGROUPS_CHANNEL.getName()).set(channel); PathAddress channelAddress = context.getCurrentAddress().getParent().getParent().getParent().append(ModelDescriptionConstants.SUBSYSTEM, "jgroups").append("channel", channel); ModelNode addChannelOperation = Util.createAddOperation(channelAddress); addChannelOperation.get("stack").set(operation.get(JGROUPS_CHANNEL_FACTORY.getName())); context.addStep(addChannelOperation, AddIfAbsentStepHandler.INSTANCE, OperationContext.Stage.MODEL); } } super.execute(context, operation); }
Source:
<code><START> public boolean isOob(final OAuthConfig config) { <END> return "oob".equals(config.getCallback()); }</code><technical_language>static invoke ImgurApi.isOob() instead of ((ImgurApi) getApi()).isOob()</technical_language>

Target:
public static boolean isOob(final OAuthConfig config) { return "oob".equals(config.getCallback()); }
Source:
<code><START> private synchronized void resetIdempotentProducerId() { <END> if (isTransactional()) throw new IllegalStateException("Cannot reset producer state for a transactional producer. " + "You must either abort the ongoing transaction or reinitialize the transactional producer instead"); setProducerIdAndEpoch(ProducerIdAndEpoch.NONE); transitionTo(State.UNINITIALIZED); }</code><technical_language>I synchronized is necessary</technical_language>

Target:
private void resetIdempotentProducerId() { if (isTransactional()) throw new IllegalStateException("Cannot reset producer state for a transactional producer. " + "You must either abort the ongoing transaction or reinitialize the transactional producer instead"); log.debug("Resetting idempotent producer ID. ID and epoch before reset are {}", this.producerIdAndEpoch); setProducerIdAndEpoch(ProducerIdAndEpoch.NONE); transitionTo(State.UNINITIALIZED); }
Source:
<code>public boolean isVMWithMemoryCompatible(VM vm) { if (vm == null) { return true; } Version recentClusterVersion = vm.getClusterCompatibilityVersion(); Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); if (vm.getCustomCompatibilityVersion() != null) { return true; <START> } <END> return originalClusterVersion != null && recentClusterVersion.getMajor() == originalClusterVersion.getMajor() && recentClusterVersion.getMinor() == originalClusterVersion.getMinor(); }</code><technical_language>move line 439-441 line 435 - of performance more clear in this case need cluster version</technical_language>

Target:
public boolean isVMWithMemoryCompatible(VM vm) { if (vm == null || vm.getCustomCompatibilityVersion() != null) { return true; } Version recentClusterVersion = vm.getClusterCompatibilityVersion(); Version originalClusterVersion = vm.getClusterCompatibilityVersionOrigin(); return originalClusterVersion != null && recentClusterVersion.getMajor() == originalClusterVersion.getMajor() && recentClusterVersion.getMinor() == originalClusterVersion.getMinor(); }
Source:
<code><START> public Entity changeDimension(DimensionType dimensionIn) { <END> final Entity entity = super.changeDimension(dimensionIn); if (entity instanceof EnderPearlEntity) { this.perlThrower = null; this.thrower = null; } return entity; }</code><technical_language>Is this a vanilla method, sponge-added method? If a vanilla method, overriding a @Shadow'ed method, prefixed appropriately</technical_language>

Target:
public Entity shadow$changeDimension(DimensionType dimensionIn) { final Entity entity = super.shadow$changeDimension(dimensionIn); if (entity instanceof EnderPearlEntity) { this.perlThrower = null; this.owner = null; } return entity; }
Source:
<code><START> public static void move(File from, File to, boolean DEBUG) throws IOException { <END> try { Files.move(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); } catch (IOException e) { if (DEBUG) { Debug.println("Failed to move atomically: " + from + " to " + to); } Files.move(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING); } if (DEBUG) { Debug.println("Successfully moved file: " + from + " to " + to); } }</code><technical_language>this work if I put a jar in place of a non-empty directory? is case exploded bundle is partially copied storage I believe</technical_language>

Target:
public static void move(File from, File to, boolean DEBUG) throws IOException { try { Files.move(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); } catch (IOException e) { if (DEBUG) { Debug.println("Failed to move atomically: " + from + " to " + to); } rm(to, DEBUG); Files.move(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING); } if (DEBUG) { Debug.println("Successfully moved file: " + from + " to " + to); } }
Source:
<code>public void testDoesEvaluateResultsWithFullConcurrency() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), value -> value + 1, <START> executor, 4, TIMEOUT); <END> Assert.assertEquals(values.collect(Collectors.toList()), ImmutableList.of(2, 3, 4, 5)); }</code><technical_language>nit: parameter line, please</technical_language>

Target:
public void testDoesEvaluateResultsWithFullConcurrency() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4, 5, 6, 7), value -> value + 1, executor, 7); Assert.assertEquals(values.collect(Collectors.toList()), ImmutableList.of(2, 3, 4, 5, 6, 7, 8)); }
Source:
<code>private static String getConfigKey(FileStore s) { <START> return javaVersionPrefix + s.name(); <END> }</code><technical_language>For Windows, NTFS, JDK 11, this work: s.name() returns Windows volume name easily "" "New Volume" for multiple volumes. serial number work better: private static String getConfigKey(FileStore s) { final String storeKey; Object attribute = null; try { attribute = s.getAttribute("volume:vsn"); } catch (IOException ignored) { } if (attribute instanceof Integer) { storeKey = attribute.toString(); } else { storeKey = s.name(); } return javaVersionPrefix + storeKey; }</technical_language>

Target:
private static String getConfigKey(FileStore s) { final String storeKey; if (SystemReader.getInstance().isWindows()) { Object attribute = null; try { attribute = s.getAttribute("volume:vsn"); } catch (IOException ignored) { } if (attribute instanceof Integer) { storeKey = attribute.toString(); } else { storeKey = s.name(); } } else { storeKey = s.name(); } return javaVersionPrefix + storeKey; }