auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void reset(URL url) { server.reset(url); try { if (url.hasParameter(Constants.HEARTBEAT_KEY) || url.hasParameter(Constants.HEARTBEAT_TIMEOUT_KEY)) { int h = url.getParameter(Constants.HEARTBEAT_KEY, heartbeat); int t = url.getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, h * 3); if (t < h * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } if (h != heartbeat || t != idleTimeout) { heartbeat = h; idleTimeout = t; stopIdleCheckTimer(); startIdleCheckTimer(); } } } catch (Throwable t) { logger.error(t.getMessage(), t); } }

Target:
public void reset(URL url) { server.reset(url); try { if (url.hasParameter(Constants.HEARTBEAT_KEY) || url.hasParameter(Constants.HEARTBEAT_TIMEOUT_KEY)) { int h = url.getParameter(Constants.HEARTBEAT_KEY, heartbeat); int t = url.getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, h * 3); if (t < h * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } if (h != heartbeat || t != idleTimeout) { heartbeat = h; idleTimeout = t; startIdleCheckTask(); } } } catch (Throwable t) { logger.error(t.getMessage(), t); } }
Source:
public void destroyResources() { if (eurekaConnCleaner != null) { eurekaConnCleaner.shutdown(); } if (apacheHttpClient != null) { apacheHttpClient.close(); } }

Target:
public void destroyResources() { if (eurekaConnCleaner != null) { eurekaConnCleaner.execute(connectionCleanerTask); eurekaConnCleaner.shutdown(); } if (apacheHttpClient != null) { apacheHttpClient.close(); } }
Source:
protected void beforeExecute(Thread t, Runnable r) { super.beforeExecute(t, r); mPauseLock.lock(); try { mNumPaused++; while (mIsPaused) { mUnpaused.await(); } mNumPaused--; } catch (InterruptedException e) { t.interrupt(); } finally { mPauseLock.unlock(); } }

Target:
protected void beforeExecute(Thread t, Runnable r) { super.beforeExecute(t, r); mPauseLock.lock(); try { mNumPaused++; while (mIsPaused) { mUnpaused.await(); } } catch (InterruptedException e) { t.interrupt(); } finally { mNumPaused--; mPauseLock.unlock(); } }
Source:
BitMappedTrie<T> append(T trailing) { final int newSize = length() + 1; if (length() == 0) { return new BitMappedTrie<>(asArray(trailing), offset, newSize, depthShift); } else { Object[] array = this.array; int shift = depthShift; if (isFullRight(newSize)) { array = asArray(array); shift += BRANCHING_BASE; } array = modifyLeaf(array, shift, offset + length(), COPY_LEAF, updateLeafWith(trailing)); return new BitMappedTrie<>(array, offset, newSize, shift); } }

Target:
BitMappedTrie<T> append(T trailing) { final int newSize = length() + 1; if (length() == 0) { return new BitMappedTrie<>(asArray(trailing), offset, newSize, depthShift); } else { Object[] array = this.array; int shift = depthShift; if (isFullRight(newSize)) { array = asArray(array); shift += BRANCHING_BASE; } array = modifyLeaf(array, shift, offset + length(), copyLeaf, updateLeafWith(trailing)); return new BitMappedTrie<>(array, offset, newSize, shift); } }
Source:
public List<IActivity> process(List<IActivity> activities) { if (queueRessources.isEmpty()) return activities; final List<IActivity> activitiesToExecute = new LinkedList<IActivity>(); for (IActivity activity : queueActivities) { if (isAvailable(activity)) activitiesToExecute.add(activity); else break; } for (IActivity activity : activities) { if (isAvailable(activity)) activitiesToExecute.add(activity); else queueActivities.add(activity); } return activitiesToExecute; }

Target:
public synchronized List<IActivity> process(List<IActivity> activities) { if (unavailableResources.isEmpty() && activityQueue.isEmpty()) { return activities; } List<IActivity> returnList = new LinkedList<>(); Set<SPath> resourcesInQueue = new HashSet<>(); processQueued(returnList, resourcesInQueue); processNew(returnList, resourcesInQueue, activities); return returnList; }
Source:
public void startWork() throws InterruptedException { HandleSet handleSet = new HandleSet(); ConcreteEventHandler concreteEventHandler = new ConcreteEventHandler(); Worker worker = new Worker(handleSet, workers, 1, this, concreteEventHandler); Worker worker2 = new Worker(handleSet, workers, 2, this, concreteEventHandler); Worker worker3 = new Worker(handleSet, workers, 3, this, concreteEventHandler); Worker worker4 = new Worker(handleSet, workers, 4, this, concreteEventHandler); workers.add(worker); workers.add(worker2); workers.add(worker3); workers.add(worker4); this.leader = workers.get(0); executorService.submit(worker); executorService.submit(worker2); executorService.submit(worker3); executorService.submit(worker4); Random rand = new Random(1000); handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); Thread.sleep(1000); }

Target:
public void startWork() throws InterruptedException { int i = 1; HandleSet handleSet = new HandleSet(); ConcreteEventHandler concreteEventHandler = new ConcreteEventHandler(); while (i <= 5) { Worker worker = new Worker(handleSet, workers, i, this, concreteEventHandler); workers.add(worker); i++; } this.leader = workers.get(0); executorService.submit(workers.get(0)); executorService.submit(workers.get(1)); executorService.submit(workers.get(2)); executorService.submit(workers.get(3)); Random rand = new Random(1000); int j = 0; while (j < 4) { handleSet.fireEvent(new Work(Math.abs(rand.nextInt()))); j++; } Thread.sleep(1000); }
Source:
public CreatePassword() { password = System.getProperty("htpasswd.password", ""); username = System.getProperty("htpasswd.username", ""); algorithm = System.getProperty("htpasswd.algorithm", SHA256_ALGORITHM); fileName = System.getProperty("htpasswd.file", ""); created = Boolean.getBoolean("htpasswd.created"); }

Target:
public CreatePassword() { password = System.getProperty("htpasswd.password", ""); username = System.getProperty("htpasswd.username", ""); algorithm = System.getProperty("htpasswd.algorithm", SHA256_ALGORITHM); fileName = System.getProperty("htpasswd.file", ""); overwrite = Boolean.getBoolean("htpasswd.overwrite"); }
Source:
public static boolean isTestPackageName(@Nullable String packageName) { return packageName != null && packageName.length() > GoConstants.TEST_SUFFIX.length() && packageName.endsWith(GoConstants.TEST_SUFFIX); }

Target:
public static boolean isTestPackageName(@Nullable String packageName) { return packageName != null && packageName.endsWith(GoConstants.TEST_SUFFIX); }
Source:
public void registerSpecialPathInfo( SpecialPathInfo pathInfo, final String pkgType ) { for ( Map.Entry<String, SpecialPathSet> entry : pkgtypes.entrySet() ) { if ( pkgType.equals( entry.getKey() ) ) { entry.getValue().registerSpecialPathInfo( pathInfo ); } } }

Target:
public void registerSpecialPathInfo( SpecialPathInfo pathInfo, final String pkgType ) { pkgtypes.get(pkgType).registerSpecialPathInfo( pathInfo ); }
Source:
public void addLogsInfo(long logSize, String logFilename) { LinearLayout logsLl = root.findViewById(R.id.frag_settings_logs_ll); TextView logsDesc1Tv = root.findViewById(R.id.frag_settings_logs_desc1_tv); TextView logsDesc2Tv = root.findViewById(R.id.frag_settings_logs_desc2_tv); logsDesc1Tv.setText(logFilename); logsDesc2Tv.setText("Size: " + logSize + "kB"); logsLl.setOnClickListener(view ->{ Intent i = new Intent(view.getContext() , LogsActivity.class); startActivity(i); }); }

Target:
public void addLogsInfo(long logSize, String logFilename) { LinearLayout logsLl = root.findViewById(R.id.frag_settings_logs_ll); TextView logsDesc1Tv = root.findViewById(R.id.frag_settings_logs_desc1_tv); TextView logsDesc2Tv = root.findViewById(R.id.frag_settings_logs_desc2_tv); logsDesc1Tv.setText(logFilename); logsDesc2Tv.setText(getContext().getString(R.string.settings_frag_size) + logSize + "kB"); logsLl.setOnClickListener(view ->{ Intent i = new Intent(view.getContext() , LogsActivity.class); startActivity(i); }); }
Source:
public void asyncRestTemplateConfig() { AsyncRestTemplate asyncRestTemplate = TestUtils.getPropertyValue( this.asyncRestTemplateConfig, "handler.asyncRestTemplate", AsyncRestTemplate.class); assertEquals(this.asyncRestTemplate, asyncRestTemplate); }

Target:
public void asyncRestTemplateConfig() { AsyncRestTemplate asyncRestTemplate = TestUtils.getPropertyValue( this.asyncRestTemplateConfig, "handler.asyncRestTemplate", AsyncRestTemplate.class); assertSame(this.asyncRestTemplate, asyncRestTemplate); }
Source:
public void testBlockWriting() throws IOException { Attribute.AttributeMap attributes = new Attribute.AttributeMap.DefaultAttributeMap(); attributes.put(DAG.DAGContext.APPLICATION_ID, "PartitionWriterTest"); attributes.put(DAG.DAGContext.APPLICATION_PATH, testMeta.outputPath); testMeta.context = mockOperatorContext(1, attributes); testMeta.underTest.setup(testMeta.context); int index = 0; for (int i = 0; i < FILE_CONTENTS.length; i++) { testMeta.underTest.beginWindow(i); testMeta.underTest.fileMetadataInput.process(testMeta.fileMetadatas.get(i)); for (int j = 0; j < testMeta.fileMetadatas.get(i).getNumberOfBlocks(); j++) { testMeta.underTest.input.process(testMeta.blockDataList.get(index++)); } testMeta.underTest.endWindow(); } testMeta.underTest.committed(2); testMeta.underTest.teardown(); File[] blockFileNames = testMeta.blocksDir.listFiles(); for (File blockFile : blockFileNames) { int fileIndex = Integer.parseInt(blockFile.getName().split("\\.")[0].substring(4)); int blockIndex = Integer.parseInt(blockFile.getName().split("\\.")[1].substring(4)); String expected = testMeta.blockIdToExpectedContent.get(testMeta.fileMetadatas.get(fileIndex).getBlockIds()[blockIndex - 1]); Assert.assertEquals(expected, FileUtils.readFileToString(blockFile)); } }

Target:
public void testBlockWriting() throws IOException { Attribute.AttributeMap attributes = new Attribute.AttributeMap.DefaultAttributeMap(); attributes.put(DAG.DAGContext.APPLICATION_ID, "PartitionWriterTest"); attributes.put(DAG.DAGContext.APPLICATION_PATH, testMeta.outputPath); testMeta.context = mockOperatorContext(1, attributes); testMeta.underTest.setup(testMeta.context); for (int fileIndex = 0; fileIndex < FILE_CONTENTS.length; fileIndex++) { testMeta.underTest.beginWindow(fileIndex); testMeta.underTest.fileMetadataInput.process(testMeta.fileMetadatas.get(fileIndex)); for (int blockIndex = 0; blockIndex < testMeta.fileMetadatas.get(fileIndex).getNumberOfBlocks(); blockIndex++) { testMeta.underTest.input.process(testMeta.blockDataList.get(fileIndex).get(blockIndex)); } testMeta.underTest.endWindow(); } testMeta.underTest.committed(2); testMeta.underTest.teardown(); File[] blockFileNames = testMeta.blocksDir.listFiles(); for (File blockFile : blockFileNames) { int fileIndex = Integer.parseInt(blockFile.getName().split("\\.")[0].replaceAll(FILE_NAME, "")); int blockIndex = Integer.parseInt(blockFile.getName().split("\\.")[1].replaceAll(PartFileWriter.PARTSUFFIX.substring(1), "")); String expected = testMeta.blockIdToExpectedContent.get(testMeta.fileMetadatas.get(fileIndex).getBlockIds()[blockIndex - 1]); Assert.assertEquals(expected, FileUtils.readFileToString(blockFile)); } }
Source:
public void saveSnapshot() { Session session = model.getSession(); JFileChooser chooser = new JFileChooser(model.getOptionsParam().getUserDirectory()); File fileproposal = new File(session.getSessionName()); String proposedFileName; if (session.getFileName() != null && session.getFileName().trim().length() > 0) { proposedFileName = session.getFileName().replace(".session",""); proposedFileName += "-" + dateFormat.format(new Date()) + ".session"; fileproposal = new File(proposedFileName); } chooser.setSelectedFile(fileproposal); chooser.setFileFilter(new FileFilter() { @Override public boolean accept(File file) { if (file.isDirectory()) { return true; } else if (file.isFile() && file.getName().endsWith(".session")) { return true; } return false; } @Override public String getDescription() { return Constant.messages.getString("file.format.zap.session"); } }); File file = null; int rc = chooser.showSaveDialog(view.getMainFrame()); if(rc == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); if (file == null) { return; } model.getOptionsParam().setUserDirectory(chooser.getCurrentDirectory()); String fileName = file.getAbsolutePath(); if (!fileName.endsWith(".session")) { fileName += ".session"; } try { waitMessageDialog = view.getWaitMessageDialog(Constant.messages.getString("menu.file.savingSession")); control.snapshotSession(fileName, this); log.info("snapshot as session file " + session.getFileName()); waitMessageDialog.setVisible(true); } catch (Exception e) { log.error(e.getMessage(), e); } } }

Target:
public void saveSnapshot() { Session session = model.getSession(); JFileChooser chooser = new JFileChooser(model.getOptionsParam().getUserDirectory()); File fileproposal = new File(session.getSessionName()); if (session.getFileName() != null && session.getFileName().trim().length() > 0) { String proposedFileName; proposedFileName = StringUtils.removeEnd(session.getFileName(), ".session"); proposedFileName += "-" + dateFormat.format(new Date()) + ".session"; fileproposal = new File(proposedFileName); } chooser.setSelectedFile(fileproposal); chooser.setFileFilter(new FileFilter() { @Override public boolean accept(File file) { if (file.isDirectory()) { return true; } else if (file.isFile() && file.getName().endsWith(".session")) { return true; } return false; } @Override public String getDescription() { return Constant.messages.getString("file.format.zap.session"); } }); File file = null; int rc = chooser.showSaveDialog(view.getMainFrame()); if(rc == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); if (file == null) { return; } model.getOptionsParam().setUserDirectory(chooser.getCurrentDirectory()); String fileName = file.getAbsolutePath(); if (!fileName.endsWith(".session")) { fileName += ".session"; } try { waitMessageDialog = view.getWaitMessageDialog(Constant.messages.getString("menu.file.savingSnapshot")); control.snapshotSession(fileName, this); log.info("Snapshotting: " + session.getFileName() + " as " + fileName); waitMessageDialog.setVisible(true); } catch (Exception e) { log.error(e.getMessage(), e); } } }
Source:
public void testMaxCnxnRate() throws InterruptedException { AtomicInteger connectionCounter = new AtomicInteger(0); int i = 0; ArrayList<CnxnThread> threads = new ArrayList<>(300); long start = System.nanoTime(); while (System.nanoTime() - start < TimeUnit.SECONDS.toNanos(3)) { CnxnThread thread = new CnxnThread(i++, host, port, connectionCounter); thread.start(); threads.add(thread); Thread.sleep(10); } for (CnxnThread thread : threads) { thread.join(); } assertEquals(13, connectionCounter.get(), 1); }

Target:
public void testMaxCnxnRate() throws InterruptedException { AtomicInteger connectionCounter = new AtomicInteger(0); int i = 0; List<CnxnThread> threads = new ArrayList<>(300); long start = System.nanoTime(); while (System.nanoTime() - start < TimeUnit.SECONDS.toNanos(3)) { CnxnThread thread = new CnxnThread(i++, host, port, connectionCounter); thread.start(); threads.add(thread); Thread.sleep(10); } for (CnxnThread thread : threads) { thread.join(); } assertEquals(13, connectionCounter.get(), 1); }
Source:
public Set<String> getAllDTInstantiableOperators() { TypeGraphVertex tgv = typeGraph.get(DAG.GenericOperator.class.getName()); if (tgv == null) { return null; } Set<String> result = new TreeSet<>(); for (TypeGraphVertex node : tgv.allInstantiableDescendants) { if ((isAncestor(DAG.GenericOperator.class.getName(), node.typeName) || !getAllInputPorts(node).isEmpty())) { result.add(node.typeName); } } return result; }

Target:
public Set<String> getAllDTInstantiableOperators() { TypeGraphVertex tgv = typeGraph.get(GenericOperator.class.getName()); if (tgv == null) { return null; } Set<String> result = new TreeSet<>(); for (TypeGraphVertex node : tgv.allInstantiableDescendants) { if ((isAncestor(InputOperator.class.getName(), node.typeName) || !getAllInputPorts(node).isEmpty())) { result.add(node.typeName); } } return result; }
Source:
public void storeBookmarks() { Logger.normal(this, "Attempting to save bookmarks to " + bookmarksFile.toString()); SimpleFieldSet sfs = null; synchronized(bookmarks) { if(isSavingBookmarks) return; isSavingBookmarks = true; sfs = toSimpleFieldSet(); } try (FileOutputStream fos = new FileOutputStream(backupBookmarksFile)){ sfs.writeToBigBuffer(fos); if(!FileUtil.renameTo(backupBookmarksFile, bookmarksFile)) Logger.error(this, "Unable to rename " + backupBookmarksFile.toString() + " to " + bookmarksFile.toString()); } catch(IOException ioe) { Logger.error(this, "An error has occured saving the bookmark file :" + ioe.getMessage(), ioe); } finally { synchronized(bookmarks) { isSavingBookmarks = false; } } }

Target:
public void storeBookmarks() { Logger.normal(this, "Attempting to save bookmarks to " + bookmarksFile.toString()); SimpleFieldSet sfs = null; synchronized(bookmarks) { if(isSavingBookmarks) return; isSavingBookmarks = true; sfs = toSimpleFieldSet(); } FileOutputStream fos = null; try { fos = new FileOutputStream(backupBookmarksFile); sfs.writeToBigBuffer(fos); fos.close(); fos = null; if(!FileUtil.renameTo(backupBookmarksFile, bookmarksFile)) Logger.error(this, "Unable to rename " + backupBookmarksFile.toString() + " to " + bookmarksFile.toString()); } catch(IOException ioe) { Logger.error(this, "An error has occured saving the bookmark file :" + ioe.getMessage(), ioe); } finally { Closer.close(fos); synchronized(bookmarks) { isSavingBookmarks = false; } } }
Source:
public @Nonnull String getLog() throws IOException { return IOUtils.toString(getLogReader()); }

Target:
public @Nonnull String getLog() throws IOException { try (Reader log = getLogReader()) { return IOUtils.toString(log); } }
Source:
protected void addAmbariConfigurationTable() throws SQLException { List<DBAccessor.DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, String.class, 100, null, false)); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN, String.class, 100, null, false)); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN, String.class, 4000, null, true)); dbAccessor.createTable(AMBARI_CONFIGURATION_TABLE, columns); dbAccessor.addPKConstraint(AMBARI_CONFIGURATION_TABLE, "PK_ambari_configuration", AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN); }

Target:
protected void addAmbariConfigurationTable() throws SQLException { List<DBAccessor.DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, String.class, 100, null, false)); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN, String.class, 100, null, false)); columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN, String.class, 2048, null, true)); dbAccessor.createTable(AMBARI_CONFIGURATION_TABLE, columns); dbAccessor.addPKConstraint(AMBARI_CONFIGURATION_TABLE, "PK_ambari_configuration", AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN); }
Source:
public Builder stream(InputStream stream, long objectSize, long partSize) { validateNotNull(stream, "stream"); int partCount = -1; if (partSize > 0) { if (partSize < MIN_MULTIPART_SIZE) { throw new IllegalArgumentException( "part size " + partSize + " is not supported; minimum allowed 5MiB"); } if (partSize > MAX_PART_SIZE) { throw new IllegalArgumentException( "part size " + partSize + " is not supported; maximum allowed 5GiB"); } } if (objectSize >= 0) { if (objectSize > MAX_OBJECT_SIZE) { throw new IllegalArgumentException( "object size " + objectSize + " is not supported; maximum allowed 5TiB"); } if (partSize > 0) { if (partSize > objectSize) { partSize = objectSize; } partCount = (int) Math.ceil((double) objectSize / partSize); if (partCount > MAX_MULTIPART_COUNT) { throw new IllegalArgumentException( "object size " + objectSize + " and part size " + partSize + " make more than " + MAX_MULTIPART_COUNT + "parts for upload"); } } else { double pSize = Math.ceil((double) objectSize / MAX_MULTIPART_COUNT); pSize = Math.ceil(pSize / MIN_MULTIPART_SIZE) * MIN_MULTIPART_SIZE; partSize = (long) pSize; if (pSize > 0) { partCount = (int) Math.ceil(objectSize / pSize); } else { partCount = 1; } } } else if (partSize <= 0) { throw new IllegalArgumentException( "valid part size must be provided when object size is unknown"); } final BufferedInputStream bis = (stream instanceof BufferedInputStream) ? (BufferedInputStream) stream : new BufferedInputStream(stream); final long finalPartSize = partSize; final int finalPartCount = partCount; operations.add(args -> args.stream = bis); operations.add(args -> args.objectSize = objectSize); operations.add(args -> args.partSize = finalPartSize); operations.add(args -> args.partCount = finalPartCount); return this; }

Target:
public Builder stream(InputStream stream, long objectSize, long partSize) { validateNotNull(stream, "stream"); validateSizes(objectSize, partSize); long[] partinfo = partInfo(objectSize, partSize); long pSize = partinfo[0]; int pCount = (int) partinfo[1]; validatePartCount(pCount, objectSize, partSize); final BufferedInputStream bis = (stream instanceof BufferedInputStream) ? (BufferedInputStream) stream : new BufferedInputStream(stream); return setStream(bis, objectSize, pSize, pCount); }
Source:
Layout restore(CorfuRuntime runtime, StateTransferManager transferManager) throws InterruptedException { LayoutTransferSegments layoutTransferSegments = performStateTransfer(runtime, transferManager); BaseClient baseClient = runtime.getLayoutView() .getRuntimeLayout(layoutTransferSegments.getLayout()) .getBaseClient(currentNode); mergeSegments(baseClient, runtime.getLayoutManagementView(), layoutTransferSegments); runtime.invalidateLayout(); return runtime.getLayoutView().getLayout(); }

Target:
private Layout restore(CorfuRuntime runtime, StateTransferManager transferManager) throws InterruptedException, OutrankedException { LayoutTransferSegments layoutTransferSegments = performStateTransfer(runtime, transferManager); mergeSegments(runtime.getLayoutView(), runtime.getLayoutManagementView(), layoutTransferSegments); runtime.invalidateLayout(); return runtime.getLayoutView().getLayout(); }
Source:
public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event) { final User user = ess.getUser(event.getPlayer()); if (ess.getSettings().isWorldChangeFlyResetEnabled()) { if (user.getBase().getGameMode() != GameMode.CREATIVE && !user.getBase().getGameMode().name().equals("SPECTATOR") && !user.isAuthorized("essentials.fly")) { user.getBase().setFallDistance(0f); user.getBase().setAllowFlight(false); } } if (ess.getSettings().isWorldChangeSpeedResetEnabled()) { if (!user.isAuthorized("essentials.speed")) { user.getBase().setFlySpeed(0.1f); user.getBase().setWalkSpeed(0.2f); } else { if (user.getBase().getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass")) { user.getBase().setFlySpeed((float) ess.getSettings().getMaxFlySpeed()); } else { user.getBase().setFlySpeed(user.getBase().getFlySpeed() * 0.99999f); } if (user.getBase().getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass")) { user.getBase().setWalkSpeed((float) ess.getSettings().getMaxWalkSpeed()); } else { user.getBase().setWalkSpeed(user.getBase().getWalkSpeed() * 0.99999f); } } } }

Target:
public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event) { final User user = ess.getUser(event.getPlayer()); if (ess.getSettings().isWorldChangeFlyResetEnabled()) { if (user.getBase().getGameMode() != GameMode.CREATIVE && !user.getBase().getGameMode().name().equals("SPECTATOR") && !user.isAuthorized("essentials.fly")) { user.getBase().setFallDistance(0f); user.getBase().setAllowFlight(false); } } if (ess.getSettings().isWorldChangeSpeedResetEnabled()) { if (!user.isAuthorized("essentials.speed")) { user.getBase().setFlySpeed(0.1f); user.getBase().setWalkSpeed(0.2f); } else { if (user.getBase().getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass")) { user.getBase().setFlySpeed((float) ess.getSettings().getMaxFlySpeed()); } else { user.getBase().setFlySpeed(user.getBase().getFlySpeed() * 0.99999f); } if (user.getBase().getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass")) { user.getBase().setWalkSpeed((float) ess.getSettings().getMaxWalkSpeed()); } } } }
Source:
TrampolineEval<A> asTrampoline() { return this; }

Target:
final TrampolineEval<A> asTrampoline() { return this; }
Source:
protected void encode(ChannelHandlerContext ctx, HAProxyMessage msg, ByteBuf out) throws Exception { if (msg.protocolVersion() == HAProxyProtocolVersion.V1) { encodeV1(msg, out); } else if (msg.protocolVersion() == HAProxyProtocolVersion.V2) { encodeV2(msg, out); } else { throw new HAProxyProtocolException("Unsupported version: " + msg.protocolVersion()); } }

Target:
protected void encode(ChannelHandlerContext ctx, HAProxyMessage msg, ByteBuf out) throws Exception { switch (msg.protocolVersion()) { case V1: encodeV1(msg, out); break; case V2: encodeV2(msg, out); break; default: throw new HAProxyProtocolException("Unsupported version: " + msg.protocolVersion()); } }
Source:
private Collection<DroolsAbstractConstraintStream<Solution_>> assembleAllStreams( DroolsAbstractConstraintStream<Solution_> parent) { final Set<DroolsAbstractConstraintStream<Solution_>> streams = new LinkedHashSet<>(); streams.add(parent); for (DroolsAbstractConstraintStream<Solution_> child: parent.getChildStreams()) { streams.addAll(assembleAllStreams(child)); } return streams; }

Target:
private Collection<DroolsAbstractConstraintStream<Solution_>> assembleAllStreams( DroolsAbstractConstraintStream<Solution_> parent) { final Set<DroolsAbstractConstraintStream<Solution_>> streamSet = new LinkedHashSet<>(); streamSet.add(parent); for (DroolsAbstractConstraintStream<Solution_> child : parent.getChildStreams()) { streamSet.addAll(assembleAllStreams(child)); } return streamSet; }
Source:
private void setTextProperty(String text) { savedText = text; if (getPropertyValue(PROPERTY_NAME_HTMLFORMAT).equals("True")) { String sanitizedText = SimpleHtmlSanitizer.sanitizeHtml(text).asString(); labelWidget.setHTML( (sanitizedText == null) ? sanitizedText : sanitizedText.replaceAll("\\\\n", "<br>") ); } else { labelWidget.setText( (text == null) ? text : text.replaceAll("\\\\n", "<br>") ); } }

Target:
private void setTextProperty(String text) { savedText = text; if (getPropertyValue(PROPERTY_NAME_HTMLFORMAT).equals("True")) { String sanitizedText = SimpleHtmlSanitizer.sanitizeHtml(text).asString(); if (sanitizedText != null) { sanitizedText = sanitizedText.replaceAll("\\\\n", " "); } labelWidget.setHTML(sanitizedText); } else { labelWidget.setHTML(text.replaceAll("&", "&amp;").replaceAll("<", "&lt;") .replaceAll(">", "&gt;").replaceAll("\\\\n", "<br>") ); } }
Source:
public Disks list() { if (isFiltered()) { return mapCollection(getBackendCollection(VdcQueryType.GetAllDisksByUserId, new VdcQueryParametersBase())); } else { return mapCollection(getBackendCollection(SearchType.Disk)); } }

Target:
public Disks list() { if (isFiltered()) { return mapCollection(getBackendCollection(VdcQueryType.GetAllDisks, new VdcQueryParametersBase())); } else { return mapCollection(getBackendCollection(SearchType.Disk)); } }
Source:
private static String removeTrailingZeroForNumber(String value, String type) { if (type == null || type.toUpperCase().equals("FLOAT") || type.toUpperCase().equals("DOUBLE") || type.toUpperCase().equals("BIGINT")) { if (value.endsWith(".0")) { return value.substring(0, value.length() - 2); } } return value; }

Target:
private static String removeTrailingZeroForNumber(String value, String type) { if (type == null || type.toUpperCase().equals("FLOAT") || type.toUpperCase().equals("DOUBLE") || type.toUpperCase().equals("BIGINT")) { try { return (new BigDecimal(value)).stripTrailingZeros().toPlainString(); } catch (NumberFormatException e) { } } return value; }
Source:
public void serialization() { XStream2 xs = new XStream2(); TestData td = new TestData(); String out = xs.toXML(td); String expected = "<hudson.util.CopyOnWriteListTest_-TestData>" + "<list1/><list2/></hudson.util.CopyOnWriteListTest_-TestData>"; assertThat(expected, CompareMatcher.isSimilarTo(out).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); TestData td2 = (TestData)xs.fromXML(out); assertTrue(td2.list1.isEmpty()); assertTrue(td2.list2.isEmpty()); td.list1.add("foobar1"); td.list2.add("foobar2"); out = xs.toXML(td); expected = "<hudson.util.CopyOnWriteListTest_-TestData>" + "<list1><string>foobar1</string></list1><list2><string>foobar2" + "</string></list2></hudson.util.CopyOnWriteListTest_-TestData>"; assertThat(expected, CompareMatcher.isSimilarTo(out).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); td2 = (TestData)xs.fromXML(out); assertEquals("foobar1", td2.list1.getView().get(0)); assertEquals("foobar2", td2.list2.get(0)); }

Target:
public void serialization() { XStream2 xs = new XStream2(); TestData td = new TestData(); String out = xs.toXML(td); String expected = "<hudson.util.CopyOnWriteListTest_-TestData>" + "<list1/><list2/></hudson.util.CopyOnWriteListTest_-TestData>"; assertThat(out, isSimilarTo(expected).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); TestData td2 = (TestData)xs.fromXML(out); assertTrue(td2.list1.isEmpty()); assertTrue(td2.list2.isEmpty()); td.list1.add("foobar1"); td.list2.add("foobar2"); out = xs.toXML(td); expected = "<hudson.util.CopyOnWriteListTest_-TestData>" + "<list1><string>foobar1</string></list1><list2><string>foobar2" + "</string></list2></hudson.util.CopyOnWriteListTest_-TestData>"; assertThat(out, isSimilarTo(expected).ignoreWhitespace() .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))); td2 = (TestData)xs.fromXML(out); assertEquals("foobar1", td2.list1.getView().get(0)); assertEquals("foobar2", td2.list2.get(0)); }
Source:
public BoostLockedRegionPriority() { final JNodeLookup lookup = Jack.getSession().getLookup(); try { String className = ThreadConfig.get(BOOST_LOCK_CLASSNAME); String boostMethod = ThreadConfig.get(BOOST_LOCK_REQUEST_METHOD); String resetMethod = ThreadConfig.get(BOOST_LOCK_RESET_METHOD); if (className.isEmpty() || boostMethod.isEmpty() || resetMethod.isEmpty()) { return; } ams = lookup.getClass(className); throwable = lookup.getClass("Ljava/lang/Throwable;"); boostMethodId = ams.getMethodIdWide( boostMethod, Collections.<JType>emptyList(), MethodKind.STATIC); resetMethodId = ams.getMethodIdWide( resetMethod, Collections.<JType>emptyList(), MethodKind.STATIC); } catch (IncompatibleJTypeLookupException notFound) { return; } catch (JMethodLookupException notFound) { return; } }

Target:
public BoostLockedRegionPriority() { String className = ThreadConfig.get(Optimizations.BoostLockedRegionPriorityFeature.BOOST_LOCK_CLASSNAME); String lockTypeSig = NamingTools.getTypeSignatureName(className); String boostMethod = ThreadConfig.get(Optimizations.BoostLockedRegionPriorityFeature.BOOST_LOCK_REQUEST_METHOD); String resetMethod = ThreadConfig.get(Optimizations.BoostLockedRegionPriorityFeature.BOOST_LOCK_RESET_METHOD); final JNodeLookup lookup = Jack.getSession().getLookup(); try { if (lockTypeSig.isEmpty() || boostMethod.isEmpty() || resetMethod.isEmpty()) { return; } boostClass = lookup.getClass(lockTypeSig); throwable = lookup.getClass("Ljava/lang/Throwable;"); boostMethodId = boostClass.getMethodIdWide(boostMethod, Collections.<JType>emptyList(), MethodKind.STATIC); resetMethodId = boostClass.getMethodIdWide(resetMethod, Collections.<JType>emptyList(), MethodKind.STATIC); } catch (IncompatibleJTypeLookupException e) { Jack.getSession().getReporter().report(Severity.FATAL, new BadBoostLockedRegionPriorityConfigurationException(e)); Jack.getSession().abortEventually(); } catch (JMethodLookupException e) { Jack.getSession().getReporter().report(Severity.FATAL, new BadBoostLockedRegionPriorityConfigurationException(e)); Jack.getSession().abortEventually(); } }
Source:
public OutputStream getOutputStream() { outputStream = provider.getOutputStream(); if (outputStream != null) { outputStream = new FilterOutputStream(outputStream) { @Override public void write(byte[] b) throws IOException { if (logToStderr) { System.err.println("LSP4E to " + id + ":" + new String(b)); } if (logToFile) { log("\nLSP4E to " + id + ":" + new String(b)); } super.write(b); } }; } return outputStream; }

Target:
public OutputStream getOutputStream() { if (outputStream != null) { return outputStream; } if (provider.getOutputStream() != null) { outputStream = new FilterOutputStream(provider.getOutputStream()) { @Override public void write(byte[] b) throws IOException { if (logToStderr) { System.err.println("LSP4E to " + id + ":" + new String(b)); } if (logToFile) { log("\nLSP4E to " + id + ":" + new String(b)); } super.write(b); } }; } return outputStream; }
Source:
private void createIndexReport(GraphContext context) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel report = applicationReportService.create(); report.setReportPriority(1); report.setReportIconClass("glyphicon glyphicon-home"); report.setReportName(APPLICATION_LIST_REPORT); report.setTemplatePath(TEMPLATE_PATH); report.setTemplateType(TemplateType.FREEMARKER); report.setDisplayInApplicationReportIndex(false); report.setReportFilename(OUTPUT_FILENAME); GraphService<WindupVertexListModel> listService = new GraphService<>(context, WindupVertexListModel.class); WindupVertexListModel<ApplicationReportModel> applications = listService.create(); Map<String, WindupVertexFrame> relatedData = new HashMap<>(); for (ApplicationReportModel applicationReportModel : applicationReportService.findAll()) { if (applicationReportModel.isMainApplicationReport() != null && applicationReportModel.isMainApplicationReport()) { applications.addItem(applicationReportModel); if (ProjectService.SHARED_LIBS_UNIQUE_ID.equals(applicationReportModel.getProjectModel().getUniqueID())) relatedData.put("sharedLibsExists", applicationReportModel); } } relatedData.put("applications", applications); report.setRelatedResource(relatedData); }

Target:
private void createIndexReport(GraphContext context) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel report = applicationReportService.create(); report.setReportPriority(1); report.setReportIconClass("glyphicon glyphicon-home"); report.setReportName(APPLICATION_LIST_REPORT); report.setTemplatePath(TEMPLATE_PATH); report.setTemplateType(TemplateType.FREEMARKER); report.setDisplayInApplicationReportIndex(false); report.setReportFilename(OUTPUT_FILENAME); GraphService<WindupVertexListModel> listService = new GraphService<>(context, WindupVertexListModel.class); WindupVertexListModel<ApplicationReportModel> applications = listService.create(); Map<String, WindupVertexFrame> relatedData = new HashMap<>(); for (ApplicationReportModel applicationReportModel : applicationReportService.findAll()) { if (applicationReportModel.isMainApplicationReport() != null && applicationReportModel.isMainApplicationReport()) { applications.addItem(applicationReportModel); if (ProjectService.SHARED_LIBS_UNIQUE_ID.equals(applicationReportModel.getProjectModel().getUniqueID())) relatedData.put("sharedLibsApplicationReport", applicationReportModel); } } relatedData.put("applications", applications); report.setRelatedResource(relatedData); }
Source:
public MaxwellKafkaProducerWorker(MaxwellContext context, String kafkaTopic, ArrayBlockingQueue<RowMap> queue, Producer<String,String> producer) { super(context); if ( kafkaTopic == null ) { this.topic = "maxwell"; } else { this.topic = kafkaTopic; } this.interpolateTopic = this.topic.contains("%{"); this.kafka = producer; String hash = context.getConfig().kafkaPartitionHash; String partitionKey = context.getConfig().producerPartitionKey; String partitionColumns = context.getConfig().producerPartitionColumns; String partitionFallback = context.getConfig().producerPartitionFallback; this.partitioner = new MaxwellKafkaPartitioner(hash, partitionKey, partitionColumns, partitionFallback); this.ddlPartitioner = makeDDLPartitioner(hash, partitionKey); this.ddlTopic = context.getConfig().ddlKafkaTopic; this.deadLetterTopic = context.getConfig().deadLetterTopic; this.deadLetterQueue = this.deadLetterTopic == null ? null : new ConcurrentLinkedQueue<>(); if ( context.getConfig().kafkaKeyFormat.equals("hash") ) keyFormat = KeyFormat.HASH; else keyFormat = KeyFormat.ARRAY; this.queue = queue; this.taskState = new StoppableTaskState("MaxwellKafkaProducerWorker"); }

Target:
public MaxwellKafkaProducerWorker(MaxwellContext context, String kafkaTopic, ArrayBlockingQueue<RowMap> queue, Producer<String,String> producer) { super(context); if ( kafkaTopic == null ) { this.topic = "maxwell"; } else { this.topic = kafkaTopic; } this.interpolateTopic = this.topic.contains("%{"); this.kafka = producer; String hash = context.getConfig().kafkaPartitionHash; String partitionKey = context.getConfig().producerPartitionKey; String partitionColumns = context.getConfig().producerPartitionColumns; String partitionFallback = context.getConfig().producerPartitionFallback; this.partitioner = new MaxwellKafkaPartitioner(hash, partitionKey, partitionColumns, partitionFallback); this.ddlPartitioner = makeDDLPartitioner(hash, partitionKey); this.ddlTopic = context.getConfig().ddlKafkaTopic; this.deadLetterTopic = context.getConfig().deadLetterTopic; this.deadLetterQueue = new ConcurrentLinkedQueue<>(); if ( context.getConfig().kafkaKeyFormat.equals("hash") ) keyFormat = KeyFormat.HASH; else keyFormat = KeyFormat.ARRAY; this.queue = queue; this.taskState = new StoppableTaskState("MaxwellKafkaProducerWorker"); }
Source:
public PayeeACHAccount createPayeeAchAccount(PaymentWorksVendorUpdatesDTO vendorUpdate, String vendorNumber) { PayeeACHAccount payeeAchAccount = new PayeeACHAccount(); Map<String, String> fieldChanges = new PaymentWorksUtil().convertFieldArrayToMap(vendorUpdate.getField_changes()); payeeAchAccount.setPayeeIdentifierTypeCode(PdpConstants.PayeeIdTypeCodes.VENDOR_ID); payeeAchAccount.setPayeeIdNumber(vendorNumber); payeeAchAccount.setBankRoutingNumber(fieldChanges.get("Routing num")); payeeAchAccount.setBankAccountNumber(fieldChanges.get("Acct num")); payeeAchAccount.setBankAccountTypeCode(PdpConstants.ACH_TRANSACTION_TYPE_DEFAULT); payeeAchAccount.setAchTransactionType(PdpConstants.DisbursementTypeCodes.ACH); payeeAchAccount.setActive(true); payeeAchAccount.setLastUpdateUserId(PaymentWorksConstants.SOURCE_USER); payeeAchAccount.setLastUpdate(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp()); return payeeAchAccount; }

Target:
public PayeeACHAccount createPayeeAchAccount(PaymentWorksVendorUpdatesDTO vendorUpdate, String vendorNumber) { PayeeACHAccount payeeAchAccount = new PayeeACHAccount(); Map<String, String> fieldChanges = getPaymentWorksUtilityService().convertFieldArrayToMap(vendorUpdate.getField_changes()); payeeAchAccount.setPayeeIdentifierTypeCode(PdpConstants.PayeeIdTypeCodes.VENDOR_ID); payeeAchAccount.setPayeeIdNumber(vendorNumber); payeeAchAccount.setBankRoutingNumber(fieldChanges.get(PaymentWorksConstants.FieldNames.ROUTING_NUMBER)); payeeAchAccount.setBankAccountNumber(fieldChanges.get(PaymentWorksConstants.FieldNames.ACCOUNT_NUMBER)); payeeAchAccount.setBankAccountTypeCode(PdpConstants.ACH_TRANSACTION_TYPE_DEFAULT); payeeAchAccount.setAchTransactionType(PdpConstants.DisbursementTypeCodes.ACH); payeeAchAccount.setActive(true); payeeAchAccount.setLastUpdateUserId(PaymentWorksConstants.SOURCE_USER); payeeAchAccount.setLastUpdate(SpringContext.getBean(DateTimeService.class).getCurrentTimestamp()); return payeeAchAccount; }
Source:
public CompassTargetData getCustomNeedle(String pOreDictName) { CompassTargetData needle = null; if (pOreDictName != null){ for (CompassTargetData entry : customNeedles.keySet()) { if (entry.getOreDictName().equals(pOreDictName)) { needle = entry; break; } } } return needle; }

Target:
public CompassTargetData getCustomNeedle(String pOreDictName) { CompassTargetData needle = null; if (pOreDictName != null){ for (CompassTargetData entry : customNeedles.keySet()) { if (pOreDictName.equals(entry.getOreDictName())) { needle = entry; break; } } } return needle; }
Source:
public T call(ConfigBag parameters) { String baseUri = Preconditions.checkNotNull(entity().getConfig(MIRRORED_ENTITY_URL), "Cannot be invoked without an entity URL"); HttpClientBuilder builder = HttpTool.httpClientBuilder() .trustAll() .laxRedirect(true) .uri(baseUri); if (entity().getConfig(MANAGEMENT_USER)!=null) builder.credentials(new UsernamePasswordCredentials(entity().getConfig(MANAGEMENT_USER), entity().getConfig(MANAGEMENT_PASSWORD))); HttpClient client = builder.build(); byte[] result = submit(client, URI.create(Urls.mergePaths(baseUri, "effectors/"+remoteEffectorName)), parameters.getAllConfig()); if (resultParser!=null) return resultParser.apply(result); else return null; }

Target:
public T call(ConfigBag parameters) { String baseUri = Preconditions.checkNotNull(entity().getConfig(MIRRORED_ENTITY_URL), "Cannot be invoked without an entity URL"); HttpClientBuilder builder = HttpTool.httpClientBuilder() .trustAll() .laxRedirect(true) .uri(baseUri); if (entity().getConfig(MANAGEMENT_USER)!=null) builder.credentials(new UsernamePasswordCredentials(entity().getConfig(MANAGEMENT_USER), entity().getConfig(MANAGEMENT_PASSWORD))); HttpClient client = builder.build(); byte[] result = submit(client, URI.create(Urls.mergePaths(baseUri, "effectors", Urls.encode(remoteEffectorName))), parameters.getAllConfig()); if (resultParser!=null) return resultParser.apply(result); else return null; }
Source:
public String poll(long timeout, TimeUnit unit) throws InterruptedException { if (slow.get()) { Thread.sleep(300); } return super.poll(timeout, unit); }

Target:
public String poll(long timeout, TimeUnit unit) throws InterruptedException { lock = true; countDownLatch.await(1, TimeUnit.MINUTES); lock = false; return super.poll(timeout, unit); }
Source:
@Override protected void run(JsonNode jsonNode) { String cacheName = jsonNode.get(PARAM_CACHE_NAME).asText(); boolean infinite = jsonNode.hasNonNull(PARAM_INFINITE) && jsonNode.get(PARAM_INFINITE).asBoolean(); boolean optimized = !jsonNode.hasNonNull(PARAM_OPTIMIZED) || jsonNode.get(PARAM_OPTIMIZED).asBoolean(); int range = jsonNode.get(PARAM_RANGE).asInt(); if (infinite) { Random rnd = new Random(); CountDownLatch exitLatch = new CountDownLatch(1); Thread th = new Thread(() -> { log.info(WATCHEABLE_BEGIN_DATA_GEN_MSG); boolean error = false; try { while (!terminated()) generateData(cacheName, range, (idx) -> rnd.nextInt(range), optimized); log.info("Background data generation finished."); } catch (Exception e) { if (!X.hasCause(e, NodeStoppingException.class)) { error = true; log.error("Failed to generate data in background.", e); } } finally { if (error) markBroken(); else markFinished(); exitLatch.countDown(); } }, DataGenerationApplication.class.getName() + "_cacheLoader"); th.start(); markInitialized(); try { exitLatch.await(); } catch (InterruptedException e) { log.warn("Interrupted waiting for background loading."); } } else { log.info("Generating data..."); generateData(cacheName, range, Function.identity(), optimized); log.info("Data generation finished. Generated " + range + " entries."); markSyncExecutionComplete(); } }

Target:
@Override protected void run(JsonNode jsonNode) { log.info("Creating cache..."); IgniteCache<Integer, Integer> cache = ignite.createCache(jsonNode.get("cacheName").asText()); try (IgniteDataStreamer<Integer, Integer> stmr = ignite.dataStreamer(cache.getName())) { for (int i = 0; i < jsonNode.get("range").asInt(); i++) { stmr.addData(i, i); if (i % 10_000 == 0) log.info("Streamed " + i + " entries"); } } markSyncExecutionComplete(); }
Source:
public List<String> getChildren(final String path, final boolean watch) throws KeeperException, InterruptedException { checkPaginatedGetChildren(); try { @SuppressWarnings("unchecked") List<String> children = (List<String>) (_isPaginationSupported ? _getChildrenMethod.invoke(_zk, path, watch, -1, -1, -1) : _getChildrenMethod.invoke(_zk, path, watch)); return children; } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof KeeperException.UnimplementedException) { LOG.warn("Paginated getChildren is unimplemented in ZK server! " + "Falling back to non-paginated getChildren"); _isPaginationSupported = false; try { _getChildrenMethod = ZooKeeper.class.getMethod("getChildren", String.class, boolean.class); } catch (NoSuchMethodException ex) { LOG.error("getChildren is not supported in this zookeeper version!", cause); } throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS); } if (cause instanceof KeeperException) { throw KeeperException.create(((KeeperException) cause).code(), path); } throw KeeperException.create(KeeperException.Code.APIERROR, path); } catch (IllegalAccessException e) { LOG.error("Unable to get children for {}", path, e); throw KeeperException.create(KeeperException.Code.APIERROR, path); } }

Target:
public List<String> getChildren(final String path, final boolean watch) throws KeeperException, InterruptedException { if (_getChildrenMethod == null) { lookupGetChildrenMethod(); } try { @SuppressWarnings("unchecked") List<String> children = (List<String>) _getChildrenMethod.invoke(_zk, path, watch); return children; } catch (InvocationTargetException e) { handleInvokedMethodException(e.getCause()); } catch (IllegalAccessException e) { LOG.error("Unable to get children for {}", path, e); } throw KeeperException.create(KeeperException.Code.APIERROR, path); }
Source:
public final IJSRuntimeInstall createRuntimeInstall(String id) { if (JSRuntimeManager.getJSRuntimeInstall(id) != null) { throw new IllegalArgumentException( NLS.bind(RuntimeMessages.AbstractJSRuntimeType_DuplicateRuntimeInstall_Error, new String[] { id })); } IJSRuntimeInstall runtimeInstall = null; synchronized (this) { runtimeInstall = doCreateRuntimeInstall(id); } return runtimeInstall; }

Target:
public final IJSRuntimeInstall createRuntimeInstall(String id) { if (JSRuntimeManager.getJSRuntimeInstall(id) != null) { throw new IllegalArgumentException( NLS.bind(RuntimeMessages.AbstractJSRuntimeType_DuplicateRuntimeInstall_Error, id)); } IJSRuntimeInstall runtimeInstall = null; runtimeInstall = doCreateRuntimeInstall(id); return runtimeInstall; }
Source:
public void setMode(Mode newMode) { try { switch (newMode) { case BATCH_EDIT: dbConnection.setConnectionMode(true, false); break; case READ_ONLY: dbConnection.setConnectionMode(false, true); break; case READ_WRITE: dbConnection.setConnectionMode(false, false); break; default: log.warn("New context mode detected that has nog been configured."); break; } } catch(SQLException ex) { log.warn("Unable to set database connection mode", ex); } this.mode = newMode; }

Target:
public void setMode(Mode newMode) { try { switch (newMode) { case BATCH_EDIT: dbConnection.setConnectionMode(true, false); break; case READ_ONLY: dbConnection.setConnectionMode(false, true); break; case READ_WRITE: dbConnection.setConnectionMode(false, false); break; default: log.warn("New context mode detected that has nog been configured."); break; } } catch(SQLException ex) { log.warn("Unable to set database connection mode", ex); } if(mode != Mode.READ_ONLY || newMode != Mode.READ_ONLY) { readOnlyCache.clear(); } mode = newMode; }