auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void close(Duration timeout) { long waitTimeMs = timeout.toMillis(); if (waitTimeMs < 0) throw new IllegalArgumentException("The timeout cannot be negative."); waitTimeMs = Math.min(TimeUnit.DAYS.toMillis(365), waitTimeMs); long now = time.milliseconds(); long newHardShutdownTimeMs = now + waitTimeMs; long prev = INVALID_SHUTDOWN_TIME; while (true) { if (hardShutdownTimeMs.compareAndSet(prev, newHardShutdownTimeMs)) { if (prev == INVALID_SHUTDOWN_TIME) { log.debug("Initiating close operation."); } else { log.debug("Moving hard shutdown time forward."); } client.wakeup(); break; } prev = hardShutdownTimeMs.get(); if (prev < newHardShutdownTimeMs) { log.debug("Hard shutdown time is already earlier than requested."); newHardShutdownTimeMs = prev; break; } } if (log.isDebugEnabled()) { long deltaMs = Math.max(0, newHardShutdownTimeMs - time.milliseconds()); log.debug("Waiting for the I/O thread to exit. Hard shutdown in ms.", deltaMs); } try { if (Thread.currentThread() != thread) { thread.join(); } log.debug("Kafka admin client closed."); } catch (InterruptedException e) { log.debug("Interrupted while joining I/O thread", e); Thread.currentThread().interrupt(); } }

Target:
public void close(Duration timeout) { long waitTimeMs = timeout.toMillis(); if (waitTimeMs < 0) throw new IllegalArgumentException("The timeout cannot be negative."); waitTimeMs = Math.min(TimeUnit.DAYS.toMillis(365), waitTimeMs); long now = time.milliseconds(); long newHardShutdownTimeMs = now + waitTimeMs; long prev = INVALID_SHUTDOWN_TIME; while (true) { if (hardShutdownTimeMs.compareAndSet(prev, newHardShutdownTimeMs)) { if (prev == INVALID_SHUTDOWN_TIME) { log.debug("Initiating close operation."); } else { log.debug("Moving hard shutdown time forward."); } client.wakeup(); break; } prev = hardShutdownTimeMs.get(); if (prev < newHardShutdownTimeMs) { log.debug("Hard shutdown time is already earlier than requested."); newHardShutdownTimeMs = prev; break; } } if (log.isDebugEnabled()) { long deltaMs = Math.max(0, newHardShutdownTimeMs - time.milliseconds()); log.debug("Waiting for the I/O thread to exit. Hard shutdown in ms.", deltaMs); } try { if (Thread.currentThread() != thread) { thread.join(waitTimeMs); } log.debug("Kafka admin client closed."); } catch (InterruptedException e) { log.debug("Interrupted while joining I/O thread", e); Thread.currentThread().interrupt(); } }
Source:
public Map<String, Object> getProperties() { return UnmodifiableMap.decorate(properties); }

Target:
public Map<String, Object> getProperties() { return Collections.unmodifiableMap(properties); }
Source:
public MissingOverride() { this.ignoreInterfaceOverrides = false; }

Target:
public MissingOverride() { this(ErrorProneFlags.empty()); }
Source:
public synchronized void createIndexes( IndexRule... rules ) throws IOException { IndexMap indexMap = indexMapRef.indexMapSnapshot(); IndexPopulationJob populationJob = null; for ( IndexRule rule : rules ) { long ruleId = rule.getId(); IndexProxy index = indexMap.getIndexProxy( ruleId ); if ( index != null && state == State.NOT_STARTED ) { indexMap.putIndexProxy( ruleId, index ); indexMapRef.setIndexMap( indexMap ); continue; } final IndexDescriptor descriptor = rule.getIndexDescriptor(); SchemaIndexProvider.Descriptor providerDescriptor = rule.getProviderDescriptor(); boolean flipToTentative = rule.canSupportUniqueConstraint(); if ( state == State.RUNNING ) { populationJob = populationJob == null ? newIndexPopulationJob() : populationJob; index = indexProxyCreator.createPopulatingIndexProxy( ruleId, descriptor, providerDescriptor, flipToTentative, monitor, populationJob ); index.start(); } else { index = indexProxyCreator.createRecoveringIndexProxy( descriptor, providerDescriptor ); } indexMap.putIndexProxy( rule.getId(), index ); } if ( populationJob != null ) { startIndexPopulation( populationJob ); } indexMapRef.setIndexMap( indexMap ); }

Target:
public void createIndexes( IndexRule... rules ) throws IOException { indexMapRef.modify( indexMap -> { IndexPopulationJob populationJob = null; for ( IndexRule rule : rules ) { long ruleId = rule.getId(); IndexProxy index = indexMap.getIndexProxy( ruleId ); if ( index != null && state == State.NOT_STARTED ) { indexMap.putIndexProxy( ruleId, index ); continue; } final IndexDescriptor descriptor = rule.getIndexDescriptor(); SchemaIndexProvider.Descriptor providerDescriptor = rule.getProviderDescriptor(); boolean flipToTentative = rule.canSupportUniqueConstraint(); if ( state == State.RUNNING ) { populationJob = populationJob == null ? newIndexPopulationJob() : populationJob; index = indexProxyCreator.createPopulatingIndexProxy( ruleId, descriptor, providerDescriptor, flipToTentative, monitor, populationJob ); index.start(); } else { index = indexProxyCreator.createRecoveringIndexProxy( descriptor, providerDescriptor ); } indexMap.putIndexProxy( rule.getId(), index ); } if ( populationJob != null ) { startIndexPopulation( populationJob ); } return indexMap; } ); }
Source:
protected void run() throws Exception { LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote); TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() { public int compare(Ref r1, Ref r2) { return r1.getName().compareTo(r2.getName()); } }); refs.addAll(command.call()); for (final Ref r : refs) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) show(r.getPeeledObjectId(), r.getName() + "^{}"); } }

Target:
protected void run() throws Exception { LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) .setTimeout(timeout); TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() { public int compare(Ref r1, Ref r2) { return r1.getName().compareTo(r2.getName()); } }); refs.addAll(command.call()); for (final Ref r : refs) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) show(r.getPeeledObjectId(), r.getName() + "^{}"); } }
Source:
public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.info(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (StreamBlock.HEADER_SIZE * m_reader.getNumObjects()))); } }

Target:
public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.debug(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); } }
Source:
private void init() { setTitle(ConstantsManager.getInstance().getConstants().editLogicalNetworkTitle()); setHelpTag(HelpTag.edit_logical_network); setHashName("edit_logical_network"); getName().setEntity(getNetwork().getName()); if (isManagemet()) { getName().setIsChangable(false); } getDescription().setEntity(getNetwork().getDescription()); getComment().setEntity(getNetwork().getComment()); getIsStpEnabled().setEntity(getNetwork().getStp()); getHasVLanTag().setEntity(getNetwork().getVlanId() != null); getVLanTag().setEntity((getNetwork().getVlanId() == null ? Integer.valueOf(0) : getNetwork().getVlanId())); initIsVm(); getExport().setEntity(getNetwork().isExternal()); getExport().setIsChangable(false); initMtu(); getExternalProviders().setIsChangable(false); getNetworkLabel().setSelectedItem(getNetwork().getLabel()); toggleProfilesAvailability(); }

Target:
private void init() { setTitle(ConstantsManager.getInstance().getConstants().editLogicalNetworkTitle()); setHelpTag(HelpTag.edit_logical_network); setHashName("edit_logical_network"); getName().setEntity(getNetwork().getName()); if (isManagemet()) { getName().setIsChangable(false); } getDescription().setEntity(getNetwork().getDescription()); getComment().setEntity(getNetwork().getComment()); getIsStpEnabled().setEntity(getNetwork().getStp()); getHasVLanTag().setEntity(getNetwork().getVlanId() != null); getVLanTag().setEntity((getNetwork().getVlanId() == null ? Integer.valueOf(0) : getNetwork().getVlanId())); initMtu(); initIsVm(); getExport().setEntity(getNetwork().isExternal()); getExport().setIsChangable(false); getExternalProviders().setIsChangable(false); getNetworkLabel().setSelectedItem(getNetwork().getLabel()); toggleProfilesAvailability(); }
Source:
public static List<Range> getCDSExonRanges(GeneChromosomePosition chromPos){ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CDS); return getCDSExonRangesReverse(chromPos,CDS); }

Target:
public static List<Range<Integer>> getCDSExonRanges(GeneChromosomePosition chromPos){ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CDS); return getCDSExonRangesReverse(chromPos,CDS); }
Source:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); final Layout layout = getLayout(); if (layout != null) { final int lineCount = layout.getLineCount(); if (lineCount == mMaxLines) { if (layout.getEllipsisCount(lineCount - 1) > 0 && getTextSize() > mMinTextSizePx) { final float textSize = getTextSize(); setTextSize(TypedValue.COMPLEX_UNIT_PX, (textSize - 2)); measure(widthMeasureSpec, heightMeasureSpec); } } } }

Target:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); final Layout layout = getLayout(); if (layout != null) { final int lineCount = layout.getLineCount(); if (lineCount == MAX_LINES && layout.getEllipsisCount(lineCount - 1) > 0 && getTextSize() > mMinTextSizePx) { final float textSize = getTextSize(); setTextSize(TypedValue.COMPLEX_UNIT_PX, (textSize - 2)); measure(widthMeasureSpec, heightMeasureSpec); } } }
Source:
public void setWinner(Team winner) { this.nextGame.removeTeam(this.winner); this.winner = winner; this.nextGame.addTeam(this.winner); }

Target:
public void setWinner(Team winner) { this.nextGame.removeTeam(this.winner); this.winner = winner; this.nextGame.addTeam(winner); }
Source:
static void setExceptionHandler(Runnable runnable) { Thread.UncaughtExceptionHandler exceptionHandler = (t, e) -> { log.error(String.format("Uncaught exception in thread (name=%s). Exiting process now.", t.getName(), e)); e.printStackTrace(System.err); runnable.run(); }; Thread.setDefaultUncaughtExceptionHandler(exceptionHandler); }

Target:
static void setExceptionHandler(Runnable runnable) { Thread.UncaughtExceptionHandler exceptionHandler = (t, e) -> { log.error(String.format("Uncaught exception in thread (name=%s).", t.getName(), e)); e.printStackTrace(System.err); runnable.run(); }; Thread.setDefaultUncaughtExceptionHandler(exceptionHandler); }
Source:
protected void run() throws UnloggedFailure { if (!loader.isRemoteInstallEnabled()) { throw die("remote installation is disabled"); } if (names != null && !names.isEmpty()) { loader.disablePlugins(Sets.newHashSet(names)); } }

Target:
protected void run() throws UnloggedFailure { if (!loader.isRemoteInstallEnabled()) { throw die("remote plugin administration is disabled"); } if (names != null && !names.isEmpty()) { loader.disablePlugins(Sets.newHashSet(names)); } }
Source:
private int getNumberOfCommas(ExpressionTree expression) { int ret = 0; if (expression.is(Kind.COMMA_OPERATOR)) { BinaryExpressionTree binaryExpression = (BinaryExpressionTree) expression; ret = getNumberOfCommas(binaryExpression.leftOperand()) + 1; } return ret; }

Target:
private int getNumberOfCommas(ExpressionTree expression) { int nbCommas = 0; if (expression.is(Kind.COMMA_OPERATOR)) { BinaryExpressionTree binaryExpression = (BinaryExpressionTree) expression; nbCommas = getNumberOfCommas(binaryExpression.leftOperand()) + 1; } return nbCommas; }
Source:
private boolean isMvccRecoveryMessageRequired() { ClusterNode mvccCrdNode = null; if (mvccCrd != null && mvccCrd.nodeId() != null) mvccCrdNode = cctx.node(mvccCrd.nodeId()); return node.isClient() && mvccCrdNode != null && (cctx.kernalContext().coordinators().mvccEnabled() || !IgniteFeatures.nodeSupports(mvccCrdNode, IgniteFeatures.MVCC_TX_RECOVERY_PROTOCOL_V2)); }

Target:
private boolean isMvccRecoveryMessageRequired() { ClusterNode mvccCrdNode = null; if (mvccCrd != null && mvccCrd.nodeId() != null) mvccCrdNode = cctx.node(mvccCrd.nodeId()); return node.isClient() && mvccCrdNode != null && cctx.kernalContext().coordinators().mvccEnabled(); }
Source:
public void invalidateSession( String subjectName, Function<HttpSession, String> sessionSubjectExtractor) { final List<AbstractSession> matchingSessions = getHttpSessionStream() .filter(s -> subjectName.equals(sessionSubjectExtractor.apply(s))) .map(AbstractSession.class::cast) .distinct() .collect(Collectors.toList()); for (AbstractSession matchingSession : matchingSessions) { idManager.removeSession(matchingSession); if (matchingSession.isValid()) { matchingSession.invalidate(); } } }

Target:
public void invalidateSession( String subjectName, Function<HttpSession, String> sessionSubjectExtractor) { final List<AbstractSession> matchingSessions = getHttpSessionStream() .filter(s -> subjectName.equals(sessionSubjectExtractor.apply(s))) .filter(AbstractSession.class::isInstance) .map(AbstractSession.class::cast) .distinct() .collect(Collectors.toList()); for (AbstractSession matchingSession : matchingSessions) { idManager.removeSession(matchingSession); if (matchingSession.isValid()) { matchingSession.invalidate(); } } }
Source:
private static void setDisplayTeam(BattleFragment battleFragment, JSONObject object) throws JSONException { object = object.getJSONObject("side"); JSONArray team = object.getJSONArray("pokemon"); for (int i = 0; i < team.length(); i++) { JSONObject info = team.getJSONObject(i); PokemonInfo pkm = parsePokemonInfo(battleFragment, info); if (battleFragment.getPlayer1Team().size() <= i) { battleFragment.getPlayer1Team().add(pkm); } else { battleFragment.getPlayer1Team().set(i, pkm); } } }

Target:
private static void setDisplayTeam(BattleFragment battleFragment, JSONObject object) throws JSONException { object = object.getJSONObject("side"); JSONArray team = object.getJSONArray("pokemon"); for (int i = 0; i < team.length(); i++) { JSONObject info = team.getJSONObject(i); PokemonInfo pkm = parsePokemonInfo(battleFragment, info); battleFragment.getPlayer1Team().add(i, pkm); } }
Source:
public void canHandleHoleInTail() { UUID streamID = UUID.randomUUID(); CorfuTable<String, String> corfuTable = getDefaultRuntime() .getObjectsView() .build() .setTypeToken(new TypeToken<CorfuTable<String, String>>() {}) .setStreamID(streamID) .open(); corfuTable.put("k1", "dog fox cat"); corfuTable.put("k2", "dog bat"); corfuTable.put("k3", "fox"); TokenResponse tokenResponse = getDefaultRuntime() .getSequencerView() .next(streamID); Token token = tokenResponse.getToken(); getDefaultRuntime().getAddressSpaceView() .write(tokenResponse, LogData.getHole(token)); for (int i = 0; i < ITERATIONS; i++) { getDefaultRuntime().getObjectsView().TXBuild() .type(TransactionType.SNAPSHOT) .snapshot(token) .build() .begin(); corfuTable.scanAndFilter(item -> true); getDefaultRuntime().getObjectsView().TXEnd(); } assertThat(((CorfuCompileProxy) ((ICorfuSMR) corfuTable). getCorfuSMRProxy()).getUnderlyingObject().getSmrStream().pos()).isEqualTo(3); }

Target:
public void canHandleHoleInTail() { UUID streamID = UUID.randomUUID(); CorfuTable<String, String> corfuTable = getDefaultRuntime() .getObjectsView() .build() .setTypeToken(new TypeToken<CorfuTable<String, String>>() {}) .setStreamID(streamID) .open(); corfuTable.put("k1", "dog fox cat"); corfuTable.put("k2", "dog bat"); corfuTable.put("k3", "fox"); TokenResponse tokenResponse = getDefaultRuntime() .getSequencerView() .next(streamID); Token token = tokenResponse.getToken(); getDefaultRuntime().getAddressSpaceView() .write(tokenResponse, LogData.getHole(token)); assertThat(getDefaultRuntime().getAddressSpaceView() .read(token.getSequence()).isHole()).isTrue(); for (int i = 0; i < ITERATIONS; i++) { getDefaultRuntime().getObjectsView().TXBuild() .type(TransactionType.SNAPSHOT) .snapshot(token) .build() .begin(); corfuTable.scanAndFilter(item -> true); getDefaultRuntime().getObjectsView().TXEnd(); } assertThat(((CorfuCompileProxy) ((ICorfuSMR) corfuTable). getCorfuSMRProxy()).getUnderlyingObject().getSmrStream().pos()).isEqualTo(3); }
Source:
static BufferedReader openReader(File inputFile) { BufferedReader in = null; try { in = new BufferedReader(new FileReader(inputFile)); } catch (Exception e) { logger.error("Can't open '" + inputFile + "' for input: " + e); System.exit(1); } return in; }

Target:
static BufferedReader openReader(File inputFile) { BufferedReader in = null; try { in = new BufferedReader(new FileReader(inputFile)); } catch (Exception e) { System.err.println("Can't open '" + inputFile + "' for input: " + e); System.exit(1); } return in; }
Source:
public Object randomValue() { return (boolean) ThreadLocalRandom.current().nextBoolean(); }

Target:
public Object randomValue() { return ThreadLocalRandom.current().nextBoolean(); }
Source:
public static BooleanStatus create() { BooleanStatus b = new BooleanStatus(false); AutoLoader a = new AutoLoader(); a.setShouldBeRunning(b); a.updateWhen(Igneous.globalPeriodic); BooleanMixing.whenBooleanBecomes(b, false).send(new EventOutput() { @Override public void event() { Elevator.elevatorControl.set(false); } }); return b; }

Target:
public static BooleanStatus create() { BooleanStatus b = new BooleanStatus(false); AutoLoader a = new AutoLoader(); a.setShouldBeRunning(b); a.updateWhen(Igneous.globalPeriodic); Elevator.elevatorControl.setFalseWhen(BooleanMixing.onRelease(b)); return b; }
Source:
public void visitAnnotation(@DottedClassName String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) { if (!Objects.equal(annotationClass, "javax.persistence.Column")) { return; } ElementValue specifiedName = map.get("name"); if (specifiedName != null) { detectLongName(specifiedName.stringifyValue()); } else { String columnName = getFieldName(); detectLongName(columnName); } }

Target:
public void visitAnnotation(@DottedClassName String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) { if (!Objects.equal(annotationClass, "javax.persistence.Column")) { return; } ElementValue specifiedName = map.get("name"); final String columnName; if (specifiedName != null) { columnName = specifiedName.stringifyValue(); } else if (visitingField()){ columnName = getFieldName(); } else if (visitingMethod()) { Method targetMethod = getMethod(); columnName = findFieldWhichisVisitedIn(targetMethod); if (columnName == null) { throw new IllegalClassException(String.format( "Method which is annotated with @Column should access to field, but %s#%s does not access.", getClassContext().getClassDescriptor().getClassName().replace('/', '.'), targetMethod.getName())); } } else { throw new IllegalClassException("@Column should annotate method or field."); } detectLongName(columnName); }
Source:
private void registerHll() { String p = "asd"; SketchDescriptor sd = new SketchDescriptor("hll"); sd.register(DATA_TO_SKETCH, org.apache.datasketches.hive.hll.DataToSketchUDAF.class); sd.register(SKETCH_TO_ESTIMATE_WITH_ERROR_BOUNDS, org.apache.datasketches.hive.hll.SketchToEstimateAndErrorBoundsUDF.class); sd.register(SKETCH_TO_ESTIMATE, org.apache.datasketches.hive.hll.SketchToEstimateUDF.class); sd.register(SKETCH_TO_STRING, org.apache.datasketches.hive.hll.SketchToStringUDF.class); sd.register(UNION_SKETCH1, org.apache.datasketches.hive.hll.UnionSketchUDF.class); sd.register(UNION_SKETCH, org.apache.datasketches.hive.hll.UnionSketchUDAF.class); sketchClasses.add(sd); }

Target:
private void registerHll() { SketchDescriptor sd = new SketchDescriptor("hll"); sd.register(DATA_TO_SKETCH, org.apache.datasketches.hive.hll.DataToSketchUDAF.class); sd.register(SKETCH_TO_ESTIMATE_WITH_ERROR_BOUNDS, org.apache.datasketches.hive.hll.SketchToEstimateAndErrorBoundsUDF.class); sd.register(SKETCH_TO_ESTIMATE, org.apache.datasketches.hive.hll.SketchToEstimateUDF.class); sd.register(SKETCH_TO_STRING, org.apache.datasketches.hive.hll.SketchToStringUDF.class); sd.register(UNION_SKETCH1, org.apache.datasketches.hive.hll.UnionSketchUDF.class); sd.register(UNION_SKETCH, org.apache.datasketches.hive.hll.UnionSketchUDAF.class); sketchClasses.add(sd); }
Source:
protected SchemaDescriptor initDefaultSchemaDescriptor() throws StandardException{ if(cachedInitialDefaultSchemaDescr==null){ DataDictionary dd=getDataDictionary(); if (defaultSchema != null) { return dd.getSchemaDescriptor(defaultSchema, getTransactionCompile(), true); } SchemaDescriptor sd= dd.getSchemaDescriptor( getSessionUserId(),getTransactionCompile(),false); if(sd==null){ sd=new SchemaDescriptor( dd, getSessionUserId(), getSessionUserId(), null, false); } cachedInitialDefaultSchemaDescr=sd; } return cachedInitialDefaultSchemaDescr; }

Target:
protected SchemaDescriptor initDefaultSchemaDescriptor() throws StandardException{ if(cachedInitialDefaultSchemaDescr==null){ DataDictionary dd=getDataDictionary(); SchemaDescriptor sd; if (defaultSchema != null) { sd = dd.getSchemaDescriptor(defaultSchema, getTransactionCompile(), true); } else { sd = dd.getSchemaDescriptor( getSessionUserId(), getTransactionCompile(), false); } if(sd==null){ sd=new SchemaDescriptor( dd, getSessionUserId(), getSessionUserId(), null, false); } cachedInitialDefaultSchemaDescr=sd; } return cachedInitialDefaultSchemaDescr; }
Source:
public SslContextBuilder keyManager(KeyManager keyManager) { if (forServer) { checkNotNull(keyManager, "keyManager required for servers"); } this.keyManagerFactory = new KeyManagerFactoryWrapper(keyManager); keyCertChain = null; key = null; keyPassword = null; return this; }

Target:
public SslContextBuilder keyManager(KeyManager keyManager) { if (forServer) { checkNotNull(keyManager, "keyManager required for servers"); } if (keyManager != null) { this.keyManagerFactory = new KeyManagerFactoryWrapper(keyManager); } else { this.keyManagerFactory = null; } keyCertChain = null; key = null; keyPassword = null; return this; }
Source:
private static TypeConverter<?> create(TypeConverter elementConverter, Class type) { return value -> { String[] elements = value.split(","); Object[] ar = (Object[]) Array.newInstance(type, elements.length); for (int i = 0; i < elements.length; i++) { ar[i] = elementConverter.convert(elements[i]); } return ar; }; }

Target:
private static TypeConverter<?> create(TypeConverter elementConverter, Class type) { return value -> { value = value.trim(); if (value.isEmpty()) { return Array.newInstance(type, 0); } String[] elements = value.split(","); Object[] ar = (Object[]) Array.newInstance(type, elements.length); for (int i = 0; i < elements.length; i++) { ar[i] = elementConverter.convert(elements[i]); } return ar; }; }
Source:
public void shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() throws IOException { final IMocksControl ctrl = EasyMock.createStrictControl(); final ProcessorStateManager stateManager = ctrl.createMock(ProcessorStateManager.class); stateDirectory = ctrl.createMock(StateDirectory.class); stateManager.registerGlobalStateStores(Collections.emptyList()); EasyMock.expectLastCall(); EasyMock.expect(stateManager.taskId()).andReturn(taskId); stateManager.close(); EasyMock.expectLastCall(); EasyMock.expect(stateManager.baseDir()).andReturn(TestUtils.tempDirectory("state_store")); stateDirectory.unlock(taskId); EasyMock.expectLastCall(); ctrl.checkOrder(true); ctrl.replay(); task = createStatefulTask(createConfig(true, "100"), true, stateManager); task.transitionTo(Task.State.RESTORING); task.transitionTo(Task.State.RUNNING); task.transitionTo(Task.State.SUSPENDED); task.prepareCloseDirty(); task.closeDirty(); task = null; ctrl.verify(); }

Target:
public void shouldAttemptToDeleteStateDirectoryWhenCloseDirtyAndEosEnabled() throws IOException { final IMocksControl ctrl = EasyMock.createStrictControl(); final ProcessorStateManager stateManager = ctrl.createMock(ProcessorStateManager.class); stateDirectory = ctrl.createMock(StateDirectory.class); stateManager.registerGlobalStateStores(Collections.emptyList()); EasyMock.expectLastCall(); EasyMock.expect(stateManager.taskId()).andReturn(taskId); stateManager.close(); EasyMock.expectLastCall(); EasyMock.expect(stateManager.baseDir()).andReturn(TestUtils.tempDirectory("state_store")); stateDirectory.unlock(taskId); EasyMock.expectLastCall(); ctrl.checkOrder(true); ctrl.replay(); task = createStatefulTask(createConfig(true, "100"), true, stateManager); task.prepareCloseDirty(); task.closeDirty(); task = null; ctrl.verify(); }
Source:
public boolean addGroupingPair(char start, char end) { if (started) { return false; } if (groupingPairs == null) { groupingPairs = new OneToOneMap<>(); } String startString = Character.toString(start); String endString = Character.toString(end); if (groupingPairs.containsKey(endString) || groupingPairs.containsValue(startString)) { return false; } String oldEnd = groupingPairs.get(startString); String oldStart = groupingPairs.getKeyFor(endString); if ((oldStart != null) && !oldStart.equals(startString) || (oldEnd != null) && !oldEnd.equals(endString)) { return false; } groupingPairs.put(startString, endString); return true; }

Target:
public void addGroupingPair(char start, char end) { if (started) { throw new IllegalStateException( "Cannot add grouping pairs to the ParsingSeparator " + "once parsing has been started"); } if (groupingPairs == null) { groupingPairs = new OneToOneMap<>(); } String startString = Character.toString(start); String endString = Character.toString(end); if (groupingPairs.containsKey(endString) || groupingPairs.containsValue(startString)) { throw new IllegalStateException( "Cannot add grouping pairs to the ParsingSeparator " + "if a key or value has already been added as a separator"); } String oldEnd = groupingPairs.get(startString); String oldStart = groupingPairs.getKeyFor(endString); if ((oldStart != null) && !oldStart.equals(startString) || (oldEnd != null) && !oldEnd.equals(endString)) { throw new IllegalStateException( "Cannot add grouping pairs to the ParsingSeparator " + "if a key or value has already been added as a separator"); } groupingPairs.put(startString, endString); }
Source:
public void initExecutor() { pageProviderService = Framework.getService(PageProviderService.class); skipAggregates = ctx.getHttpHeaders().getRequestHeaders().getFirst(PageProvider.SKIP_AGGREGATES_PROP) != null; }

Target:
public void initExecutor() { pageProviderService = Framework.getService(PageProviderService.class); skipAggregates = Boolean.parseBoolean( ctx.getHttpHeaders().getRequestHeaders().getFirst(PageProvider.SKIP_AGGREGATES_PROP)); }
Source:
public synchronized void forceServerSync() { if (started.get()) { try { this.jobDirectoryManifestCreatorService.invalidateCachedDirectoryManifest(jobDirectoryPath); this.taskScheduler.schedule(this::pushManifest, Instant.now()); } catch (Exception e) { log.error("Failed to force push a fresh manifest", e); } } }

Target:
public synchronized Optional<ScheduledFuture<?>> forceServerSync() { if (started.get()) { try { this.jobDirectoryManifestCreatorService.invalidateCachedDirectoryManifest(jobDirectoryPath); return Optional.of(this.taskScheduler.schedule(this::pushManifest, Instant.now())); } catch (Exception e) { log.error("Failed to force push a fresh manifest", e); } } return Optional.empty(); }
Source:
protected void configureServlets() { if (Boolean.valueOf(System.getenv("CHE_TRACING_ENABLED"))) { install(new org.eclipse.che.core.tracing.web.TracingWebModule()); } if (Boolean.valueOf(System.getenv("CHE_WSMASTER_CORS_FILTER_ENABLED"))) { final Map<String, String> corsFilterParams = new HashMap<>(); corsFilterParams.put("cors.allowed.origins", "*"); corsFilterParams.put( "cors.allowed.methods", "GET," + "POST," + "HEAD," + "OPTIONS," + "PUT," + "DELETE"); corsFilterParams.put( "cors.allowed.headers", "Content-Type," + "X-Requested-With," + "accept," + "Origin," + "Access-Control-Request-Method," + "Access-Control-Request-Headers"); corsFilterParams.put("cors.support.credentials", "true"); corsFilterParams.put("cors.preflight.maxage", "10"); bind(CorsFilter.class).in(Singleton.class); filter("/*").through(CorsFilter.class, corsFilterParams); } filter("/*").through(RequestIdLoggerFilter.class); serveRegex("^(?!/websocket.?)(.*)").with(GuiceEverrestServlet.class); install(new org.eclipse.che.swagger.deploy.BasicSwaggerConfigurationModule()); if (Boolean.valueOf(System.getenv("CHE_MULTIUSER"))) { configureMultiUserMode(); } else { configureSingleUserMode(); } }

Target:
protected void configureServlets() { if (Boolean.valueOf(System.getenv("CHE_TRACING_ENABLED"))) { install(new org.eclipse.che.core.tracing.web.TracingWebModule()); } if (isCheCorsEnabled()) { filter("/*").through(CheCorsFilter.class); } filter("/*").through(RequestIdLoggerFilter.class); serveRegex("^(?!/websocket.?)(.*)").with(GuiceEverrestServlet.class); install(new org.eclipse.che.swagger.deploy.BasicSwaggerConfigurationModule()); if (Boolean.valueOf(System.getenv("CHE_MULTIUSER"))) { configureMultiUserMode(); } else { configureSingleUserMode(); } if (Boolean.valueOf(System.getenv("CHE_METRICS_ENABLED"))) { install(new org.eclipse.che.core.metrics.MetricsServletModule()); } }
Source:
protected boolean isDeprecated() { if (isDeprecated == null) { boolean isDeprecated = false; if (parent instanceof AbstractProperty) { AbstractProperty absParent = (AbstractProperty) parent; isDeprecated = absParent.isDeprecated(); Property parentDeprecatedFallback = absParent.deprecatedFallback; if (isDeprecated && parentDeprecatedFallback != null) { deprecatedFallback = parentDeprecatedFallback.resolvePath(getName()); } } if (!isDeprecated) { String name = getXPath(); String schema = getSchema().getName(); SchemaManager schemaManager = Framework.getService(SchemaManager.class); isDeprecated = schemaManager.isPropertyDeprecated(schema, name); if (isDeprecated) { String fallback = schemaManager.getDeprecatedPropertyFallback(schema, name); if (fallback != null) { deprecatedFallback = resolvePath('/' + fallback); } } } this.isDeprecated = Boolean.valueOf(isDeprecated); } return isDeprecated.booleanValue(); }

Target:
protected boolean isDeprecated() { if (isDeprecated == null) { boolean deprecated = false; if (parent instanceof AbstractProperty) { AbstractProperty absParent = (AbstractProperty) parent; deprecated = absParent.isDeprecated(); Property parentDeprecatedFallback = absParent.deprecatedFallback; if (deprecated && parentDeprecatedFallback != null) { deprecatedFallback = parentDeprecatedFallback.resolvePath(getName()); } } if (!deprecated) { String name = getXPath(); String schema = getSchema().getName(); SchemaManager schemaManager = Framework.getService(SchemaManager.class); PropertyDeprecationHandler deprecatedProperties = schemaManager.getDeprecatedProperties(); deprecated = deprecatedProperties.isMarked(schema, name); if (deprecated) { String fallback = deprecatedProperties.getFallback(schema, name); if (fallback != null) { deprecatedFallback = resolvePath('/' + fallback); } } } isDeprecated = Boolean.valueOf(deprecated); } return isDeprecated.booleanValue(); }
Source:
public GatheringByteArrayInputStream(List<byte[]> buffers, long totalBytes) { checkArgument(totalBytes >= 0, "totalBytes should equal to or greater than 0"); this.buffers = requireNonNull(buffers, "buffers is null").iterator(); this.remainingBytes = totalBytes; currentBuffer = new byte[0]; currentBufferPosition = 0; singleByte = new byte[1]; }

Target:
public GatheringByteArrayInputStream(List<byte[]> buffers, long totalBytes) { checkArgument(totalBytes >= 0, "totalBytes should equal to or greater than 0"); this.buffers = requireNonNull(buffers, "buffers is null").iterator(); this.remainingBytes = totalBytes; }
Source:
public void displayHelp( PrintStream stdout ) { stdout.println(); PrintWriter pw = new PrintWriter( stdout ); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( pw, 120, "mvn [options] [<goal(s)>] [<phase(s)>]", "\nOptions:", options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, "\n", false ); pw.flush(); }

Target:
public void displayHelp( PrintStream stdout ) { stdout.println(); PrintWriter pw = new PrintWriter( stdout ); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( pw, HelpFormatter.DEFAULT_WIDTH, "mvn [options] [<goal(s)>] [<phase(s)>]", "\nOptions:", options, HelpFormatter.DEFAULT_LEFT_PAD, HelpFormatter.DEFAULT_DESC_PAD, "\n", false ); pw.flush(); }
Source:
public void start() { if (!running) { ChannelBindingServiceProperties channelBindingServiceProperties = null; try { ChannelBindingService channelBindingService = this.applicationContext .getBean(ChannelBindingService.class); channelBindingServiceProperties = channelBindingService.getChannelBindingServiceProperties(); Map<String, Bindable> bindables = this.applicationContext.getBeansOfType(Bindable.class); for (Bindable bindable : bindables.values()) { bindable.bindOutputs(channelBindingService); } } catch (BeansException e) { throw new IllegalStateException( "Cannot perform binding, no proper implementation found", e); } if (channelBindingServiceProperties != null && channelBindingServiceProperties.isAutoStartup()) { this.running = true; this.applicationContext.start(); } } }

Target:
public void start() { if (!running) { try { ChannelBindingService channelBindingService = this.applicationContext .getBean(ChannelBindingService.class); Map<String, Bindable> bindables = this.applicationContext.getBeansOfType(Bindable.class); for (Bindable bindable : bindables.values()) { bindable.bindOutputs(channelBindingService); } } catch (BeansException e) { throw new IllegalStateException( "Cannot perform binding, no proper implementation found", e); } this.running = true; if (channelBindingServiceProperties != null && channelBindingServiceProperties.isAutoStartContext()) { this.applicationContext.start(); } } }
Source:
private void handleAllocation(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final TokenRequestMsg tokenRequest = req.getPayload().getTokenRequest(); long newTail = globalLogTail + tokenRequest.getNumTokens(); ImmutableMap.Builder<UUID, Long> backPointerMap = ImmutableMap.builder(); for (UuidMsg id : tokenRequest.getStreamsList()) { streamTailToGlobalTailMap.compute(getUUID(id), (k, v) -> { if (v == null) { backPointerMap.put(k, Address.NON_EXIST); return newTail - 1; } else { backPointerMap.put(k, v); return newTail - 1; } }); streamsAddressMap.compute(getUUID(id), (streamId, addressMap) -> { if (addressMap == null) { addressMap = new StreamAddressSpace( Address.NON_ADDRESS, new Roaring64NavigableMap() ); } for (long i = globalLogTail; i < newTail; i++) { addressMap.addAddress(i); } return addressMap; }); } if (tokenRequest.hasTxnResolution()) { tokenRequest.getTxnResolution().getWriteConflictParamsSetList() .forEach((item) -> { item.getValueList().forEach(conflictParam -> cache.put(new ConflictTxStream(getUUID(item.getKey()), conflictParam.toByteArray(), newTail - 1))); }); } log.trace("handleAllocation: token={} backpointers={}", globalLogTail, backPointerMap.build()); Token newToken = new Token(sequencerEpoch, globalLogTail); globalLogTail = newTail; ResponseMsg response = getResponseMsg( req.getHeader(), getTokenResponseMsg(newToken, backPointerMap.build())); r.sendResponse(response, ctx); }

Target:
private void handleAllocation(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { final TokenRequestMsg tokenRequest = req.getPayload().getTokenRequest(); long newTail = globalLogTail + tokenRequest.getNumTokens(); ImmutableMap.Builder<UUID, Long> backPointerMap = ImmutableMap.builder(); for (UuidMsg id : tokenRequest.getStreamsList()) { UUID uuid = getUUID(id); streamTailToGlobalTailMap.compute(uuid, (k, v) -> { if (v == null) { backPointerMap.put(k, Address.NON_EXIST); return newTail - 1; } else { backPointerMap.put(k, v); return newTail - 1; } }); streamsAddressMap.compute(uuid, (streamId, addressMap) -> { if (addressMap == null) { addressMap = new StreamAddressSpace( Address.NON_ADDRESS, new Roaring64NavigableMap() ); } for (long i = globalLogTail; i < newTail; i++) { addressMap.addAddress(i); } return addressMap; }); } if (tokenRequest.hasTxnResolution()) { tokenRequest.getTxnResolution().getWriteConflictParamsSetList() .forEach((item) -> { item.getValueList().forEach(conflictParam -> cache.put(new ConflictTxStream(getUUID(item.getKey()), conflictParam.toByteArray(), newTail - 1))); }); } if (log.isTraceEnabled()) { log.trace("handleAllocation: token={} backpointers={}", globalLogTail, backPointerMap.build()); } Token newToken = new Token(sequencerEpoch, globalLogTail); globalLogTail = newTail; ResponseMsg response = getResponseMsg( req.getHeader(), getTokenResponseMsg(newToken, backPointerMap.build())); r.sendResponse(response, ctx); }
Source:
private List<String> getPaths(String pathWithWildcard) { String pattern = "**" + pathWithWildcard; PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern); Path startPath = Paths.get(""); try { List<String> paths = Files.find(startPath, Integer.MAX_VALUE, (path, basicFileAttributes) -> pathMatcher.matches(path)) .filter(path -> path.toString().contains(".jar")) .map(Path::toString) .collect(Collectors.toList()); if (paths == null || paths.isEmpty()) { throw new IllegalStateException("Cannot find any jars files in selected path"); } return paths; } catch (IOException e) { throw new IllegalStateException("Cannot find any jars files in selected path"); } }

Target:
private List<String> getPaths(String pathWithWildcard) { String pathWithoutWildcards = pathWithWildcard.replace("*", ""); try { List<String> paths = Files.list(Paths.get(pathWithoutWildcards)) .map(Path::toString) .filter(path -> path.toLowerCase().endsWith(".jar")) .collect(Collectors.toList()); if (paths == null || paths.isEmpty()) { throw new IllegalStateException("Cannot find any jars files in selected path"); } return paths; } catch (IOException e) { throw new IllegalStateException("Cannot find any jars files in selected path"); } }
Source:
public void getAllNonEmptyEntitylessAttributesByNameWhenOnlyDefinitionExists() throws Exception { System.out.println(CLASS_NAME + "getAllNonEmptyEntitylessAttributesByNameWhenOnlyDefinitionExists"); Attribute entitylessAttr = setUpEntitylessAttribute(); AttributeDefinition entitylessAttrDef = setUpEntitylessAttributeDefinition(); cacheManager.setEntitylessAttribute(entitylessAttr, subject); List<Attribute> attrs = cacheManager.getAllNonEmptyEntitylessAttributesByName(entitylessAttrDef.getName()); assertTrue("result should not contain entityless attribute definition", !attrs.contains(new Attribute(entitylessAttrDef))); assertTrue("there should be no returned attributes", attrs.isEmpty()); }

Target:
public void getAllNonEmptyEntitylessAttributesByNameWhenOnlyDefinitionExists() throws Exception { System.out.println(CLASS_NAME + "getAllNonEmptyEntitylessAttributesByNameWhenOnlyDefinitionExists"); Attribute entitylessAttr = setUpEntitylessAttribute(); AttributeDefinition entitylessAttrDef = setUpEntitylessAttributeDefinition(); cacheManager.setEntitylessAttribute(entitylessAttr, subject); List<Attribute> attrs = cacheManager.getAllNonEmptyEntitylessAttributesByName(entitylessAttrDef.getName()); assertTrue("result should not contain entityless attribute definition", !attrs.contains(entitylessAttrDef)); assertTrue("there should be no returned attributes", attrs.isEmpty()); }
Source:
boolean deregisterIndexGauges(String storeId) { String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentCapacityUsed")) && registry.remove( MetricRegistry.name(Log.class, prefix + "PercentageUsedCapacity")) && registry.remove( MetricRegistry.name(Log.class, prefix + "CurrentSegmentCount")); }

Target:
private boolean deregisterIndexGauges(String storeId) { String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(Log.class, prefix + "CurrentCapacityUsed")) && registry.remove( MetricRegistry.name(Log.class, prefix + "PercentageUsedCapacity")) && registry.remove( MetricRegistry.name(Log.class, prefix + "CurrentSegmentCount")); }
Source:
private String getLabel(Viewer viewer, Object e1) { String name1; if (viewer == null || !(viewer instanceof ContentViewer)) { name1 = e1.toString(); } else { IBaseLabelProvider prov = ((ContentViewer) viewer) .getLabelProvider(); if (prov instanceof ILabelProvider) { ILabelProvider lprov = (ILabelProvider) prov; name1 = lprov.getText(e1); } else { name1 = e1.toString(); } } if (name1 == null) { name1 = ""; } return name1; }

Target:
private String getLabel(Viewer viewer, Object e1) { String name; if (viewer == null || !(viewer instanceof ContentViewer)) { name = e1.toString(); } else { IBaseLabelProvider prov = ((ContentViewer) viewer) .getLabelProvider(); if (prov instanceof ILabelProvider) { ILabelProvider lprov = (ILabelProvider) prov; name = lprov.getText(e1); } else { name = e1.toString(); } } if (name == null) { name = ""; } return name; }
Source:
private Long convertToLong(Serializable identifier) { return Long.valueOf(identifier.toString()); }

Target:
private Long convertToLong(Serializable identifier) { Long idAsLong; if (canConvertFromStringTo(Long.class)) { idAsLong = conversionService.convert(identifier, Long.class); } else { idAsLong = Long.valueOf(identifier.toString()); } return idAsLong; }
Source:
public boolean onBackPressed() { LocalPictureListFragment curPage = (LocalPictureListFragment)((TabsAdapter)getViewPager().getAdapter()) .getStoredFragment(getViewPager().getCurrentItem()); if ((curPage != null) && !curPage.atRootDirectory()) { curPage.onBackPressed(); return true; } return false; }

Target:
public boolean onBackPressed() { LocalMediaFileListFragment curPage = (LocalMediaFileListFragment)((TabsAdapter)getViewPager().getAdapter()) .getStoredFragment(getViewPager().getCurrentItem()); if ((curPage != null) && !curPage.atRootDirectory()) { curPage.onBackPressed(); return true; } return false; }
Source:
private void validateRazEnablement(SdxClusterRequest sdxClusterRequest, DetailedEnvironmentResponse environment) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); boolean razEntitlement = entitlementService.razEnabled(environment.getCreator(), Crn.safeFromString(environment.getCreator()).getAccountId()); if (sdxClusterRequest.isEnableRangerRaz()) { if (!razEntitlement) { validationBuilder.error("Provisioning Ranger Raz is not enabled for this account."); } if (!AZURE.name().equalsIgnoreCase(environment.getCloudPlatform())) { validationBuilder.error("Provisioning Ranger Raz is only valid for Microsft Azure."); } } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }

Target:
private void validateRazEnablement(SdxClusterRequest sdxClusterRequest, DetailedEnvironmentResponse environment) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (sdxClusterRequest.isEnableRangerRaz()) { boolean razEntitlementEnabled = entitlementService.razEnabled(environment.getCreator(), Crn.safeFromString(environment.getCreator()).getAccountId()); if (!razEntitlementEnabled) { validationBuilder.error("Provisioning Ranger Raz is not enabled for this account."); } if (!AZURE.name().equalsIgnoreCase(environment.getCloudPlatform())) { validationBuilder.error("Provisioning Ranger Raz is only valid for Microsft Azure."); } if (!isRazSupported(sdxClusterRequest.getRuntime())) { validationBuilder.error("Provisioning Ranger Raz is only valid for CM version > 7.2.0 and not " + sdxClusterRequest.getRuntime()); } } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }
Source:
private void loadSubscriptions() { if (disposable != null) { disposable.dispose(); } emptyView.hide(); progressBar.setVisibility(View.VISIBLE); disposable = Observable.fromCallable(DBReader::getNavDrawerData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { navDrawerData = result; subscriptionAdapter.notifyDataSetChanged(); emptyView.updateVisibility(); progressBar.setVisibility(View.GONE); }, error -> Log.e(TAG, Log.getStackTraceString(error))); if (UserPreferences.getFeedFilter() != UserPreferences.FEED_FILTER_NONE) filterMsg.setVisibility(View.VISIBLE); else filterMsg.setVisibility(View.GONE); }

Target:
private void loadSubscriptions() { if (disposable != null) { disposable.dispose(); } emptyView.hide(); progressBar.setVisibility(View.VISIBLE); disposable = Observable.fromCallable(DBReader::getNavDrawerData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { navDrawerData = result; subscriptionAdapter.notifyDataSetChanged(); emptyView.updateVisibility(); progressBar.setVisibility(View.GONE); }, error -> Log.e(TAG, Log.getStackTraceString(error))); if (UserPreferences.getFeedFilter() != UserPreferences.FEED_FILTER_NONE) { feedsFilteredMsg.setText("{md-info-outline} " + getString(R.string.subscriptions_are_filtered)); Iconify.addIcons(feedsFilteredMsg); feedsFilteredMsg.setVisibility(View.VISIBLE); } else { feedsFilteredMsg.setVisibility(View.GONE); } }
Source:
public static void toJSON(OutputWriter jsonOutputWriter, GoDashboardPipeline model, Username username) { String usernameString = username.getUsername().toString(); jsonOutputWriter .addLinks(linksWriter -> addLinks(linksWriter, model)) .add("name", model.name().toString()) .add("last_updated_timestamp", model.getLastUpdatedTimeStamp()) .add("locked", model.model().getLatestPipelineInstance().isCurrentlyLocked()) .addChild("pause_info", getPauseInfoNEW(model)) .add("can_operate", model.isPipelineOperator(usernameString)) .add("can_administer", model.canBeAdministeredBy(usernameString)) .add("can_unlock", model.canBeOperatedBy(usernameString)) .add("can_pause", model.canBeOperatedBy(usernameString)) .addChild("origin", getOrigin(model.getOrigin())); if (model.getTrackingTool().isPresent()) { TrackingTool trackingTool = model.getTrackingTool().get(); jsonOutputWriter.addChild("tracking_tool", childWriter -> { childWriter .add("regex", trackingTool.getRegex()) .add("link", trackingTool.getLink()); }); } jsonOutputWriter.addChild("_embedded", childWriter -> { childWriter.addChildList("instances", writeInstances(model)); }); }

Target:
public static void toJSON(OutputWriter jsonOutputWriter, GoDashboardPipeline model, Username username) { String usernameString = username.getUsername().toString(); jsonOutputWriter .addLinks(linksWriter -> addLinks(linksWriter, model)) .add("name", model.name().toString()) .add("last_updated_timestamp", model.getLastUpdatedTimeStamp()) .add("locked", model.model().getLatestPipelineInstance().isCurrentlyLocked()) .addChild("pause_info", getPauseInfoNEW(model)) .add("can_operate", model.isPipelineOperator(usernameString)) .add("can_administer", model.canBeAdministeredBy(usernameString)) .add("can_unlock", model.canBeOperatedBy(usernameString)) .add("can_pause", model.canBeOperatedBy(usernameString)) .add("from_config_repo", !model.getOrigin().isLocal()); if (model.getTrackingTool().isPresent()) { TrackingTool trackingTool = model.getTrackingTool().get(); jsonOutputWriter.addChild("tracking_tool", childWriter -> { childWriter .add("regex", trackingTool.getRegex()) .add("link", trackingTool.getLink()); }); } jsonOutputWriter.addChild("_embedded", childWriter -> { childWriter.addChildList("instances", writeInstances(model)); }); }
Source:
public void doGet(HttpServletRequest request,HttpServletResponse response){ M_log.debug("doGet: Called"); try { if(request.getServletPath().equals("/manager")){ canvasRestApiCall(request, response); } else{ M_log.info("NOT MANAGER"); doRequest(request, response); } }catch(Exception e) { M_log.error("GET request has some exceptions",e); } }

Target:
public void doGet(HttpServletRequest request,HttpServletResponse response){ M_log.debug("doGet: Called"); try { if(request.getServletPath().equals(MANAGER_SERVLET_NAME)){ canvasRestApiCall(request, response); } else{ M_log.info("NOT MANAGER"); doRequest(request, response); } }catch(Exception e) { M_log.error("GET request has some exceptions",e); } }