auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String convertToDebianVersion( String version, boolean apply, String envName, String template, Date timestamp ) { Matcher matcher = SNAPSHOT_PATTERN.matcher(version); if (matcher.matches()) { version = matcher.group(1) + "~"; if (apply) { final String envValue = System.getenv(envName); if(template != null && template.length() > 0) { int startBracket = template.indexOf('['); int endBracket = template.indexOf(']'); if(startBracket == -1 || endBracket == -1) { version += template; } else { final String date = new SimpleDateFormat(template.substring(startBracket + 1, endBracket)).format(timestamp); String datePrefix = startBracket == 0 ? "" : template.substring(0, startBracket); String dateSuffix = endBracket == template.length() ? "" : template.substring(endBracket + 1); version += datePrefix + date + dateSuffix; } } else if (envValue != null && envValue.length() > 0) { version += envValue; } else { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); version += dateFormat.format(timestamp); } } else { version += "SNAPSHOT"; } } else { matcher = BETA_PATTERN.matcher(version); if (matcher.matches()) { if (matcher.group(1) != null) { version = matcher.group(1) + "~" + matcher.group(4) + matcher.group(5); } else { version = matcher.group(3) + "~" + matcher.group(4) + matcher.group(5); } } } version = version.replaceAll("[^\\.+~A-Za-z0-9]", "+").replaceAll("\\++", "+"); return version; }

Target:
public static String convertToDebianVersion( String version, boolean apply, String envName, String template, Date timestamp ) { Matcher matcher = SNAPSHOT_PATTERN.matcher(version); if (matcher.matches()) { version = matcher.group(1) + "~"; if (apply) { final String envValue = System.getenv(envName); if(template != null && template.length() > 0) { version += formatSnapshotTemplate(template, timestamp); } else if (envValue != null && envValue.length() > 0) { version += envValue; } else { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); version += dateFormat.format(timestamp); } } else { version += "SNAPSHOT"; } } else { matcher = BETA_PATTERN.matcher(version); if (matcher.matches()) { if (matcher.group(1) != null) { version = matcher.group(1) + "~" + matcher.group(4) + matcher.group(5); } else { version = matcher.group(3) + "~" + matcher.group(4) + matcher.group(5); } } } version = version.replaceAll("[^\\.+~A-Za-z0-9]", "+").replaceAll("\\++", "+"); return version; }
Source:
public String getDescr() { switch (m_name) { case RRD_TIME_SERIES_STRATEGY_NAME: return "RRD (RRDTool or JRobin)"; case NEWTS_TIME_SERIES_STRATEGY_NAME: return "Newts"; case EVALUETE_TIME_SERIES_STRATEGY_NAME: return "Evaluate (Sizing mode, all data discarded)"; } return m_name; }

Target:
public String getDescr() { return m_descr; }
Source:
private void addDAGToCurrentDAG(ModuleMeta moduleMeta) { LogicalPlan subDag = moduleMeta.getDag(); String subDAGName = moduleMeta.getName(); String name; for (OperatorMeta operatorMeta : subDag.getAllOperators()) { name = subDAGName + MODULE_NAMESPACE_SEPARATOR + operatorMeta.getName(); this.addOperator(name, operatorMeta.getOperator()); OperatorMeta operatorMetaNew = this.getOperatorMeta(name); operatorMetaNew.setModuleName(operatorMeta.getModuleName() == null ? subDAGName : subDAGName + MODULE_NAMESPACE_SEPARATOR + operatorMeta.getModuleName()); } for (StreamMeta streamMeta : subDag.getAllStreams()) { OutputPortMeta sourceMeta = streamMeta.getSource(); List<InputPort<?>> ports = new LinkedList<>(); for (InputPortMeta inputPortMeta : streamMeta.getSinks()) { ports.add(inputPortMeta.getPortObject()); } InputPort[] inputPorts = ports.toArray(new InputPort[]{}); name = subDAGName + MODULE_NAMESPACE_SEPARATOR + streamMeta.getName(); StreamMeta streamMetaNew = this.addStream(name, sourceMeta.getPortObject(), inputPorts); streamMetaNew.setModuleName(streamMeta.getModuleName() == null ? subDAGName : subDAGName + "_" + streamMeta.getModuleName()); } }

Target:
private void addDAGToCurrentDAG(ModuleMeta moduleMeta) { LogicalPlan subDag = moduleMeta.getDag(); String subDAGName = moduleMeta.getName(); String name; for (OperatorMeta operatorMeta : subDag.getAllOperators()) { name = subDAGName + MODULE_NAMESPACE_SEPARATOR + operatorMeta.getName(); this.addOperator(name, operatorMeta.getOperator()); OperatorMeta operatorMetaNew = this.getOperatorMeta(name); operatorMetaNew.setModuleName(operatorMeta.getModuleName() == null ? subDAGName : subDAGName + MODULE_NAMESPACE_SEPARATOR + operatorMeta.getModuleName()); } for (StreamMeta streamMeta : subDag.getAllStreams()) { OutputPortMeta sourceMeta = streamMeta.getSource(); List<InputPort<?>> ports = new LinkedList<>(); for (InputPortMeta inputPortMeta : streamMeta.getSinks()) { ports.add(inputPortMeta.getPortObject()); } InputPort[] inputPorts = ports.toArray(new InputPort[]{}); name = subDAGName + MODULE_NAMESPACE_SEPARATOR + streamMeta.getName(); this.addStream(name, sourceMeta.getPortObject(), inputPorts); } }
Source:
public void queueMove(Location from, Location to) { new Throwable().printStackTrace(); queueLock.readLock().lock(); try { movingQueue.put(from, to); } finally { queueLock.readLock().unlock(); } }

Target:
public void queueMove(Location from, Location to) { queueLock.readLock().lock(); try { movingQueue.put(from, to); } finally { queueLock.readLock().unlock(); } }
Source:
public void addSingleNodeWithPages() { DocStructInterface ds = null; DocStructTypeInterface docStructTypeInterface = this.myPrefs.getDocStrctTypeByName(this.tempTyp); try { ds = addNode(this.docStruct, this.digitalDocument, docStructTypeInterface, this.positionOfNewDocStrucElement, 1, null, null); } catch (UGHException e) { logger.error(e.getMessage()); } if (!this.pagesStart.equals("") && !this.pagesEnd.equals("")) { DocStructInterface temp = this.docStruct; this.docStruct = ds; this.ajaxPageStart = this.pagesStart; this.ajaxPageEnd = this.pagesEnd; ajaxSeitenStartUndEndeSetzen(); this.docStruct = temp; } readMetadataAsFirstTree(); }

Target:
public void addSingleNodeWithPages() { DocStructInterface docStruct = null; DocStructTypeInterface docStructType = this.myPrefs.getDocStrctTypeByName(this.tempTyp); try { docStruct = addNode(this.docStruct, this.digitalDocument, docStructType, this.positionOfNewDocStrucElement, 1, null, null); } catch (UGHException e) { logger.error(e.getMessage()); } if (!this.pagesStart.equals("") && !this.pagesEnd.equals("")) { DocStructInterface temp = this.docStruct; this.docStruct = docStruct; this.ajaxPageStart = this.pagesStart; this.ajaxPageEnd = this.pagesEnd; ajaxSeitenStartUndEndeSetzen(); this.docStruct = temp; } readMetadataAsFirstTree(); }
Source:
public static ArrayList<String> readFile(String filePath, Class<?> publisherClass) throws java.io.FileNotFoundException, java.io.IOException { ArrayList<String> aList = new ArrayList<String>(); try { final InputStream is = publisherClass.getResourceAsStream(filePath); try { final Reader r = new InputStreamReader(is); try { final BufferedReader br = new BufferedReader(r); try { String line = null; while ((line = br.readLine()) != null) { aList.add(line); } br.close(); r.close(); is.close(); } finally { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } finally { try { r.close(); } catch (IOException e) { e.printStackTrace(); } } } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } return aList; }

Target:
public static ArrayList<String> readFile(String filePath, Class<?> publisherClass) throws java.io.FileNotFoundException, java.io.IOException { ArrayList<String> aList = new ArrayList<String>(); try { final InputStream is = publisherClass.getResourceAsStream(filePath); try { final Reader r = new InputStreamReader(is, Charset.defaultCharset()); try { final BufferedReader br = new BufferedReader(r); try { String line = null; while ((line = br.readLine()) != null) { aList.add(line); } br.close(); r.close(); is.close(); } finally { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } finally { try { r.close(); } catch (IOException e) { e.printStackTrace(); } } } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } return aList; }
Source:
public static String toSRS(final CoordinateReferenceSystem crs) { if( crs == null ){ return null; } boolean forcedLonLat = false; try { forcedLonLat = Boolean.getBoolean("org.geotools.referencing.forceXY") || Boolean.TRUE.equals(Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER)); } catch(Exception e) { LOGGER.log(Level.FINE, "Failed to determine if we are in forced lon/lat mode", e); } if (forcedLonLat && CRS.getAxisOrder(crs, false) == AxisOrder.NORTH_EAST) { try { Integer code = CRS.lookupEpsgCode(crs, false); if (code != null) { return "urn:ogc:def:crs:EPSG::" + code; } } catch (Exception e) { LOGGER.log(Level.FINE, "Failed to determine EPSG code", e); } } if( crs == DefaultGeographicCRS.WGS84){ return "CRS:84"; } for( ReferenceIdentifier identifier : crs.getIdentifiers() ){ if( identifier.toString().contains("EPSG:") || identifier.toString().contains("CRS:")){ return identifier.toString(); } } final ReferenceIdentifier name = crs.getName(); if (name != null) { if( name.toString().contains("EPSG:") || name.toString().contains("CRS:")){ return name.toString(); } return "CUSTOM:"+name.toString(); } return null; }

Target:
public static String toSRS(final CoordinateReferenceSystem crs) { if (crs == null) { return null; } boolean forcedLonLat = false; try { forcedLonLat = Boolean.getBoolean("org.geotools.referencing.forceXY") || Boolean.TRUE.equals(Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER)); } catch(Exception e) { LOGGER.log(Level.FINE, "Failed to determine if we are in forced lon/lat mode", e); } if (forcedLonLat && CRS.getAxisOrder(crs, false) == AxisOrder.NORTH_EAST) { try { Integer code = CRS.lookupEpsgCode(crs, false); if (code != null) { return "urn:ogc:def:crs:EPSG::" + code; } } catch (Exception e) { LOGGER.log(Level.FINE, "Failed to determine EPSG code", e); } } if (crs == DefaultGeographicCRS.WGS84) { return "CRS:84"; } Set<ReferenceIdentifier> identifiers = crs.getIdentifiers(); if (identifiers.isEmpty()) { final ReferenceIdentifier name = crs.getName(); if (name != null) { return name.toString(); } return null; } else { for (ReferenceIdentifier identifier : crs.getIdentifiers()) { String srs = identifier.toString(); if (srs.contains("EPSG:") || srs.contains("CRS:")) { return srs; } } ReferenceIdentifier name = crs.getName(); if (name != null && (name.toString().contains("EPSG:") || name.toString().contains("CRS:"))) { return name.toString(); } return identifiers.iterator().next().toString(); } }
Source:
public List<GitHubBranchCommitCheck> getChecks() { return checks; }

Target:
public List<GitHubBranchCommitCheck> getChecks() { if (isNull(checks)) { checks = new ArrayList<>(); } return checks; }
Source:
public void revokeAccessTokens(String id, String token) { AccessToken accessToken = new AccessToken.Builder(token).build(); try { connector.revokeAllAccessTokens(id, accessToken); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to revoke access token on auth-server %s: %s", authServerHome, e.getMessage())); throw e; } catch (UnauthorizedException e) { LOGGER.warn("Error revoking all access tokens", e); throw new InvalidTokenException("The provided access token is not valid", e); } }

Target:
public void revokeAccessTokens(String id, String token) { AccessToken accessToken = new AccessToken.Builder(token).build(); try { connector.revokeAllAccessTokens(id, accessToken); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to revoke access token on auth-server %s: %s", authServerHome, e.getMessage())); throw e; } catch (UnauthorizedException e) { LOGGER.warn(String.format("Error revoking all access tokens on auth-server: %s", e.getMessage())); throw new InvalidTokenException("The provided access token is not valid", e); } }
Source:
public void testCrossCacheTransactionInAnotherThread() throws Exception { withAllIsolationsAndConcurrencies(new IgniteClosure<Object, Void>() { @Override public Void apply(Object o) { try { crossCacheTransactionInAnotherThread(); } catch (Exception ignore) { assert false : "Impossible situation"; } return null; } }); }

Target:
public void testCrossCacheTransactionInAnotherThread() throws Exception { runWithAllIsolations(new IgniteCallable<Void>() { @Override public Void call() throws Exception { crossCacheTransactionInAnotherThread(); return null; } }); }
Source:
public void filterQuery_invalidQuery_defaultSearchPerformed() { int[][] expected = new int[][]{{0, 1, 2, 3}}; String query = "unknown"; verifyActionResult(expected, "filterQuery", query); query = ""; verifyActionResult(expected, "filterQuery", query); query = "info"; verifyActionResult(expected, "filterQuery", query); query = "info:"; verifyActionResult(expected, "filterQuery", query); query = "receiver unknown_connector info:content"; verifyActionResult(expected, "filterQuery", query); query = "unknown:subject1 | info:keyword1"; verifyActionResult(expected, "filterQuery", query); expected = new int[][]{{0, 1, 2, 3, 4, 5, 6}}; query = "information:unkown"; verifyActionResult(expected, "filterQuery", query, "all", "true"); }

Target:
public void filterQuery_invalidQuery_defaultSearchPerformed() { int[][] expected = new int[][]{{0, 1, 2, 3}}; String query = "unknown"; verifyActionResult(expected, "filterQuery", query); query = ""; verifyActionResult(expected, "filterQuery", query); query = "info"; verifyActionResult(expected, "filterQuery", query); query = "info:"; verifyActionResult(expected, "filterQuery", query); query = "receiver unknown_connector info:content"; verifyActionResult(expected, "filterQuery", query); query = "unknown:subject1 | info:keyword1"; verifyActionResult(expected, "filterQuery", query); expected = new int[][]{{0, 1, 2, 3, 4, 5, 6}}; query = "information:unknown"; verifyActionResult(expected, "filterQuery", query, "all", "true"); }
Source:
public DatastreamD2Config(Properties config, String clusterName, Map<String, String> endpoints) { Validate.notNull(config, "null D2 config"); Validate.notBlank(clusterName, "invalid cluster name"); Validate.notEmpty(endpoints, "invalid endpoints"); _zkBasePath = String.format("/%s/d2", clusterName); _zkSessionTimeout = Integer.parseInt(config.getProperty(ZK_SESSION_TIMEOUT, DEFAULT_ZK_SESSION_TIMEOUT)); _zkRetryLimit = Integer.parseInt(config.getProperty(ZK_RETRY_LIMIT, DEFAULT_ZK_RETRY_LIMIT)); _endpoints = endpoints; _serviceConfig.put(LB_STRATEGY_LIST, getSingletonList("degraderV3")); _serviceConfig.put(PRIORITIZED_SCHEMES, getSingletonList("http")); getOptServiceConfig(config); Map<String, Object> svcMap = new HashMap<>(); svcMap.put("services", _endpoints.entrySet().stream().collect(Collectors .toMap(e -> e.getKey(), e -> getSingletonMap("path", e.getValue())))); _clusterConfig.put(DMS_D2_CLUSTER, svcMap); }

Target:
public DatastreamD2Config(Properties config, String clusterName, Map<String, String> endpoints) { Validate.notNull(config, "null D2 config"); Validate.notBlank(clusterName, "invalid cluster name"); Validate.notEmpty(endpoints, "invalid endpoints"); VerifiableProperties props = new VerifiableProperties(config); _zkBasePath = String.format("/%s/d2", clusterName); _zkSessionTimeout = props.getInt(ZK_SESSION_TIMEOUT, DEFAULT_ZK_SESSION_TIMEOUT); _zkRetryLimit = props.getInt(ZK_RETRY_LIMIT, DEFAULT_ZK_RETRY_LIMIT); _endpoints = endpoints; _serviceConfig.put(LB_STRATEGY_LIST, getSingletonList("degraderV3")); _serviceConfig.put(PRIORITIZED_SCHEMES, getSingletonList("http")); getOptServiceConfig(config); Map<String, Object> svcMap = new HashMap<>(); svcMap.put("services", _endpoints.entrySet().stream().collect(Collectors .toMap(e -> e.getKey(), e -> getSingletonMap("path", e.getValue())))); _clusterConfig.put(DMS_D2_CLUSTER, svcMap); }
Source:
public ActiveScanPanel(ExtensionActiveScan extension) { super( "ascan", new ImageIcon(ActiveScanPanel.class.getResource("/resource/icon/16/093.png")), extension); tabbedPane.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { switch (tabbedPane.getSelectedIndex()) { case 0: getExportButton().setTable(getMessagesTable()); break; case 1: getExportButton().setTable(getFilterMessageTable()); break; } } }); this.extension = extension; this.setDefaultAccelerator( extension .getView() .getMenuShortcutKeyStroke( KeyEvent.VK_A, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK, false)); this.setMnemonic(Constant.messages.getChar("ascan.panel.mnemonic")); }

Target:
public ActiveScanPanel(ExtensionActiveScan extension) { super( "ascan", new ImageIcon(ActiveScanPanel.class.getResource("/resource/icon/16/093.png")), extension); tabbedPane.addChangeListener( (e) -> { switch (tabbedPane.getSelectedIndex()) { case 0: getExportButton().setTable(getMessagesTable()); break; case 1: getExportButton().setTable(getFilterMessageTable()); break; } }); this.extension = extension; this.setDefaultAccelerator( extension .getView() .getMenuShortcutKeyStroke( KeyEvent.VK_A, KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK, false)); this.setMnemonic(Constant.messages.getChar("ascan.panel.mnemonic")); }
Source:
public boolean next(List<Cell> results) throws IOException { List<Cell> dataTableResults = new ArrayList<Cell>(); boolean next = super.next(dataTableResults); try { addMutations(dataTableResults); } catch (SQLException e) { e.printStackTrace(); } if (ServerUtil.readyToCommit(mutationList.size(), mutationList.byteSize(), maxBatchSize, maxBatchSizeBytes)||!next) { region.batchMutate(mutationList.toArray(new Mutation[mutationList.size()])); mutationList.clear(); } return next; }

Target:
public boolean next(List<Cell> results) throws IOException { List<Cell> dataTableResults = new ArrayList<Cell>(); boolean next = super.next(dataTableResults); try { addMutations(dataTableResults); } catch (SQLException e) { throw new IOException(e.getMessage()); } if (ServerUtil.readyToCommit(mutationList.size(), mutationList.byteSize(), maxBatchSize, maxBatchSizeBytes)||!next) { region.batchMutate(mutationList.toArray(new Mutation[mutationList.size()])); mutationList.clear(); } return next; }
Source:
public ContentUpdatingNitroBroadcastHandler(ContentResolver resolver, ContentWriter writer, LocalOrRemoteNitroFetcher localOrRemoteNitroFetcher, GroupLock<String> lock) { this.writer = writer; this.localOrRemoteFetcher = localOrRemoteNitroFetcher; this.lock = lock; }

Target:
public ContentUpdatingNitroBroadcastHandler(ContentResolver resolver, ContentWriter writer, LocalOrRemoteNitroFetcher localOrRemoteNitroFetcher, GroupLock<String> lock) { this.writer = writer; this.localOrRemoteFetcher = localOrRemoteNitroFetcher; this.lock = lock; this.idCodec = SubstitutionTableNumberCodec.lowerCaseOnly(); }
Source:
public MomentSketchWrapper fromByteBuffer(ByteBuffer buffer, int numBytes) { if (numBytes == 0) { return EMPTY_SKETCH; } buffer.limit(buffer.position() + numBytes); return MomentSketchWrapper.fromBytes(buffer); }

Target:
public MomentSketchWrapper fromByteBuffer(ByteBuffer buffer, int numBytes) { if (numBytes == 0) { return null; } buffer.limit(buffer.position() + numBytes); return MomentSketchWrapper.fromBytes(buffer); }
Source:
protected void copyAboutFile(final IProject createdProject) { InputStream inputStream = null; OutputStream outputStream = null; try { final URL url = Activator.getDefault().getBundle().getResource(NattableConfigurationConstants.ABOUT_FILE_NAME); inputStream = url.openStream(); final File newAboutFile = new File(createdProject.getLocation().toOSString() + File.separator + NattableConfigurationConstants.ABOUT_FILE_NAME); newAboutFile.createNewFile(); outputStream = new FileOutputStream(newAboutFile); int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } } catch (IOException e) { Activator.logException(e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { Activator.logException(e); } } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { Activator.logException(e); } } } }

Target:
protected void copyAboutFile(final IProject createdProject) { InputStream inputStream = null; OutputStream outputStream = null; try { final URL url = Activator.getDefault().getBundle().getResource(NattableConfigurationConstants.ABOUT_FILE_NAME); inputStream = url.openStream(); final File newAboutFile = new File(createdProject.getLocation().toOSString() + File.separator + NattableConfigurationConstants.ABOUT_FILE_NAME); newAboutFile.createNewFile(); outputStream = new FileOutputStream(newAboutFile); int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } } catch (final IOException e) { Activator.logException(e); } finally { if (null != inputStream) { try { inputStream.close(); } catch (final IOException e) { Activator.logException(e); } } if (null != outputStream) { try { outputStream.close(); } catch (final IOException e) { Activator.logException(e); } } } }
Source:
private void processDynamicElements(Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { MMenuElement[] ml = menuModel.getChildren().toArray( new MMenuElement[menuModel.getChildren().size()]); for (int i = 0; i < ml.length; i++) { MMenuElement currentMenuElement = ml[i]; if (currentMenuElement instanceof MDynamicMenuContribution) { Object contribution = ((MDynamicMenuContribution) currentMenuElement) .getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory .create(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement .getTransientData() .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); dynamicMenuContext.set(List.class, mel); ContextInjectionFactory .invoke(contribution, AboutToHide.class, dynamicMenuContext, null); } } } }); } }

Target:
private void processDynamicElements(Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { MMenuElement[] ml = menuModel.getChildren().toArray( new MMenuElement[menuModel.getChildren().size()]); for (int i = 0; i < ml.length; i++) { MMenuElement currentMenuElement = ml[i]; if (currentMenuElement instanceof MDynamicMenuContribution) { Object contribution = ((MDynamicMenuContribution) currentMenuElement) .getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory .create(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement .getTransientData() .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); dynamicMenuContext.set(List.class, mel); IEclipseContext parentContext = modelService .getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, parentContext, dynamicMenuContext, null); } } } }); } }
Source:
static public void assertEquals(String message, float expected, float actual, float delta) { if (Float.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }

Target:
static public void assertEquals(String message, float expected, float actual, float delta) { if (Float.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, new Float(expected), new Float(actual)); } }
Source:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.hadoop.security.kerberos", DruidKerberosConfig.class); JsonConfigProvider.bind(binder, "druid.hadoop.security.spnego", SpnegoFilterConfig.class); Multibinder.newSetBinder(binder, ServletFilterHolder.class) .addBinding() .to(SpnegoFilterHolder.class); binder.bind(HttpClient.class) .annotatedWith(Global.class) .toProvider(new KerberosHttpClientProvider(new HttpClientModule.HttpClientProvider(Global.class))) .in(LazySingleton.class); binder.bind(HttpClient.class) .annotatedWith(Client.class) .toProvider(new KerberosHttpClientProvider(new HttpClientModule.HttpClientProvider(Client.class))) .in(LazySingleton.class); binder.bind(org.eclipse.jetty.client.HttpClient.class) .annotatedWith(Router.class) .toProvider(new KerberosJettyHttpClientProvider(new JettyHttpClientModule.HttpClientProvider(Router.class))) .in(LazySingleton.class); }

Target:
public void configure(Binder binder) { JsonConfigProvider.bind(binder, "druid.hadoop.security.kerberos", AuthenticationKerberosConfig.class); JsonConfigProvider.bind(binder, "druid.hadoop.security.spnego", SpnegoFilterConfig.class); Multibinder.newSetBinder(binder, ServletFilterHolder.class) .addBinding() .to(SpnegoFilterHolder.class); binder.bind(HttpClient.class) .annotatedWith(Global.class) .toProvider(new KerberosHttpClientProvider(new HttpClientModule.HttpClientProvider(Global.class))) .in(LazySingleton.class); binder.bind(HttpClient.class) .annotatedWith(Client.class) .toProvider(new KerberosHttpClientProvider(new HttpClientModule.HttpClientProvider(Client.class))) .in(LazySingleton.class); binder.bind(org.eclipse.jetty.client.HttpClient.class) .annotatedWith(Router.class) .toProvider(new KerberosJettyHttpClientProvider(new JettyHttpClientModule.HttpClientProvider(Router.class))) .in(LazySingleton.class); }
Source:
public NoChangeMove<Solution_> createUndoMove(ScoreDirector<Solution_> scoreDirector) { return new NoChangeMove<>(); }

Target:
protected AbstractMove<Solution_> createUndoMove(ScoreDirector<Solution_> scoreDirector) { return null; }
Source:
public void testGetForVdsFilteredWithPermissionsNoPermissionsAndNoFilter() { storage_pool result = dao.get(vds, UNPRIVILEGED_USER_ID, false); assertGetResult(result); }

Target:
public void testGetForVdsFilteredWithPermissionsNoPermissionsAndNoFilter() { storage_pool result = dao.getForVds(vds, UNPRIVILEGED_USER_ID, false); assertGetResult(result); }
Source:
private void synchronizeJavaProjectInTransaction(final OmniEclipseProject project, final IProject workspaceProject, SubMonitor progress) throws JavaModelException, CoreException { progress.setWorkRemaining(8); CorePlugin.workspaceOperations().addNature(workspaceProject, JavaCore.NATURE_ID, progress.newChild(1)); IJavaProject javaProject = JavaCore.create(workspaceProject); OutputLocationUpdater.update(javaProject, project.getOutputLocation(), progress.newChild(1)); SourceFolderUpdater.update(javaProject, project.getSourceDirectories(), progress.newChild(1)); ClasspathUpdater.update(javaProject, project, progress.newChild(1)); ClasspathContainerUpdater.update(javaProject, project.getClasspathContainers(), project.getJavaSourceSettings().get(), progress.newChild(1)); JavaSourceSettingsUpdater.update(javaProject, project, progress.newChild(1)); GradleClasspathContainerUpdater.updateFromModel(javaProject, project, SynchronizeGradleBuildOperation.this.allProjects, progress.newChild(1)); WtpClasspathUpdater.update(javaProject, project, progress.newChild(1)); }

Target:
private void synchronizeJavaProjectInTransaction(final OmniEclipseProject project, final IProject workspaceProject, SubMonitor progress) throws JavaModelException, CoreException { progress.setWorkRemaining(8); CorePlugin.workspaceOperations().addNature(workspaceProject, JavaCore.NATURE_ID, progress.newChild(1)); IJavaProject javaProject = JavaCore.create(workspaceProject); OutputLocationUpdater.update(javaProject, project.getOutputLocation(), progress.newChild(1)); SourceFolderUpdater.update(javaProject, project.getSourceDirectories(), progress.newChild(1)); LibraryFilter.update(javaProject, project, progress.newChild(1)); ClasspathContainerUpdater.update(javaProject, project.getClasspathContainers(), project.getJavaSourceSettings().get(), progress.newChild(1)); JavaSourceSettingsUpdater.update(javaProject, project, progress.newChild(1)); GradleClasspathContainerUpdater.updateFromModel(javaProject, project, SynchronizeGradleBuildOperation.this.allProjects, progress.newChild(1)); WtpClasspathUpdater.update(javaProject, project, progress.newChild(1)); }
Source:
private void checkValidTime(long t) { if (t < getStartTime() || t > fEndTime) { throw new TimeRangeException(getSSID() + " Time:" + t + ", Start:" + getStartTime() + ", End:" + fEndTime); } }

Target:
private void checkValidTime(long t) { if (t < getStartTime() || t > fEndTime) { throw new TimeRangeException(String.format("%s Time:%d, Start:%d, End:%d", getSSID(), t, getStartTime(), fEndTime)); } }
Source:
public void handleAction(final ActionParameters params) throws ActionException { final int id = params.getRequiredParamInt(PARAM_ID); final OskariLayer oskariLayer = mapLayerService.find(id); if (oskariLayer == null) { throw new ActionParamsException("Layer not found, id: " + id); } String url = oskariLayer.getUrl(); String wmsUrl = Helpers.getGetFeatureInfoUrlForProxy(url, params.getHttpParam(PARAM_SRS), params.getHttpParam(PARAM_BBOX), params.getHttpParam(PARAM_WIDTH), params.getHttpParam(PARAM_HEIGHT), params.getHttpParam(PARAM_X), params.getHttpParam(PARAM_Y), params.getHttpParam(PARAM_LAYERS)); LOGGER.debug("Details of the data cropping feature"); try { HttpURLConnection con = IOHelper.getConnection(wmsUrl); if(hasAuthorization()){ IOHelper.setupBasicAuth(con,croppingUsername, croppingPassword); } con.setRequestProperty("Accept-Charset", "UTF-8"); final String data = IOHelper.readString(con, "UTF-8"); JSONObject json = new JSONObject(data); ResponseHelper.writeResponse(params, json); } catch (JSONException e) { throw new ActionException("Could not get cropping:", e); } catch (MalformedURLException e) { throw new ActionException("Could not get cropping:", e); } catch (IOException e) { throw new ActionException("Could not get cropping:", e); } }

Target:
public void handleAction(final ActionParameters params) throws ActionException { final int id = params.getRequiredParamInt(PARAM_ID); final OskariLayer oskariLayer = mapLayerService.find(id); if (oskariLayer == null) { throw new ActionParamsException("Layer not found, id: " + id); } String url = oskariLayer.getUrl(); String wmsUrl = Helpers.getGetFeatureInfoUrlForProxy(url, params.getHttpParam(PARAM_SRS), params.getHttpParam(PARAM_BBOX), params.getHttpParam(PARAM_WIDTH), params.getHttpParam(PARAM_HEIGHT), params.getHttpParam(PARAM_X), params.getHttpParam(PARAM_Y), params.getHttpParam(PARAM_LAYERS)); LOGGER.debug("Details of the data cropping feature"); try { HttpURLConnection con = IOHelper.getConnection(wmsUrl, oskariLayer.getUsername(), oskariLayer.getPassword()); con.setRequestProperty("Accept-Charset", "UTF-8"); final String data = IOHelper.readString(con, "UTF-8"); JSONObject json = new JSONObject(data); ResponseHelper.writeResponse(params, json); } catch (JSONException e) { throw new ActionException("Could not get cropping:", e); } catch (MalformedURLException e) { throw new ActionException("Could not get cropping:", e); } catch (IOException e) { throw new ActionException("Could not get cropping:", e); } }
Source:
public final int getColumnIndex(String name) { if (m_columnNameIndexMap != null) { Integer cachedIndex = m_columnNameIndexMap.get(name); if (cachedIndex != null) { return cachedIndex; } } else { m_columnNameIndexMap = new HashMap<String,Integer>(m_colCount); } assert(verifyTableInvariants()); for (int i = 0; i < m_colCount; i++) { if (getColumnName(i).equalsIgnoreCase(name)) m_columnNameIndexMap.put(name, Integer.valueOf(i)); return i; } String msg = "No Column named '" + name + "'. Existing columns are:"; for (int i = 0; i < m_colCount; i++) { msg += "[" + i + "]" + getColumnName(i) + ","; } throw new IllegalArgumentException(msg); }

Target:
public final int getColumnIndex(String name) { if (m_columnNameIndexMap != null) { Integer cachedIndex = m_columnNameIndexMap.get(name.toUpperCase()); if (cachedIndex != null) { return cachedIndex; } } else { m_columnNameIndexMap = new HashMap<String,Integer>(m_colCount); } assert(verifyTableInvariants()); for (int i = 0; i < m_colCount; i++) { if (getColumnName(i).equalsIgnoreCase(name)) { m_columnNameIndexMap.put(name.toUpperCase(), Integer.valueOf(i)); return i; } } String msg = "No Column named '" + name + "'. Existing columns are:"; for (int i = 0; i < m_colCount; i++) { msg += "[" + i + "]" + getColumnName(i) + ","; } throw new IllegalArgumentException(msg); }
Source:
private JSONArray buildSchemasResponseBody(Map<String, List<Attribute>> schemas) throws CharonException { JSONArray rootObject = new JSONArray(); JSONObject userSchemaObject = buildUserSchema(schemas.get(USER_CORE_SCHEMA_URI)); rootObject.put(userSchemaObject); if (schemas.get(ENTERPRISE_USER_SCHEMA_URI) != null) { JSONObject enterpriseUserSchemaObject = buildEnterpriseUserSchema(schemas.get(ENTERPRISE_USER_SCHEMA_URI)); rootObject.put(enterpriseUserSchemaObject); } return rootObject; }

Target:
private JSONArray buildSchemasResponseBody(Map<String, List<Attribute>> schemas) throws CharonException { JSONArray rootObject = new JSONArray(); if (schemas.get(USER_CORE_SCHEMA_URI) != null) { JSONObject userSchemaObject = buildUserSchema(schemas.get(USER_CORE_SCHEMA_URI)); rootObject.put(userSchemaObject); } if (schemas.get(ENTERPRISE_USER_SCHEMA_URI) != null) { JSONObject enterpriseUserSchemaObject = buildEnterpriseUserSchema(schemas.get(ENTERPRISE_USER_SCHEMA_URI)); rootObject.put(enterpriseUserSchemaObject); } return rootObject; }
Source:
public Optional<DirectDownloadHandle> getDirectDownloadHandle(String key) { final long secondsToExpire = config.has("direct_download_expiration") ? config.get("direct_download_expiration", Long.class) : 10*60; GeneratePresignedUrlRequest req = new GeneratePresignedUrlRequest(bucket, key); req.setExpiration(Date.from(Instant.now().plusSeconds(secondsToExpire))); String url = client.generatePresignedUrl(req).toString(); return Optional.of(DirectDownloadHandle.of(url)); }

Target:
public Optional<DirectDownloadHandle> getDirectDownloadHandle(String key) { final long secondsToExpire = config.get("direct_download_expiration", Long.class, 10L*60); GeneratePresignedUrlRequest req = new GeneratePresignedUrlRequest(bucket, key); req.setExpiration(Date.from(Instant.now().plusSeconds(secondsToExpire))); String url = client.generatePresignedUrl(req).toString(); return Optional.of(DirectDownloadHandle.of(url)); }
Source:
protected synchronized DatagramSocket getSocket() throws IOException { if (this.socketExpression != null) { return this.socketExpression.getValue(this.evaluationContext, DatagramSocket.class); } if (this.socket == null) { if (acknowledge) { if (localAddress == null) { this.socket = this.ackPort == 0 ? new DatagramSocket() : new DatagramSocket(this.ackPort); } else { InetAddress whichNic = InetAddress.getByName(this.localAddress); this.socket = new DatagramSocket(new InetSocketAddress(whichNic, this.ackPort)); } if (this.soReceiveBufferSize > 0) { socket.setReceiveBufferSize(this.soReceiveBufferSize); } if (logger.isDebugEnabled()) { logger.debug("Listening for acks on port: " + getAckPort()); } updateAckAddress(); } else { this.socket = new DatagramSocket(); } setSocketAttributes(this.socket); } return this.socket; }

Target:
protected synchronized DatagramSocket getSocket() throws IOException { if (this.socket == null) { if (acknowledge) { if (localAddress == null) { this.socket = this.ackPort == 0 ? new DatagramSocket() : new DatagramSocket(this.ackPort); } else { InetAddress whichNic = InetAddress.getByName(this.localAddress); this.socket = new DatagramSocket(new InetSocketAddress(whichNic, this.ackPort)); } if (this.soReceiveBufferSize > 0) { socket.setReceiveBufferSize(this.soReceiveBufferSize); } if (logger.isDebugEnabled()) { logger.debug("Listening for acks on port: " + getAckPort()); } updateAckAddress(); } else { this.socket = new DatagramSocket(); } setSocketAttributes(this.socket); } return this.socket; }
Source:
public void reconnectMesos() { callWithStateLock(() -> { state.setMesosSchedulerState(MesosSchedulerState.PAUSED_FOR_MESOS_RECONNECT); mesosSchedulerClient.close(); try { Retryer<Void> startRetryer = RetryerBuilder.<Void>newBuilder() .retryIfException() .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait()) .withStopStrategy(StopStrategies.stopAfterDelay(configuration.getMesosConfiguration().getReconnectTimeoutMillis(), TimeUnit.MILLISECONDS)) .build(); startRetryer.call(() -> { start(); return null; }); } catch (RetryException re) { if (re.getLastFailedAttempt().getExceptionCause() != null) { LOG.error("Unable to retry mesos master connection", re.getLastFailedAttempt().getExceptionCause()); notifyStopping(); abort.abort(AbortReason.MESOS_ERROR, Optional.of(re.getLastFailedAttempt().getExceptionCause())); } } catch (Throwable t) { LOG.error("Unable to retry mesos master connection", t); notifyStopping(); abort.abort(AbortReason.MESOS_ERROR, Optional.of(t)); } }, "reconnectMesos", false); }

Target:
public void reconnectMesos() { callWithStateLock(() -> { state.setMesosSchedulerState(MesosSchedulerState.PAUSED_FOR_MESOS_RECONNECT); LOG.info("Paused scheduler actions, closing existing mesos connection"); mesosSchedulerClient.close(); LOG.info("Closed existing mesos connection"); try { Retryer<Void> startRetryer = RetryerBuilder.<Void>newBuilder() .retryIfException() .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait()) .withStopStrategy(StopStrategies.stopAfterDelay(configuration.getMesosConfiguration().getReconnectTimeoutMillis(), TimeUnit.MILLISECONDS)) .build(); startRetryer.call(() -> { start(); return null; }); } catch (RetryException re) { if (re.getLastFailedAttempt().getExceptionCause() != null) { LOG.error("Unable to retry mesos master connection", re.getLastFailedAttempt().getExceptionCause()); notifyStopping(); abort.abort(AbortReason.MESOS_ERROR, Optional.of(re.getLastFailedAttempt().getExceptionCause())); } } catch (Throwable t) { LOG.error("Unable to retry mesos master connection", t); notifyStopping(); abort.abort(AbortReason.MESOS_ERROR, Optional.of(t)); } }, "reconnectMesos", false); }
Source:
private ImmutableList<String> buildAnnotationClasses() { ImmutableList.Builder<String> builder = ImmutableList.builder(); for (AnnotationMirror annotationMirror : method.getAnnotationMirrors()) { String fullName = typeSimplifier.simplify(annotationMirror.getAnnotationType()); String annotationClass = "@" + fullName; List<String> values = FluentIterable .from(annotationMirror.getElementValues().entrySet()) .filter(Predicates.notNull()) .transform(valuesToString) .toList(); if (!values.isEmpty()) { annotationClass += "("; annotationClass += Joiner.on(", ").join(values); annotationClass += ")"; } builder.add(annotationClass); } return builder.build(); }

Target:
private ImmutableList<String> buildAnnotationClasses() { ImmutableList.Builder<String> builder = ImmutableList.builder(); for (AnnotationMirror annotationMirror : method.getAnnotationMirrors()) { String annotationName = typeSimplifier.simplify(annotationMirror.getAnnotationType()); String annotation = "@" + annotationName; List<String> values = FluentIterable .from(annotationMirror.getElementValues().entrySet()) .filter(Predicates.notNull()) .transform(valuesToString) .toList(); if (!values.isEmpty()) { annotation += "(" + Joiner.on(", ").join(values) + ")"; } builder.add(annotation); } return builder.build(); }
Source:
public void clearChildrenProducerBatch() { childrenProducerBatch.clear(); }

Target:
private synchronized void clearChildrenProducerBatch() { if (childrenProducerBatch != null) { childrenProducerBatch.clear(); } }
Source:
private static void populateHiveConf(HiveConf hiveConf, String[] args) { if (args == null) { return; } int index = 0; for (; index < args.length; index++) { if ("-hiveconf".equals(args[index])) { String hiveConfParam = args[++index]; String[] tokens = hiveConfParam.split("="); if (tokens.length == 2) { String name = tokens[0]; if (name.startsWith("'") || name.startsWith("\"")) { name = name.substring(1); } String value = tokens[1]; if (value.endsWith("'") || value.endsWith("\"")) { value = value.substring(1); } logger.info("Setting: " + name + " value:" + value + " to hiveConf"); hiveConf.set(name, value); } else { logger.warn("Invalid hiveconf: " + hiveConfParam); } } } }

Target:
private static void populateHiveConf(HiveConf hiveConf, String[] args) { if (args == null) { return; } int index = 0; for (; index < args.length; index++) { if ("-hiveconf".equals(args[index])) { String hiveConfParam = stripSingleDoubleQuote(args[++index]); String[] tokens = hiveConfParam.split("="); if (tokens.length == 2) { String name = tokens[0]; String value = tokens[1]; logger.info("Setting: " + name + "=" + value + " to hiveConf"); hiveConf.set(name, value); } else { logger.warn("Invalid hiveconf: " + hiveConfParam); } } } }
Source:
private Set<String> getRoles(PrincipalCollection principals, final LdapContextFactory ldapContextFactory) throws NamingException { final String username = (String) getAvailablePrincipal(principals); LdapContext systemLdapCtx = null; try { systemLdapCtx = ldapContextFactory.getSystemLdapContext(); return rolesFor(principals, username, systemLdapCtx, ldapContextFactory, SecurityUtils.getSubject().getSession()); } catch (Throwable t) { t.printStackTrace(); return Collections.emptySet(); } finally { LdapUtils.closeContext(systemLdapCtx); } }

Target:
private Set<String> getRoles(PrincipalCollection principals, final LdapContextFactory ldapContextFactory) throws NamingException { final String username = (String) getAvailablePrincipal(principals); LdapContext systemLdapCtx = null; try { systemLdapCtx = ldapContextFactory.getSystemLdapContext(); return rolesFor(principals, username, systemLdapCtx, ldapContextFactory, SecurityUtils.getSubject().getSession()); } catch (Throwable t) { log.warn("Failed to get roles in current context for " + username, t); return Collections.emptySet(); } finally { LdapUtils.closeContext(systemLdapCtx); } }
Source:
private List<String> getAllChanges() { ArrayList<String> result = new ArrayList<String>(globalQueue); globalQueue.clear(); return result; }

Target:
private List<String> getAllChanges() { Set<String> seen = new HashSet<String>((int) (globalQueue.size() / 0.75f) + 1, 0.75f); List<String> result = new ArrayList<String>(globalQueue.size()); while (true) { String path = globalQueue.poll(); if (path == null) { break; } if (seen.add(path)) { result.add(path); } } return result; }
Source:
Config generateConfig() { Map<String, String> streamConfig = new HashMap<>(); StreamSpec spec = getStreamSpec(); streamConfig.put(String.format(StreamConfig.SYSTEM_FOR_STREAM_ID(), spec.getId()), spec.getSystemName()); streamConfig.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), spec.getId()), spec.getPhysicalName()); if (isIntermediate()) { streamConfig.put(String.format(StreamConfig.IS_INTERMEDIATE_FOR_STREAM_ID(), spec.getId()), "true"); streamConfig.put(String.format(StreamConfig.DELETE_COMMITTED_MESSAGES_FOR_STREAM_ID(), spec.getId()), "true"); if (new ApplicationConfig(config).getAppMode().equals(ApplicationConfig.ApplicationMode.BATCH)) { streamConfig.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), spec.getId()), "oldest"); } streamConfig.put(String.format(StreamConfig.PRIORITY_FOR_STREAM_ID(), spec.getId()), String.valueOf(Integer.MAX_VALUE)); } spec.getConfig().forEach((property, value) -> { streamConfig.put(String.format(StreamConfig.STREAM_ID_PREFIX(), spec.getId()) + property, value); }); return new MapConfig(streamConfig); }

Target:
Config generateConfig() { Map<String, String> streamConfig = new HashMap<>(); StreamSpec spec = getStreamSpec(); String streamId = spec.getId(); streamConfig.put(String.format(StreamConfig.SYSTEM_FOR_STREAM_ID(), streamId), spec.getSystemName()); streamConfig.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), streamId), spec.getPhysicalName()); if (isIntermediate()) { streamConfig.put(String.format(StreamConfig.IS_INTERMEDIATE_FOR_STREAM_ID(), streamId), "true"); streamConfig.put(String.format(StreamConfig.DELETE_COMMITTED_MESSAGES_FOR_STREAM_ID(), streamId), "true"); if (ApplicationConfig.ApplicationMode.BATCH.equals(new ApplicationConfig(config).getAppMode())) { streamConfig.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), streamId), "oldest"); } streamConfig.put(String.format(StreamConfig.PRIORITY_FOR_STREAM_ID(), streamId), String.valueOf(Integer.MAX_VALUE)); } spec.getConfig().forEach((property, value) -> { streamConfig.put(String.format(StreamConfig.STREAM_ID_PREFIX(), streamId) + property, value); }); return new MapConfig(streamConfig); }
Source:
private Resource snapshotStoreFiles( Collection<StoreFileMetadata> files ) throws IOException { final Collection<ResourceIterator<File>> snapshots = new ArrayList<>(); Lock lock = configurationLock.readLock(); lock.lock(); try { for ( WritableFulltext index : Iterables.concat( writableNodeIndices[ASIDE].values(), writableNodeIndices[BSIDE].values(), writableRelationshipIndices[ASIDE].values(), writableRelationshipIndices[BSIDE].values() ) ) { index.saveConfiguration( transactionIdStore.getLastCommittedTransactionId() ); try { applier.writeBarrier().awaitCompletion(); } catch ( ExecutionException e ) { throw new IOException( "Unable to prepare index for snapshot." ); } index.flush(); ResourceIterator<File> snapshot = index.snapshot(); snapshots.add( snapshot ); files.addAll( getSnapshotFilesMetadata( snapshot ) ); } } finally { lock.unlock(); } return new MultiResource( snapshots ); }

Target:
private Resource snapshotStoreFiles( Collection<StoreFileMetadata> files ) throws IOException { final Collection<ResourceIterator<File>> snapshots = new ArrayList<>(); for ( WritableFulltext index : Iterables.concat( writableNodeIndices[ASIDE].values(), writableNodeIndices[BSIDE].values(), writableRelationshipIndices[ASIDE].values(), writableRelationshipIndices[BSIDE].values() ) ) { Lock listingLock = configurationLock.readLock(); listingLock.lock(); index.saveConfiguration( transactionIdStore.getLastCommittedTransactionId() ); try { applier.writeBarrier().awaitCompletion(); } catch ( ExecutionException e ) { throw new IOException( "Unable to prepare index for snapshot.", e ); } index.flush(); ResourceIterator<File> snapshot = index.snapshot(); ResourceIterator<File> lockedSnapshot = lockedSnapshot( listingLock, snapshot ); snapshots.add( lockedSnapshot ); files.addAll( getSnapshotFilesMetadata( lockedSnapshot ) ); } return new MultiResource( snapshots ); }
Source:
private void presentIcalFile(ICalendar ical, HttpServletResponse response){ try{ File file = File.createTempFile("ical", ".ics"); ICalWriter writer = new ICalWriter(file, ICalVersion.V2_0); writer.write(ical); writer.close(); IOUtils.copy(new FileInputStream(file), response.getOutputStream()); response.flushBuffer(); } catch (IOException e) { throw new RuntimeException("IOError writing ICalendar to response output stream"); } }

Target:
private void presentIcalFile(ICalendar ical, HttpServletResponse response){ try{ ICalWriter writer = new ICalWriter(response.getOutputStream(), ICalVersion.V2_0); writer.write(ical); writer.close(); response.flushBuffer(); } catch (IOException e) { throw new RuntimeException("IOError writing ICalendar to response output stream", e); } }
Source:
public void reset() throws IOException { if (inputStreamFactory != null) { in = new BufferedReader(new InputStreamReader(inputStreamFactory.createInputStream(), encoding)); } }

Target:
public void reset() throws IOException { in = new BufferedReader(new InputStreamReader(inputStreamFactory.createInputStream(), encoding)); }