auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized void processNotifies(int timeoutMillis) throws SQLException { waitOnLock(); if (getTransactionState() != TransactionState.IDLE) { return; } if (hasNotifications()) { timeoutMillis = -1; } boolean useTimeout = timeoutMillis > 0; long startTime = 0; int oldTimeout = 0; if (useTimeout) { startTime = System.nanoTime() / (long)1E6; try { oldTimeout = pgStream.getSocket().getSoTimeout(); } catch (SocketException e) { throw new PSQLException(GT.tr("An error occurred while trying to get the socket " + "timeout."), PSQLState.CONNECTION_FAILURE, e); } } try { while (timeoutMillis >= 0 || pgStream.hasMessagePending()) { if (useTimeout && timeoutMillis >= 0) { setSocketTimeout(timeoutMillis); } int c = pgStream.receiveChar(); if (useTimeout && timeoutMillis >= 0) { setSocketTimeout(0); } switch (c) { case 'A': receiveAsyncNotify(); timeoutMillis = -1; continue; case 'E': throw receiveErrorResponse(); case 'N': SQLWarning warning = receiveNoticeResponse(); addWarning(warning); if (useTimeout) { long newTimeMillis = System.nanoTime() / (long)1E6; timeoutMillis += startTime - newTimeMillis; startTime = newTimeMillis; if (timeoutMillis == 0) { timeoutMillis = -1; } } break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", (char) c), PSQLState.CONNECTION_FAILURE); } } } catch (SocketTimeoutException ioe) { } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occurred while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } finally { if (useTimeout) { setSocketTimeout(oldTimeout); } } }

Target:
public synchronized void processNotifies(int timeoutMillis) throws SQLException { waitOnLock(); if (getTransactionState() != TransactionState.IDLE) { return; } if (hasNotifications()) { timeoutMillis = -1; } boolean useTimeout = timeoutMillis > 0; long startTime = 0; int oldTimeout = 0; if (useTimeout) { startTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); try { oldTimeout = pgStream.getSocket().getSoTimeout(); } catch (SocketException e) { throw new PSQLException(GT.tr("An error occurred while trying to get the socket " + "timeout."), PSQLState.CONNECTION_FAILURE, e); } } try { while (timeoutMillis >= 0 || pgStream.hasMessagePending()) { if (useTimeout && timeoutMillis >= 0) { setSocketTimeout(timeoutMillis); } int c = pgStream.receiveChar(); if (useTimeout && timeoutMillis >= 0) { setSocketTimeout(0); } switch (c) { case 'A': receiveAsyncNotify(); timeoutMillis = -1; continue; case 'E': throw receiveErrorResponse(); case 'N': SQLWarning warning = receiveNoticeResponse(); addWarning(warning); if (useTimeout) { long newTimeMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); timeoutMillis += startTime - newTimeMillis; startTime = newTimeMillis; if (timeoutMillis == 0) { timeoutMillis = -1; } } break; default: throw new PSQLException(GT.tr("Unknown Response Type {0}.", (char) c), PSQLState.CONNECTION_FAILURE); } } } catch (SocketTimeoutException ioe) { } catch (IOException ioe) { throw new PSQLException(GT.tr("An I/O error occurred while sending to the backend."), PSQLState.CONNECTION_FAILURE, ioe); } finally { if (useTimeout) { setSocketTimeout(oldTimeout); } } }
Source:
private static String getClientPath() { Properties properties = new Properties(); try { InputStream inputStream = FileOpenSaveDialog.class.getClassLoader().getResourceAsStream( "project.properties" ); properties.load( inputStream ); } catch ( IOException e ) { e.printStackTrace(); } return properties.getProperty( "CLIENT_PATH" ); }

Target:
private static String getClientPath() { Properties properties = new Properties(); try ( InputStream inputStream = FileOpenSaveDialog.class.getClassLoader() .getResourceAsStream( "project.properties" ) ) { properties.load( inputStream ); } catch ( IOException e ) { e.printStackTrace(); } return properties.getProperty( "CLIENT_PATH" ); }
Source:
public void testAsyncReceiveWholeBytesFailed() throws Exception { org.junit.Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows")); EXCEPTIONS.clear(); Socket socket = new Socket(); socket.connect(DefaultServer.getDefaultServerAddress()); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; ++i) { sb.append("hello world\r\n"); } String request = "POST /fullbytes HTTP/1.1\r\nHost:localhost\r\nContent-Length:" + sb.length() + 100 + "\r\n\r\n" + sb.toString(); OutputStream outputStream = socket.getOutputStream(); outputStream.write(request.getBytes("US-ASCII")); socket.getInputStream().close(); outputStream.close(); IOException e = EXCEPTIONS.poll(2, TimeUnit.SECONDS); Assert.assertNotNull(e); }

Target:
public void testAsyncReceiveWholeBytesFailed() throws Exception { org.junit.Assume.assumeFalse(DefaultServer.isH2() && org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS); EXCEPTIONS.clear(); Socket socket = new Socket(); socket.connect(DefaultServer.getDefaultServerAddress()); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; ++i) { sb.append("hello world\r\n"); } String request = "POST /fullbytes HTTP/1.1\r\nHost:localhost\r\nContent-Length:" + sb.length() + 100 + "\r\n\r\n" + sb.toString(); OutputStream outputStream = socket.getOutputStream(); outputStream.write(request.getBytes("US-ASCII")); socket.getInputStream().close(); outputStream.close(); IOException e = EXCEPTIONS.poll(2, TimeUnit.SECONDS); Assert.assertNotNull(e); }
Source:
private static void processParseException(ParseException e, SensorContext context, CompatibleInputFile inputFile, Optional<RuleKey> parsingErrorKey) { reportAnalysisError(e, context, inputFile); if (parsingErrorKey.isPresent()) { NewIssue newIssue = context.newIssue(); NewIssueLocation primaryLocation = newIssue.newLocation() .message("Parse error: " + e.getMessage()) .on(inputFile.wrapped()); newIssue .forRule(parsingErrorKey.get()) .at(primaryLocation) .save(); } else { LOG.warn("Unable to parse file {}", inputFile.absolutePath()); LOG.warn("Cause: {}", e.getMessage()); } }

Target:
private static void processParseException(ParseException e, SensorContext context, CompatibleInputFile inputFile, Optional<RuleKey> parsingErrorKey) { reportAnalysisError(e, context, inputFile); LOG.warn("Unable to parse file {}", inputFile.absolutePath()); LOG.warn("Cause: {}", e.getMessage()); if (parsingErrorKey.isPresent()) { NewIssue newIssue = context.newIssue(); NewIssueLocation primaryLocation = newIssue.newLocation() .message("Parse error: " + e.getMessage()) .on(inputFile.wrapped()); newIssue .forRule(parsingErrorKey.get()) .at(primaryLocation) .save(); } }
Source:
public void setup() throws IOException { if (!created) { final String repositoryName = getRepositoryName(); final String path = createTempDirectory().getAbsolutePath(); System.setProperty("org.uberfire.nio.git.dir", path); System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); System.setProperty(ServerType.SERVER_TYPE_PROPERTY, "false"); System.out.println(".niogit: " + path); final URI newRepo = URI.create("git://" + repositoryName); try { IOService ioService = ioService(); ioService.newFileSystem(newRepo, new HashMap<>()); basePath = getDirectoryPath().resolveSibling("someNewOtherPath"); Path dummyFile = basePath.resolve("dummy"); ioService.createDirectory(dummyFile); } catch (final Exception e) { e.printStackTrace(); logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e); } finally { created = true; } final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class); when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator()); service = new RefactoringQueryServiceImpl(config, new NamedQueries(namedQueriesProducer)); service.init(); } }

Target:
public void setup() throws IOException { if (!created) { final String repositoryName = getRepositoryName(); final String path = createTempDirectory().getAbsolutePath(); System.setProperty("org.uberfire.nio.git.dir", path); System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); System.setProperty(FileSystemUtils.SIMPLIFIED_MONITORING_ENABLED, "false"); System.out.println(".niogit: " + path); final URI newRepo = URI.create("git://" + repositoryName); try { IOService ioService = ioService(); ioService.newFileSystem(newRepo, new HashMap<>()); basePath = getDirectoryPath().resolveSibling("someNewOtherPath"); Path dummyFile = basePath.resolve("dummy"); ioService.createDirectory(dummyFile); } catch (final Exception e) { e.printStackTrace(); logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e); } finally { created = true; } final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class); when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator()); service = new RefactoringQueryServiceImpl(config, new NamedQueries(namedQueriesProducer)); service.init(); } }
Source:
public boolean isStoredValueAvailable() { return cacheEvals && cachedValue != null && !cachedValue.isNull(); }

Target:
public boolean isStoredValueAvailable() { return cacheEvals && cachedValue != null && !cachedValue.hasValue(); }
Source:
public void execute() { if (isLocalNodeExecutionTarget()) { invokeLocally(); } else { if (trace) log.tracef("Sending %s to remote execution at node %s", f, getExecutionTarget()); try { rpc.invokeRemotelyInFuture(Collections.singletonList(getExecutionTarget()), getCommand(), rpc.getRpcOptionsBuilder().timeout(getOwningTask().timeout(), TimeUnit.MILLISECONDS).build(), (DistributedTaskPart<Object>) this); } catch (Throwable e) { log.remoteExecutionFailed(getExecutionTarget(), e); } } }

Target:
public void execute() { if (isLocalNodeExecutionTarget()) { invokeLocally(); } else { if (trace) log.tracef("Sending %s to remote execution at node %s", f, getExecutionTarget()); try { rpc.invokeRemotelyInFuture(Collections.singletonList(getExecutionTarget()), getCommand(), rpc.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS) .timeout(getOwningTask().timeout(), TimeUnit.MILLISECONDS).build(), (DistributedTaskPart<Object>) this); } catch (Throwable e) { log.remoteExecutionFailed(getExecutionTarget(), e); } } }
Source:
public synchronized void close() { if ( !closed ) { closed = true; db.unregisterTransactionEventHandler( fulltextTransactionEventUpdater ); nodeIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { e.printStackTrace(); } } ); relationshipIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { e.printStackTrace(); } } ); } }

Target:
public void close() { db.unregisterTransactionEventHandler( fulltextTransactionEventUpdater ); nodeIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { log.error( "Unable to close fulltext node index.", e ); } } ); relationshipIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { log.error( "Unable to close fulltext relationship index.", e ); } } ); }
Source:
public void onChangeTextSize(ChangeTextSizeEvent event) { if (curPageFragment != null && curPageFragment.getWebView() != null) { themeChooser.updateButtonState(true); curPageFragment.updateFontSize(); Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { themeChooser.updateButtonState(false); } }, (long)Math.ceil(0.75 * DateUtils.SECOND_IN_MILLIS)); } }

Target:
public void onChangeTextSize(ChangeTextSizeEvent event) { if (curPageFragment != null && curPageFragment.getWebView() != null) { themeChooser.updateButtonState(true); curPageFragment.updateFontSize(); Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { themeChooser.updateButtonState(false); } }, (long)(0.75 * DateUtils.SECOND_IN_MILLIS)); } }
Source:
private static void ackingProducerSimulation() { WaitStrategyPark ws = new WaitStrategyPark(100); StormMetricRegistry registry = new StormMetricRegistry(); JCQueue spoutQ = new JCQueue("spoutQ", 1024, 0, 100, ws, "test", "test", getTaskIds(), 1000, registry); JCQueue ackQ = new JCQueue("ackQ", 1024, 0, 100, ws, "test", "test", getTaskIds(), 1000, registry); final AckingProducer ackingProducer = new AckingProducer(spoutQ, ackQ); final Acker acker = new Acker(ackQ, spoutQ); runAllThds(ackingProducer, acker); }

Target:
private static void ackingProducerSimulation() { WaitStrategyPark ws = new WaitStrategyPark(100); StormMetricRegistry registry = new StormMetricRegistry(); JCQueue spoutQ = new JCQueue("spoutQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry); JCQueue ackQ = new JCQueue("ackQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry); final AckingProducer ackingProducer = new AckingProducer(spoutQ, ackQ); final Acker acker = new Acker(ackQ, spoutQ); runAllThds(ackingProducer, acker); }
Source:
public String getComputedValue(String name, String prefix, BaseCollection object, XWikiContext context) { String script = getScript(); try { ScriptContext scontext = Utils.getComponent(ScriptContextManager.class).getCurrentScriptContext(); scontext.setAttribute("name", name, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("prefix", prefix, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("object", new com.xpn.xwiki.api.Object((BaseObject) object, context), ScriptContext.ENGINE_SCOPE); XWikiDocument classDocument = object.getXClass(context).getOwnerDocument(); return renderContentInContext(script, classDocument.getSyntax().toIdString(), classDocument.getAuthorReference(), classDocument.getDocumentReference(), context); } catch (Exception e) { return e.getMessage(); } }

Target:
public String getComputedValue(String name, String prefix, BaseCollection object, XWikiContext context) throws Exception { String script = getScript(); ScriptContext scontext = Utils.getComponent(ScriptContextManager.class).getCurrentScriptContext(); scontext.setAttribute("name", name, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("prefix", prefix, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("object", new com.xpn.xwiki.api.Object((BaseObject) object, context), ScriptContext.ENGINE_SCOPE); XWikiDocument classDocument = object.getXClass(context).getOwnerDocument(); return renderContentInContext(script, classDocument.getSyntax().toIdString(), classDocument.getAuthorReference(), classDocument.getDocumentReference(), context); }
Source:
public Optional<RuleAnnotationClauseColumn> getUiModelColumn() { return uiModelColumn; }

Target:
Optional<RuleAnnotationClauseColumn> getUiModelColumn() { return uiModelColumn; }
Source:
public ConfigDaoImpl(Configuration appConfig) throws ClassNotFoundException, SQLException, ConfigurationException, ConnectException, XPathExpressionException { valueColumn = appConfig.getString("configColumnValue"); configTable = appConfig.getString("configTable"); nameColumn = appConfig.getString("configColumnName"); versionColumn = appConfig.getString("configColumnVersion"); defaultColumn = appConfig.getString("configColumnDefault"); selectSql = MessageFormat.format("select {0} from {1} where {2}=? and {3} =?", valueColumn, configTable, nameColumn, versionColumn); updateSql = MessageFormat.format("update {0} set {1}=? where {2}=? and {3}=?", configTable, valueColumn, nameColumn, versionColumn); selectKeysForNameSql = MessageFormat.format("select * from {0} where {1}=? ", configTable, nameColumn); getConfigDiff = "SELECT option_name, option_value, default_value, version\n" + " FROM vdc_options\n" + " WHERE option_value != default_value"; ds = new StandaloneDataSource(); }

Target:
public ConfigDaoImpl(Configuration appConfig) throws ClassNotFoundException, SQLException, ConfigurationException, ConnectException, XPathExpressionException { valueColumn = appConfig.getString("configColumnValue"); configTable = appConfig.getString("configTable"); nameColumn = appConfig.getString("configColumnName"); versionColumn = appConfig.getString("configColumnVersion"); defaultColumn = appConfig.getString("configColumnDefault"); selectSql = MessageFormat.format("select {0} from {1} where {2}=? and {3} =?", valueColumn, configTable, nameColumn, versionColumn); updateSql = MessageFormat.format("update {0} set {1}=? where {2}=? and {3}=?", configTable, valueColumn, nameColumn, versionColumn); selectKeysForNameSql = MessageFormat.format("select * from {0} where {1}=? ", configTable, nameColumn); selectConfigDiff = MessageFormat.format("SELECT {0}, {1}, {2}, {3} FROM {4} WHERE {5} != {6}", nameColumn, valueColumn, defaultColumn, versionColumn, configTable, valueColumn, defaultColumn); System.out.println(selectConfigDiff); ds = new StandaloneDataSource(); }
Source:
public static ThreadPoolExecutor newBlockingSingleThreaded(final String nameFormat, final int capacity) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }

Target:
public static ExecutorService newBlockingSingleThreaded(final String nameFormat, final int capacity) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }
Source:
protected TrustManager[] getTrustManagers( KeyStore trustStore, Collection<? extends CRL> crls ) throws Exception { TrustManager[] trustManagers = super.getTrustManagers(trustStore, crls); TrustManager[] newTrustManagers = new TrustManager[trustManagers.length]; for (int i = 0; i < trustManagers.length; i++) { if (trustManagers[i] instanceof X509ExtendedTrustManager) { newTrustManagers[i] = new CustomCheckX509TrustManager( (X509ExtendedTrustManager) trustManagers[i], certificateChecker, tlsServerConfig.isValidateHostnames() ); } } return newTrustManagers; }

Target:
protected TrustManager[] getTrustManagers( KeyStore trustStore, Collection<? extends CRL> crls ) throws Exception { TrustManager[] trustManagers = super.getTrustManagers(trustStore, crls); TrustManager[] newTrustManagers = new TrustManager[trustManagers.length]; for (int i = 0; i < trustManagers.length; i++) { if (trustManagers[i] instanceof X509ExtendedTrustManager) { newTrustManagers[i] = new CustomCheckX509TrustManager( (X509ExtendedTrustManager) trustManagers[i], certificateChecker, tlsServerConfig.isValidateHostnames() ); } else { newTrustManagers[i] = trustManagers[i]; log.info("Encountered non-X509ExtendedTrustManager: " + trustManagers[i].getClass()); } } return newTrustManagers; }
Source:
private void createSecondaryConnections(boolean isRejoin) { int partitionGroupCount = m_clusterSettings.get().hostcount() / (m_configuredReplicationFactor + 1); int localHostId = m_messenger.getHostId(); Set<Integer> peers = Sets.newHashSet(); if (m_configuredReplicationFactor > 0 && partitionGroupCount > 1) { Set<Integer> buddyHostIds = m_cartographer.getBuddyHostIds(localHostId); if (isRejoin) { peers.addAll(buddyHostIds); } else { for (Integer host : buddyHostIds) { if (host > localHostId) { peers.add(host); } } } int maxConnection = m_clusterSettings.get().hostcount() - 1; int existingConnections = buddyHostIds.size() - 1; int numberOfConnections = Math.min( maxConnection, CoreUtils.availableProcessors() / 4); int secondaryConnections = (numberOfConnections - 1) / existingConnections; Integer configNumberOfConnections = Integer.getInteger(SECONDARY_PICONETWORK_THREADS); if (configNumberOfConnections != null) { secondaryConnections = configNumberOfConnections; hostLog.info("Overridden secondary PicoNetwork network thread count:" + configNumberOfConnections); } else { hostLog.info("This node has " + secondaryConnections + " secondary PicoNetwork thread" + ((secondaryConnections > 1) ? "s" :"")); } m_messenger.createAuxiliaryConnections(peers, secondaryConnections); } }

Target:
private void createSecondaryConnections(boolean isRejoin) { int partitionGroupCount = m_clusterSettings.get().hostcount() / (m_configuredReplicationFactor + 1); int localHostId = m_messenger.getHostId(); Set<Integer> peers = Sets.newHashSet(); if (m_configuredReplicationFactor > 0 && partitionGroupCount > 1) { Set<Integer> hostIdsWithinGroup = m_cartographer.getHostIdsWithinPartitionGroup(localHostId); if (isRejoin) { peers.addAll(hostIdsWithinGroup); peers.remove(m_messenger.getHostId()); } else { for (Integer host : hostIdsWithinGroup) { if (host > localHostId) { peers.add(host); } } } int connectionsWithoutPG = m_clusterSettings.get().hostcount() - 1; int existingConnectionsWithinPG = hostIdsWithinGroup.size() - 1; int targetConnectionsWithinPG = Math.min( connectionsWithoutPG, CoreUtils.availableProcessors() / 4); int secondaryConnections = (targetConnectionsWithinPG - 1) / existingConnectionsWithinPG; Integer configNumberOfConnections = Integer.getInteger(SECONDARY_PICONETWORK_THREADS); if (configNumberOfConnections != null) { secondaryConnections = configNumberOfConnections; hostLog.info("Overridden secondary PicoNetwork network thread count:" + configNumberOfConnections); } else { hostLog.info("This node has " + secondaryConnections + " secondary PicoNetwork thread" + ((secondaryConnections > 1) ? "s" :"")); } m_messenger.createAuxiliaryConnections(peers, secondaryConnections); } }
Source:
private List<Vector> parseRawSmallMatrix(final String rawSmallMatrix) { final List<Vector> matrix = new LinkedList<>(); for (final String row : rawSmallMatrix.split("\n")) { if (row.startsWith("#") || row.length() == 0) { continue; } final String[] split = row.split("\\s+"); final int numColumns = split.length - 1; final Vector rowVector = new DenseVector(numColumns); try { for (int i = 0; i < numColumns; i++) { rowVector.set(i, Double.valueOf(split[i + 1])); } } catch (final NumberFormatException e) { throw new RuntimeException(e); } matrix.add(rowVector); } return matrix; }

Target:
private Matrix parseRawSmallMatrix(final String rawSmallMatrix) { final List<double[]> rows = new LinkedList<>(); for (final String row : rawSmallMatrix.split(System.getProperty("line.separator"))) { if (row.startsWith("#") || row.length() == 0) { continue; } final String[] split = row.split("\\s+"); final int numColumns = split.length - 1; final double[] rowVector = new double[numColumns]; try { for (int i = 0; i < numColumns; i++) { rowVector[i] = Double.valueOf(split[i + 1]); } } catch (final NumberFormatException e) { throw new RuntimeException(e); } rows.add(rowVector); } final double[][] rawData = new double[rows.size()][]; int index = 0; for (final double[] row : rows) { rawData[index++] = row; } return new DenseMatrix(rawData); }
Source:
public void update() { super.update(); if(worldObj.isRemote) { return; } updateRecipes(); if(power >= getTarget() && getTarget() != 0) { AssemblyRecipe recipe = getActiveRecipe(); extract(recipe.requiredStacks, false); ItemStack stack = recipe.output.copy(); stack.stackSize -= Utils.addToRandomInventoryAround(worldObj, pos, stack); if(stack.stackSize > 0) { stack.stackSize -= Utils.addToRandomInjectableAround(worldObj, pos, null, stack); } InvUtils.dropItemUp(getWorld(), stack, getPos()); power -= getTarget(); activateNextRecipe(); } sendNetworkUpdate(NET_RENDER_DATA); }

Target:
public void update() { super.update(); if(worldObj.isRemote) { return; } updateRecipes(); if(power >= getTarget() && getTarget() != 0) { AssemblyRecipe recipe = getActiveRecipe(); extract(recipe.requiredStacks, false); ItemStack stack = recipe.output.copy(); stack.stackSize -= Utils.addToRandomInventoryAround(worldObj, pos, stack); if(stack.stackSize > 0) { stack.stackSize -= Utils.addToRandomInjectableAround(worldObj, pos, null, stack); } InvUtils.dropItemUp(getWorld(), stack, getPos()); power -= getTarget(); activateNextRecipe(); } sendNetworkGuiUpdate(NET_GUI_DATA); }
Source:
private String buildError(Error error, List<String> branches) { StringBuilder sb = new StringBuilder(); sb.append(error.get()); if(branches.size() > 0) { sb.append("\nIn branch(es): "); } String delimiter = ""; for (String branch : branches) { sb.append(delimiter).append(branch); delimiter = ", "; } return sb.toString(); }

Target:
private String buildError(Error error, List<String> branches) { if (branches.isEmpty()) { return error.get(); } StringBuilder sb = new StringBuilder(); if (branches.size() == 1) { sb.append("Branch ").append(branches.get(0)).append(":\n"); sb.append(error.get()); return sb.toString(); } sb.append("Branches"); String delim = " "; for (String branch : branches) { sb.append(delim).append(branch); delim = ", "; } return sb.append(":\n").append(error.get()).toString(); }
Source:
public void putBlock(final String dataType, final int blockId, final Map<Long, Object> data) { if (!typeToBlocks.containsKey(dataType)) { initBlocks(dataType); } final Map<Integer, Block> blocks = typeToBlocks.get(dataType); if (blocks.containsKey(blockId)) { LOG.log(Level.SEVERE, "Block with id {0} already exists.", blockId); throw new RuntimeException(); } final Block block = new Block(); block.putAll(data); blocks.put(blockId, block); }

Target:
public void putBlock(final String dataType, final int blockId, final Map<Long, Object> data) { if (!typeToBlocks.containsKey(dataType)) { initBlocks(dataType); } final Map<Integer, Block> blocks = typeToBlocks.get(dataType); if (blocks.containsKey(blockId)) { throw new RuntimeException("Block with id " + blockId + " already exists."); } final Block block = new Block(); block.putAll(data); blocks.put(blockId, block); }
Source:
public Response intercept(Chain chain) throws IOException { AsyncTracerTag tracerTag = chain.request().tag(AsyncTracerTag.class); if (tracerTag == null && tracerTag.asyncTracer() == null) { return chain.proceed(chain.request()); } return tracerTag.asyncTracer().withTrace(() -> chain.proceed(chain.request())); }

Target:
public Response intercept(Chain chain) throws IOException { AsyncTracerTag tracerTag = chain.request().tag(AsyncTracerTag.class); if (tracerTag == null || tracerTag.asyncTracer() == null) { return chain.proceed(chain.request()); } return tracerTag.asyncTracer().withTrace(() -> chain.proceed(chain.request())); }
Source:
public void onMessage(@NonNull MessageType messageType, @NonNull String message) { switch (messageType) { case FLYIN_ERROR: case FLYIN_WARNING: case FLYIN_INFO: this.showInfoMessage(message); break; case ERROR: case WARNING: case INFO: this.showMessageInSitu(message); break; case EMPTY: this.hideMessageInSitu(); break; } }

Target:
public void onMessage(@NonNull MessageType messageType, @NonNull String message) { switch (messageType) { case FLYIN_ERROR: this.showErrorMessage("", message); break; case FLYIN_WARNING: case FLYIN_INFO: this.showInfoMessage(message); break; case ERROR: case WARNING: case INFO: this.showMessageInSitu(message); break; case EMPTY: this.hideMessageInSitu(); break; case DIALOG: this.showErrorDialog(message); } }
Source:
private Settings() { settingsFile = new File("settings.yaml"); loadDescriptions(); try { if (!settingsFile.exists()) { createSettingsFile(); } else { loadSettings(); } } catch (IOException e) { log.log(LogLevel.ERROR, "Error creating setting file settings.cfg!"); } }

Target:
private Settings() { settingsFile = new File("settings.yml"); loadDescriptions(); try { if (!settingsFile.exists()) { createSettingsFile(); } else { loadSettings(); } } catch (IOException e) { log.log(LogLevel.ERROR, "Error creating setting file settings.cfg!"); } }
Source:
@Test public void testDistinctCount2() { foodmartModelWithOneTile() .query("select count(distinct \"the_year\") as c\n" + "from \"foodmart\".\"sales_fact_1997\"\n" + "join \"foodmart\".\"time_by_day\" using (\"time_id\")\n" + "group by \"the_year\"") .enableMaterializations(true) .explainContains("EnumerableCalc(expr#0..1=[{inputs}], C=[$t1])\n" + " EnumerableAggregate(group=[{0}], C=[COUNT($0)])\n" + " EnumerableAggregate(group=[{0}])\n" + " EnumerableTableScan(table=[[adhoc, m{32, 36}]])") .returnsUnordered("C=1"); }

Target:
@Test public void testDistinctCount2() { foodmartModelWithOneTile() .query("select count(distinct \"the_year\") as c\n" + "from \"foodmart\".\"sales_fact_1997\"\n" + "join \"foodmart\".\"time_by_day\" using (\"time_id\")\n" + "group by \"the_year\"") .enableMaterializations(true) .explainContains("EnumerableCalc(expr#0=[{inputs}], expr#1=[IS NOT NULL($t0)], " + "expr#2=[1:BIGINT], expr#3=[0:BIGINT], expr#4=[CASE($t1, $t2, $t3)], C=[$t4])\n" + " EnumerableAggregate(group=[{0}])\n" + " EnumerableTableScan(table=[[adhoc, m{32, 36}]])") .returnsUnordered("C=1"); }
Source:
private VersionConstraint[] getUnsatisfiedConstraints(BundleDescription bundle, ResolverHook hook) { State containingState = bundle.getContainingState(); if (containingState == null) throw new IllegalStateException("Does not belong to a state"); List<VersionConstraint> unsatisfied = new ArrayList<>(); HostSpecification host = bundle.getHost(); if (host != null) if (!host.isResolved() && !isBundleConstraintResolvable(host, BundleRevision.HOST_NAMESPACE, hook)) unsatisfied.add(host); BundleSpecification[] requiredBundles = bundle.getRequiredBundles(); for (BundleSpecification requiredBundle : requiredBundles) { if (!requiredBundle.isResolved() && !isBundleConstraintResolvable(requiredBundle, null, hook)) { unsatisfied.add(requiredBundle); } } ImportPackageSpecification[] packages = bundle.getImportPackages(); for (ImportPackageSpecification package1 : packages) { if (!package1.isResolved() && !isResolvable(package1, hook)) { if (bundle.isResolved()) { if (!ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(package1.getDirective(Constants.RESOLUTION_DIRECTIVE))) { continue; } } unsatisfied.add(package1); } } GenericSpecification[] generics = bundle.getGenericRequires(); for (GenericSpecification generic : generics) { if (!generic.isResolved() && !isResolvable(generic, hook)) { unsatisfied.add(generic); } } NativeCodeSpecification nativeCode = bundle.getNativeCodeSpecification(); if (nativeCode != null && !nativeCode.isResolved()) unsatisfied.add(nativeCode); return unsatisfied.toArray(new VersionConstraint[unsatisfied.size()]); }

Target:
private VersionConstraint[] getUnsatisfiedConstraints(BundleDescription bundle, ResolverHook hook) { State containingState = bundle.getContainingState(); if (containingState == null) throw new IllegalStateException("Does not belong to a state"); List<VersionConstraint> unsatisfied = new ArrayList<>(); HostSpecification host = bundle.getHost(); if (host != null) if (!host.isResolved() && !isBundleConstraintResolvable(host, BundleRevision.HOST_NAMESPACE, hook)) unsatisfied.add(host); BundleSpecification[] requiredBundles = bundle.getRequiredBundles(); for (BundleSpecification requiredBundle : requiredBundles) { if (!requiredBundle.isResolved() && !isBundleConstraintResolvable(requiredBundle, null, hook)) { unsatisfied.add(requiredBundle); } } ImportPackageSpecification[] packages = bundle.getImportPackages(); for (ImportPackageSpecification importSpecification : packages) { if (!importSpecification.isResolved() && !isResolvable(importSpecification, hook)) { if (bundle.isResolved()) { if (!ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(importSpecification.getDirective(Constants.RESOLUTION_DIRECTIVE))) { continue; } } unsatisfied.add(importSpecification); } } GenericSpecification[] generics = bundle.getGenericRequires(); for (GenericSpecification generic : generics) { if (!generic.isResolved() && !isResolvable(generic, hook)) { unsatisfied.add(generic); } } NativeCodeSpecification nativeCode = bundle.getNativeCodeSpecification(); if (nativeCode != null && !nativeCode.isResolved()) unsatisfied.add(nativeCode); return unsatisfied.toArray(new VersionConstraint[unsatisfied.size()]); }
Source:
private Flux<Indexable> invokeReadyTasksAsync(final InvocationContext context) { TaskGroupEntry<TaskItem> readyTaskEntry = super.getNext(); final List<Flux<Indexable>> observables = new ArrayList<>(); while (readyTaskEntry != null) { final TaskGroupEntry<TaskItem> currentEntry = readyTaskEntry; final TaskItem currentTaskItem = currentEntry.data(); if (currentTaskItem instanceof ProxyTaskItem) { observables.add(invokeAfterPostRunAsync(currentEntry, context)); } else { observables.add(invokeTaskAsync(currentEntry, context)); } readyTaskEntry = super.getNext(); } return Flux.mergeOrdered(32, (some, other) -> { if (rootTaskEntry.key().endsWith(some.key())) { return 1; } else { return -1; } }, (Flux<Indexable>[]) observables.toArray(new Flux[0])); }

Target:
private Flux<Indexable> invokeReadyTasksAsync(final InvocationContext context) { TaskGroupEntry<TaskItem> readyTaskEntry = super.getNext(); final List<Flux<Indexable>> observables = new ArrayList<>(); while (readyTaskEntry != null) { final TaskGroupEntry<TaskItem> currentEntry = readyTaskEntry; final TaskItem currentTaskItem = currentEntry.data(); if (currentTaskItem instanceof ProxyTaskItem) { observables.add(invokeAfterPostRunAsync(currentEntry, context)); } else { observables.add(invokeTaskAsync(currentEntry, context)); } readyTaskEntry = super.getNext(); } return Flux.mergeOrdered(32, (some, other) -> { if (rootTaskEntry.key().endsWith(some.key())) { if (rootTaskEntry.key().endsWith(other.key())) { return 0; } return 1; } else if (rootTaskEntry.key().endsWith(other.key())) { return -1; } else { return some.key().compareTo(other.key()); } }, (Flux<Indexable>[]) observables.toArray(new Flux[0])); }
Source:
private void postInfoAndPRsActions(PullRequestRef pr, List<Issue> issueReport, int issueThreshold, StashDiffReport diffReport, StashClient stashClient) { boolean canApprovePullrequest = config.canApprovePullRequest(); int issueTotal = issueReport.size(); if (issueTotal >= issueThreshold) { LOGGER.warn("Too many issues detected ({}/{}): Issues cannot be displayed in Diff view", issueTotal, issueThreshold); } else { stashRequestFacade.postSonarQubeReport(pr, issueReport, diffReport, stashClient); } if (config.includeAnalysisOverview()) { stashRequestFacade.postAnalysisOverview(pr, issueThreshold, issueReport, stashClient); } if (canApprovePullrequest && (issueTotal == 0)){ stashRequestFacade.approvePullRequest(pr, stashClient); } else if (canApprovePullrequest && ( (issueTotal != 0)) ) { stashRequestFacade.resetPullRequestApproval(pr, stashClient); } }

Target:
private void postInfoAndPRsActions(PullRequestRef pr, List<Issue> issueReport, int issueThreshold, StashDiffReport diffReport, StashClient stashClient) { boolean canApprovePullrequest = config.canApprovePullRequest(); int issueTotal = issueReport.size(); if (issueTotal >= issueThreshold) { LOGGER.warn("Too many issues detected ({}/{}): Issues cannot be displayed in Diff view", issueTotal, issueThreshold); } else { stashRequestFacade.postSonarQubeReport(pr, issueReport, diffReport, stashClient); } if (config.includeAnalysisOverview()) { stashRequestFacade.postAnalysisOverview(pr, issueThreshold, issueReport, stashClient); } if (canApprovePullrequest) { if (issueTotal == 0) { stashRequestFacade.approvePullRequest(pr, stashClient); } else { stashRequestFacade.resetPullRequestApproval(pr, stashClient); } } }
Source:
public void searchPayments_ShouldIncludeCaptureLink_whenReturnedFromConnector() { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String SUBMITTED_STATE = "submitted"; String payments = aPaginatedPaymentSearchResult() .withCount(1) .withPage(1) .withTotal(1) .withPayments(aSuccessfulSearchPayment() .withMatchingInProgressState(SUBMITTED_STATE) .withMatchingReference(TEST_REFERENCE) .withNumberOfResults(1) .withCaptureLink() .getResults()) .build(); connectorMock.respondOk_whenSearchCharges(GATEWAY_ACCOUNT_ID, TEST_REFERENCE, null, null, null, null, null, null, null, null, payments ); searchPayments(API_KEY, ImmutableMap.of("reference", TEST_REFERENCE)) .statusCode(200) .contentType(JSON) .body("results[0]._links", hasKey("capture")) .body("results[0]._links.capture.method", is("POST")); }

Target:
public void searchPayments_ShouldIncludeCaptureLink_whenReturnedFromConnector() { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String submittedState = "submitted"; String chargeId = "charge-id"; String payments = aPaginatedPaymentSearchResult() .withCount(1) .withPage(1) .withTotal(1) .withPayments(aSuccessfulSearchPayment() .withChargeId(chargeId) .withMatchingInProgressState(submittedState) .withMatchingReference(TEST_REFERENCE) .withNumberOfResults(1) .withCaptureLink() .getResults()) .build(); connectorMock.respondOk_whenSearchCharges(GATEWAY_ACCOUNT_ID, TEST_REFERENCE, null, null, null, null, null, null, null, null, payments ); searchPayments(API_KEY, ImmutableMap.of("reference", TEST_REFERENCE)) .statusCode(200) .contentType(JSON) .body("results[0]._links", hasKey("capture")) .body("results[0]._links.capture.method", is("POST")) .body("results[0]._links.capture.href", is("<LINK_0>" + chargeId + "/capture")); }
Source:
public synchronized TaskHandle addTask( TaskId taskId, DoubleSupplier utilizationSupplier, int initialSplitConcurrency, Duration splitConcurrencyAdjustFrequency, OptionalInt maxDriversPerTask) { requireNonNull(taskId, "taskId is null"); requireNonNull(utilizationSupplier, "utilizationSupplier is null"); checkArgument(!maxDriversPerTask.isPresent() || maxDriversPerTask.getAsInt() <= maximumNumberOfDriversPerTask, "maxDriversPerTask must not be greater than the system default"); log.debug("Task scheduled " + taskId); TaskHandle taskHandle = new TaskHandle(taskId, waitingSplits, utilizationSupplier, initialSplitConcurrency, splitConcurrencyAdjustFrequency, maxDriversPerTask); tasks.add(taskHandle); return taskHandle; }

Target:
public synchronized TaskHandle addTask( TaskId taskId, DoubleSupplier utilizationSupplier, int initialSplitConcurrency, Duration splitConcurrencyAdjustFrequency, OptionalInt maxDriversPerTask) { requireNonNull(taskId, "taskId is null"); requireNonNull(utilizationSupplier, "utilizationSupplier is null"); checkArgument(!maxDriversPerTask.isPresent() || maxDriversPerTask.getAsInt() <= maximumNumberOfDriversPerTask, "maxDriversPerTask cannot be greater than the configured value"); log.debug("Task scheduled " + taskId); TaskHandle taskHandle = new TaskHandle(taskId, waitingSplits, utilizationSupplier, initialSplitConcurrency, splitConcurrencyAdjustFrequency, maxDriversPerTask); tasks.add(taskHandle); return taskHandle; }
Source:
private static IllegalStateException noDispatcherFound(MessageEnvelope envelope) { String id = Identifier.toString(envelope.id()); String msg = format("No dispatcher found for the command (class: `%s` id: `%s`).", envelope.messageClass(), id); throw new IllegalStateException(msg); }

Target:
private static IllegalStateException noDispatcherFound(MessageEnvelope envelope) { String id = Identifier.toString(envelope.id()); throw newIllegalStateException( "No dispatcher found for the command (class: `%s` id: `%s`).", envelope.messageClass(), id ); }
Source:
void testResetBeforeStartingPerformsANormalRun() throws Exception { when(mockHandler.supportsReset()).thenReturn(true); final List<String> handled = new CopyOnWriteArrayList<>(); final List<String> handledInRedelivery = new CopyOnWriteArrayList<>(); doAnswer(i -> { EventMessage<?> message = i.getArgument(0); handled.add(message.getIdentifier()); if (ReplayToken.isReplay(message)) { handledInRedelivery.add(message.getIdentifier()); } return null; }).when(mockHandler).handle(any()); testSubject.resetTokens(); testSubject.start(); eventBus.publish(createEvents(4)); assertWithin(1, TimeUnit.SECONDS, () -> assertEquals(4, handled.size())); assertEquals(0, handledInRedelivery.size()); assertFalse(testSubject.processingStatus().get(0).isReplaying()); assertTrue(testSubject.processingStatus().get(0).getReplayPosition().isPresent()); assertFalse(testSubject.processingStatus().get(0).getResetTokenPosition().isPresent()); }

Target:
void testResetBeforeStartingPerformsANormalRun() throws Exception { when(mockHandler.supportsReset()).thenReturn(true); final List<String> handled = new CopyOnWriteArrayList<>(); final List<String> handledInRedelivery = new CopyOnWriteArrayList<>(); doAnswer(i -> { EventMessage<?> message = i.getArgument(0); handled.add(message.getIdentifier()); if (ReplayToken.isReplay(message)) { handledInRedelivery.add(message.getIdentifier()); } return null; }).when(mockHandler).handle(any()); testSubject.resetTokens(); testSubject.start(); eventBus.publish(createEvents(4)); assertWithin(1, TimeUnit.SECONDS, () -> assertEquals(4, handled.size())); assertEquals(0, handledInRedelivery.size()); assertFalse(testSubject.processingStatus().get(0).isReplaying()); assertFalse(testSubject.processingStatus().get(0).getResetPosition().isPresent()); assertTrue(testSubject.processingStatus().get(0).getCurrentPosition().isPresent()); assertTrue(testSubject.processingStatus().get(0).getCurrentPosition().getAsLong() > 0); }
Source:
public void testImageExtractionHandlesNullImageUris() { AmazonUnboxItem amazonUnboxItem = createAmazonUnboxItem("seasonAsin", ContentType.TVSEASON) .withLargeImageUrl(null) .build(); Series series = (Series) Iterables.getOnlyElement(extractor.extract(amazonUnboxItem)); assertEquals(0, series.getImages().size()); AmazonUnboxItem amazonUnboxItem2 = createAmazonUnboxItem("seasonAsin", ContentType.TVSEASON) .withLargeImageUrl("") .build(); Series series2 = (Series) Iterables.getOnlyElement(extractor.extract(amazonUnboxItem2)); assertEquals(0, series2.getImages().size()); }

Target:
public void testImageExtractionHandlesNullImageUris() { AmazonUnboxItem amazonUnboxItem = createAmazonUnboxItem("seasonAsin", ContentType.TVSEASON) .withLargeImageUrl(null) .build(); Series series = (Series) Iterables.getOnlyElement(extractor.extract(amazonUnboxItem)); assertEquals(0, series.getImages().size()); }
Source:
public void registerItemModels() { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Config.itemRing, 0, new ModelResourceLocation(Baubles.MODID + ":ring", "inventory")); ModelBakery.registerItemVariants(Config.itemRing, new ResourceLocation(Baubles.MODID + ":ring")); }

Target:
public void registerItemModels() { ModelLoader.setCustomModelResourceLocation(Config.itemRing, 0, new ModelResourceLocation("baubles:Ring", "inventory")); }
Source:
private Map<Address, List<Integer>> getMemberPartitions(Collection<Integer> partitions) { Map<Address, List<Integer>> memberPartitions = createHashMap(3); InternalPartitionService partitionService = nodeEngine.getPartitionService(); for (int partition : partitions) { Address owner = partitionService.getPartitionOwnerOrWait(partition); if (!memberPartitions.containsKey(owner)) { memberPartitions.put(owner, new ArrayList<>()); } memberPartitions.get(owner).add(partition); } return memberPartitions; }

Target:
private Map<Address, List<Integer>> getMemberPartitions(Collection<Integer> partitions) { Map<Address, List<Integer>> memberPartitions = createHashMap(3); InternalPartitionService partitionService = nodeEngine.getPartitionService(); for (int partition : partitions) { Address owner = partitionService.getPartitionOwnerOrWait(partition); memberPartitions.computeIfAbsent(owner, k -> new ArrayList<>()).add(partition); } return memberPartitions; }
Source:
private NQueens readSolution(String resource) throws IOException { Path tempFile = Files.createTempFile("optaplanner-test", "xml"); try (InputStreamReader inputStreamReader = new InputStreamReader(NQueensConstraintProviderTest.class.getResourceAsStream(resource))) { List<String> lines = IOUtils.readLines(inputStreamReader); Files.write(tempFile,lines); final SolutionFileIO<NQueens> solutionFileIO = new XStreamSolutionFileIO<>(NQueens.class); return solutionFileIO.read(tempFile.toFile()); } finally { Files.deleteIfExists(tempFile); } }

Target:
private static NQueens readSolution(String resource) throws IOException { try (InputStream inputStream = NQueensConstraintProviderTest.class.getResourceAsStream(resource)) { final XStreamSolutionFileIO<NQueens> solutionFileIO = new XStreamSolutionFileIO<>(NQueens.class); return solutionFileIO.read(inputStream); } }
Source:
public Instance getInstance() { if (mock) return DeprecationUtil.makeMockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } try { return getConnector().getInstance(); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public Instance getInstance() { if (instance == null) { return HdfsZooInstance.getInstance(); } try { return getConnector().getInstance(); } catch (AccumuloSecurityException | AccumuloException e) { throw new IllegalStateException(e); } }
Source:
public static int getValue(String text) { if (text == null || text.isEmpty() || text.equals("build")) { return BUILD; } if (text.equals("codan")) { return CODAN; } throw new IllegalArgumentException("Unknown context value: " + text); }

Target:
public static int getValue(String text) { if ("build".equals(text)) { return BUILD; } if ("codan".equals(text)) { return CODAN; } throw new IllegalArgumentException("Unknown context value: " + text); }
Source:
private void extractFile(File pdfFile, Appendable outFile) throws ParseException { PDDocument pdfDocument = null; try { pdfDocument = this.password == null ? PDDocument.load(pdfFile) : PDDocument.load(pdfFile, this.password); PageIterator pageIterator = getPageIterator(pdfDocument); List<Table> tables = new ArrayList<>(); while (pageIterator.hasNext()) { Page page = pageIterator.next(); if (pageAreas != null) { for (Pair<Integer, Rectangle> areaPair : pageAreas) { tables.addAll(tableExtractor.extractTables(page.getArea(areaPair.getRight(), areaPair.getLeft()))); } } else { tables.addAll(tableExtractor.extractTables(page)); } } writeTables(tables, outFile); } catch (IOException e) { throw new ParseException(e.getMessage()); } finally { try { if (pdfDocument != null) { pdfDocument.close(); } } catch (IOException e) { System.out.println("Error in closing pdf document" + e); } } }

Target:
private void extractFile(File pdfFile, Appendable outFile) throws ParseException { PDDocument pdfDocument = null; try { pdfDocument = this.password == null ? PDDocument.load(pdfFile) : PDDocument.load(pdfFile, this.password); PageIterator pageIterator = getPageIterator(pdfDocument); List<Table> tables = new ArrayList<>(); while (pageIterator.hasNext()) { Page page = pageIterator.next(); if (pageAreas != null) { for (Pair<Integer, Rectangle> areaPair : pageAreas) { Rectangle area = areaPair.getRight(); if (areaPair.getLeft() == RELATIVE_AREA_CALCULATION_MODE) { area = new Rectangle((float) (area.getTop() / 100 * page.getHeight()), (float) (area.getLeft() / 100 * page.getWidth()), (float) (area.getWidth() / 100 * page.getWidth()), (float) (area.getHeight() / 100 * page.getHeight())); } tables.addAll(tableExtractor.extractTables(page.getArea(area))); } } else { tables.addAll(tableExtractor.extractTables(page)); } } writeTables(tables, outFile); } catch (IOException e) { throw new ParseException(e.getMessage()); } finally { try { if (pdfDocument != null) { pdfDocument.close(); } } catch (IOException e) { System.out.println("Error in closing pdf document" + e); } } }
Source:
public Session handshake(String[] subProtocols, boolean allowExtensions) throws ProtocolException { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(getWebSocketURL(httpRequest), getSubProtocolsStr(subProtocols), allowExtensions); WebSocketServerHandshaker handshaker = wsFactory.newHandshaker(httpRequest); return handleHandshake(handshaker, 0); }

Target:
public HandshakeFuture handshake(String[] subProtocols, boolean allowExtensions) { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(getWebSocketURL(httpRequest), getSubProtocolsCSV(subProtocols), allowExtensions); WebSocketServerHandshaker handshaker = wsFactory.newHandshaker(httpRequest); return handleHandshake(handshaker, 0); }